From: eileen Date: Wed, 28 Jun 2017 20:59:35 +0000 (+1200) Subject: CRM-20786 Move deprecated utils functions to the import classes X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=96f6f0b990ce5cfed992365dde4f005b1e6bfa80;p=civicrm-core.git CRM-20786 Move deprecated utils functions to the import classes --- diff --git a/CRM/Contact/Import/Parser/Contact.php b/CRM/Contact/Import/Parser/Contact.php index ad6f41a035..f07bb3ca6b 100644 --- a/CRM/Contact/Import/Parser/Contact.php +++ b/CRM/Contact/Import/Parser/Contact.php @@ -24,7 +24,7 @@ | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ */ - +require_once 'CRM/Utils/DeprecatedUtils.php'; /** * * @package CRM @@ -1953,8 +1953,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { } if (!$break) { - require_once 'CRM/Utils/DeprecatedUtils.php'; - _civicrm_api3_deprecated_add_formatted_param($value, $formatted); + list($value, $formatted) = $this->formatContactParameters(); } } if (!$isAddressCustomField) { @@ -1976,11 +1975,10 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { if ($key == 'id' && isset($field)) { $formatted[$key] = $field; } - require_once 'CRM/Utils/DeprecatedUtils.php'; - _civicrm_api3_deprecated_add_formatted_param($formatValues, $formatted); + $this->formatContactParameters($formatValues, $formatted); //Handling Custom Data - // note: Address custom fields will be handled separately inside _civicrm_api3_deprecated_add_formatted_param + // note: Address custom fields will be handled separately inside formatContactParameters if (($customFieldID = CRM_Core_BAO_CustomField::getKeyID($key)) && array_key_exists($customFieldID, $customFields) && !array_key_exists($customFieldID, $addressCustomFields) @@ -2251,4 +2249,21 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { } + /** + * Format contact parameters. + * + * @todo this function needs re-writing & re-merging into the main function. + * + * Here be dragons. + * + * @param array $values + * @param array $params + * + * @return bool + */ + protected function formatContactParameters(&$values, &$params) { + _civicrm_api3_deprecated_add_formatted_param($values, $params); + return TRUE; + } + }