summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEarl Miles2010-03-16 23:36:38 (GMT)
committer Earl Miles2010-03-16 23:36:38 (GMT)
commitee49d7590f3321a1581ceae8d06dd2006787dec0 (patch)
tree7c5c46d3c28e831f35baa7b4d4cf0c7c2a69e293
parent4eaf93a720d1dc1806b2ed20b20ee2102c65ec69 (diff)
#496634 by dereine: Fix long-standing issue of "0" not being a valid argument for multiple integer CCK types.
-rw-r--r--CHANGELOG.txt1
-rw-r--r--handlers/views_handler_argument_many_to_one.inc15
-rw-r--r--modules/taxonomy.views.inc1
3 files changed, 16 insertions, 1 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index e1816ae..e372423 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -51,6 +51,7 @@ Views 2.x-dev
o #513396 by yhager: Attempt multi-byte safety for "trim at word boundary" setting.
o #418230 by Scott Reynolds: Views adds wrong nid with "Node: Has new content".
o #558602 by dboulet and Crashtest_: Summary views should provide "active" class on links properly.
+ o #496634 by dereine: Fix long-standing issue of "0" not being a valid argument for multiple integer CCK types.
Other changes:
o #570558 by yhahn: Segment default views caching to conserve memory used by Views during normal operation.
diff --git a/handlers/views_handler_argument_many_to_one.inc b/handlers/views_handler_argument_many_to_one.inc
index 559e500..831f52d 100644
--- a/handlers/views_handler_argument_many_to_one.inc
+++ b/handlers/views_handler_argument_many_to_one.inc
@@ -8,6 +8,8 @@
* - numeric: If true, the field will be considered numeric. Probably should
* always be set TRUE as views_handler_argument_string has many to one
* capabilities.
+ * - zero is null: If true, a 0 will be handled as empty, so for example
+ * a default argument can be provided or a summary can be shown.
*
* @ingroup views_argument_handlers
*/
@@ -73,7 +75,18 @@ class views_handler_argument_many_to_one extends views_handler_argument {
}
function query() {
- if (empty($this->argument)) {
+ $empty = FALSE;
+ if (isset($this->definition['zero is null']) && $this->definition['zero is null']) {
+ if (empty($this->argument)) {
+ $empty = TRUE;
+ }
+ }
+ else {
+ if (isset($this->argument)) {
+ $empty = TRUE;
+ }
+ }
+ if ($empty) {
parent::ensure_my_table();
$this->query->add_where(0, "$this->table_alias.$this->real_field IS NULL");
return;
diff --git a/modules/taxonomy.views.inc b/modules/taxonomy.views.inc
index 8fd4e5e..e13dacb 100644
--- a/modules/taxonomy.views.inc
+++ b/modules/taxonomy.views.inc
@@ -105,6 +105,7 @@ function taxonomy_views_data() {
'argument' => array(
'handler' => 'views_handler_argument_numeric',
'skip base' => array('node', 'node_revision'),
+ 'zero is null' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_term_node_tid',