diff --git a/CRM/Contact/BAO/Contact/Optimizer.php b/CRM/Contact/BAO/Contact/Optimizer.php deleted file mode 100644 index c9766ccd8740..000000000000 --- a/CRM/Contact/BAO/Contact/Optimizer.php +++ /dev/null @@ -1,190 +0,0 @@ - $value) { - if (!empty($value['url'])) { - $oldEmpty = FALSE; - $old[] = array('website_type_id' => $value['website_type_id'], 'url' => $value['url']); - } - } - - foreach ($newWebsiteValues as $idx => $value) { - if (!empty($value['url'])) { - $newEmpty = FALSE; - $new[] = array('website_type_id' => $value['website_type_id'], 'url' => $value['url']); - } - } - - // if both old and new are empty, we can delete new and avoid a write - if ($oldEmpty && $newEmpty) { - unset($newValues['website']); - } - - // if different number of non-empty entries, return - if (count($new) != count($old)) { - return; - } - - // same number of entries, check if they are exactly the same - foreach ($old as $oldID => $oldValues) { - $found = FALSE; - foreach ($new as $newID => $newValues) { - if ( - $old['website_type_id'] == $new['website_type_id'] && - $old['url'] == $new['url'] - ) { - $found = TRUE; - unset($new[$newID]); - break; - } - if (!$found) { - return; - } - } - } - - // if we've come here, this means old and new are the same - // we can skip saving new and return - unset($newValues['website']); - } - - /** - * @param $newValues - * @param $oldValues - */ - public static function email(&$newValues, &$oldValues) { - $oldEmailValues = CRM_Utils_Array::value('email', $oldValues); - $newEmailValues = CRM_Utils_Array::value('email', $newValues); - - if ($oldEmailValues == NULL || $newEmailValues == NULL) { - return; - } - - // check if we had a value in the old - $oldEmpty = $newEmpty = TRUE; - $old = $new = array(); - - foreach ($oldEmailValues as $idx => $value) { - if (!empty($value['email'])) { - $oldEmpty = FALSE; - $old[] = array( - 'email' => $value['email'], - 'location_type_id' => $value['location_type_id'], - 'on_hold' => $value['on_hold'] ? 1 : 0, - 'is_primary' => $value['is_primary'] ? 1 : 0, - 'is_bulkmail' => $value['is_bulkmail'] ? 1 : 0, - 'signature_text' => $value['signature_text'] ? $value['signature_text'] : '', - 'signature_html' => $value['signature_html'] ? $value['signature_html'] : '', - ); - } - } - - foreach ($newEmailValues as $idx => $value) { - if (!empty($value['email'])) { - $newEmpty = FALSE; - $new[] = array( - 'email' => $value['email'], - 'location_type_id' => $value['location_type_id'], - 'on_hold' => $value['on_hold'] ? 1 : 0, - 'is_primary' => $value['is_primary'] ? 1 : 0, - 'is_bulkmail' => $value['is_bulkmail'] ? 1 : 0, - 'signature_text' => $value['signature_text'] ? $value['signature_text'] : '', - 'signature_html' => $value['signature_html'] ? $value['signature_html'] : '', - ); - } - } - - // if both old and new are empty, we can delete new and avoid a write - if ($oldEmpty && $newEmpty) { - unset($newValues['email']); - } - - // if different number of non-empty entries, return - if (count($new) != count($old)) { - return; - } - - // same number of entries, check if they are exactly the same - foreach ($old as $oldID => $oldValues) { - $found = FALSE; - foreach ($new as $newID => $newValues) { - if ( - $old['email_type_id'] == $new['email_type_id'] && - $old['url'] == $new['url'] - ) { - $found = TRUE; - unset($new[$newID]); - break; - } - if (!$found) { - return; - } - } - } - - // if we've come here, this means old and new are the same - // we can skip saving new and return - unset($newValues['email']); - } - -} diff --git a/CRM/Contact/Form/Contact.php b/CRM/Contact/Form/Contact.php index e65b49d2d6be..e3a4ea57fec1 100644 --- a/CRM/Contact/Form/Contact.php +++ b/CRM/Contact/Form/Contact.php @@ -866,8 +866,6 @@ public function postProcess() { } } - CRM_Contact_BAO_Contact_Optimizer::edit($params, $this->_preEditValues); - if (!empty($params['image_URL'])) { CRM_Contact_BAO_Contact::processImageParams($params); } @@ -916,8 +914,6 @@ public function postProcess() { CRM_Utils_Hook::pre('create', $params['contact_type'], NULL, $params); } - $customFields = CRM_Core_BAO_CustomField::getFields($params['contact_type'], FALSE, TRUE); - //CRM-5143 //if subtype is set, send subtype as extend to validate subtype customfield $customFieldExtends = (CRM_Utils_Array::value('contact_sub_type', $params)) ? $params['contact_sub_type'] : $params['contact_type'];