X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FDeprecatedUtils.php;h=85effe9287b184f17a9fc54602b14904483470b3;hb=d44c681d9105af668449d16d9f53832d7982f47e;hp=9ec53a73ad9a08fc77ba6051b7b346a40cc2e8fe;hpb=fcba99eb6892c1006a16fc5451e7074d602b7ade;p=civicrm-core.git diff --git a/CRM/Utils/DeprecatedUtils.php b/CRM/Utils/DeprecatedUtils.php index 9ec53a73ad..85effe9287 100644 --- a/CRM/Utils/DeprecatedUtils.php +++ b/CRM/Utils/DeprecatedUtils.php @@ -285,11 +285,13 @@ function _civicrm_api3_deprecated_formatted_param($params, &$values, $create = F } $dao = new CRM_Core_DAO(); $qParams = array(); - $svq = $dao->singleValueQuery("SELECT id FROM civicrm_contact WHERE id = $value", + $svq = $dao->singleValueQuery("SELECT is_deleted FROM civicrm_contact WHERE id = $value", $qParams ); - if (!$svq) { + if (!isset($svq)) { return civicrm_api3_create_error("Invalid Contact ID: There is no contact record with contact_id = $value."); + } else if ($svq == 1) { + return civicrm_api3_create_error("Invalid Contact ID: contact_id $value is a soft-deleted contact."); } $values['contact_id'] = $values['contribution_contact_id']; @@ -415,7 +417,9 @@ function _civicrm_api3_deprecated_formatted_param($params, &$values, $create = F $contact->external_identifier = $externalId; $errorMsg = NULL; if (!$contact->find(TRUE)) { - $errorMsg = $contactId ? ts("Soft Credit ContactID - $contactId doesn't exist. Row was skipped.") : ts("Provided Soft Credit External Identifier - $externalIddoesn't exist. Row was skipped."); + $field = $contactId ? ts('Contact ID') : ts('External ID'); + $errorMsg = ts("Soft Credit %1 - %2 doesn't exist. Row was skipped.", + array(1 => $field, 2 => $contactId ? $contactId : $externalId)); } if ($errorMsg) { @@ -592,7 +596,7 @@ function _civicrm_api3_deprecated_formatted_param($params, &$values, $create = F } /** - * Function to check duplicate contacts based on de-deupe parameters + * check duplicate contacts based on de-deupe parameters */ function _civicrm_api3_deprecated_check_contact_dedupe($params) { static $cIndieFields = NULL; @@ -869,7 +873,7 @@ function _civicrm_api3_deprecated_add_formatted_param(&$values, &$params) { return TRUE; } - if (isset($values['preferred_communication_method'])) { + if (!empty($values['preferred_communication_method'])) { $comm = array(); $pcm = array_change_key_case(array_flip(CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'preferred_communication_method')), CASE_LOWER); @@ -1208,12 +1212,9 @@ function _civicrm_api3_deprecated_validate_formatted_contact(&$params) { /** * @deprecated - this is part of the import parser not the API & needs to be moved on out * - * @param $params + * @param array $params * @param $onDuplicate * - * @internal param $ $params - * @internal param $ $onDuplicate - * * @return array|bool */ function _civicrm_api3_deprecated_create_participant_formatted($params, $onDuplicate) { @@ -1261,7 +1262,7 @@ function _civicrm_api3_deprecated_participant_check_params($params, $checkDuplic if (!empty($params['event_id'])) { $isTemplate = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $params['event_id'], 'is_template'); if (!empty($isTemplate)) { - return civicrm_api3_create_error(ts('Event templates are not meant to be registered')); + return civicrm_api3_create_error(ts('Event templates are not meant to be registered.')); } } @@ -1326,7 +1327,7 @@ function _civicrm_api3_deprecated_contact_check_custom_params($params, $csType = } /** - * @param $params + * @param array $params * @param bool $dupeCheck * @param bool $dupeErrorArray * @param bool $requiredCheck @@ -1372,7 +1373,7 @@ function _civicrm_api3_deprecated_contact_check_params( if ($csType = CRM_Utils_Array::value('contact_sub_type', $params)) { if (!(CRM_Contact_BAO_ContactType::isExtendsContactType($csType, $params['contact_type']))) { - return civicrm_api3_create_error("Invalid or Mismatched Contact SubType: " . implode(', ', (array)$csType)); + return civicrm_api3_create_error("Invalid or Mismatched Contact Subtype: " . implode(', ', (array)$csType)); } } @@ -1466,9 +1467,6 @@ function _civicrm_api3_deprecated_contact_check_params( * @param $result * @param $activityTypeID * - * @internal param $ $result - * @internal param $ $activityTypeID - * * @return array $params */ function _civicrm_api3_deprecated_activity_buildmailparams($result, $activityTypeID) {