[open-ils-commits] r9832 - in trunk/Open-ILS:
src/perlmods/OpenILS/Reporter web/reports web/reports/xul
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Jun 13 13:34:41 EDT 2008
Author: miker
Date: 2008-06-13 13:34:39 -0400 (Fri, 13 Jun 2008)
New Revision: 9832
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Reporter/SQLBuilder.pm
trunk/Open-ILS/web/reports/oils_rpt_builder.js
trunk/Open-ILS/web/reports/oils_rpt_param_editor.js
trunk/Open-ILS/web/reports/xul/operators.js
trunk/Open-ILS/web/reports/xul/template-config.js
Log:
add "is blank" and "is not blank" ops, similar to "is null" and "is not null"
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Reporter/SQLBuilder.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Reporter/SQLBuilder.pm 2008-06-13 17:33:50 UTC (rev 9831)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Reporter/SQLBuilder.pm 2008-06-13 17:34:39 UTC (rev 9832)
@@ -927,7 +927,7 @@
return $self->{_sql} if ($self->{_sql});
- my $sql;
+ my $sql = '';
my $rel = $self->find_relation();
if ($rel && $rel->is_nullable) {
@@ -941,12 +941,22 @@
if (lc($op) eq 'in') {
$sql .= " IN (". join(",", map { $_->toSQL } @$val).")";
+
} elsif (lc($op) eq 'not in') {
$sql .= " NOT IN (". join(",", map { $_->toSQL } @$val).")";
+
+ } elsif (lc($op) eq 'is blank') {
+ $sql = '('. $self->SUPER::toSQL ." IS NULL OR ". $self->SUPER::toSQL ." = '')";
+
+ } elsif (lc($op) eq 'is not blank') {
+ $sql = '('. $self->SUPER::toSQL ." IS NOT NULL AND ". $self->SUPER::toSQL ." <> '')";
+
} elsif (lc($op) eq 'between') {
$sql .= " BETWEEN ". join(" AND ", map { $_->toSQL } @$val);
+
} elsif (lc($op) eq 'not between') {
$sql .= " NOT BETWEEN ". join(" AND ", map { $_->toSQL } @$val);
+
} elsif (lc($op) eq 'like') {
$val = $$val[0] if (ref($val) eq 'ARRAY');
$val = $val->toSQL;
@@ -954,6 +964,7 @@
$val =~ s/%/\\\\%/o;
$val =~ s/_/\\\\_/o;
$sql .= " LIKE '\%$val\%'";
+
} elsif (lc($op) eq 'ilike') {
$val = $$val[0] if (ref($val) eq 'ARRAY');
$val = $val->toSQL;
@@ -961,6 +972,7 @@
$val =~ s/%/\\\\%/o;
$val =~ s/_/\\\\_/o;
$sql .= " ILIKE '\%$val\%'";
+
} else {
$val = $$val[0] if (ref($val) eq 'ARRAY');
$sql .= " $op " . $val->toSQL;
Modified: trunk/Open-ILS/web/reports/oils_rpt_builder.js
===================================================================
--- trunk/Open-ILS/web/reports/oils_rpt_builder.js 2008-06-13 17:33:50 UTC (rev 9831)
+++ trunk/Open-ILS/web/reports/oils_rpt_builder.js 2008-06-13 17:34:39 UTC (rev 9832)
@@ -518,7 +518,7 @@
//_debug('NEXT PARAM = ' + oilsRptID2);
//_debug('NEXT PARAM = ' + oilsRptNextParam());
- if( filter == 'is' || filter == 'is not' )
+ if( filter == 'is' || filter == 'is not' || filter == 'is blank' || filter == 'is not blank' )
where.condition[filter] = null;
else where.condition[filter] = oilsRptNextParam();
@@ -557,7 +557,7 @@
column: { transform: tform, colname: oilsRptPathCol(path) },
condition : {}
};
- if( filter == 'is' || filter == 'is not' )
+ if( filter == 'is' || filter == 'is not' || filter == 'is blank' || filter == 'is not blank' )
having.condition[filter] = null;
else having.condition[filter] = oilsRptNextParam();
Modified: trunk/Open-ILS/web/reports/oils_rpt_param_editor.js
===================================================================
--- trunk/Open-ILS/web/reports/oils_rpt_param_editor.js 2008-06-13 17:33:50 UTC (rev 9831)
+++ trunk/Open-ILS/web/reports/oils_rpt_param_editor.js 2008-06-13 17:34:39 UTC (rev 9832)
@@ -194,6 +194,8 @@
return new oilsRptSetWidget(widgetArgs);
case 'is':
case 'is not':
+ case 'is blank':
+ case 'is not blank':
return new oilsRptNullWidget(widgetArgs);
case 'between':
case 'not between':
Modified: trunk/Open-ILS/web/reports/xul/operators.js
===================================================================
--- trunk/Open-ILS/web/reports/xul/operators.js 2008-06-13 17:33:50 UTC (rev 9831)
+++ trunk/Open-ILS/web/reports/xul/operators.js 2008-06-13 17:34:39 UTC (rev 9832)
@@ -55,6 +55,14 @@
'is not' : {
label : 'Is not NULL'
+ },
+
+ 'is blank' : {
+ label : 'Is NULL or Blank'
+ },
+
+ 'is not blank' : {
+ label : 'Is not NULL or Blank'
}
}
Modified: trunk/Open-ILS/web/reports/xul/template-config.js
===================================================================
--- trunk/Open-ILS/web/reports/xul/template-config.js 2008-06-13 17:33:50 UTC (rev 9831)
+++ trunk/Open-ILS/web/reports/xul/template-config.js 2008-06-13 17:34:39 UTC (rev 9832)
@@ -920,7 +920,7 @@
if (tab_name.match(/filter/)) {
element.condition = {};
- if (tab[field].op == 'is' || tab[field].op == 'is not') {
+ if (tab[field].op == 'is' || tab[field].op == 'is not' || tab[field].op == 'is blank' || tab[field].op == 'is not blank') {
element.condition[tab[field].op] = null;
} else {
element.condition[tab[field].op] =
More information about the open-ils-commits
mailing list