summaryrefslogtreecommitdiff
path: root/httemplate/search/elements/match-classnum
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/search/elements/match-classnum')
-rw-r--r--httemplate/search/elements/match-classnum12
1 files changed, 12 insertions, 0 deletions
diff --git a/httemplate/search/elements/match-classnum b/httemplate/search/elements/match-classnum
new file mode 100644
index 000000000..ed1efd53c
--- /dev/null
+++ b/httemplate/search/elements/match-classnum
@@ -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>