diff --git a/CRM/Case/XMLProcessor/Process.php b/CRM/Case/XMLProcessor/Process.php index 6e3765b05ddf..ddb717b0370a 100644 --- a/CRM/Case/XMLProcessor/Process.php +++ b/CRM/Case/XMLProcessor/Process.php @@ -448,7 +448,7 @@ public function createActivity($activityTypeXML, &$params) { 'source_contact_id' => $params['creatorID'], 'is_auto' => FALSE, 'is_current_revision' => 1, - 'subject' => CRM_Utils_Array::value('subject', $params) ? $params['subject'] : $activityTypeName, + 'subject' => !empty($params['subject']) ? $params['subject'] : $activityTypeName, 'status_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_status_id', $statusName), 'target_contact_id' => $client, 'medium_id' => CRM_Utils_Array::value('medium_id', $params), diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 3f2ca58df0f7..ddb840de2f3b 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -1102,7 +1102,7 @@ private static function updateFinancialAccountsOnContributionStatusChange(&$para elseif (($previousContributionStatus == 'Pending' && $params['prevContribution']->is_pay_later) || $previousContributionStatus == 'In Progress' ) { - $financialTypeID = CRM_Utils_Array::value('financial_type_id', $params) ? $params['financial_type_id'] : $params['prevContribution']->financial_type_id; + $financialTypeID = !empty($params['financial_type_id']) ? $params['financial_type_id'] : $params['prevContribution']->financial_type_id; $arAccountId = CRM_Contribute_PseudoConstant::getRelationalFinancialAccount($financialTypeID, 'Accounts Receivable Account is'); if ($currentContributionStatus == 'Cancelled') { @@ -5557,7 +5557,7 @@ public static function recordAlwaysAccountsReceivable(&$trxnParams, $contributio } $params = $trxnParams; - $financialTypeID = CRM_Utils_Array::value('financial_type_id', $contributionParams) ? $contributionParams['financial_type_id'] : $contributionParams['prevContribution']->financial_type_id; + $financialTypeID = !empty($contributionParams['financial_type_id']) ? $contributionParams['financial_type_id'] : $contributionParams['prevContribution']->financial_type_id; $arAccountId = CRM_Contribute_PseudoConstant::getRelationalFinancialAccount($financialTypeID, 'Accounts Receivable Account is'); $params['to_financial_account_id'] = $arAccountId; $params['status_id'] = array_search('Pending', $contributionStatuses); diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php index 520a56bb2100..506fe73f7b41 100644 --- a/CRM/Contribute/Form/Contribution/Main.php +++ b/CRM/Contribute/Form/Contribution/Main.php @@ -479,7 +479,7 @@ public function buildQuickForm() { if (!($allAreBillingModeProcessors && !$this->_values['is_pay_later'])) { $submitButton = [ 'type' => 'upload', - 'name' => CRM_Utils_Array::value('is_confirm_enabled', $this->_values) ? ts('Confirm Contribution') : ts('Contribute'), + 'name' => !empty($this->_values['is_confirm_enabled']) ? ts('Confirm Contribution') : ts('Contribute'), 'spacing' => '         ', 'isDefault' => TRUE, ]; diff --git a/CRM/Core/BAO/FinancialTrxn.php b/CRM/Core/BAO/FinancialTrxn.php index 6abb1bdb83d8..113efbf308b5 100644 --- a/CRM/Core/BAO/FinancialTrxn.php +++ b/CRM/Core/BAO/FinancialTrxn.php @@ -348,7 +348,7 @@ public static function createPremiumTrxn($params) { 'to_financial_account_id' => CRM_Contribute_PseudoConstant::getRelationalFinancialAccount($params['financial_type_id'], $toFinancialAccountType), 'from_financial_account_id' => CRM_Contribute_PseudoConstant::getRelationalFinancialAccount($params['financial_type_id'], $fromFinancialAccountType), 'trxn_date' => date('YmdHis'), - 'total_amount' => CRM_Utils_Array::value('cost', $params) ? $params['cost'] : 0, + 'total_amount' => !empty($params['cost']) ? $params['cost'] : 0, 'currency' => CRM_Utils_Array::value('currency', $params), 'status_id' => array_search('Completed', $contributionStatuses), 'entity_table' => 'civicrm_contribution', diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index 171450460544..97d9649639f0 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -911,7 +911,7 @@ protected function preProcessPaymentOptions() { // minimums with the payment processor minimums. This would lead to fields like 'postal_code' // only being on the form if either the admin has configured it as wanted or the processor // requires it. - $this->assign('billing_profile_id', (CRM_Utils_Array::value('is_billing_required', $this->_values) ? 'billing' : '')); + $this->assign('billing_profile_id', (!empty($this->_values['is_billing_required']) ? 'billing' : '')); } /** diff --git a/CRM/Financial/Page/AJAX.php b/CRM/Financial/Page/AJAX.php index 989e75ea09be..25d1b262bf63 100644 --- a/CRM/Financial/Page/AJAX.php +++ b/CRM/Financial/Page/AJAX.php @@ -429,7 +429,7 @@ public static function getFinancialTransactionsList() { ); } if ($financialItem->contact_id) { - $row[$financialItem->id]['contact_type'] = CRM_Contact_BAO_Contact_Utils::getImage(CRM_Utils_Array::value('contact_sub_type', $row[$financialItem->id]) ? $row[$financialItem->id]['contact_sub_type'] : CRM_Utils_Array::value('contact_type', $row[$financialItem->id]), FALSE, $financialItem->contact_id); + $row[$financialItem->id]['contact_type'] = CRM_Contact_BAO_Contact_Utils::getImage(!empty($row[$financialItem->id]['contact_sub_type']) ? $row[$financialItem->id]['contact_sub_type'] : CRM_Utils_Array::value('contact_type', $row[$financialItem->id]), FALSE, $financialItem->contact_id); } $financialitems = $row; } diff --git a/CRM/Mailing/BAO/Mailing.php b/CRM/Mailing/BAO/Mailing.php index 59c588221cc5..8af7f776c0d2 100644 --- a/CRM/Mailing/BAO/Mailing.php +++ b/CRM/Mailing/BAO/Mailing.php @@ -2102,7 +2102,7 @@ public static function &report($id, $skipDetails = FALSE, $isSMS = FALSE) { 'link_unique' => CRM_Utils_System::url($path, "reset=1&event=click&mid=$mailing_id&uid={$mailing->id}&distinct=1"), 'clicks' => $mailing->clicks, 'unique' => $mailing->unique_clicks, - 'rate' => CRM_Utils_Array::value('delivered', $report['event_totals']) ? (100.0 * $mailing->unique_clicks) / $report['event_totals']['delivered'] : 0, + 'rate' => !empty($report['event_totals']['delivered']) ? (100.0 * $mailing->unique_clicks) / $report['event_totals']['delivered'] : 0, 'report' => CRM_Report_Utils_Report::getNextUrl('mailing/clicks', "reset=1&mailing_id_value={$mailing_id}&url_value={$mailing->url}", FALSE, TRUE), ]; } diff --git a/CRM/Price/BAO/PriceField.php b/CRM/Price/BAO/PriceField.php index b5660d92becb..4325c883157b 100644 --- a/CRM/Price/BAO/PriceField.php +++ b/CRM/Price/BAO/PriceField.php @@ -143,7 +143,7 @@ public static function create(&$params) { 'membership_type_id' => CRM_Utils_Array::value($index, CRM_Utils_Array::value('membership_type_id', $params), NULL), 'weight' => $params['option_weight'][$index], 'is_active' => 1, - 'is_default' => CRM_Utils_Array::value($params['option_weight'][$index], $defaultArray) ? $defaultArray[$params['option_weight'][$index]] : 0, + 'is_default' => !empty($defaultArray[$params['option_weight'][$index]]) ? $defaultArray[$params['option_weight'][$index]] : 0, 'membership_num_terms' => NULL, 'non_deductible_amount' => CRM_Utils_Array::value('non_deductible_amount', $params), 'visibility_id' => CRM_Utils_Array::value($index, CRM_Utils_Array::value('option_visibility_id', $params), self::getVisibilityOptionID('public')), @@ -151,7 +151,7 @@ public static function create(&$params) { if ($options['membership_type_id']) { $options['membership_num_terms'] = CRM_Utils_Array::value($index, CRM_Utils_Array::value('membership_num_terms', $params), 1); - $options['is_default'] = CRM_Utils_Array::value($params['membership_type_id'][$index], $defaultArray) ? $defaultArray[$params['membership_type_id'][$index]] : 0; + $options['is_default'] = !empty($defaultArray[$params['membership_type_id'][$index]]) ? $defaultArray[$params['membership_type_id'][$index]] : 0; } if (CRM_Utils_Array::value($index, CRM_Utils_Array::value('option_financial_type_id', $params))) { diff --git a/api/v3/Profile.php b/api/v3/Profile.php index 73ea34dc7ae5..1f12a073223b 100644 --- a/api/v3/Profile.php +++ b/api/v3/Profile.php @@ -608,13 +608,13 @@ function _civicrm_api3_buildprofile_submitfields($profileID, $optionsBehaviour = } /** - * @param $a - * @param $b + * @param array $a + * @param array $b * * @return bool */ function _civicrm_api3_order_by_weight($a, $b) { - return CRM_Utils_Array::value('weight', $b) < CRM_Utils_Array::value('weight', $a) ? TRUE : FALSE; + return ($b['weight'] ?? 0) < ($a['weight'] ?? 0); } /** @@ -731,7 +731,7 @@ function _civicrm_api3_profile_appendaliases($values, $entity) { } //special case on membership & contribution - can't see how to handle in a generic way if (in_array($entity, ['membership', 'contribution'])) { - $values['send_receipt'] = ['title' => 'Send Receipt', 'type' => (int) 16]; + $values['send_receipt'] = ['title' => 'Send Receipt', 'type' => 16]; } return $values; }