[open-ils-commits] r9831 - in branches/rel_1_2/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:33:53 EDT 2008


Author: miker
Date: 2008-06-13 13:33:50 -0400 (Fri, 13 Jun 2008)
New Revision: 9831

Modified:
   branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Reporter/SQLBuilder.pm
   branches/rel_1_2/Open-ILS/web/reports/oils_rpt_builder.js
   branches/rel_1_2/Open-ILS/web/reports/oils_rpt_param_editor.js
   branches/rel_1_2/Open-ILS/web/reports/xul/operators.js
   branches/rel_1_2/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: branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Reporter/SQLBuilder.pm
===================================================================
--- branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Reporter/SQLBuilder.pm	2008-06-13 17:31:13 UTC (rev 9830)
+++ branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Reporter/SQLBuilder.pm	2008-06-13 17:33:50 UTC (rev 9831)
@@ -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: branches/rel_1_2/Open-ILS/web/reports/oils_rpt_builder.js
===================================================================
--- branches/rel_1_2/Open-ILS/web/reports/oils_rpt_builder.js	2008-06-13 17:31:13 UTC (rev 9830)
+++ branches/rel_1_2/Open-ILS/web/reports/oils_rpt_builder.js	2008-06-13 17:33:50 UTC (rev 9831)
@@ -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: branches/rel_1_2/Open-ILS/web/reports/oils_rpt_param_editor.js
===================================================================
--- branches/rel_1_2/Open-ILS/web/reports/oils_rpt_param_editor.js	2008-06-13 17:31:13 UTC (rev 9830)
+++ branches/rel_1_2/Open-ILS/web/reports/oils_rpt_param_editor.js	2008-06-13 17:33:50 UTC (rev 9831)
@@ -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: branches/rel_1_2/Open-ILS/web/reports/xul/operators.js
===================================================================
--- branches/rel_1_2/Open-ILS/web/reports/xul/operators.js	2008-06-13 17:31:13 UTC (rev 9830)
+++ branches/rel_1_2/Open-ILS/web/reports/xul/operators.js	2008-06-13 17:33:50 UTC (rev 9831)
@@ -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: branches/rel_1_2/Open-ILS/web/reports/xul/template-config.js
===================================================================
--- branches/rel_1_2/Open-ILS/web/reports/xul/template-config.js	2008-06-13 17:31:13 UTC (rev 9830)
+++ branches/rel_1_2/Open-ILS/web/reports/xul/template-config.js	2008-06-13 17:33:50 UTC (rev 9831)
@@ -915,7 +915,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