projects
/
civicrm-core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' into master-civimail-abtest
[civicrm-core.git]
/
CRM
/
Activity
/
BAO
/
Activity.php
diff --git
a/CRM/Activity/BAO/Activity.php
b/CRM/Activity/BAO/Activity.php
index 243fcd0ac6ba034785b4a072fc3a7cd48fe2b926..efb8f57d1e37de28458c5c98b7d895c8a91c8a8c 100644
(file)
--- a/
CRM/Activity/BAO/Activity.php
+++ b/
CRM/Activity/BAO/Activity.php
@@
-40,7
+40,7
@@
class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity {
/**
class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity {
/**
- *
s
tatic field for all the activity information that we can potentially export
+ *
S
tatic field for all the activity information that we can potentially export
*
* @var array
* @static
*
* @var array
* @static
@@
-48,7
+48,7
@@
class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity {
static $_exportableFields = NULL;
/**
static $_exportableFields = NULL;
/**
- *
s
tatic field for all the activity information that we can potentially import
+ *
S
tatic field for all the activity information that we can potentially import
*
* @var array
* @static
*
* @var array
* @static
@@
-71,18
+71,12
@@
class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity {
}
/**
}
/**
- * Takes a bunch of params that are needed to match certain criteria and
- * retrieves the relevant objects. Typically the valid params are only
- * contact_id. We'll tweak this function to be more full featured over a period
- * of time. This is the inverse function of create. It also stores all the retrieved
- * values in the default array
+ * Fetch object based on array of properties
*
* @param array $params (reference ) an assoc array of name/value pairs
* @param array $defaults (reference ) an assoc array to hold the flattened values
*
*
* @param array $params (reference ) an assoc array of name/value pairs
* @param array $defaults (reference ) an assoc array to hold the flattened values
*
- * @internal param string $activityType activity type
- *
- * @return object CRM_Core_BAO_Meeting object
+ * @return CRM_Activity_DAO_Activity object
* @access public
*/
public static function retrieve(&$params, &$defaults) {
* @access public
*/
public static function retrieve(&$params, &$defaults) {
@@
-146,10
+140,9
@@
class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity {
}
/**
}
/**
- *
Function to d
elete the activity
+ *
D
elete the activity
*
* @param array $params associated array
*
* @param array $params associated array
- *
* @param bool $moveToTrash
*
* @return void
* @param bool $moveToTrash
*
* @return void
@@
-256,10
+249,8
@@
class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity {
/**
* Delete activity assignment record
*
/**
* Delete activity assignment record
*
- * @param $activityId
- * @param null $recordTypeID
- *
- * @internal param int $id activity id
+ * @param int $activityId
+ * @param int $recordTypeID
*
* @return null
* @access public
*
* @return null
* @access public
@@
-274,15
+265,11
@@
class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity {
}
/**
}
/**
- *
Function to p
rocess the activities
+ *
P
rocess the activities
*
* @param array $params associated array of the submitted values
*
* @throws CRM_Core_Exception
*
* @param array $params associated array of the submitted values
*
* @throws CRM_Core_Exception
- * @internal param object $form form object
- * @internal param array $ids array of ids
- * @internal param string $activityType activity Type
- * @internal param bool $record true if it is Record Activity
* @access public
*
* @return $this|null|object
* @access public
*
* @return $this|null|object
@@
-656,7
+643,7
@@
class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity {
}
/**
}
/**
- *
function to g
et the list Activities
+ *
G
et the list Activities
*
* @param array $input array of parameters
* Keys include
*
* @param array $input array of parameters
* Keys include
@@
-830,9
+817,11
@@
SELECT {$activityTempTable}.*,
{$activityContactTempTable}.record_type_id,
{$activityContactTempTable}.contact_name,
{$activityContactTempTable}.is_deleted,
{$activityContactTempTable}.record_type_id,
{$activityContactTempTable}.contact_name,
{$activityContactTempTable}.is_deleted,
- {$activityContactTempTable}.counter
+ {$activityContactTempTable}.counter,
+ re.parent_id as is_recurring_activity
FROM {$activityTempTable}
INNER JOIN {$activityContactTempTable} on {$activityTempTable}.activity_id = {$activityContactTempTable}.activity_id
FROM {$activityTempTable}
INNER JOIN {$activityContactTempTable} on {$activityTempTable}.activity_id = {$activityContactTempTable}.activity_id
+LEFT JOIN civicrm_recurring_entity re on {$activityContactTempTable}.activity_id = re.entity_id
ORDER BY fixed_sort_order
";
ORDER BY fixed_sort_order
";
@@
-859,6
+848,7
@@
ORDER BY fixed_sort_order
$values[$activityID]['status_id'] = $dao->status_id;
$values[$activityID]['subject'] = $dao->subject;
$values[$activityID]['campaign_id'] = $dao->campaign_id;
$values[$activityID]['status_id'] = $dao->status_id;
$values[$activityID]['subject'] = $dao->subject;
$values[$activityID]['campaign_id'] = $dao->campaign_id;
+ $values[$activityID]['is_recurring_activity'] = $dao->is_recurring_activity;
if ($dao->campaign_id) {
$values[$activityID]['campaign'] = $allCampaigns[$dao->campaign_id];
if ($dao->campaign_id) {
$values[$activityID]['campaign'] = $allCampaigns[$dao->campaign_id];
@@
-916,7
+906,7
@@
ORDER BY fixed_sort_order
* user has permission. To decide whether we are going to include
* component related activities w/ core activity retrieve process.
*
* user has permission. To decide whether we are going to include
* component related activities w/ core activity retrieve process.
*
- *
return a
n array of component id and name.
+ *
@retur
n array of component id and name.
* @static
**/
static function activityComponents() {
* @static
**/
static function activityComponents() {
@@
-945,7
+935,7
@@
ORDER BY fixed_sort_order
}
/**
}
/**
- *
function to g
et the activity Count
+ *
G
et the activity Count
*
* @param array $input array of parameters
* Keys include
*
* @param array $input array of parameters
* Keys include
@@
-981,7
+971,7
@@
LEFT JOIN civicrm_case_activity ON ( civicrm_case_activity.activity_id = tbl.a
}
/**
}
/**
- *
function to g
et the activity sql clause to pick activities
+ *
G
et the activity sql clause to pick activities
*
* @param array $input array of parameters
* Keys include
*
* @param array $input array of parameters
* Keys include
@@
-1161,7
+1151,7
@@
LEFT JOIN civicrm_activity_contact src ON (src.activity_id = ac.activity_id AND
}
/**
}
/**
- *
s
end the message to all the contacts and also insert a
+ *
S
end the message to all the contacts and also insert a
* contact activity in each contacts record
*
* @param array $contactDetails the array of contact details to send the email
* contact activity in each contacts record
*
* @param array $contactDetails the array of contact details to send the email
@@
-1177,7
+1167,6
@@
LEFT JOIN civicrm_activity_contact src ON (src.activity_id = ac.activity_id AND
* @param array $contactIds contact ids
* @param string $additionalDetails the additional information of CC and BCC appended to the activity Details
*
* @param array $contactIds contact ids
* @param string $additionalDetails the additional information of CC and BCC appended to the activity Details
*
- * @internal param string $message the message contents
* @return array ( sent, activityId) if any email is sent and activityId
* @access public
* @static
* @return array ( sent, activityId) if any email is sent and activityId
* @access public
* @static
@@
-1366,11
+1355,11
@@
LEFT JOIN civicrm_activity_contact src ON (src.activity_id = ac.activity_id AND
}
/**
}
/**
- * @param $contactDetails
- * @param $activityParams
+ * @param
array
$contactDetails
+ * @param
array
$activityParams
* @param array $smsParams
* @param $contactIds
* @param array $smsParams
* @param $contactIds
- * @param
null
$userID
+ * @param
int
$userID
*
* @return array
* @throws CRM_Core_Exception
*
* @return array
* @throws CRM_Core_Exception
@@
-1386,16
+1375,12
@@
LEFT JOIN civicrm_activity_contact src ON (src.activity_id = ac.activity_id AND
$userID = $session->get('userID');
}
$userID = $session->get('userID');
}
- $text = &$activityParams['text_message'];
- $html = &$activityParams['html_message'];
+ $text = &$activityParams['sms_text_message'];
// CRM-4575
// token replacement of addressee/email/postal greetings
// get the tokens added in subject and message
$messageToken = CRM_Utils_Token::getTokens($text);
// CRM-4575
// token replacement of addressee/email/postal greetings
// get the tokens added in subject and message
$messageToken = CRM_Utils_Token::getTokens($text);
- $messageToken = array_merge($messageToken,
- CRM_Utils_Token::getTokens($html)
- );
//create the meta level record first ( sms activity )
$activityTypeID = CRM_Core_OptionGroup::getValue('activity_type',
//create the meta level record first ( sms activity )
$activityTypeID = CRM_Core_OptionGroup::getValue('activity_type',
@@
-1403,13
+1388,7
@@
LEFT JOIN civicrm_activity_contact src ON (src.activity_id = ac.activity_id AND
'name'
);
'name'
);
- // CRM-6265: save both text and HTML parts in details (if present)
- if ($html and $text) {
- $details = "-ALTERNATIVE ITEM 0-\n$html\n-ALTERNATIVE ITEM 1-\n$text\n-ALTERNATIVE END-\n";
- }
- else {
- $details = $html ? $html : $text;
- }
+ $details = $text;
$activitySubject = $activityParams['activity_subject'];
$activityParams = array(
$activitySubject = $activityParams['activity_subject'];
$activityParams = array(
@@
-1465,9
+1444,6
@@
LEFT JOIN civicrm_activity_contact src ON (src.activity_id = ac.activity_id AND
$tokenText = CRM_Utils_Token::replaceContactTokens($text, $values, FALSE, $messageToken, FALSE, $escapeSmarty);
$tokenText = CRM_Utils_Token::replaceHookTokens($tokenText, $values, $categories, FALSE, $escapeSmarty);
$tokenText = CRM_Utils_Token::replaceContactTokens($text, $values, FALSE, $messageToken, FALSE, $escapeSmarty);
$tokenText = CRM_Utils_Token::replaceHookTokens($tokenText, $values, $categories, FALSE, $escapeSmarty);
- $tokenHtml = CRM_Utils_Token::replaceContactTokens($html, $values, TRUE, $messageToken, FALSE, $escapeSmarty);
- $tokenHtml = CRM_Utils_Token::replaceHookTokens($tokenHtml, $values, $categories, TRUE, $escapeSmarty);
-
// Only send if the phone is of type mobile
$phoneTypes = CRM_Core_OptionGroup::values('phone_type', TRUE, FALSE, FALSE, NULL, 'name');
if ($values['phone_type_id'] == CRM_Utils_Array::value('Mobile', $phoneTypes)) {
// Only send if the phone is of type mobile
$phoneTypes = CRM_Core_OptionGroup::values('phone_type', TRUE, FALSE, FALSE, NULL, 'name');
if ($values['phone_type_id'] == CRM_Utils_Array::value('Mobile', $phoneTypes)) {
@@
-1480,7
+1456,6
@@
LEFT JOIN civicrm_activity_contact src ON (src.activity_id = ac.activity_id AND
$sendResult = self::sendSMSMessage(
$contactId,
$tokenText,
$sendResult = self::sendSMSMessage(
$contactId,
$tokenText,
- $tokenHtml,
$smsParams,
$activityID,
$userID
$smsParams,
$activityID,
$userID
@@
-1509,15
+1484,14
@@
LEFT JOIN civicrm_activity_contact src ON (src.activity_id = ac.activity_id AND
}
/**
}
/**
- *
s
end the sms message to a specific contact
+ *
S
end the sms message to a specific contact
*
* @param int $toID the contact id of the recipient
* @param $tokenText
* @param $tokenHtml
* @param array $smsParams the params used for sending sms
*
* @param int $toID the contact id of the recipient
* @param $tokenText
* @param $tokenHtml
* @param array $smsParams the params used for sending sms
- *
* @param int $activityID the activity ID that tracks the message
* @param int $activityID the activity ID that tracks the message
- * @param
null
$userID
+ * @param
int
$userID
*
* @return mixed true on success or PEAR_Error object
* @access public
*
* @return mixed true on success or PEAR_Error object
* @access public
@@
-1525,7
+1499,6
@@
LEFT JOIN civicrm_activity_contact src ON (src.activity_id = ac.activity_id AND
*/
static function sendSMSMessage($toID,
&$tokenText,
*/
static function sendSMSMessage($toID,
&$tokenText,
- &$tokenHtml,
$smsParams = array(),
$activityID,
$userID = null
$smsParams = array(),
$activityID,
$userID = null
@@
-1558,13
+1531,12
@@
LEFT JOIN civicrm_activity_contact src ON (src.activity_id = ac.activity_id AND
);
}
);
}
- $message = $tokenHtml ? $tokenHtml : $tokenText;
$recipient = $smsParams['To'];
$smsParams['contact_id'] = $toID;
$smsParams['parent_activity_id'] = $activityID;
$providerObj = CRM_SMS_Provider::singleton(array('provider_id' => $smsParams['provider_id']));
$recipient = $smsParams['To'];
$smsParams['contact_id'] = $toID;
$smsParams['parent_activity_id'] = $activityID;
$providerObj = CRM_SMS_Provider::singleton(array('provider_id' => $smsParams['provider_id']));
- $sendResult = $providerObj->send($recipient, $smsParams, $
message
, NULL, $userID);
+ $sendResult = $providerObj->send($recipient, $smsParams, $
tokenText
, NULL, $userID);
if (PEAR::isError($sendResult)) {
return $sendResult;
}
if (PEAR::isError($sendResult)) {
return $sendResult;
}
@@
-1585,22
+1557,20
@@
LEFT JOIN civicrm_activity_contact src ON (src.activity_id = ac.activity_id AND
}
/**
}
/**
- *
s
end the message to a specific contact
+ *
S
end the message to a specific contact
*
* @param string $from the name and email of the sender
*
* @param string $from the name and email of the sender
- * @param $fromID
+ * @param
int
$fromID
* @param int $toID the contact id of the recipient
* @param string $subject the subject of the message
* @param $text_message
* @param $html_message
* @param string $emailAddress use this 'to' email address instead of the default Primary address
* @param int $activityID the activity ID that tracks the message
* @param int $toID the contact id of the recipient
* @param string $subject the subject of the message
* @param $text_message
* @param $html_message
* @param string $emailAddress use this 'to' email address instead of the default Primary address
* @param int $activityID the activity ID that tracks the message
- *
* @param null $attachments
* @param null $cc
* @param null $bcc
*
* @param null $attachments
* @param null $cc
* @param null $bcc
*
- * @internal param string $message the message contents
* @return boolean true if successfull else false.
* @access public
* @static
* @return boolean true if successfull else false.
* @access public
* @static
@@
-1665,7
+1635,7
@@
LEFT JOIN civicrm_activity_contact src ON (src.activity_id = ac.activity_id AND
}
/**
}
/**
- *
c
ombine all the importable fields from the lower levels object
+ *
C
ombine all the importable fields from the lower levels object
*
* The ordering is important, since currently we do not have a weight
* scheme. Adding weight is super important and should be done in the
*
* The ordering is important, since currently we do not have a weight
* scheme. Adding weight is super important and should be done in the
@@
-1673,8
+1643,6
@@
LEFT JOIN civicrm_activity_contact src ON (src.activity_id = ac.activity_id AND
*
* @param bool $status
*
*
* @param bool $status
*
- * @internal param $NULL
- *
* @return array array of importable Fields
* @access public
* @static
* @return array array of importable Fields
* @access public
* @static
@@
-1727,8
+1695,7
@@
LEFT JOIN civicrm_activity_contact src ON (src.activity_id = ac.activity_id AND
/**
* To get the Activities of a target contact
*
/**
* To get the Activities of a target contact
*
- * @param $contactId Integer ContactId of the contact whose activities
- * need to find
+ * @param int $contactId Id of the contact whose activities need to find
*
* @return array array of activity fields
* @access public
*
* @return array array of activity fields
* @access public
@@
-1799,13
+1766,11
@@
WHERE activity.id IN ($activityIds)";
}
/**
}
/**
- *
Function to a
dd activity for Membership/Event/Contribution
+ *
A
dd activity for Membership/Event/Contribution
*
* @param object $activity (reference) particular component object
* @param string $activityType for Membership Signup or Renewal
*
* @param object $activity (reference) particular component object
* @param string $activityType for Membership Signup or Renewal
- *
- *
- * @param null $targetContactID
+ * @param int $targetContactID
*
* @return bool
* @static
*
* @return bool
* @static
@@
-1839,7
+1804,7
@@
SELECT display_name
$subject .= " (by {$displayName})";
}
$subject .= " (by {$displayName})";
}
- $subject .= " - Status: " . CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipStatus', $activity->status_id);
+ $subject .= " - Status: " . CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipStatus', $activity->status_id
, 'label'
);
// CRM-72097 changed from start date to today
$date = date('YmdHis');
$component = 'Membership';
// CRM-72097 changed from start date to today
$date = date('YmdHis');
$component = 'Membership';
@@
-1919,7
+1884,7
@@
SELECT display_name
}
/**
}
/**
- *
Function to g
et Parent activity for currently viewed activity
+ *
G
et Parent activity for currently viewed activity
*
* @param int $activityId current activity id
*
*
* @param int $activityId current activity id
*
@@
-1946,11
+1911,9
@@
SELECT display_name
}
/**
}
/**
- * Function to get total count of prior revision of currently viewd activity
- *
- * @param $activityID
+ * Get total count of prior revision of currently viewd activity
*
*
- * @
internal param int $activityId
current activity id
+ * @
param $activityID
current activity id
*
* @return int $params count of prior activities otherwise false.
* @access public
*
* @return int $params count of prior activities otherwise false.
* @access public
@@
-1985,14
+1948,11
@@
AND id < {$activityID}
}
/**
}
/**
- * Function to get all prior activities of currently viewe
- * d activity
+ * Get all prior activities of currently viewed activity
*
*
- * @param $activityID
+ * @param $activityID
current activity id
* @param bool $onlyPriorRevisions
*
* @param bool $onlyPriorRevisions
*
- * @internal param int $activityId current activity id
- *
* @return array $result prior activities info.
* @access public
*/
* @return array $result prior activities info.
* @access public
*/
@@
-2038,13
+1998,11
@@
AND cl.modified_id = c.id
}
/**
}
/**
- * Function to find the latest revision of a given activity
- *
- * @param $activityID
+ * Find the latest revision of a given activity
*
*
- * @
internal param int $activityId
prior activity id
+ * @
param int $activityID
prior activity id
*
*
- * @return int
$params
current activity id.
+ * @return int current activity id.
* @access public
*/
static function getLatestActivityId($activityID) {
* @access public
*/
static function getLatestActivityId($activityID) {
@@
-2072,15
+2030,12
@@
AND cl.modified_id = c.id
}
/**
}
/**
- * Function to create a follow up a given activity
- *
- * @activityId int activity id of parent activity
+ * Create a follow up a given activity
*
*
- * @param $activityId
- * @param $params
+ * @param $activityId
int activity id of parent activity
+ * @param
array
$params
*
* @return $this|null|object
*
* @return $this|null|object
- * @internal param array $activity details
*
* @access public
*/
*
* @access public
*/
@@
-2115,13
+2070,12
@@
AND cl.modified_id = c.id
}
/**
}
/**
- *
Function to g
et Activity specific File according activity type Id.
+ *
G
et Activity specific File according activity type Id.
*
* @param int $activityTypeId activity id
*
* @param int $activityTypeId activity id
- *
* @param string $crmDir
*
* @param string $crmDir
*
- * @return if file exists returns $activityTypeFile activity filename otherwise false.
+ * @return
string|bool
if file exists returns $activityTypeFile activity filename otherwise false.
*
* @static
*/
*
* @static
*/
@@
-2150,7
+2104,7
@@
AND cl.modified_id = c.id
}
/**
}
/**
- *
Function to r
estore the activity
+ *
R
estore the activity
*
* @param array $params associated array
*
*
* @param array $params associated array
*
@@
-2310,7
+2264,7
@@
AND cl.modified_id = c.id
}
/**
}
/**
- * Does user has sufficient permission for view/edit activity record
.
+ * Does user has sufficient permission for view/edit activity record
?
*
* @param int $activityId activity record id.
* @param int $action edit/view
*
* @param int $activityId activity record id.
* @param int $action edit/view
@@
-2598,18
+2552,19
@@
INNER JOIN civicrm_option_group grp ON ( grp.id = val.option_group_id AND grp.n
'Activity',
$values['activity_id']
);
'Activity',
$values['activity_id']
);
+
+ $contactActivities[$activityId]['is_recurring_activity'] = $values['is_recurring_activity'];
}
}
return $contactActivities;
}
}
}
return $contactActivities;
}
- /*
- * Used to copy custom fields and attachments from an existing activity to another.
- * see CRM_Case_Page_AJAX::_convertToCaseActivity() for example
- */
/**
/**
- * @param $params
+ * Used to copy custom fields and attachments from an existing activity to another.
+ * @see CRM_Case_Page_AJAX::_convertToCaseActivity() for example
+ *
+ * @param array $params
*/
static function copyExtendedActivityData($params) {
// attach custom data to the new activity
*/
static function copyExtendedActivityData($params) {
// attach custom data to the new activity
@@
-2649,8
+2604,8
@@
INNER JOIN civicrm_option_group grp ON ( grp.id = val.option_group_id AND grp.n
}
/**
}
/**
- * @param $activityId
- * @param
null
$recordTypeID
+ * @param
int
$activityId
+ * @param
int
$recordTypeID
* @param string $column
*
* @return null
* @param string $column
*
* @return null
@@
-2668,7
+2623,7
@@
INNER JOIN civicrm_option_group grp ON ( grp.id = val.option_group_id AND grp.n
}
/**
}
/**
- * @param $activityId
+ * @param
int
$activityId
*
* @return null
*/
*
* @return null
*/
@@
-2683,7
+2638,7
@@
INNER JOIN civicrm_option_group grp ON ( grp.id = val.option_group_id AND grp.n
}
/**
}
/**
- * @param $params
+ * @param
array
$params
*/
function setApiFilter(&$params) {
if (CRM_Utils_Array::value('target_contact_id', $params)) {
*/
function setApiFilter(&$params) {
if (CRM_Utils_Array::value('target_contact_id', $params)) {