CRM-18427: Custom data didn't got populated upon subsequent submission
authordeb.monish <monish.deb@webaccessglobal.com>
Mon, 30 Jan 2017 13:23:20 +0000 (18:53 +0530)
committerdeb.monish <monish.deb@webaccessglobal.com>
Mon, 30 Jan 2017 13:23:20 +0000 (18:53 +0530)
CRM/Core/BAO/CustomGroup.php

index 703572d2981d6580348d5dafbb18b56f20465cd7..924fb74a2b4d2384b9753a088ad596abe0c92dd9 100644 (file)
@@ -1884,12 +1884,6 @@ SELECT IF( EXISTS(SELECT name FROM civicrm_contact_type WHERE name like %1), 1,
       // add field information
       foreach ($value['fields'] as $k => $properties) {
         $properties['element_name'] = "custom_{$k}_-{$groupCount}";
-        if ($value = CRM_Utils_Request::retrieve($properties['element_name'], 'String', $form, FALSE, NULL, 'POST')) {
-          $formValues[$properties['element_name']] = $value;
-        }
-        elseif (isset($submittedValues[$properties['element_name']])) {
-          $properties['element_value'] = $submittedValues[$properties['element_name']];
-        }
         if (isset($properties['customValue']) &&
           !CRM_Utils_System::isNull($properties['customValue']) &&
           !isset($properties['element_value'])
@@ -1906,6 +1900,12 @@ SELECT IF( EXISTS(SELECT name FROM civicrm_contact_type WHERE name like %1), 1,
             }
           }
         }
+        if ($value = CRM_Utils_Request::retrieve($properties['element_name'], 'String', $form, FALSE, NULL, 'POST')) {
+          $formValues[$properties['element_name']] = $value;
+        }
+        elseif (isset($submittedValues[$properties['element_name']])) {
+          $properties['element_value'] = $submittedValues[$properties['element_name']];
+        }
         unset($properties['customValue']);
         $formattedGroupTree[$key]['fields'][$k] = $properties;
       }