From b99f3e96442eef35e8cb16d8da9dcac1b00643b4 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Thu, 16 Apr 2020 15:33:43 -0400 Subject: [PATCH] REF - Switch CRM_Utils_Array::value to empty in conditionals --- CRM/Activity/Task.php | 2 +- CRM/Admin/Form/Preferences/Address.php | 2 +- CRM/Campaign/Task.php | 2 +- CRM/Case/Task.php | 2 +- CRM/Contact/BAO/Query.php | 2 +- CRM/Contact/Form/Search/Advanced.php | 2 +- CRM/Contact/Selector.php | 8 ++------ CRM/Contribute/BAO/Contribution.php | 2 +- CRM/Contribute/Form/Contribution.php | 10 +++++----- CRM/Contribute/Form/Contribution/Confirm.php | 6 +++--- CRM/Contribute/Form/Contribution/Main.php | 2 +- CRM/Contribute/Form/ContributionBase.php | 2 +- CRM/Contribute/Form/SoftCredit.php | 2 +- CRM/Contribute/Form/Task/PDF.php | 2 +- CRM/Contribute/Task.php | 2 +- CRM/Core/BAO/RecurringEntity.php | 2 +- CRM/Core/Invoke.php | 5 +++-- CRM/Event/Form/Participant.php | 2 +- CRM/Event/Form/Registration/AdditionalParticipant.php | 2 +- CRM/Event/Form/SelfSvcTransfer.php | 2 +- CRM/Event/Task.php | 2 +- CRM/Mailing/Task.php | 2 +- CRM/Member/BAO/Query.php | 2 +- CRM/Member/Page/Tab.php | 4 ++-- CRM/Member/Task.php | 2 +- CRM/Pledge/Form/Pledge.php | 2 +- CRM/Profile/Form.php | 2 +- CRM/Report/Form.php | 2 +- CRM/Report/Form/Campaign/SurveyDetails.php | 2 +- CRM/Report/Form/Case/Detail.php | 4 ++-- CRM/Utils/Token.php | 2 +- 31 files changed, 42 insertions(+), 45 deletions(-) diff --git a/CRM/Activity/Task.php b/CRM/Activity/Task.php index d93519d8bd..3b81d124dd 100644 --- a/CRM/Activity/Task.php +++ b/CRM/Activity/Task.php @@ -152,7 +152,7 @@ class CRM_Activity_Task extends CRM_Core_Task { */ public static function getTask($value) { self::tasks(); - if (!$value || !CRM_Utils_Array::value($value, self::$_tasks)) { + if (!$value || empty(self::$_tasks[$value])) { // make the print task by default $value = self::TASK_PRINT; } diff --git a/CRM/Admin/Form/Preferences/Address.php b/CRM/Admin/Form/Preferences/Address.php index 31f96b338a..3b56db2adb 100644 --- a/CRM/Admin/Form/Preferences/Address.php +++ b/CRM/Admin/Form/Preferences/Address.php @@ -92,7 +92,7 @@ class CRM_Admin_Form_Preferences_Address extends CRM_Admin_Form_Preferences { // check that locale supports address parsing if ( - CRM_Utils_Array::value($addressOptions['Street Address Parsing'], $this->_params['address_options']) && + !empty($this->_params['address_options'][$addressOptions['Street Address Parsing']]) && !CRM_Core_BAO_Address::isSupportedParsingLocale() ) { $config = CRM_Core_Config::singleton(); diff --git a/CRM/Campaign/Task.php b/CRM/Campaign/Task.php index 3026579e42..c903165fa3 100644 --- a/CRM/Campaign/Task.php +++ b/CRM/Campaign/Task.php @@ -108,7 +108,7 @@ class CRM_Campaign_Task extends CRM_Core_Task { */ public static function getTask($value) { self::tasks(); - if (!$value || !CRM_Utils_Array::value($value, self::$_tasks)) { + if (!$value || empty(self::$_tasks[$value])) { // Set the interview task as default $value = self::INTERVIEW; } diff --git a/CRM/Case/Task.php b/CRM/Case/Task.php index 9823a1b0e3..fc20a8d5e3 100644 --- a/CRM/Case/Task.php +++ b/CRM/Case/Task.php @@ -132,7 +132,7 @@ class CRM_Case_Task extends CRM_Core_Task { */ public static function getTask($value) { self::tasks(); - if (!$value || !CRM_Utils_Array::value($value, self::$_tasks)) { + if (!$value || empty(self::$_tasks[$value])) { // make the print task by default $value = self::TASK_PRINT; } diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index 4570614274..3cabd6f2e0 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -2554,7 +2554,7 @@ class CRM_Contact_BAO_Query { } if ((!empty($tables['civicrm_state_province']) || !empty($tables['civicrm_country']) || - CRM_Utils_Array::value('civicrm_county', $tables)) && empty($tables['civicrm_address'])) { + !empty($tables['civicrm_county'])) && empty($tables['civicrm_address'])) { $tables = array_merge(['civicrm_address' => 1], $tables ); diff --git a/CRM/Contact/Form/Search/Advanced.php b/CRM/Contact/Form/Search/Advanced.php index 4bc5d28dbf..642fcfdd72 100644 --- a/CRM/Contact/Form/Search/Advanced.php +++ b/CRM/Contact/Form/Search/Advanced.php @@ -116,7 +116,7 @@ class CRM_Contact_Form_Search_Advanced extends CRM_Contact_Form_Search { // see if we need to include this paneName in the current form if ($this->_searchPane == $type || !empty($_POST["hidden_{$type}"]) || - CRM_Utils_Array::value("hidden_{$type}", $this->_formValues) + !empty($this->_formValues["hidden_{$type}"]) ) { $allPanes[$name]['open'] = 'true'; diff --git a/CRM/Contact/Selector.php b/CRM/Contact/Selector.php index f2fd42a7e2..0e1c82f78c 100644 --- a/CRM/Contact/Selector.php +++ b/CRM/Contact/Selector.php @@ -805,9 +805,7 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se ); } elseif ((is_numeric(CRM_Utils_Array::value('geo_code_1', $row))) || - (!empty($row['city']) && - CRM_Utils_Array::value('state_province', $row) - ) + (!empty($row['city']) && !empty($row['state_province'])) ) { $row['action'] = CRM_Core_Action::formLink( $links, @@ -935,9 +933,7 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se } if ((!is_numeric(CRM_Utils_Array::value('geo_code_1', $row))) && - (empty($row['city']) || - !CRM_Utils_Array::value('state_province', $row) - ) + (empty($row['city']) || empty($row['state_province'])) ) { $mask = $mask & 4095; } diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index d2c99595fb..a5ec11ad77 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -127,7 +127,7 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution { $contributionStatus = CRM_Core_PseudoConstant::getName('CRM_Contribute_BAO_Contribution', 'contribution_status_id', (int) $params['contribution_status_id']); if (!$contributionID - && CRM_Utils_Array::value('membership_id', $params) + && !empty($params['membership_id']) && Civi::settings()->get('deferred_revenue_enabled') ) { $memberStartDate = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $params['membership_id'], 'start_date'); diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php index 1712d0a79a..b3a7e36cfe 100644 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@ -369,7 +369,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $defaults['total_amount'] = CRM_Utils_Money::format($total_value, NULL, '%a'); if (!empty($defaults['tax_amount'])) { $componentDetails = CRM_Contribute_BAO_Contribution::getComponentDetails($this->_id); - if (!(CRM_Utils_Array::value('membership', $componentDetails) || CRM_Utils_Array::value('participant', $componentDetails))) { + if (empty($componentDetails['membership']) && empty($componentDetails['participant'])) { $defaults['total_amount'] = CRM_Utils_Money::format($total_value - $defaults['tax_amount'], NULL, '%a'); } } @@ -483,7 +483,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP // FIXME: This probably needs to be done in preprocess if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && $this->_action & CRM_Core_Action::UPDATE - && CRM_Utils_Array::value('financial_type_id', $this->_values) + && !empty($this->_values['financial_type_id']) ) { $financialTypeID = CRM_Contribute_PseudoConstant::financialType($this->_values['financial_type_id']); CRM_Financial_BAO_FinancialType::checkPermissionedLineItems($this->_id, 'edit'); @@ -1253,7 +1253,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP // See if we need to include this paneName in the current form. if ($this->_formType == $type || !empty($_POST["hidden_{$type}"]) || - CRM_Utils_Array::value("hidden_{$type}", $defaults) + !empty($defaults["hidden_{$type}"]) ) { $this->assign('showAdditionalInfo', TRUE); $pane['open'] = 'true'; @@ -1462,7 +1462,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP if ($this->_priceSetId && CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config')) { //CRM-16833: Ensure tax is applied only once for membership conribution, when status changed.(e.g Pending to Completed). $componentDetails = CRM_Contribute_BAO_Contribution::getComponentDetails($this->_id); - if (!(CRM_Utils_Array::value('membership', $componentDetails) || CRM_Utils_Array::value('participant', $componentDetails))) { + if (empty($componentDetails['membership']) && empty($componentDetails['participant'])) { if (!($this->_action & CRM_Core_Action::UPDATE && (($this->_defaults['contribution_status_id'] != $submittedValues['contribution_status_id'])))) { $lineItems[$itemId]['unit_price'] = $lineItems[$itemId]['line_total'] = CRM_Utils_Rule::cleanMoney(CRM_Utils_Array::value('total_amount', $submittedValues)); } @@ -1499,7 +1499,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP // NOTE that this IS still a legitimate use of 'quick-config' for contributions under the current DB but // we should look at having a price field per contribution type & then there would be little reason // for the back-office contribution form postProcess to know if it is a quick-config form. - if ($isQuickConfig && !empty($submittedValues['financial_type_id']) && CRM_Utils_Array::value($this->_priceSetId, $lineItem) + if ($isQuickConfig && !empty($submittedValues['financial_type_id']) && !empty($lineItem[$this->_priceSetId]) ) { foreach ($lineItem[$this->_priceSetId] as &$values) { $values['financial_type_id'] = $submittedValues['financial_type_id']; diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index 88adb5db94..e929146e70 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -1871,7 +1871,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr // the quick config seems like a red-herring - if this is about a separate membership payment then there // are 2 types of line items - membership ones & non-membership ones - regardless of whether quick config is set elseif ( - CRM_Utils_Array::value('is_separate_payment', $this->_membershipBlock) + !empty($this->_membershipBlock['is_separate_payment']) && !empty($this->_values['fee'][$priceField->id]) && ($this->_values['fee'][$priceField->id]['name'] == "other_amount") && CRM_Utils_Array::value("price_{$paramWeDoNotUnderstand}", $this->_params) < 1 @@ -2052,8 +2052,8 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr // CRM-18854 if (!empty($this->_params['is_pledge']) && empty($this->_values['pledge_id']) && !empty($this->_values['adjust_recur_start_date'])) { $pledgeBlock = CRM_Pledge_BAO_PledgeBlock::getPledgeBlock($this->_id); - if (CRM_Utils_Array::value('start_date', $this->_params) || !CRM_Utils_Array::value('is_pledge_start_date_visible', $pledgeBlock) - || !CRM_Utils_Array::value('is_pledge_start_date_editable', $pledgeBlock)) { + if (!empty($this->_params['start_date']) || empty($pledgeBlock['is_pledge_start_date_visible']) + || empty($pledgeBlock['is_pledge_start_date_editable'])) { $pledgeStartDate = $this->_params['start_date'] ?? NULL; $this->_params['receive_date'] = CRM_Pledge_BAO_Pledge::getPledgeStartDate($pledgeStartDate, $pledgeBlock); $recurParams = CRM_Pledge_BAO_Pledge::buildRecurParams($this->_params); diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php index 458b52cf5e..12cb2813df 100644 --- a/CRM/Contribute/Form/Contribution/Main.php +++ b/CRM/Contribute/Form/Contribution/Main.php @@ -852,7 +852,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu (int) $self->_paymentProcessor['billing_mode'] & CRM_Core_Payment::BILLING_MODE_BUTTON ) { if (!empty($fields[$self->_expressButtonName . '_x']) || !empty($fields[$self->_expressButtonName . '_y']) || - CRM_Utils_Array::value($self->_expressButtonName, $fields) + !empty($fields[$self->_expressButtonName]) ) { return $errors; } diff --git a/CRM/Contribute/Form/ContributionBase.php b/CRM/Contribute/Form/ContributionBase.php index 300ebbbf6c..db2870fa14 100644 --- a/CRM/Contribute/Form/ContributionBase.php +++ b/CRM/Contribute/Form/ContributionBase.php @@ -1363,7 +1363,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { } if ((!empty($this->_params['selectMembership']) || !empty($this->_params['priceSetId'])) && !empty($this->_paymentProcessor['is_recur']) && - CRM_Utils_Array::value('auto_renew', $this->_params) + !empty($this->_params['auto_renew']) && empty($this->_params['is_recur']) && empty($this->_params['frequency_interval']) ) { diff --git a/CRM/Contribute/Form/SoftCredit.php b/CRM/Contribute/Form/SoftCredit.php index d8c7bfa8de..d9fddead5d 100644 --- a/CRM/Contribute/Form/SoftCredit.php +++ b/CRM/Contribute/Form/SoftCredit.php @@ -180,7 +180,7 @@ class CRM_Contribute_Form_SoftCredit { // if honor roll fields are populated but no PCP is selected if (empty($fields['pcp_made_through_id'])) { if (!empty($fields['pcp_display_in_roll']) || !empty($fields['pcp_roll_nickname']) || - CRM_Utils_Array::value('pcp_personal_note', $fields) + !empty($fields['pcp_personal_note']) ) { $errors['pcp_made_through_id'] = ts('Please select a Personal Campaign Page, OR uncheck Display in Honor Roll and clear both the Honor Roll Name and the Personal Note field.'); } diff --git a/CRM/Contribute/Form/Task/PDF.php b/CRM/Contribute/Form/Task/PDF.php index 8b192d66f6..76dac1989f 100644 --- a/CRM/Contribute/Form/Task/PDF.php +++ b/CRM/Contribute/Form/Task/PDF.php @@ -281,7 +281,7 @@ AND {$this->_componentClause}"; foreach ($contactDetails as $id => $values) { if (empty($values['email']) || (empty($params['override_privacy']) && !empty($values['do_not_email'])) - || CRM_Utils_Array::value('is_deceased', $values) + || !empty($values['is_deceased']) || !empty($values['on_hold']) ) { $suppressedEmails++; diff --git a/CRM/Contribute/Task.php b/CRM/Contribute/Task.php index 0acabfa405..9a88cfc6d5 100644 --- a/CRM/Contribute/Task.php +++ b/CRM/Contribute/Task.php @@ -175,7 +175,7 @@ class CRM_Contribute_Task extends CRM_Core_Task { */ public static function getTask($value) { self::tasks(); - if (!$value || !CRM_Utils_Array::value($value, self::$_tasks)) { + if (!$value || empty(self::$_tasks[$value])) { // make the print task by default $value = self::TASK_PRINT; } diff --git a/CRM/Core/BAO/RecurringEntity.php b/CRM/Core/BAO/RecurringEntity.php index fd47f0e12d..f4b1622de9 100644 --- a/CRM/Core/BAO/RecurringEntity.php +++ b/CRM/Core/BAO/RecurringEntity.php @@ -685,7 +685,7 @@ class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity { if (empty($hasaRecurringRecord)) { // check if its a linked entity if (array_key_exists($obj->__table, self::$_linkedEntitiesInfo) && - !CRM_Utils_Array::value('is_multirecord', self::$_linkedEntitiesInfo[$obj->__table]) + empty(self::$_linkedEntitiesInfo[$obj->__table]['is_multirecord']) ) { $linkedDAO = new self::$_tableDAOMapper[$obj->__table](); $linkedDAO->id = $obj->id; diff --git a/CRM/Core/Invoke.php b/CRM/Core/Invoke.php index 52c2fdf551..b0262dfda7 100644 --- a/CRM/Core/Invoke.php +++ b/CRM/Core/Invoke.php @@ -55,7 +55,7 @@ class CRM_Core_Invoke { return NULL; } // CRM-15901: Turn off PHP errors display for all ajax calls - if (CRM_Utils_Array::value(1, $args) == 'ajax' || CRM_Utils_Array::value('snippet', $_REQUEST)) { + if (CRM_Utils_Array::value(1, $args) == 'ajax' || !empty($_REQUEST['snippet'])) { ini_set('display_errors', 0); } @@ -184,7 +184,8 @@ class CRM_Core_Invoke { stream_wrapper_unregister('phar'); stream_wrapper_register('phar', \TYPO3\PharStreamWrapper\PharStreamWrapper::class); } - } else { + } + else { // this is not an exception we can handle throw $e; } diff --git a/CRM/Event/Form/Participant.php b/CRM/Event/Form/Participant.php index d14b3dfe02..06a22a8e7d 100644 --- a/CRM/Event/Form/Participant.php +++ b/CRM/Event/Form/Participant.php @@ -1761,7 +1761,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment ); } if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() - && !CRM_Utils_Array::value('fee', $form->_values) + && empty($form->_values['fee']) && CRM_Utils_Array::value('snippet', $_REQUEST) == CRM_Core_Smarty::PRINT_NOFORM ) { CRM_Core_Session::setStatus(ts('You do not have all the permissions needed for this page.'), 'Permission Denied', 'error'); diff --git a/CRM/Event/Form/Registration/AdditionalParticipant.php b/CRM/Event/Form/Registration/AdditionalParticipant.php index c29163ef0a..1d369f93ba 100644 --- a/CRM/Event/Form/Registration/AdditionalParticipant.php +++ b/CRM/Event/Form/Registration/AdditionalParticipant.php @@ -700,7 +700,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R // CRM-11182 - Optional confirmation screen !$this->_values['event']['is_confirm_enabled'] && !$this->_values['event']['is_monetary'] - && CRM_Utils_Array::value('additional_participants', $this->_params[0]) + && !empty($this->_params[0]['additional_participants']) && $this->isLastParticipant() ) { $this->processRegistration($this->_params); diff --git a/CRM/Event/Form/SelfSvcTransfer.php b/CRM/Event/Form/SelfSvcTransfer.php index ca7aa0fd71..c02649e9b4 100644 --- a/CRM/Event/Form/SelfSvcTransfer.php +++ b/CRM/Event/Form/SelfSvcTransfer.php @@ -246,7 +246,7 @@ class CRM_Event_Form_SelfSvcTransfer extends CRM_Core_Form { } } if (!$email && !(CRM_Utils_Array::value('first_name', $fields) && - CRM_Utils_Array::value('last_name', $fields))) { + !empty($fields['last_name']))) { $defaults = $params = ['id' => $eventId]; CRM_Event_BAO_Event::retrieve($params, $defaults); $message = ts("Mandatory fields (first name and last name, OR email address) are missing from this form."); diff --git a/CRM/Event/Task.php b/CRM/Event/Task.php index 64ced68750..6d54227016 100644 --- a/CRM/Event/Task.php +++ b/CRM/Event/Task.php @@ -177,7 +177,7 @@ class CRM_Event_Task extends CRM_Core_Task { */ public static function getTask($value) { self::tasks(); - if (!$value || !CRM_Utils_Array::value($value, self::$_tasks)) { + if (!$value || empty(self::$_tasks[$value])) { // make the print task by default $value = self::TASK_PRINT; } diff --git a/CRM/Mailing/Task.php b/CRM/Mailing/Task.php index 10f67b7b3b..721175fabe 100644 --- a/CRM/Mailing/Task.php +++ b/CRM/Mailing/Task.php @@ -75,7 +75,7 @@ class CRM_Mailing_Task extends CRM_Core_Task { */ public static function getTask($value) { self::tasks(); - if (!$value || !CRM_Utils_Array::value($value, self::$_tasks)) { + if (!$value || empty(self::$_tasks[$value])) { // make the print task by default $value = self::TASK_PRINT; } diff --git a/CRM/Member/BAO/Query.php b/CRM/Member/BAO/Query.php index ce8e807e10..ca74ca0445 100644 --- a/CRM/Member/BAO/Query.php +++ b/CRM/Member/BAO/Query.php @@ -573,7 +573,7 @@ class CRM_Member_BAO_Query extends CRM_Core_BAO_Query { * @param array $tables */ public static function tableNames(&$tables) { - if (!empty($tables['civicrm_membership_log']) || !empty($tables['civicrm_membership_status']) || CRM_Utils_Array::value('civicrm_membership_type', $tables)) { + if (!empty($tables['civicrm_membership_log']) || !empty($tables['civicrm_membership_status']) || !empty($tables['civicrm_membership_type'])) { $tables = array_merge(['civicrm_membership' => 1], $tables); } } diff --git a/CRM/Member/Page/Tab.php b/CRM/Member/Page/Tab.php index 8301a964a7..6818490f17 100644 --- a/CRM/Member/Page/Tab.php +++ b/CRM/Member/Page/Tab.php @@ -150,8 +150,8 @@ class CRM_Member_Page_Tab extends CRM_Core_Page { } // if relevant--membership is active and type allows inheritance--count related memberships - if (CRM_Utils_Array::value('is_current_member', $statusANDType[$dao->id]) - && CRM_Utils_Array::value('relationship_type_id', $statusANDType[$dao->id]) + if (!empty($statusANDType[$dao->id]['is_current_member']) + && !empty($statusANDType[$dao->id]['relationship_type_id']) && empty($dao->owner_membership_id) ) { // not an related membership diff --git a/CRM/Member/Task.php b/CRM/Member/Task.php index 98b822c234..b042abe75a 100644 --- a/CRM/Member/Task.php +++ b/CRM/Member/Task.php @@ -170,7 +170,7 @@ class CRM_Member_Task extends CRM_Core_Task { */ public static function getTask($value) { self::tasks(); - if (!$value || !CRM_Utils_Array::value($value, self::$_tasks)) { + if (!$value || empty(self::$_tasks[$value])) { // Make the print task the default $value = self::TASK_PRINT; } diff --git a/CRM/Pledge/Form/Pledge.php b/CRM/Pledge/Form/Pledge.php index a4418c1813..d87fd52fb9 100644 --- a/CRM/Pledge/Form/Pledge.php +++ b/CRM/Pledge/Form/Pledge.php @@ -221,7 +221,7 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { ]; // see if we need to include this paneName in the current form if ($this->_formType == $type || !empty($_POST["hidden_{$type}"]) || - CRM_Utils_Array::value("hidden_{$type}", $defaults) + !empty($defaults["hidden_{$type}"]) ) { $showAdditionalInfo = TRUE; $allPanes[$name]['open'] = 'true'; diff --git a/CRM/Profile/Form.php b/CRM/Profile/Form.php index 2567e79ec2..1d03a0a683 100644 --- a/CRM/Profile/Form.php +++ b/CRM/Profile/Form.php @@ -1107,7 +1107,7 @@ class CRM_Profile_Form extends CRM_Core_Form { $details = $contactDetails[$this->_id]; } if (!(!empty($details['addressee_id']) || !empty($details['email_greeting_id']) || - CRM_Utils_Array::value('postal_greeting_id', $details) + !empty($details['postal_greeting_id']) ) ) { diff --git a/CRM/Report/Form.php b/CRM/Report/Form.php index f9250adea9..f09de2def6 100644 --- a/CRM/Report/Form.php +++ b/CRM/Report/Form.php @@ -5835,7 +5835,7 @@ LEFT JOIN civicrm_contact {$field['alias']} ON {$field['alias']}.id = {$this->_a */ protected function storeGroupByArray() { - if (!CRM_Utils_Array::value('group_bys', $this->_params) + if (empty($this->_params['group_bys']) || !is_array($this->_params['group_bys'])) { $this->_params['group_bys'] = []; } diff --git a/CRM/Report/Form/Campaign/SurveyDetails.php b/CRM/Report/Form/Campaign/SurveyDetails.php index 5398ef6f5a..a5496a5469 100644 --- a/CRM/Report/Form/Campaign/SurveyDetails.php +++ b/CRM/Report/Form/Campaign/SurveyDetails.php @@ -234,7 +234,7 @@ class CRM_Report_Form_Campaign_SurveyDetails extends CRM_Report_Form { foreach ($table['fields'] as $fieldName => $field) { if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName]) || - CRM_Utils_Array::value('is_required', $field) + !empty($field['is_required']) ) { $fieldsName = CRM_Utils_Array::value(1, explode('_', $tableName)); diff --git a/CRM/Report/Form/Case/Detail.php b/CRM/Report/Form/Case/Detail.php index 95a91ff9b3..b241faaac0 100644 --- a/CRM/Report/Form/Case/Detail.php +++ b/CRM/Report/Form/Case/Detail.php @@ -548,14 +548,14 @@ class CRM_Report_Form_Case_Detail extends CRM_Report_Form { if (!empty($this->_params['last_completed_date_time_relative']) || !empty($this->_params['last_completed_date_time_from']) || - CRM_Utils_Array::value('last_completed_date_time_to', $this->_params) + !empty($this->_params['last_completed_date_time_to']) ) { $this->_activityLastCompleted = TRUE; } if (!empty($this->_params['last_activity_date_time_relative']) || !empty($this->_params['last_activity_date_time_from']) || - CRM_Utils_Array::value('last_activity_date_time_to', $this->_params) + !empty($this->_params['last_activity_date_time_to']) ) { $this->_activityLast = TRUE; } diff --git a/CRM/Utils/Token.php b/CRM/Utils/Token.php index afb69333b6..7439473c7a 100644 --- a/CRM/Utils/Token.php +++ b/CRM/Utils/Token.php @@ -1672,7 +1672,7 @@ class CRM_Utils_Token { */ public static function replaceContributionTokens($str, &$contribution, $html = FALSE, $knownTokens = NULL, $escapeSmarty = FALSE) { $key = 'contribution'; - if (!$knownTokens || !CRM_Utils_Array::value($key, $knownTokens)) { + if (!$knownTokens || empty($knownTokens[$key])) { //early return return $str; } -- 2.25.1