projects
/
civicrm-core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #5057 from cividesk/CRM-15901-4.5
[civicrm-core.git]
/
CRM
/
Utils
/
DeprecatedUtils.php
diff --git
a/CRM/Utils/DeprecatedUtils.php
b/CRM/Utils/DeprecatedUtils.php
index f17358a4739ca9f16105f6a44749f6920c1d0a70..0fda33b51655724e5c3e980d03e9cf7c6fd576d4 100644
(file)
--- a/
CRM/Utils/DeprecatedUtils.php
+++ b/
CRM/Utils/DeprecatedUtils.php
@@
-38,11
+38,11
@@
require_once 'api/v3/utils.php';
* take the input parameter list as specified in the data model and
* convert it into the same format that we use in QF and BAO object
*
* take the input parameter list as specified in the data model and
* convert it into the same format that we use in QF and BAO object
*
- * @param array
$params
Associative array of property name/value
+ * @param array
$params
Associative array of property name/value
* pairs to insert in new contact.
* pairs to insert in new contact.
- * @param array
$values
The reformatted properties that we can use internally
+ * @param array
$values
The reformatted properties that we can use internally
*
*
- * @param array
$create
Is the formatted Values array going to
+ * @param array
|bool $create
Is the formatted Values array going to
* be used for CRM_vent_BAO_Participant:create()
*
* @return array|CRM_Error
* be used for CRM_vent_BAO_Participant:create()
*
* @return array|CRM_Error
@@
-209,11
+209,14
@@
function _civicrm_api3_deprecated_participant_formatted_param($params, &$values,
* take the input parameter list as specified in the data model and
* convert it into the same format that we use in QF and BAO object
*
* take the input parameter list as specified in the data model and
* convert it into the same format that we use in QF and BAO object
*
- * @param array
$params
Associative array of property name/value
+ * @param array
$params
Associative array of property name/value
* pairs to insert in new contact.
* pairs to insert in new contact.
- * @param array
$values
The reformatted properties that we can use internally
+ * @param array
$values
The reformatted properties that we can use internally
* '
*
* '
*
+ * @param bool $create
+ * @param null $onDuplicate
+ *
* @return array|CRM_Error
* @access public
*/
* @return array|CRM_Error
* @access public
*/
@@
-282,11
+285,13
@@
function _civicrm_api3_deprecated_formatted_param($params, &$values, $create = F
}
$dao = new CRM_Core_DAO();
$qParams = array();
}
$dao = new CRM_Core_DAO();
$qParams = array();
- $svq = $dao->singleValueQuery("SELECT id FROM civicrm_contact WHERE id = $value",
+ $svq = $dao->singleValueQuery("SELECT i
s_delete
d FROM civicrm_contact WHERE id = $value",
$qParams
);
$qParams
);
- if (!
$svq
) {
+ if (!
isset($svq)
) {
return civicrm_api3_create_error("Invalid Contact ID: There is no contact record with contact_id = $value.");
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'];
}
$values['contact_id'] = $values['contribution_contact_id'];
@@
-412,7
+417,9
@@
function _civicrm_api3_deprecated_formatted_param($params, &$values, $create = F
$contact->external_identifier = $externalId;
$errorMsg = NULL;
if (!$contact->find(TRUE)) {
$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) {
}
if ($errorMsg) {
@@
-663,11
+670,11
@@
function _civicrm_api3_deprecated_check_contact_dedupe($params) {
* take the input parameter list as specified in the data model and
* convert it into the same format that we use in QF and BAO object
*
* take the input parameter list as specified in the data model and
* convert it into the same format that we use in QF and BAO object
*
- * @param array
$params
Associative array of property name/value
+ * @param array
$params
Associative array of property name/value
* pairs to insert in new contact.
* pairs to insert in new contact.
- * @param array
$values
The reformatted properties that we can use internally
+ * @param array
$values
The reformatted properties that we can use internally
*
*
- * @param array
$create
Is the formatted Values array going to
+ * @param array
|bool $create
Is the formatted Values array going to
* be used for CRM_Activity_BAO_Activity::create()
*
* @return array|CRM_Error
* be used for CRM_Activity_BAO_Activity::create()
*
* @return array|CRM_Error
@@
-866,7
+873,7
@@
function _civicrm_api3_deprecated_add_formatted_param(&$values, &$params) {
return TRUE;
}
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);
$comm = array();
$pcm = array_change_key_case(array_flip(CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'preferred_communication_method')), CASE_LOWER);
@@
-1107,7
+1114,7
@@
function _civicrm_api3_deprecated_add_formatted_location_blocks(&$values, &$para
*
* @param <type> $params
*
*
* @param <type> $params
*
- * @return <type>
+ * @return
array
<type>
*/
function _civicrm_api3_deprecated_duplicate_formatted_contact($params) {
$id = CRM_Utils_Array::value('id', $params);
*/
function _civicrm_api3_deprecated_duplicate_formatted_contact($params) {
$id = CRM_Utils_Array::value('id', $params);
@@
-1185,7
+1192,7
@@
function _civicrm_api3_deprecated_validate_formatted_contact(&$params) {
$valid = CRM_Core_BAO_CustomValue::typecheck(CRM_Utils_Array::value('type', $value),
CRM_Utils_Array::value('value', $value)
);
$valid = CRM_Core_BAO_CustomValue::typecheck(CRM_Utils_Array::value('type', $value),
CRM_Utils_Array::value('value', $value)
);
- if (!$valid) {
+ if (!$valid
&& $value['is_required']
) {
return civicrm_api3_create_error('Invalid value for custom field \'' .
CRM_Utils_Array::value('name', $custom) . '\''
);
return civicrm_api3_create_error('Invalid value for custom field \'' .
CRM_Utils_Array::value('name', $custom) . '\''
);
@@
-1202,14
+1209,16
@@
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
*
/**
* @deprecated - this is part of the import parser not the API & needs to be moved on out
*
- * @param <type> $params
- * @param <type> $onDuplicate
+ * @param $params
+ * @param $onDuplicate
+ *
+ * @internal param $ <type> $params
+ * @internal param $ <type> $onDuplicate
*
*
- * @return <type>
+ * @return
array|bool
<type>
*/
function _civicrm_api3_deprecated_create_participant_formatted($params, $onDuplicate) {
require_once 'CRM/Event/Import/Parser.php';
*/
function _civicrm_api3_deprecated_create_participant_formatted($params, $onDuplicate) {
require_once 'CRM/Event/Import/Parser.php';
@@
-1228,7
+1237,9
@@
function _civicrm_api3_deprecated_create_participant_formatted($params, $onDupli
*
* @param <type> $params
*
*
* @param <type> $params
*
- * @return <type>
+ * @param bool $checkDuplicate
+ *
+ * @return array|bool <type>
*/
function _civicrm_api3_deprecated_participant_check_params($params, $checkDuplicate = FALSE) {
*/
function _civicrm_api3_deprecated_participant_check_params($params, $checkDuplicate = FALSE) {
@@
-1318,6
+1329,15
@@
function _civicrm_api3_deprecated_contact_check_custom_params($params, $csType =
}
}
}
}
+/**
+ * @param $params
+ * @param bool $dupeCheck
+ * @param bool $dupeErrorArray
+ * @param bool $requiredCheck
+ * @param null $dedupeRuleGroupID
+ *
+ * @return array|null
+ */
function _civicrm_api3_deprecated_contact_check_params(
&$params,
$dupeCheck = TRUE,
function _civicrm_api3_deprecated_contact_check_params(
&$params,
$dupeCheck = TRUE,
@@
-1447,10
+1467,13
@@
function _civicrm_api3_deprecated_contact_check_params(
/**
*
/**
*
- * @param <type> $result
- * @param <type> $activityTypeID
+ * @param $result
+ * @param $activityTypeID
+ *
+ * @internal param $ <type> $result
+ * @internal param $ <type> $activityTypeID
*
*
- * @return <type> $params
+ * @return
array
<type> $params
*/
function _civicrm_api3_deprecated_activity_buildmailparams($result, $activityTypeID) {
// get ready for collecting data about activity to be created
*/
function _civicrm_api3_deprecated_activity_buildmailparams($result, $activityTypeID) {
// get ready for collecting data about activity to be created