Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM-21065 Replace some CRM_Core_OptionGroup::values with CRM_Activity_BAO_Activ… #10860

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Putting this here for easy reference

 public static function &values(
    $name, $flip = FALSE, $grouping = FALSE,
    $localize = FALSE, $condition = NULL,
    $labelColumnName = 'label', $onlyActive = TRUE, $fresh = FALSE, $keyColumnName = 'value',
    $orderBy = 'weight')

Here is the definition of the contexts for buildOptions

    $contexts = array(
      'get' => "get: all options are returned, even if they are disabled; labels are translated.",
      'create' => "create: options are filtered appropriately for the object being created/updated; labels are translated.",
      'search' => "search: searchable options are returned; labels are translated.",
      'validate' => "validate: all options are returned, even if they are disabled; machine names are used in place of labels.",
      'abbreviate' => "abbreviate: enabled options are returned; labels are replaced with abbreviations.",
      'match' => "match: enabled options are returned using machine names as keys; labels are translated.",
    );

In the case of this change the $onlyActive is TRUE in the existing code & FALSE in the changed version, but I don't find it valid that we should be disabling ActivityContact record types.

Definition of record_type_id DOES refer to activity_contacts

  <field>
    <name>record_type_id</name>
    <type>int unsigned</type>
    <title>Record Type ID</title>
    <comment>Nature of this contact's role in the activity: 1 assignee, 2 creator, 3 focus or target.</comment>
    <pseudoconstant>
      <optionGroupName>activity_contacts</optionGroupName>
    </pseudoconstant>
    <html>
      <type>Select</type>
    </html>
    <add>4.4</add>
  </field>

Summary of above - change looks good :-)

if ($schedule->limit_to == 0 || !isset($activityContacts[$schedule->recipient])) {
$recipientTypeId = \CRM_Utils_Array::key('Activity Targets', $activityContacts);
}
Expand Down
30 changes: 15 additions & 15 deletions 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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above = checked

$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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above = checked

$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 @@ -633,7 +633,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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above = checked

$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
$id = self::getActivityContact($activity->id, $sourceID);
}
Expand Down Expand Up @@ -672,7 +672,7 @@ public static function getActivities($params, $getCount = FALSE) {
$activities = array();

// fetch all active activity types
$activityTypes = CRM_Core_OptionGroup::values('activity_type');
$activityTypes = CRM_Activity_BAO_Activity::buildOptions('activity_type_id', 'get');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implicit in the first line is $labelColumnName = 'label'
The use of get as context has the same effect

I'm finding the way this parameter is used in the function kinda odd - ie

    elseif (!empty($activityTypes) && count($activityTypes)) {
      $activityParams['activity_type_id'] = array('IN' => array_keys($activityTypes));
    }

seems to imply we want to exclude active ones here. I would be inclined to drop this from the PR to get the others through without this holding them up

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eileenmcnaughton I've removed from this PR and raised a more complex change for this line in https://issues.civicrm.org/jira/browse/CRM-21111 - PR #10909 which should also improve performance of that function


// Activity.Get API params
$activityParams = array(
Expand Down Expand Up @@ -886,7 +886,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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

$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 @@ -1307,7 +1307,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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

$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 @@ -1824,7 +1824,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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);

// add activity target record for every sms that is send
Expand Down Expand Up @@ -1888,7 +1888,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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);

// create the params array
Expand Down Expand Up @@ -1990,7 +1990,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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

$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 @@ -2030,8 +2030,8 @@ 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');
$activityTypes = CRM_Activity_BAO_Activity::buildOptions('activity_type_id', 'get');
$activityStatuses = CRM_Activity_BAO_Activity::buildOptions('activity_status_id', 'get');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, this looks correct, being used for rendering a label within the results. CRM_Core_Pseudoconstant::getLabel would make even more sense in the function context

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eileenmcnaughton As it's trivial and neater to use getLabel here I've updated the PR to do so!


while ($dao->fetch()) {
$activities[$dao->activity_id]['id'] = $dao->activity_id;
Expand Down Expand Up @@ -2610,7 +2610,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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);

