Add is empty filter to search / api
[civicrm-core.git] / ext / search / ang / crmSearchAdmin / crmSearchClause.component.js
index de5ce60e43d8c1b0e222941f0d179fa76c9063f2..b91dea8128c127218208873c151064577aa7ce24 100644 (file)
         }
       };
 
+      // Returns false for 'IS NULL', 'IS EMPTY', etc. true otherwise.
+      this.operatorTakesInput = function(operator) {
+        return operator.indexOf('IS ') !== 0;
+      };
+
       this.changeClauseOperator = function(clause) {
-        // Add/remove value if operator allows for one
-        if (_.contains(clause[1], 'NULL')) {
+        // Add/remove value depending on whether operator allows for one
+        if (!ctrl.operatorTakesInput(clause[1])) {
           clause.length = 2;
         } else {
           if (clause.length === 2) {