X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;ds=sidebyside;f=CRM%2FContact%2FForm%2FContact.php;h=4d30d0c01988c7d3253e772edcfcb339d5c7c5a6;hb=ea3ddccf2929c9778e4443ecd039c02a0a957dd8;hp=468c3f2c31c74dd97b222ed0a6eb254d2178df97;hpb=06f898e694ddccf097d58050e86c004cb3e7e757;p=civicrm-core.git diff --git a/CRM/Contact/Form/Contact.php b/CRM/Contact/Form/Contact.php index 468c3f2c31..4d30d0c019 100644 --- a/CRM/Contact/Form/Contact.php +++ b/CRM/Contact/Form/Contact.php @@ -1,7 +1,7 @@ _action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add'); @@ -404,15 +400,12 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { } /** - * Set default values for the form. Note that in edit/view mode - * the default values are retrieved from the database - * + * Set default values for the form. * - * @return void + * Note that in edit/view mode the default values are retrieved from the database */ public function setDefaultValues() { $defaults = $this->_values; - $params = array(); if ($this->_action & CRM_Core_Action::ADD) { if (array_key_exists('TagsAndGroups', $this->_editOptions)) { @@ -471,8 +464,9 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { } /** - * Do the set default related to location type id, - * primary location, default country + * Do the set default related to location type id, primary location, default country. + * + * @param array $defaults */ public function blockSetDefaults(&$defaults) { $locationTypeKeys = array_filter(array_keys(CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id')), 'is_int'); @@ -572,7 +566,6 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { * add the rules (mainly global rules) for form. * All local rules are added near the element * - * @return void * @see valid_date */ public function addRules() { @@ -738,8 +731,6 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { /** * Build the form object. - * - * @return void */ public function buildQuickForm() { //load form for child blocks @@ -866,9 +857,6 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { /** * Form submission of new/edit contact is processed. - * - * - * @return void */ public function postProcess() { // check if dedupe button, if so return. @@ -988,6 +976,18 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { $parseStatusMsg = self::parseAddressStatusMsg($parseResult); } + $blocks = array('email', 'phone', 'im', 'openid', 'address', 'website'); + foreach ($blocks as $block) { + if (!empty($this->_preEditValues[$block]) && is_array($this->_preEditValues[$block])) { + foreach ($this->_preEditValues[$block] as $count => $value) { + if (!empty($value['id'])) { + $params[$block][$count]['id'] = $value['id']; + $params[$block]['isIdSet'] = TRUE; + } + } + } + } + // Allow un-setting of location info, CRM-5969 $params['updateBlankLocInfo'] = TRUE;