From: Deepak Srivastava Date: Thu, 5 Sep 2013 14:22:54 +0000 (+0530) Subject: towards CRM-10128 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=dfc2f8c23cd649b6498ce0ed52cc2a1a86774f60;p=civicrm-core.git towards CRM-10128 --- diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php index 603dd4e12a..49fd4b065d 100644 --- a/CRM/Contact/BAO/Contact.php +++ b/CRM/Contact/BAO/Contact.php @@ -2067,6 +2067,11 @@ ORDER BY civicrm_email.is_primary DESC"; $value .= ' ' . $params[$key . '_time']; } + // updateBlankCustomInfo flag is false && $value is blank, do not proceed + if (!CRM_Utils_Array::value('updateBlankCustomInfo', $params, TRUE) && ($value == '' || !isset($value))) { + continue; + } + $valueId = NULL; if (CRM_Utils_Array::value('customRecordValues', $params)) { if (is_array($params['customRecordValues']) && !empty($params['customRecordValues'])) { diff --git a/CRM/Event/Form/Registration/Register.php b/CRM/Event/Form/Registration/Register.php index 719a0a5a5c..381c9cedca 100644 --- a/CRM/Event/Form/Registration/Register.php +++ b/CRM/Event/Form/Registration/Register.php @@ -1362,7 +1362,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { * @return void * @access public */ - static function checkRegistration($fields, &$self, $isAdditional = FALSE, $returnContactId = FALSE, $useDedupeRules = FALSE) { + static function checkRegistration(&$fields, &$self, $isAdditional = FALSE, $returnContactId = FALSE, $useDedupeRules = FALSE) { // CRM-3907, skip check for preview registrations // CRM-4320 participant need to walk wizard if (!$returnContactId && @@ -1406,6 +1406,9 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { } } } + if ($contactID) { + $fields['updateBlankCustomInfo'] = FALSE; + } } if ($returnContactId) { diff --git a/CRM/Profile/Form.php b/CRM/Profile/Form.php index 4a083cc8c5..7fe7a6f30b 100644 --- a/CRM/Profile/Form.php +++ b/CRM/Profile/Form.php @@ -59,6 +59,8 @@ class CRM_Profile_Form extends CRM_Core_Form { */ protected $_id; + protected $_updateBlankInfos = array(); + /** * The group id that we are editing * @@ -959,6 +961,8 @@ class CRM_Profile_Form extends CRM_Core_Form { elseif ($form->_isUpdateDupe == 1) { if (!$form->_id) { $form->_id = $ids[0]; + // CRM-10128: flag to ignore empty form fields rather than clearing the existing DB value + $form->_updateBlankInfos['updateBlankCustomInfo'] = FALSE; } } else { @@ -1070,6 +1074,7 @@ class CRM_Profile_Form extends CRM_Core_Form { */ public function postProcess() { $params = $this->controller->exportValues($this->_name); + $params = $params + $this->_updateBlankInfos; //if the delete record button is clicked if ($this->_deleteButtonName) {