optimiation changes
authormonishdeb <monish.deb@webaccessglobal.com>
Sun, 1 Mar 2015 22:19:55 +0000 (03:49 +0530)
committerJamie McClelland <jm@mayfirst.org>
Fri, 6 Mar 2015 19:39:27 +0000 (14:39 -0500)
CRM/Upgrade/Incremental/php/FourFive.php

index 537095fd0bff4f25f8ed6e6566f93f99a757d13c..47c6152d97626fb2dd5fb591f30d05a0d5538982 100755 (executable)
@@ -347,15 +347,18 @@ DROP KEY `{$dao->CONSTRAINT_NAME}`";
               if (!is_null($key)) {
                 $op = 'or';
                 unset($data_value[$key]);
-                if (count($data_value) == 0) {
-                  $customOption = CRM_Core_BAO_CustomOption::getCustomOption($fieldID);
-                  foreach ($customOption as $option) {
-                    $data_value[] = CRM_Utils_Array::value('value', $option);
-                  }
-                }
               }
           }
 
+          //If only Or operator has been chosen means we need to select all values and
+          //so to execute OR operation between these values according to new data structure
+          if (count($data_value) == 0) {
+            $customOption = CRM_Core_BAO_CustomOption::getCustomOption($fieldID);
+            foreach ($customOption as $option) {
+              $data_value[] = CRM_Utils_Array::value('value', $option);
+            }
+          }
+
           // Add new key for the operator.
           $formValues["${field}_operator"] = $op;