Unverified Commit b86da8a2 authored by colemanw's avatar colemanw Committed by GitHub

Merge pull request #16896 from eileenmcnaughton/act

[NFC] Use strict comparison where  possible
parents 044a6b24 5d7c2bd2
......@@ -278,7 +278,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
// if we're not adding new one, there must be an id to
// an activity we're trying to work on.
if ($this->_action != CRM_Core_Action::ADD &&
get_class($this->controller) != 'CRM_Contact_Controller_Search'
get_class($this->controller) !== 'CRM_Contact_Controller_Search'
) {
$this->_activityId = CRM_Utils_Request::retrieve('id', 'Positive', $this);
}
......@@ -317,7 +317,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
// Check the mode when this form is called either single or as
// search task action.
if ($this->_activityTypeId ||
$this->_context == 'standalone' ||
$this->_context === 'standalone' ||
$this->_currentlyViewedContactId
) {
$this->_single = TRUE;
......@@ -388,7 +388,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
$qfKey = NULL;
}
if ($this->_context == 'fulltext') {
if ($this->_context === 'fulltext') {
$keyName = '&qfKey';
$urlParams = 'force=1';
$urlString = 'civicrm/contact/search/custom';
......@@ -412,21 +412,21 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
$urlParams = 'reset=1';
$urlString = 'civicrm/dashboard';
}
elseif ($this->_context == 'search') {
elseif ($this->_context === 'search') {
$urlParams = 'force=1';
if ($qfKey) {
$urlParams .= "&qfKey=$qfKey";
}
$path = CRM_Utils_System::currentPath();
if ($this->_compContext == 'advanced') {
if ($this->_compContext === 'advanced') {
$urlString = 'civicrm/contact/search/advanced';
}
elseif ($path == 'civicrm/group/search'
|| $path == 'civicrm/contact/search'
|| $path == 'civicrm/contact/search/advanced'
|| $path == 'civicrm/contact/search/custom'
|| $path == 'civicrm/group/search'
|| $path == 'civicrm/contact/search/builder'
elseif ($path === 'civicrm/group/search'
|| $path === 'civicrm/contact/search'
|| $path === 'civicrm/contact/search/advanced'
|| $path === 'civicrm/contact/search/custom'
|| $path === 'civicrm/group/search'
|| $path === 'civicrm/contact/search/builder'
) {
$urlString = $path;
}
......@@ -435,7 +435,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
}
$this->assign('searchKey', $qfKey);
}
elseif ($this->_context != 'caseActivity') {
elseif ($this->_context !== 'caseActivity') {
$urlParams = "action=browse&reset=1&cid={$this->_currentlyViewedContactId}&selectedChild=activity";
$urlString = 'civicrm/contact/view';
}
......@@ -532,7 +532,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
// if we're editing...
if (isset($this->_activityId)) {
if ($this->_context != 'standalone') {
if ($this->_context !== 'standalone') {
$this->assign('target_contact_value',
CRM_Utils_Array::value('target_contact_value', $defaults)
);
......@@ -654,10 +654,10 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
$attribute = $values['attributes'] ?? NULL;
$required = !empty($values['required']);
if ($values['type'] == 'select' && empty($attribute)) {
if ($values['type'] === 'select' && empty($attribute)) {
$this->addSelect($field, ['entity' => 'activity'], $required);
}
elseif ($values['type'] == 'entityRef') {
elseif ($values['type'] === 'entityRef') {
$this->addEntityRef($field, $values['label'], $attribute, $required);
}
else {
......@@ -733,7 +733,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
$this->add('datepicker', 'followup_date', ts('in'));
// Only admins and case-workers can change the activity source
if (!CRM_Core_Permission::check('administer CiviCRM') && $this->_context != 'caseActivity') {
if (!CRM_Core_Permission::check('administer CiviCRM') && $this->_context !== 'caseActivity') {
$this->getElement('source_contact_id')->freeze();
}
......@@ -825,7 +825,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
*/
public static function formRule($fields, $files, $self) {
// skip form rule if deleting
if (CRM_Utils_Array::value('_qf_Activity_next_', $fields) == 'Delete') {
if (($fields['_qf_Activity_next_'] ?? NULL) === 'Delete') {
return TRUE;
}
$errors = [];
......@@ -960,7 +960,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
$this->_activityId
);
$params['is_multi_activity'] = CRM_Utils_Array::value('separation', $params) == 'separate';
$params['is_multi_activity'] = ($params['separation'] ?? NULL) === 'separate';
$activity = [];
if (!empty($params['is_multi_activity']) &&
......@@ -979,7 +979,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
}
// Redirect to contact page or activity view in standalone mode
if ($this->_context == 'standalone') {
if ($this->_context === 'standalone') {
if (count($params['target_contact_id']) == 1) {
$url = CRM_Utils_System::url('civicrm/contact/view', ['cid' => CRM_Utils_Array::first($params['target_contact_id']), 'selectedChild' => 'activity']);
}
......@@ -1040,6 +1040,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
* Associated array of submitted values.
*
* @return self|null|object
* @throws \CRM_Core_Exception
*/
protected function processActivity(&$params) {
$activityAssigned = [];
......@@ -1163,8 +1164,11 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
/**
* Shorthand for getting id by display name (makes code more readable)
* @param $displayName
*
* @param string $displayName
*
* @return null|string
* @throws \CRM_Core_Exception
*/
protected function _getIdByDisplayName($displayName) {
return CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact',
......@@ -1176,8 +1180,11 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
/**
* Shorthand for getting display name by id (makes code more readable)
* @param $id
*
* @param int $id
*
* @return null|string
* @throws \CRM_Core_Exception
*/
protected function _getDisplayNameById($id) {
return CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact',
......
......@@ -1894,7 +1894,7 @@ SELECT IF( EXISTS(SELECT name FROM civicrm_contact_type WHERE name like %1), 1,
* @param int $entityId
*
* @return array|int
* @throws \Exception
* @throws \CRM_Core_Exception
*/
public static function buildCustomDataView(&$form, &$groupTree, $returnCount = FALSE, $gID = NULL, $prefix = NULL, $customValueId = NULL, $entityId = NULL) {
$details = [];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment