CRM-19081 fix mapping load function for legacy smart groups
authorSeamus Lee <seamuslee001@gmail.com>
Tue, 16 Aug 2016 03:25:19 +0000 (15:25 +1200)
committereileen <emcnaughton@wikimedia.org>
Tue, 16 Aug 2016 03:30:28 +0000 (15:30 +1200)
CRM/Core/BAO/Mapping.php

index dac37cd33ecda44f611aa7536900a683c3b6efe1..5914b1c2e72f930365d4b1c39a37706523256553 100644 (file)
@@ -1004,6 +1004,12 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping {
             $value = explode(',', $value);
             $value = array($params['operator'][$key][$k] => $value);
           }
+          // CRM-19081 Fix legacy StateProvince Field Values.
+          // These derive from smart groups created using search builder under older
+          // CiviCRM versions.
+          if (!is_numeric($value) && $fldName == 'state_province') {
+            $value = CRM_Core_PseudoConstant::getKey('CRM_Core_BAO_Address', 'state_province_id', $value);
+          }
 
           if ($row) {
             $fields[] = array(