class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity {
/**
- * static field for all the activity information that we can potentially export
+ * Static field for all the activity information that we can potentially export
*
* @var array
* @static
static $_exportableFields = NULL;
/**
- * static field for all the activity information that we can potentially import
+ * Static field for all the activity information that we can potentially import
*
* @var array
* @static
}
/**
- * 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
*
- * @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) {
}
/**
- * Function to delete the activity
+ * Delete the activity
*
* @param array $params associated array
- *
* @param bool $moveToTrash
*
* @return void
/**
* 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
}
/**
- * Function to process the activities
+ * Process the activities
*
* @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
}
/**
- * function to get the list Activities
+ * Get the list Activities
*
* @param array $input array of parameters
* Keys include
{$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
+LEFT JOIN civicrm_recurring_entity re on {$activityContactTempTable}.activity_id = re.entity_id
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]['is_recurring_activity'] = $dao->is_recurring_activity;
if ($dao->campaign_id) {
$values[$activityID]['campaign'] = $allCampaigns[$dao->campaign_id];
* user has permission. To decide whether we are going to include
* component related activities w/ core activity retrieve process.
*
- * return an array of component id and name.
+ * @return array of component id and name.
* @static
**/
static function activityComponents() {
}
/**
- * function to get the activity Count
+ * Get the activity Count
*
* @param array $input array of parameters
* Keys include
}
/**
- * function to get the activity sql clause to pick activities
+ * Get the activity sql clause to pick activities
*
* @param array $input array of parameters
* Keys include
}
/**
- * send the message to all the contacts and also insert a
+ * Send 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
* @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
}
/**
- * @param $contactDetails
- * @param $activityParams
+ * @param array $contactDetails
+ * @param array $activityParams
* @param array $smsParams
* @param $contactIds
- * @param null $userID
+ * @param int $userID
*
* @return array
* @throws CRM_Core_Exception
$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);
- $messageToken = array_merge($messageToken,
- CRM_Utils_Token::getTokens($html)
- );
//create the meta level record first ( sms activity )
$activityTypeID = CRM_Core_OptionGroup::getValue('activity_type',
'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(
$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)) {
$sendResult = self::sendSMSMessage(
$contactId,
$tokenText,
- $tokenHtml,
$smsParams,
$activityID,
$userID
}
/**
- * send the sms message to a specific contact
+ * Send 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 $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
*/
static function sendSMSMessage($toID,
&$tokenText,
- &$tokenHtml,
$smsParams = array(),
$activityID,
$userID = null
);
}
- $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']));
- $sendResult = $providerObj->send($recipient, $smsParams, $message, NULL, $userID);
+ $sendResult = $providerObj->send($recipient, $smsParams, $tokenText, NULL, $userID);
if (PEAR::isError($sendResult)) {
return $sendResult;
}
}
/**
- * send the message to a specific contact
+ * Send the message to a specific contact
*
* @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 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
}
/**
- * combine all the importable fields from the lower levels object
+ * Combine 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
*
* @param bool $status
*
- * @internal param $NULL
- *
* @return array array of importable Fields
* @access public
* @static
/**
* 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
}
/**
- * Function to add activity for Membership/Event/Contribution
+ * Add activity for Membership/Event/Contribution
*
* @param object $activity (reference) particular component object
* @param string $activityType for Membership Signup or Renewal
- *
- *
- * @param null $targetContactID
+ * @param int $targetContactID
*
* @return bool
* @static
$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';
}
/**
- * Function to get Parent activity for currently viewed activity
+ * Get Parent activity for currently viewed activity
*
* @param int $activityId current activity id
*
}
/**
- * 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
}
/**
- * 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
*
- * @internal param int $activityId current activity id
- *
* @return array $result prior activities info.
* @access public
*/
}
/**
- * 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) {
}
/**
- * 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
- * @internal param array $activity details
*
* @access public
*/
}
/**
- * Function to get Activity specific File according activity type Id.
+ * Get Activity specific File according activity type Id.
*
* @param int $activityTypeId activity id
- *
* @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
*/
}
/**
- * Function to restore the activity
+ * Restore the activity
*
* @param array $params associated array
*
}
/**
- * 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
'Activity',
$values['activity_id']
);
+
+ $contactActivities[$activityId]['is_recurring_activity'] = $values['is_recurring_activity'];
}
}
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
}
/**
- * @param $activityId
- * @param null $recordTypeID
+ * @param int $activityId
+ * @param int $recordTypeID
* @param string $column
*
* @return null
}
/**
- * @param $activityId
+ * @param int $activityId
*
* @return null
*/
}
/**
- * @param $params
+ * @param array $params
*/
function setApiFilter(&$params) {
if (CRM_Utils_Array::value('target_contact_id', $params)) {