reports with row grouping for payment/refund search, #25944
[freeside.git] / httemplate / search / elements / match-classnum
diff --git a/httemplate/search/elements/match-classnum b/httemplate/search/elements/match-classnum
new file mode 100644 (file)
index 0000000..ed1efd5
--- /dev/null
@@ -0,0 +1,12 @@
+<%args>
+$param            # name of the form field containing the classnum
+$field => $param  # SQL field that must match that form field
+</%args>
+<%init>
+my @values = grep /^(\d+)$/, $cgi->param( $param );
+if (@values) {
+  return "COALESCE($field, 0) IN (" . join(',', @values) . ')';
+} else {
+  return;
+}
+</%init>