Skip to content

Commit

Permalink
Remove some calls to deprecated function
Browse files Browse the repository at this point in the history
civicrm#23880 is
thoroughly stale so I'm closing it - but just thought I'd rescue a couple of changes

These are in the barely maintained legacycustomsearches so of marginal risk &
marginal benefit but since I looked maybe no-one else has to ever again...
  • Loading branch information
eileenmcnaughton committed Nov 30, 2023
1 parent 0bd36ff commit 311a4e2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
5 changes: 0 additions & 5 deletions api/v3/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,6 @@ function _civicrm_api3_activity_get_extraFilters(&$params, &$sql) {
'join' => '!joinType civicrm_entity_file !alias ON (!alias.entity_table = "civicrm_activity" AND !alias.entity_id = a.id)',
'column' => 'file_id',
],
'case_id' => [
'subquery' => 'a.id IN (SELECT activity_id FROM civicrm_case_activity WHERE !clause)',
'join' => '!joinType civicrm_case_activity !alias ON (!alias.activity_id = a.id)',
'column' => 'case_id',
],
];
foreach ($rels as $filter => $relSpec) {
if (!empty($params[$filter])) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,15 @@ public function buildForm(&$form) {
);

// Select box for Activity Type
$activityType = ['' => ts(' - select activity - ')] + CRM_Core_PseudoConstant::activityType();
$activityType = ['' => ts(' - select activity - ')] + CRM_Activity_BAO_Activity::buildOptions('activity_type_id', 'search');;

$form->add('select', 'activity_type_id', ts('Activity Type'),
$activityType,
FALSE
);

// textbox for Activity Status
$activityStatus = ['' => ts(' - select status - ')] + CRM_Core_PseudoConstant::activityStatus();
$activityStatus = ['' => ts(' - select status - ')] + CRM_Activity_BAO_Activity::buildOptions('status_id', 'search');;

$form->add('select', 'activity_status_id', ts('Activity Status'),
$activityStatus,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ public function __construct(&$formValues) {
// 1. this custom search has slightly different structure ,
// 2. we are in constructor right now,
// we 'll use a small hack -
$rowCount = CRM_Utils_Array::value('crmRowCount', $_REQUEST, Civi::settings()->get('default_pager_size'));
$pageId = CRM_Utils_Array::value('crmPID', $_REQUEST, 1);
$rowCount = $_REQUEST['crmRowCount'] ?? Civi::settings()->get('default_pager_size');
$pageId = $_REQUEST['crmPID'] ?? 1;
$offset = ($pageId - 1) * $rowCount;
$this->_limitClause = NULL;
$this->_limitRowClause = [$rowCount, NULL];
Expand All @@ -137,7 +137,7 @@ public function __construct(&$formValues) {
public function getFieldValue(array $formValues, string $field, $type, $default = NULL) {
$value = $formValues[$field] ?? NULL;
if (!$value) {
return CRM_Utils_Request::retrieve($field, $type, CRM_Core_DAO::$_nullObject, FALSE, $default);
return CRM_Utils_Request::retrieve($field, $type, NULL, FALSE, $default);
}
return $value;
}
Expand Down Expand Up @@ -377,23 +377,21 @@ public function summary() {
}
$dao = CRM_Core_DAO::executeQuery($sql);

$activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE);
$roleIds = CRM_Event_PseudoConstant::participantRole();
while ($dao->fetch()) {
$row = [];
foreach ($this->_tableFields as $name => $dontCare) {
if ($name !== 'activity_type_id') {
$row[$name] = $dao->$name;
}
else {
$row['activity_type'] = $activityTypes[$dao->$name] ?? NULL;
$row['activity_type'] = CRM_Core_PseudoConstant::getLabel('CRM_Activity_BAO_Activity', 'activity_type_id', $dao->$name);
}
}
if (isset($row['participant_role'])) {
$participantRole = explode(CRM_Core_DAO::VALUE_SEPARATOR, $row['participant_role']);
$viewRoles = [];
foreach ($participantRole as $v) {
$viewRoles[] = $roleIds[$v];
$viewRoles[] = CRM_Core_PseudoConstant::getLabel('CRM_Event_BAO_Participant', 'role_id', $v);
}
$row['participant_role'] = implode(', ', $viewRoles);
}
Expand Down

0 comments on commit 311a4e2

Please sign in to comment.