/**
* Get all fields of the type Date
*/
-
public static function getDateFields() {
$allFields = CRM_Core_BAO_CustomField::getFields('');
$dateFields = array('birth_date' => ts('Birth Date'));
* @param bool $id
* Mapping id.
*
- * @return array associated array of all the drop downs in the form
- * @static
+ * @return array
+ * associated array of all the drop downs in the form
*/
public static function getSelection($id = NULL) {
$mapping = self::getMapping();
$activityStatus = CRM_Core_PseudoConstant::activityStatus();
- $activityType = CRM_Core_PseudoConstant::activityType(TRUE, TRUE);
+ $activityType = CRM_Core_PseudoConstant::activityType(TRUE, TRUE);
$participantStatus = CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label');
$event = CRM_Event_PseudoConstant::event(NULL, FALSE, "( is_template IS NULL OR is_template != 1 )");
* @param null $entityValue
* @param int $id
*
- * @return array (reference) reminder list
- * @static
+ * @return array
+ * (reference) reminder list
*/
public static function &getList($namesOnly = FALSE, $entityValue = NULL, $id = NULL) {
$activity_type = CRM_Core_PseudoConstant::activityType(TRUE, TRUE);
$schedule = new CRM_Core_DAO_ActionSchedule();
$schedule->id = $scheduleID;
- $domain = CRM_Core_BAO_Domain::getDomain();
- $result = NULL;
+ $domain = CRM_Core_BAO_Domain::getDomain();
+ $result = NULL;
$hookTokens = array();
if ($schedule->find(TRUE)) {
- $body_text = $schedule->body_text;
- $body_html = $schedule->body_html;
+ $body_text = $schedule->body_text;
+ $body_html = $schedule->body_html;
$sms_body_text = $schedule->sms_body_text;
$body_subject = $schedule->subject;
if (!$body_text) {
$smarty = CRM_Core_Smarty::singleton();
foreach (array(
- 'text', 'html', 'sms_text') as $elem) {
+ 'text',
+ 'html',
+ 'sms_text',
+ ) as $elem) {
$$elem = $smarty->fetch("string:{$$elem}");
}
if ($schedule->mode == 'SMS' or $schedule->mode == 'User_Preference') {
$session = CRM_Core_Session::singleton();
$userID = $session->get('userID') ? $session->get('userID') : $contactId;
- $smsParams = array('To' => $phoneNumber, 'provider_id' => $schedule->sms_provider_id, 'activity_subject' => $messageSubject);
+ $smsParams = array(
+ 'To' => $phoneNumber,
+ 'provider_id' => $schedule->sms_provider_id,
+ 'activity_subject' => $messageSubject,
+ );
$activityTypeID = CRM_Core_OptionGroup::getValue('activity_type',
'SMS',
'name'
* The array that holds all the db ids.
*
* @return CRM_Core_DAO_ActionSchedule
- * @static
- *
*/
public static function add(&$params, $ids = array()) {
$actionSchedule = new CRM_Core_DAO_ActionSchedule();
* @param array $values
* (reference ) an assoc array to hold the flattened values.
*
- * @return CRM_Core_DAO_ActionSchedule object on success, null otherwise
- * @static
+ * @return CRM_Core_DAO_ActionSchedule|null
+ * object on success, null otherwise
*/
public static function retrieve(&$params, &$values) {
if (empty($params)) {
* @param int $id
* ID of the Reminder to be deleted.
*
- * @static
*/
public static function del($id) {
if ($id) {
* @param bool $is_active
* Value we want to set the is_active field.
*
- * @return Object DAO object on success, null otherwise
- * @static
+ * @return Object
+ * DAO object on success, null otherwise
*/
public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_Core_DAO_ActionSchedule', $id, 'is_active', $is_active);
$activityStatusID = FALSE;
if ($actionSchedule->record_activity) {
if ($mapping->entity == 'civicrm_membership') {
- $activityTypeID =
- CRM_Core_OptionGroup::getValue('activity_type', 'Membership Renewal Reminder', 'name');
+ $activityTypeID
+ = CRM_Core_OptionGroup::getValue('activity_type', 'Membership Renewal Reminder', 'name');
}
else {
- $activityTypeID =
- CRM_Core_OptionGroup::getValue('activity_type', 'Reminder Sent', 'name');
+ $activityTypeID
+ = CRM_Core_OptionGroup::getValue('activity_type', 'Reminder Sent', 'name');
}
- $activityStatusID =
- CRM_Core_OptionGroup::getValue('activity_status', 'Completed', 'name');
+ $activityStatusID
+ = CRM_Core_OptionGroup::getValue('activity_status', 'Completed', 'name');
}
if ($mapping->entity == 'civicrm_activity') {
$tokenEntity = 'activity';
$tokenFields = array('activity_id', 'activity_type', 'subject', 'details', 'activity_date_time');
$extraSelect = ', ov.label as activity_type, e.id as activity_id';
- $extraJoin = "
+ $extraJoin = "
INNER JOIN civicrm_option_group og ON og.name = 'activity_type'
INNER JOIN civicrm_option_value ov ON e.activity_type_id = ov.value AND ov.option_group_id = og.id";
$extraOn = ' AND e.is_current_revision = 1 AND e.is_deleted = 0 ';
if ($actionSchedule->limit_to == 0) {
- $extraJoin = "
+ $extraJoin = "
LEFT JOIN civicrm_option_group og ON og.name = 'activity_type'
LEFT JOIN civicrm_option_value ov ON e.activity_type_id = ov.value AND ov.option_group_id = og.id";
}
if ($mapping->entity == 'civicrm_participant') {
$tokenEntity = 'event';
- $tokenFields = array('event_type', 'title', 'event_id', 'start_date', 'end_date', 'summary', 'description', 'location', 'info_url', 'registration_url', 'fee_amount', 'contact_email', 'contact_phone', 'balance');
+ $tokenFields = array(
+ 'event_type',
+ 'title',
+ 'event_id',
+ 'start_date',
+ 'end_date',
+ 'summary',
+ 'description',
+ 'location',
+ 'info_url',
+ 'registration_url',
+ 'fee_amount',
+ 'contact_email',
+ 'contact_phone',
+ 'balance',
+ );
$extraSelect = ', ov.label as event_type, ev.title, ev.id as event_id, ev.start_date, ev.end_date, ev.summary, ev.description, address.street_address, address.city, address.state_province_id, address.postal_code, email.email as contact_email, phone.phone as contact_phone ';
- $extraJoin = "
+ $extraJoin = "
INNER JOIN civicrm_event ev ON e.event_id = ev.id
INNER JOIN civicrm_option_group og ON og.name = 'event_type'
INNER JOIN civicrm_option_value ov ON ev.event_type_id = ov.value AND ov.option_group_id = og.id
LEFT JOIN civicrm_phone phone ON phone.id = lb.phone_id
";
if ($actionSchedule->limit_to == 0) {
- $extraJoin = "
+ $extraJoin = "
LEFT JOIN civicrm_event ev ON e.event_id = ev.id
LEFT JOIN civicrm_option_group og ON og.name = 'event_type'
LEFT JOIN civicrm_option_value ov ON ev.event_type_id = ov.value AND ov.option_group_id = og.id
$tokenEntity = 'membership';
$tokenFields = array('fee', 'id', 'join_date', 'start_date', 'end_date', 'status', 'type');
$extraSelect = ', mt.minimum_fee as fee, e.id as id , e.join_date, e.start_date, e.end_date, ms.name as status, mt.name as type';
- $extraJoin = '
+ $extraJoin = '
INNER JOIN civicrm_membership_type mt ON e.membership_type_id = mt.id
INNER JOIN civicrm_membership_status ms ON e.status_id = ms.id';
if ($actionSchedule->limit_to == 0) {
- $extraJoin = '
+ $extraJoin = '
LEFT JOIN civicrm_membership_type mt ON e.membership_type_id = mt.id
LEFT JOIN civicrm_membership_status ms ON e.status_id = ms.id';
}
}
}
- $isError = 0;
+ $isError = 0;
$errorMsg = $toEmail = $toPhoneNumber = '';
if ($actionSchedule->mode == 'SMS' or $actionSchedule->mode == 'User_Preference') {
if ($toEmail || !(empty($toPhoneNumber) or $toDoNotSms)) {
$to['email'] = $toEmail;
$to['phone'] = $toPhoneNumber;
- $result =
- CRM_Core_BAO_ActionSchedule::sendReminder(
+ $result
+ = CRM_Core_BAO_ActionSchedule::sendReminder(
$dao->contactID,
$to,
$actionSchedule->id,
$activityParams = array(
'subject' => $actionSchedule->title,
'details' => $actionSchedule->body_html,
- 'source_contact_id' =>
- $session->get('userID') ? $session->get('userID') : $dao->contactID,
+ 'source_contact_id' => $session->get('userID') ? $session->get('userID') : $dao->contactID,
'target_contact_id' => $dao->contactID,
'activity_date_time' => date('YmdHis'),
'status_id' => $activityStatusID,
$date = $operator . "({$dateField}, INTERVAL {$actionSchedule->start_action_offset} {$actionSchedule->start_action_unit})";
$startDateClause[] = "'{$now}' >= {$date}";
if ($mapping->entity == 'civicrm_participant') {
- $startDateClause[] = $operator . "({$now}, INTERVAL 1 DAY ) {$op} " . $dateField;
+ $startDateClause[] = $operator . "({$now}, INTERVAL 1 DAY ) {$op} " . $dateField;
}
else {
$startDateClause[] = "DATE_SUB({$now}, INTERVAL 1 DAY ) <= {$date}";
$isSendToAdditionalContacts = (!is_null($limitTo) && $limitTo == 0 && (!empty($addGroup) || !empty($addWhere))) ? TRUE : FALSE;
if ($isSendToAdditionalContacts) {
$contactTable = "civicrm_contact c";
- $addSelect = "SELECT c.id as contact_id, c.id as entity_id, 'civicrm_contact' as entity_table, {$actionSchedule->id} as action_schedule_id";
+ $addSelect = "SELECT c.id as contact_id, c.id as entity_id, 'civicrm_contact' as entity_table, {$actionSchedule->id} as action_schedule_id";
$additionReminderClause = "civicrm_action_log reminder ON reminder.contact_id = c.id AND
reminder.entity_id = c.id AND
reminder.entity_table = 'civicrm_contact' AND
{$groupByClause}
{$havingClause}";
- $valsqlInsertValues = CRM_Core_DAO::executeQuery($sqlInsertValues, array(1 => array($actionSchedule->id, 'Integer')));
+ $valsqlInsertValues = CRM_Core_DAO::executeQuery($sqlInsertValues, array(
+ 1 => array(
+ $actionSchedule->id,
+ 'Integer',
+ ),
+ )
+ );
$arrValues = array();
while ($valsqlInsertValues->fetch()) {
}
if (!empty($excludeIds)) {
- $clause = "AND {$field} NOT IN ( " . implode(', ', $excludeIds) . ' ) ';
+ $clause = "AND {$field} NOT IN ( " . implode(', ', $excludeIds) . ' ) ';
return $clause;
}
return NULL;