$transaction = new CRM_Core_Transaction();
Expand Down Expand Up @@ -2745,7 +2745,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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

$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 @@ -3083,7 +3083,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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
}

Expand All @@ -3100,7 +3100,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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

$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 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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

$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 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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

$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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

$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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);

$query = "
Expand Down
4 changes: 2 additions & 2 deletions 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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

$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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
$from = "
LEFT JOIN civicrm_activity_contact ac
Expand Down
2 changes: 1 addition & 1 deletion 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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
// format assignee params
if (!CRM_Utils_Array::crmIsEmptyArray($params['assignee_contact_id'])) {
Expand Down
2 changes: 1 addition & 1 deletion CRM/Activity/Form/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public static function preProcessCommon(&$form, $useTable = FALSE) {
public function setContactIDs() {
$IDs = implode(',', $this->_activityHolderIds);

$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
$query = "
SELECT contact_id
Expand Down
2 changes: 1 addition & 1 deletion CRM/Activity/Form/Task/PickOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function postProcess() {
$params = $this->exportValues();
$this->_contacts = array();

$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
// Get assignee contacts.
Expand Down
2 changes: 1 addition & 1 deletion CRM/Activity/Form/Task/SearchTaskHookSample.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function preProcess() {
// display name and activity details of all selected contacts
$activityIDs = implode(',', $this->_activityHolderIds);

$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
$query = "
SELECT at.subject as subject,
Expand Down
2 changes: 1 addition & 1 deletion CRM/Activity/Page/AJAX.php
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ public static function _convertToCaseActivity($params) {
$targetContacts = array_unique(explode(',', $params['targetContactIds']));
}

$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

$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
2 changes: 1 addition & 1 deletion CRM/Activity/Selector/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ public function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
$allCampaigns = CRM_Campaign_BAO_Campaign::getCampaigns(NULL, NULL, FALSE, FALSE, FALSE, TRUE);

$engagementLevels = CRM_Campaign_PseudoConstant::engagementLevel();
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

$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
8 changes: 4 additions & 4 deletions CRM/Campaign/BAO/Petition.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public function confirmSignature($activity_id, $contact_id, $petition_id) {
// change activity status to completed (status_id = 2)
// I wonder why do we need contact_id when we have activity_id anyway? [chastell]
$sql = 'UPDATE civicrm_activity SET status_id = 2 WHERE id = %1';
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
$params = array(
1 => array($activity_id, 'Integer'),
Expand Down Expand Up @@ -307,7 +307,7 @@ public static function getPetitionSignatureTotalbyCountry($surveyId) {
civicrm_survey.id = %1 AND
a.source_record_id = %1 ";

$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
$params = array(
1 => array($surveyId, 'Integer'),
Expand Down Expand Up @@ -432,7 +432,7 @@ public static function getPetitionSignature($surveyId, $status_id = NULL) {
}
$sql .= " ORDER BY a.activity_date_time";

$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
$params[3] = array($sourceID, 'Integer');

Expand Down Expand Up @@ -497,7 +497,7 @@ public static function checkSignature($surveyId, $contactId) {

$surveyInfo = CRM_Campaign_BAO_Petition::getSurveyInfo($surveyId);
$signature = array();
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);

$sql = "
Expand Down
2 changes: 1 addition & 1 deletion CRM/Campaign/BAO/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public static function from($name, $mode, $side) {
return $from;
}

$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

$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
6 changes: 3 additions & 3 deletions CRM/Campaign/BAO/Survey.php
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ public static function voterActivityDetails($surveyId, $voterIds, $interviewerId
}

$targetContactIds = ' ( ' . implode(',', $voterIds) . ' ) ';
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);

Expand Down Expand Up @@ -625,7 +625,7 @@ public static function getSurveyActivities(
contact_a.display_name as voter_name";
}

$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);

Expand Down Expand Up @@ -1046,7 +1046,7 @@ public static function getInterviewers() {
}

$interviewers = array();
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);

$query = "
Expand Down
Loading