Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
Update to CiviCRM 4.7.25. This is an important update for the stabili…
Browse files Browse the repository at this point in the history
…ty of CiviCRM on Pantheon by ensuring that paths are dynamic for the PHPIDS intrusion detection library.
  • Loading branch information
herbdool committed Oct 6, 2017
1 parent b25ba6f commit 9d555d8
Show file tree
Hide file tree
Showing 301 changed files with 5,833 additions and 3,234 deletions.
6 changes: 4 additions & 2 deletions civicrm/CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ CiviCRM Team - Atif Shaikh, Coleman Watts, David Greenberg, Eileen McNaughton,
Yashodha Chaku

AGH Strategies - Andrew Hunt, Tyrell Cook, Nikki Murray
Agileware - Francis Whittle
Agileware - Justin Freeman, Francis Whittle, Iris Abarquez, Vaibhav Sagar
Andrew West
Aputsiaĸ Niels Janussen
Aron Novak
Expand Down Expand Up @@ -60,6 +60,7 @@ Lighthouse Consulting and Design - Brian Shaughnessy
Marty Wright
Matthew Wire
Mattias Michaux
Megaphone Technology Consulting - Jon Goldberg
Mohit Aggarwal
National Urban League - Lisa Taliano
Nicholai Burton
Expand All @@ -68,7 +69,7 @@ New York City Council
New York State Senate - Ken Zalewski
Northbridge Digital - Oliver Gibson
Olaf Buddenhagen
Palante Technology Cooperative - Jon Goldberg, Joseph Lacey
Palante Technology Cooperative - Joseph Lacey
Paul Campbell
Progressive Tech Project - Alice Aguilar, Jamie McClelland
Richard Van Oosterhout
Expand Down Expand Up @@ -107,6 +108,7 @@ CiviCRM Team - Atif Shaikh, Coleman Watts, David Greenberg, Donald Lobo,
Yashodha Chaku
ADG Communications - Steve Binkowski
AGH Strategies - Andrew Hunt, Jane Hanley, Tommy Bobo, Tyrell Cook
Agileware - Justin Freeman, Francis Whittle, Iris Abarquez, Vaibhav Sagar
Alex C
Allan Chappell
Amnesty International Spain - Carlos Capote
Expand Down
2 changes: 1 addition & 1 deletion civicrm/CRM/Activity/ActionMapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function createQuery($schedule, $phase, $defaultParams) {
$query['casDateField'] = 'e.activity_date_time';

if (!is_null($schedule->limit_to)) {
$activityContacts = \CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityContacts = \CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
if ($schedule->limit_to == 0 || !isset($activityContacts[$schedule->recipient])) {
$recipientTypeId = \CRM_Utils_Array::key('Activity Targets', $activityContacts);
}
Expand Down
54 changes: 26 additions & 28 deletions civicrm/CRM/Activity/BAO/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public static function retrieve(&$params, &$defaults) {
$activity->copyValues($params);

if ($activity->find(TRUE)) {
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
Expand Down Expand Up @@ -209,7 +209,7 @@ public static function deleteActivity(&$params, $moveToTrash = FALSE) {
$logMsg = 'Case Activity deleted for';
$msgs = array();

$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
Expand Down Expand Up @@ -285,6 +285,10 @@ public static function deleteActivityContact($activityId, $recordTypeID = NULL)
* @return CRM_Activity_BAO_Activity|null|object
*/
public static function create(&$params) {
// CRM-20958 - These fields are managed by MySQL triggers. Watch out for clients resaving stale timestamps.
unset($params['created_date']);
unset($params['modified_date']);

// check required params
if (!self::dataExists($params)) {
throw new CRM_Core_Exception('Not enough data to create activity object');
Expand All @@ -300,10 +304,10 @@ public static function create(&$params) {
if (isset($params['activity_date_time']) &&
strcmp($params['activity_date_time'], CRM_Utils_Date::processDate(date('Ymd')) == -1)
) {
$params['status_id'] = 2;
$params['status_id'] = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'status_id', 'Completed');
}
else {
$params['status_id'] = 1;
$params['status_id'] = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'status_id', 'Scheduled');
}
}

Expand Down Expand Up @@ -352,10 +356,9 @@ public static function create(&$params) {
}

$activityId = $activity->id;
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
$sourceID = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_ActivityContact', 'record_type_id', 'Activity Source');
$assigneeID = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_ActivityContact', 'record_type_id', 'Activity Assignees');
$targetID = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_ActivityContact', 'record_type_id', 'Activity Targets');

if (isset($params['source_contact_id'])) {
$acParams = array(
Expand Down Expand Up @@ -567,7 +570,7 @@ public static function create(&$params) {
if (!isset($activity->parent_id)) {
$recentContactDisplay = CRM_Contact_BAO_Contact::displayName($recentContactId);
// add the recently created Activity
$activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE);
$activityTypes = CRM_Activity_BAO_Activity::buildOptions('activity_type_id');
$activitySubject = CRM_Core_DAO::getFieldValue('CRM_Activity_DAO_Activity', $activity->id, 'subject');

$title = "";
Expand Down Expand Up @@ -634,7 +637,7 @@ public static function create(&$params) {
public static function logActivityAction($activity, $logMessage = NULL) {
$id = CRM_Core_Session::getLoggedInContactID();
if (!$id) {
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
$id = self::getActivityContact($activity->id, $sourceID);
}
Expand Down Expand Up @@ -887,7 +890,7 @@ public static function deprecatedGetActivities($input) {
'Bulk Email'
);

$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
Expand Down Expand Up @@ -1308,7 +1311,7 @@ public static function deprecatedGetActivitySQLClause($input) {
// build main activity table select clause
$sourceSelect = '';

$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
$sourceJoin = "
INNER JOIN civicrm_activity_contact ac ON ac.activity_id = civicrm_activity.id
Expand Down Expand Up @@ -1679,8 +1682,7 @@ public static function sendSMS(
'activity_date_time' => date('YmdHis'),
'subject' => $activitySubject,
'details' => $details,
// FIXME: check for name Completed and get ID from that lookup
'status_id' => 2,
'status_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'status_id', 'Completed'),
);

$activity = self::create($activityParams);
Expand Down Expand Up @@ -1727,8 +1729,7 @@ public static function sendSMS(
$tokenText = CRM_Utils_Token::replaceHookTokens($tokenText, $values, $categories, FALSE, $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)) {
if ($values['phone_type_id'] == CRM_Core_PseudoConstant::getKey('CRM_Core_BAO_Phone', 'phone_type_id', 'Mobile')) {
$smsParams['To'] = $values['phone'];
}
else {
Expand Down Expand Up @@ -1827,7 +1828,7 @@ public static function sendSMSMessage(
return $sendResult;
}

$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);

// add activity target record for every sms that is send
Expand Down Expand Up @@ -1891,7 +1892,7 @@ public static function sendMessage(
$toDisplayName = $toEmail;
}

$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);

// create the params array
Expand Down Expand Up @@ -1993,7 +1994,7 @@ public static function &importableFields($status = FALSE) {
public static function getContactActivity($contactId) {
// @todo remove this function entirely.
$activities = array();
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
Expand Down Expand Up @@ -2033,9 +2034,6 @@ public static function getContactActivity($contactId) {

$dao = CRM_Core_DAO::executeQuery($query);

$activityTypes = CRM_Core_OptionGroup::values('activity_type');
$activityStatuses = CRM_Core_OptionGroup::values('activity_status');

while ($dao->fetch()) {
$activities[$dao->activity_id]['id'] = $dao->activity_id;
$activities[$dao->activity_id]['activity_type_id'] = $dao->activity_type_id;
Expand All @@ -2044,8 +2042,8 @@ public static function getContactActivity($contactId) {
$activities[$dao->activity_id]['activity_date_time'] = $dao->activity_date_time;
$activities[$dao->activity_id]['details'] = $dao->details;
$activities[$dao->activity_id]['status_id'] = $dao->status_id;
$activities[$dao->activity_id]['activity_name'] = $activityTypes[$dao->activity_type_id];
$activities[$dao->activity_id]['status'] = $activityStatuses[$dao->status_id];
$activities[$dao->activity_id]['activity_name'] = CRM_Core_PseudoConstant::getLabel('CRM_Activity_BAO_Activity', 'activity_type_id', $dao->activity_type_id);
$activities[$dao->activity_id]['status'] = CRM_Core_PseudoConstant::getLabel('CRM_Activity_BAO_Activity', 'activity_status_id', $dao->status_id);

// set to null if not set
if (!isset($activities[$dao->activity_id]['source_contact_id'])) {
Expand Down Expand Up @@ -2613,7 +2611,7 @@ public static function cleanupActivity($contactId) {
if (!$contactId) {
return $result;
}
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);

$transaction = new CRM_Core_Transaction();
Expand Down Expand Up @@ -2748,7 +2746,7 @@ public static function checkPermission($activityId, $action) {
$permission = CRM_Core_Permission::EDIT;
}

$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
Expand Down Expand Up @@ -3086,7 +3084,7 @@ public static function getActivityContact($activityId, $recordTypeID = NULL, $co
public static function getSourceContactID($activityId) {
static $sourceID = NULL;
if (!$sourceID) {
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
}

Expand All @@ -3103,7 +3101,7 @@ public static function getSourceContactID($activityId) {
public function setApiFilter(&$params) {
if (!empty($params['target_contact_id'])) {
$this->selectAdd();
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
$obj = new CRM_Activity_BAO_ActivityContact();
$params['return.target_contact_id'] = 1;
Expand Down
6 changes: 3 additions & 3 deletions civicrm/CRM/Activity/BAO/ActivityAssignment.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function __construct() {
*/
public static function create(&$params) {
$assignment = new CRM_Activity_BAO_ActivityContact();
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);

$assignment->copyValues($params);
Expand All @@ -76,7 +76,7 @@ public static function retrieveAssigneeIdsByActivityId($activity_id) {
return $assigneeArray;
}

$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);

$sql = "
Expand Down Expand Up @@ -112,7 +112,7 @@ public static function getAssigneeNames($activityIDs, $isDisplayName = FALSE, $s
if (empty($activityIDs)) {
return $assigneeNames;
}
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);

$whereClause = "";
Expand Down
6 changes: 3 additions & 3 deletions civicrm/CRM/Activity/BAO/ActivityTarget.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function __construct() {
*/
public static function create(&$params) {
$target = new CRM_Activity_BAO_ActivityContact();
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);

$target->copyValues($params);
Expand All @@ -74,7 +74,7 @@ public static function retrieveTargetIdsByActivityId($activity_id) {
return $targetArray;
}

$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);

$sql = "
Expand Down Expand Up @@ -105,7 +105,7 @@ public static function getTargetNames($activityID) {
if (empty($activityID)) {
return $targetNames;
}
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);

$query = "
Expand Down
4 changes: 2 additions & 2 deletions civicrm/CRM/Activity/BAO/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public static function whereClauseSingle(&$values, &$query) {

case 'activity_role':
CRM_Contact_BAO_Query::$_activityRole = $values[2];
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
Expand Down Expand Up @@ -399,7 +399,7 @@ public static function from($name, $mode, $side) {
break;

case 'source_contact':
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
$from = "
LEFT JOIN civicrm_activity_contact ac
Expand Down
46 changes: 45 additions & 1 deletion civicrm/CRM/Activity/DAO/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*
* Generated from xml/schema/CRM/Activity/Activity.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:a530f1fb1a27c5a15b5d138732b4c581)
* (GenCodeChecksum:dfa63754ef6ea1a9c7148e735dd6ff8a)
*/
require_once 'CRM/Core/DAO.php';
require_once 'CRM/Utils/Type.php';
Expand Down Expand Up @@ -195,6 +195,18 @@ class CRM_Activity_DAO_Activity extends CRM_Core_DAO {
* @var boolean
*/
public $is_star;
/**
* When was the activity was created.
*
* @var timestamp
*/
public $created_date;
/**
* When was the activity (or closely related entity) was created or modified or deleted.
*
* @var timestamp
*/
public $modified_date;
/**
* Class constructor.
*/
Expand Down Expand Up @@ -642,6 +654,38 @@ static function &fields() {
'bao' => 'CRM_Activity_BAO_Activity',
'localizable' => 0,
) ,
'activity_created_date' => array(
'name' => 'created_date',
'type' => CRM_Utils_Type::T_TIMESTAMP,
'title' => ts('Created Date') ,
'description' => 'When was the activity was created.',
'required' => false,
'export' => true,
'where' => 'civicrm_activity.created_date',
'headerPattern' => '',
'dataPattern' => '',
'default' => 'NULL',
'table_name' => 'civicrm_activity',
'entity' => 'Activity',
'bao' => 'CRM_Activity_BAO_Activity',
'localizable' => 0,
) ,
'activity_modified_date' => array(
'name' => 'modified_date',
'type' => CRM_Utils_Type::T_TIMESTAMP,
'title' => ts('Modified Date') ,
'description' => 'When was the activity (or closely related entity) was created or modified or deleted.',
'required' => false,
'export' => true,
'where' => 'civicrm_activity.modified_date',
'headerPattern' => '',
'dataPattern' => '',
'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
'table_name' => 'civicrm_activity',
'entity' => 'Activity',
'bao' => 'CRM_Activity_BAO_Activity',
'localizable' => 0,
) ,
);
CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
}
Expand Down
2 changes: 1 addition & 1 deletion civicrm/CRM/Activity/Form/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ public function postProcess($params = NULL) {
*/
protected function processActivity(&$params) {
$activityAssigned = array();
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
// format assignee params
if (!CRM_Utils_Array::crmIsEmptyArray($params['assignee_contact_id'])) {
Expand Down
Loading

0 comments on commit 9d555d8

Please sign in to comment.