From 109ff2ac60c7ab8dd37f024b758a8af62f8352de Mon Sep 17 00:00:00 2001 From: "Donald A. Lobo" Date: Wed, 8 May 2013 07:07:48 -0700 Subject: [PATCH] CRM-12558 ---------------------------------------- * CRM-12558: Ensure CRM/Utils/DeprecatedUtils.php is required http://issues.civicrm.org/jira/browse/CRM-12558 --- CRM/Utils/DeprecatedUtils.php | 50 +++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/CRM/Utils/DeprecatedUtils.php b/CRM/Utils/DeprecatedUtils.php index 8512b0a15c..97155f5b09 100644 --- a/CRM/Utils/DeprecatedUtils.php +++ b/CRM/Utils/DeprecatedUtils.php @@ -51,7 +51,7 @@ require_once 'api/v3/utils.php'; * @param array $values The reformatted properties that we can use internally * * @param array $create Is the formatted Values array going to - * be used for CRM_Event_BAO_Participant:create() + * be used for CRM_vent_BAO_Participant:create() * * @return array|CRM_Error * @access public @@ -774,8 +774,6 @@ function _civicrm_api3_deprecated_add_formatted_param(&$values, &$params) { /* Cache the various object fields */ - - static $fields = NULL; if ($fields == NULL) { @@ -1488,7 +1486,12 @@ function _civicrm_api3_deprecated_contact_check_custom_params($params, $csType = } } -function _civicrm_api3_deprecated_contact_check_params(&$params, $dupeCheck = TRUE, $dupeErrorArray = FALSE, $requiredCheck = TRUE, $dedupeRuleGroupID = NULL) { +function _civicrm_api3_deprecated_contact_check_params( + &$params, + $dupeCheck = TRUE, + $dupeErrorArray = FALSE, + $requiredCheck = TRUE, + $dedupeRuleGroupID = NULL) { if (isset($params['id']) && is_numeric($params['id'])) { $requiredCheck = FALSE; } @@ -1609,4 +1612,41 @@ function _civicrm_api3_deprecated_contact_check_params(&$params, $dupeCheck = TR return NULL; } -// @codeCoverageIgnoreEnd +/** + * + * @param $result + * @param $activityTypeID + * + * @return $params + */ +function _civicrm_api3_deprecated_activity_buildmailparams($result, $activityTypeID) { + // get ready for collecting data about activity to be created + $params = array(); + + $params['activity_type_id'] = $activityTypeID; + + $params['status_id'] = 2; + $params['source_contact_id'] = $params['assignee_contact_id'] = $result['from']['id']; + $params['target_contact_id'] = array(); + $keys = array('to', 'cc', 'bcc'); + foreach ($keys as $key) { + if (is_array($result[$key])) { + foreach ($result[$key] as $key => $keyValue) { + if (!empty($keyValue['id'])) { + $params['target_contact_id'][] = $keyValue['id']; + } + } + } + } + $params['subject'] = $result['subject']; + $params['activity_date_time'] = $result['date']; + $params['details'] = $result['body']; + + for ($i = 1; $i <= 5; $i++) { + if (isset($result["attachFile_$i"])) { + $params["attachFile_$i"] = $result["attachFile_$i"]; + } + } + + return $params; +} -- 2.25.1