Swap CRM_Utils_Array::value for empty() or isset() in conditionals
authorColeman Watts <coleman@civicrm.org>
Fri, 9 Aug 2019 12:31:18 +0000 (08:31 -0400)
committerColeman Watts <coleman@civicrm.org>
Mon, 12 Aug 2019 12:28:17 +0000 (08:28 -0400)
47 files changed:
CRM/Activity/BAO/Activity.php
CRM/Admin/Form/Extensions.php
CRM/Admin/Form/ScheduleReminders.php
CRM/Admin/Form/Setting/Localization.php
CRM/Badge/BAO/Badge.php
CRM/Case/Form/Activity/ChangeCaseType.php
CRM/Contact/Form/DedupeRules.php
CRM/Contact/Form/Task/ProximityCommon.php
CRM/Contribute/BAO/Contribution.php
CRM/Contribute/Form/Contribution.php
CRM/Contribute/Form/Contribution/Confirm.php
CRM/Contribute/Form/Contribution/Main.php
CRM/Contribute/Form/ContributionPage.php
CRM/Contribute/Form/ContributionPage/Amount.php
CRM/Core/BAO/Location.php
CRM/Core/BAO/RecurringEntity.php
CRM/Core/BAO/Setting.php
CRM/Core/BAO/StatusPreference.php
CRM/Core/BAO/UFField.php
CRM/Core/DAO/AllCoreTables.php
CRM/Core/Form/RecurringEntity.php
CRM/Core/Form/Search.php
CRM/Core/Page/AJAX.php
CRM/Core/Page/AJAX/RecurringEntity.php
CRM/Custom/Form/Preview.php
CRM/Event/Cart/Form/Checkout/Payment.php
CRM/Event/Form/ManageEvent/Repeat.php
CRM/Event/Form/Registration.php
CRM/Event/Form/Registration/Confirm.php
CRM/Event/Form/Registration/Register.php
CRM/Financial/BAO/FinancialType.php
CRM/Financial/BAO/Payment.php
CRM/Financial/Form/FinancialAccount.php
CRM/Member/BAO/Membership.php
CRM/Member/Form/Membership.php
CRM/Pledge/BAO/Pledge.php
CRM/Pledge/BAO/PledgeBlock.php
CRM/Price/BAO/LineItem.php
CRM/Price/BAO/PriceSet.php
CRM/Price/Form/Field.php
CRM/Report/Form/Contribute/Detail.php
CRM/Report/Form/Event/Summary.php
CRM/Utils/API/ReloadOption.php
CRM/Utils/Address.php
api/v3/LineItem.php
api/v3/Order.php
api/v3/Payment.php

index 313fa5c1282749902ca579c43e32a15fd5fde457..382b4e6a331d13a6df2ffd2c8c585d7f5be8f11d 100644 (file)
@@ -312,9 +312,9 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity {
     }
 
     // Set priority to Normal for Auto-populated activities (for Cases)
-    if (CRM_Utils_Array::value('priority_id', $params) === NULL &&
+    if (!isset($params['priority_id']) &&
       // if not set and not 0
-      !CRM_Utils_Array::value('id', $params)
+      empty($params['id'])
     ) {
       $priority = CRM_Core_PseudoConstant::get('CRM_Activity_DAO_Activity', 'priority_id');
       $params['priority_id'] = array_search('Normal', $priority);
index 852ebb082083eee4f0d3f61629d95f93edeaccd8..6826a159d4d8e2d9e324fa3e0286a686465bb8fe 100644 (file)
@@ -205,7 +205,7 @@ class CRM_Admin_Form_Extensions extends CRM_Admin_Form {
         'version' => 3,
         'key' => $this->_key,
       ]);
-      if (!CRM_Utils_Array::value('is_error', $result, FALSE)) {
+      if (empty($result['is_error'])) {
         CRM_Core_Session::setStatus("", ts('Extension Upgraded'), "success");
       }
       else {
index e2365cb9d01e38fe9688c7c6e477de3d387c7ad1..b827be6910df771410d3d20adb44c8aa5d87fc71 100644 (file)
@@ -523,7 +523,7 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form {
       'end_date',
     ];
 
-    if (!CRM_Utils_Array::value('absolute_date', $params)) {
+    if (empty($params['absolute_date'])) {
       $params['absolute_date'] = 'null';
     }
     foreach ($moreKeys as $mkey) {
@@ -577,7 +577,7 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form {
 
     $params['is_active'] = CRM_Utils_Array::value('is_active', $values, 0);
 
-    if (CRM_Utils_Array::value('is_repeat', $values) == 0) {
+    if (empty($values['is_repeat'])) {
       $params['repetition_frequency_unit'] = 'null';
       $params['repetition_frequency_interval'] = 'null';
       $params['end_frequency_unit'] = 'null';
index 2e85c5924a39e05541a30690eac403174d4b9e79..a3cec9ae90c598d2e4441d6f4b5e27bb22d4f0e3 100644 (file)
@@ -220,7 +220,7 @@ class CRM_Admin_Form_Setting_Localization extends CRM_Admin_Form_Setting {
     }
 
     // add a new db locale if the requested language is not yet supported by the db
-    if (!CRM_Utils_Array::value('makeSinglelingual', $values) and CRM_Utils_Array::value('addLanguage', $values)) {
+    if (empty($values['makeSinglelingual']) && !empty($values['addLanguage'])) {
       $domain = new CRM_Core_DAO_Domain();
       $domain->find(TRUE);
       if (!substr_count($domain->locales, $values['addLanguage'])) {
index 7775cd4ae5417cde3d33da537c07905199c16618..b4ff8e41030bcd2028e73c795275fd5a79504ca6 100644 (file)
@@ -225,8 +225,8 @@ class CRM_Badge_BAO_Badge {
           break;
       }
       $this->pdf->Image($formattedRow['participant_image'], $x + $imageAlign, $y + $startOffset, CRM_Utils_Array::value('width_participant_image', $formattedRow), CRM_Utils_Array::value('height_participant_image', $formattedRow));
-      if ($startOffset == NULL && CRM_Utils_Array::value('height_participant_image', $formattedRow)) {
-        $startOffset = CRM_Utils_Array::value('height_participant_image', $formattedRow);
+      if ($startOffset == NULL && !empty($formattedRow['height_participant_image'])) {
+        $startOffset = $formattedRow['height_participant_image'];
       }
     }
 
index 2a8ac64e850ca4df14af58d5fec022c931a53993..1e683a8beb71af863b4a100203cdd8adf451d592 100644 (file)
@@ -119,7 +119,7 @@ class CRM_Case_Form_Activity_ChangeCaseType {
       $params['id'] = $form->_id;
     }
 
-    if (CRM_Utils_Array::value('is_reset_timeline', $params) == 0) {
+    if (empty($params['is_reset_timeline'])) {
       unset($params['reset_date_time']);
     }
   }
index 318138ff760792c1a1ebf924fbb73e4f6d8c1806..84dd28002b2cea382020064668db6bdf8cb7abbf 100644 (file)
@@ -62,7 +62,7 @@ class CRM_Contact_Form_DedupeRules extends CRM_Admin_Form {
     // check if $contactType is valid
     $contactTypes = civicrm_api3('Contact', 'getOptions', ['field' => "contact_type", 'context' => "validate"]);
     $contactType = CRM_Utils_Request::retrieve('contact_type', 'String', $this, FALSE, 0);
-    if (CRM_Utils_Array::value($contactType, $contactTypes['values'])) {
+    if (!empty($contactTypes['values'][$contactType])) {
       $this->_contactType = $contactType;
     }
     elseif (!empty($contactType)) {
index 6f632cb9de6e3741aa1a2dc845d05c00dac8a559..b4a0bb0ab3bf08aa5f17ab34e1c93f92818a2649 100644 (file)
@@ -107,9 +107,7 @@ class CRM_Contact_Form_Task_ProximityCommon {
       if (empty($fields['prox_state_province_id']) || empty($fields['prox_country_id'])) {
         $errors["prox_state_province_id"] = ts("Country AND State/Province are required to search by distance.");
       }
-      if (!CRM_Utils_Array::value('prox_postal_code', $fields) and
-        !CRM_Utils_Array::value('prox_city', $fields)
-      ) {
+      if (empty($fields['prox_postal_code']) && empty($fields['prox_city'])) {
         $errors["prox_distance"] = ts("City OR Postal Code are required to search by distance.");
       }
     }
index 0268840ba9b687e4c3e2e7fc30ce9cf1723fb45a..ebc06b6e47f08a349f547e878b8cb02809fee4c6 100644 (file)
@@ -2962,7 +2962,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
         if (!empty($lineItems)) {
           $firstLineItem = reset($lineItems);
           $priceSet = [];
-          if (CRM_Utils_Array::value('price_set_id', $firstLineItem)) {
+          if (!empty($firstLineItem['price_set_id'])) {
             $priceSet = civicrm_api3('PriceSet', 'getsingle', [
               'id' => $firstLineItem['price_set_id'],
               'return' => 'is_quick_config, id',
@@ -4013,7 +4013,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
       $baseTrxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($contributionId);
       $baseTrxnId = $baseTrxnId['financialTrxnId'];
     }
-    if (!CRM_Utils_Array::value('total_amount', $total) || $usingLineTotal) {
+    if (empty($total['total_amount']) || $usingLineTotal) {
       $total = CRM_Price_BAO_LineItem::getLineTotal($contributionId);
     }
     else {
@@ -4538,7 +4538,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
     $contributionResult = civicrm_api3('Contribution', 'create', $contributionParams);
 
     // Add new soft credit against current $contribution.
-    if (CRM_Utils_Array::value('contributionRecur', $objects) && $objects['contributionRecur']->id) {
+    if (!empty($objects['contributionRecur']) && $objects['contributionRecur']->id) {
       CRM_Contribute_BAO_ContributionRecur::addrecurSoftCredit($objects['contributionRecur']->id, $contribution->id);
     }
 
@@ -5046,7 +5046,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
   public static function checkContributeSettings($name = NULL, $checkInvoicing = FALSE) {
     $contributeSettings = Civi::settings()->get('contribution_invoice_settings');
 
-    if ($checkInvoicing && !CRM_Utils_Array::value('invoicing', $contributeSettings)) {
+    if ($checkInvoicing && empty($contributeSettings['invoicing'])) {
       return NULL;
     }
 
index 23ec91d2d943ecb9e8971a40e69553e3d2a4e54f..057ba8f14247695e01fbfec7fa24ed0234197071 100644 (file)
@@ -665,10 +665,10 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
     $componentDetails = [];
     if ($this->_id) {
       $componentDetails = CRM_Contribute_BAO_Contribution::getComponentDetails($this->_id);
-      if (CRM_Utils_Array::value('membership', $componentDetails)) {
+      if (!empty($componentDetails['membership'])) {
         $component = 'membership';
       }
-      elseif (CRM_Utils_Array::value('participant', $componentDetails)) {
+      elseif (!empty($componentDetails['participant'])) {
         $component = 'participant';
       }
     }
@@ -831,8 +831,8 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
       $componentDetails = CRM_Contribute_BAO_Contribution::getComponentDetails($this->_id);
       $isCancelledStatus = ($this->_values['contribution_status_id'] == CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Cancelled'));
 
-      if (CRM_Utils_Array::value('membership', $componentDetails) ||
-        CRM_Utils_Array::value('participant', $componentDetails) ||
+      if (!empty($componentDetails['membership']) ||
+        !empty($componentDetails['participant']) ||
         // if status is Cancelled freeze Amount, Payment Instrument, Check #, Financial Type,
         // Net and Fee Amounts are frozen in AdditionalInfo::buildAdditionalDetail
         $isCancelledStatus
@@ -1710,7 +1710,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
   protected function invoicingPostProcessHook($submittedValues, $action, $lineItem) {
 
     $invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
-    if (!CRM_Utils_Array::value('invoicing', $invoiceSettings)) {
+    if (empty($invoiceSettings['invoicing'])) {
       return;
     }
     $taxRate = [];
index 601b3bf3b4d373e692b4d76934dd3f58eb035063..25deceea7b02741ba3c8d7a20431a42e915057e3 100644 (file)
@@ -117,7 +117,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
         $pledgeParams['frequency_day'] = 1;
       }
       $pledgeParams['create_date'] = $pledgeParams['start_date'] = $pledgeParams['scheduled_date'] = date("Ymd");
-      if (CRM_Utils_Array::value('start_date', $params)) {
+      if (!empty($params['start_date'])) {
         $pledgeParams['frequency_day'] = intval(date("d", strtotime(CRM_Utils_Array::value('start_date', $params))));
         $pledgeParams['start_date'] = $pledgeParams['scheduled_date'] = date('Ymd', strtotime(CRM_Utils_Array::value('start_date', $params)));
       }
@@ -1942,7 +1942,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     $form->_fields['billing_first_name'] = 1;
     $form->_fields['billing_last_name'] = 1;
     // CRM-18854 - Set form values to allow pledge to be created for api test.
-    if (CRM_Utils_Array::value('pledge_block_id', $params)) {
+    if (!empty($params['pledge_block_id'])) {
       $form->_values['pledge_id'] = CRM_Utils_Array::value('pledge_id', $params, NULL);
       $form->_values['pledge_block_id'] = $params['pledge_block_id'];
       $pledgeBlock = CRM_Pledge_BAO_PledgeBlock::getPledgeBlock($params['id']);
index 44d9ffecf172364e45e4826b6cdd16e0808119d9..6b8d915b8d5d8875cc5f67b17153126c9bd42ba8 100644 (file)
@@ -631,9 +631,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
   public static function formRule($fields, $files, $self) {
     $errors = [];
     $amount = self::computeAmount($fields, $self->_values);
-    if (CRM_Utils_Array::value('auto_renew', $fields) &&
-      CRM_Utils_Array::value('payment_processor_id', $fields) == 0
-    ) {
+    if (!empty($fields['auto_renew']) && empty($fields['payment_processor_id'])) {
       $errors['auto_renew'] = ts('You cannot have auto-renewal on if you are paying later.');
     }
 
@@ -876,15 +874,13 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
     //CRM-16285 - Function to handle validation errors on form, for recurring contribution field.
     CRM_Contribute_BAO_ContributionRecur::validateRecurContribution($fields, $files, $self, $errors);
 
-    if (!empty($fields['is_recur']) &&
-      CRM_Utils_Array::value('payment_processor_id', $fields) == 0
-    ) {
+    if (!empty($fields['is_recur']) && empty($fields['payment_processor_id'])) {
       $errors['_qf_default'] = ts('You cannot set up a recurring contribution if you are not paying online by credit card.');
     }
 
     // validate PCP fields - if not anonymous, we need a nick name value
     if ($self->_pcpId && !empty($fields['pcp_display_in_roll']) &&
-      (CRM_Utils_Array::value('pcp_is_anonymous', $fields) == 0) &&
+      empty($fields['pcp_is_anonymous']) &&
       CRM_Utils_Array::value('pcp_roll_nickname', $fields) == ''
     ) {
       $errors['pcp_roll_nickname'] = ts('Please enter a name to include in the Honor Roll, or select \'contribute anonymously\'.');
@@ -915,13 +911,13 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
           $errors['pledge_installments'] = ts('Please enter a valid number of pledge installments.');
         }
         else {
-          if (CRM_Utils_Array::value('pledge_installments', $fields) == NULL) {
+          if (!isset($fields['pledge_installments'])) {
             $errors['pledge_installments'] = ts('Pledge Installments is required field.');
           }
           elseif (CRM_Utils_Array::value('pledge_installments', $fields) == 1) {
             $errors['pledge_installments'] = ts('Pledges consist of multiple scheduled payments. Select one-time contribution if you want to make your gift in a single payment.');
           }
-          elseif (CRM_Utils_Array::value('pledge_installments', $fields) == 0) {
+          elseif (empty($fields['pledge_installments'])) {
             $errors['pledge_installments'] = ts('Pledge Installments field must be > 1.');
           }
         }
@@ -931,10 +927,10 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
           $errors['pledge_frequency_interval'] = ts('Please enter a valid Pledge Frequency Interval.');
         }
         else {
-          if (CRM_Utils_Array::value('pledge_frequency_interval', $fields) == NULL) {
+          if (!isset($fields['pledge_frequency_interval'])) {
             $errors['pledge_frequency_interval'] = ts('Pledge Frequency Interval. is required field.');
           }
-          elseif (CRM_Utils_Array::value('pledge_frequency_interval', $fields) == 0) {
+          elseif (empty($fields['pledge_frequency_interval'])) {
             $errors['pledge_frequency_interval'] = ts('Pledge frequency interval field must be > 0');
           }
         }
@@ -947,7 +943,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
       return $errors;
     }
 
-    if (CRM_Utils_Array::value('payment_processor_id', $fields) === NULL) {
+    if (!isset($fields['payment_processor_id'])) {
       $errors['payment_processor_id'] = ts('Payment Method is a required field.');
     }
     else {
@@ -1192,7 +1188,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
     if ($params['amount'] != 0 && (($this->_values['is_pay_later'] &&
           empty($this->_paymentProcessor) &&
           !array_key_exists('hidden_processor', $params)) ||
-        (CRM_Utils_Array::value('payment_processor_id', $params) == 0))
+        empty($params['payment_processor_id']))
     ) {
       $params['is_pay_later'] = 1;
     }
index f1490ee44ceefb1942d03c7d6eed51df9b2b8e00..343c11998ab07fc22afc0f7769f0c2ce356d5333 100644 (file)
@@ -306,7 +306,7 @@ class CRM_Contribute_Form_ContributionPage extends CRM_Core_Form {
       ];
       foreach ($pledgeBlock as $key) {
         $defaults[$key] = CRM_Utils_Array::value($key, $pledgeBlockDefaults);
-        if ($key == 'pledge_start_date' && CRM_Utils_Array::value($key, $pledgeBlockDefaults)) {
+        if ($key == 'pledge_start_date' && !empty($pledgeBlockDefaults[$key])) {
           $defaultPledgeDate = (array) json_decode($pledgeBlockDefaults['pledge_start_date']);
           $pledgeDateFields = [
             'pledge_calendar_date' => 'calendar_date',
index 538569eb2cb784883ffd6f15df453d1ea00ff06e..ef3d9071c586abdb8b42be1773e1081f681e6ae3 100644 (file)
@@ -95,10 +95,10 @@ class CRM_Contribute_Form_ContributionPage_Amount extends CRM_Contribute_Form_Co
         if ($id != 0) {
           $paymentProcessor[$id] = $processor['name'];
         }
-        if (CRM_Utils_Array::value('is_recur', $processor)) {
+        if (!empty($processor['is_recur'])) {
           $recurringPaymentProcessor[] = $id;
         }
-        if (CRM_Utils_Array::value('object', $processor) && $processor['object']->supports('FutureRecurStartDate')) {
+        if (!empty($processor['object']) && $processor['object']->supports('FutureRecurStartDate')) {
           $futurePaymentProcessor[] = $id;
         }
       }
@@ -345,7 +345,7 @@ class CRM_Contribute_Form_ContributionPage_Amount extends CRM_Contribute_Form_Co
     }
 
     // CRM-18854 Check if recurring start date is in the future.
-    if (CRM_Utils_Array::value('pledge_calendar_date', $fields)) {
+    if (!empty($fields['pledge_calendar_date'])) {
       if (date('Ymd') > date('Ymd', strtotime($fields['pledge_calendar_date']))) {
         $errors['pledge_calendar_date'] = ts('The recurring start date cannot be prior to the current date.');
       }
@@ -506,7 +506,7 @@ class CRM_Contribute_Form_ContributionPage_Amount extends CRM_Contribute_Form_Co
       $params['is_recur_installments'] = CRM_Utils_Array::value('is_recur_installments', $params, FALSE);
     }
 
-    if (CRM_Utils_Array::value('adjust_recur_start_date', $params)) {
+    if (!empty($params['adjust_recur_start_date'])) {
       $fieldValue = '';
       $pledgeDateFields = [
         'calendar_date' => 'pledge_calendar_date',
@@ -517,7 +517,7 @@ class CRM_Contribute_Form_ContributionPage_Amount extends CRM_Contribute_Form_Co
       }
       else {
         foreach ($pledgeDateFields as $key => $pledgeDateField) {
-          if (CRM_Utils_Array::value($pledgeDateField, $params) && $params['pledge_default_toggle'] == $key) {
+          if (!empty($params[$pledgeDateField]) && $params['pledge_default_toggle'] == $key) {
             $fieldValue = json_encode([$key => $params[$pledgeDateField]]);
             break;
           }
@@ -531,10 +531,10 @@ class CRM_Contribute_Form_ContributionPage_Amount extends CRM_Contribute_Form_Co
       $params['is_pledge_start_date_visible'] = 0;
       $params['is_pledge_start_date_editable'] = 0;
     }
-    if (!CRM_Utils_Array::value('is_pledge_start_date_visible', $params)) {
+    if (empty($params['is_pledge_start_date_visible'])) {
       $params['is_pledge_start_date_visible'] = 0;
     }
-    if (!CRM_Utils_Array::value('is_pledge_start_date_editable', $params)) {
+    if (empty($params['is_pledge_start_date_editable'])) {
       $params['is_pledge_start_date_editable'] = 0;
     }
 
index b0c68d1b8a932b2f1b9124cb1657af612ae8eae2..b8e7f073fea4ebe54f4bb60fd8d412bf2bbefdb1 100644 (file)
@@ -84,7 +84,7 @@ class CRM_Core_BAO_Location extends CRM_Core_DAO {
       // when we come from a form which displays all the location elements (like the edit form or the inline block
       // elements, we can skip the below check. The below check adds quite a feq queries to an already overloaded
       // form
-      if (!CRM_Utils_Array::value('updateBlankLocInfo', $params, FALSE)) {
+      if (empty($params['updateBlankLocInfo'])) {
         // make sure contact should have only one primary block, CRM-5051
         self::checkPrimaryBlocks(CRM_Utils_Array::value('contact_id', $params));
       }
index 95ef8907ecb0b8f44ba23bbd6ee5c6fa86d7bd88..daf86a7806e71b1ae71a00c3d7adb7e7cc5b8cc1 100644 (file)
@@ -917,7 +917,7 @@ class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity {
         }
       }
       if ($formParams['repeats_by'] == 2) {
-        if (CRM_Utils_Array::value('entity_status_1', $formParams) && CRM_Utils_Array::value('entity_status_2', $formParams)) {
+        if (!empty($formParams['entity_status_1']) && !empty($formParams['entity_status_2'])) {
           $dbParams['entity_status'] = $formParams['entity_status_1'] . " " . $formParams['entity_status_2'];
         }
       }
index 2c4b837bda63710a491e18086fa8d4bf18136087..41d520efef3be17e00a56da35ef58bb4d8501f38 100644 (file)
@@ -496,7 +496,7 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting {
   public static function isAPIJobAllowedToRun($params) {
     $environment = CRM_Core_Config::environment(NULL, TRUE);
     if ($environment != 'Production') {
-      if (CRM_Utils_Array::value('runInNonProductionEnvironment', $params)) {
+      if (!empty($params['runInNonProductionEnvironment'])) {
         $mailing = Civi::settings()->get('mailing_backend_store');
         if ($mailing) {
           Civi::settings()->set('mailing_backend', $mailing);
index 98e9a35faa47135f09bfc30a0b38c6c21326cb3d..fbeb8528f3c4e32f7e49048eafe4bc3cf2cd7804 100644 (file)
@@ -66,7 +66,7 @@ class CRM_Core_BAO_StatusPreference extends CRM_Core_DAO_StatusPreference {
     }
 
     // Check if this StatusPreference already exists.
-    if (empty($params['id']) && CRM_Utils_Array::value('name', $params)) {
+    if (empty($params['id']) && !empty($params['name'])) {
       $statusPreference->domain_id = CRM_Utils_Array::value('domain_id', $params, CRM_Core_Config::domainID());
       $statusPreference->name = $params['name'];
 
index 4549d78d3b0a1f5963dc5dcffaa611c75ed47f0e..357e0819357be4b5dde53a3a4d68cefaf0044006 100644 (file)
@@ -827,7 +827,7 @@ SELECT  id
       if (in_array($field['field_name'], $validBillingFields)) {
         $validProfileFields[] = $field['field_name'];
       }
-      if (CRM_Utils_Array::value('is_required', $field)) {
+      if (!empty($field['is_required'])) {
         $requiredProfileFields[] = $field['field_name'];
       }
     }
index df253125696451457c1f99b70040d8396573d087..d38f96ba1b7b2299b5968cb49de9a1a3802e8d5b 100644 (file)
@@ -300,7 +300,7 @@ class CRM_Core_DAO_AllCoreTables {
       $fields = $dao::fields();
 
       foreach ($fields as $name => $field) {
-        if (CRM_Utils_Array::value('export', $field)) {
+        if (!empty($field['export'])) {
           if ($prefix) {
             $exports[$labelName] = & $fields[$name];
           }
@@ -340,7 +340,7 @@ class CRM_Core_DAO_AllCoreTables {
       $fields = $dao::fields();
 
       foreach ($fields as $name => $field) {
-        if (CRM_Utils_Array::value('import', $field)) {
+        if (!empty($field['import'])) {
           if ($prefix) {
             $imports[$labelName] = & $fields[$name];
           }
index 85f53b22e23dbac4220d64f6d26aa34db286bf47..880c4f0b6298a417b10b54d7dca607d0944a611a 100644 (file)
@@ -369,7 +369,7 @@ class CRM_Core_Form_RecurringEntity {
 
         //exclude dates
         $excludeDateList = [];
-        if (CRM_Utils_Array::value('exclude_date_list', $params) && CRM_Utils_Array::value('parent_entity_id', $params) && $actionScheduleObj->entity_value) {
+        if (!empty($params['exclude_date_list']) && !empty($params['parent_entity_id']) && $actionScheduleObj->entity_value) {
           //Since we get comma separated values lets get them in array
           $excludeDates = explode(",", $params['exclude_date_list']);
 
index 1ade998abd75526e593bab89aff9b11a45e1643f..919f43848ccca7e111587fd12482e48266f01618 100644 (file)
@@ -337,7 +337,7 @@ class CRM_Core_Form_Search extends CRM_Core_Form {
     $this->addElement('checkbox', 'toggleSelect', NULL, NULL, ['class' => 'select-rows']);
     if (!empty($rows)) {
       foreach ($rows as $row) {
-        if (CRM_Utils_Array::value('checkbox', $row)) {
+        if (!empty($row['checkbox'])) {
           $this->addElement('checkbox', $row['checkbox'], NULL, NULL, ['class' => 'select-row']);
         }
       }
index 7c2d1a00b743e4995a184c2ac1cc687ef2361803..0569c7ee86c484486942b0323dc8e597b51cb0b4 100644 (file)
@@ -269,7 +269,7 @@ class CRM_Core_Page_AJAX {
     }
 
     foreach ($optionalParams as $param => $type) {
-      if (CRM_Utils_Array::value($param, $_GET)) {
+      if (!empty($_GET[$param])) {
         if (!is_array($_GET[$param])) {
           $params[$param] = CRM_Utils_Type::validate(CRM_Utils_Array::value($param, $_GET), $type);
         }
index 198b22c33ed0bf6c7c3857b7572dc5862577613b..15706f62cc49066a78df4c7124c047f4abec997f 100644 (file)
@@ -14,7 +14,7 @@ class CRM_Core_Page_AJAX_RecurringEntity {
 
   public static function updateMode() {
     $finalResult = [];
-    if (CRM_Utils_Array::value('mode', $_REQUEST) && CRM_Utils_Array::value('entityId', $_REQUEST) && CRM_Utils_Array::value('entityTable', $_REQUEST)) {
+    if (!empty($_REQUEST['mode']) && !empty($_REQUEST['entityId']) && !empty($_REQUEST['entityTable'])) {
       $mode = CRM_Utils_Type::escape($_REQUEST['mode'], 'Integer');
       $entityId = CRM_Utils_Type::escape($_REQUEST['entityId'], 'Integer');
       $entityTable = CRM_Utils_Type::escape($_REQUEST['entityTable'], 'String');
index 9f7c9e06a73838c88fe0daa0fa0b89f70411f8db..149049992dcfa2276526ca3d3c127828c76400b1 100644 (file)
@@ -71,7 +71,7 @@ class CRM_Custom_Form_Preview extends CRM_Core_Form {
       if (!empty($defaults['is_view'])) {
         CRM_Core_Error::statusBounce(ts('This field is view only so it will not display on edit form.'));
       }
-      elseif (CRM_Utils_Array::value('is_active', $defaults) == 0) {
+      elseif (empty($defaults['is_active'])) {
         CRM_Core_Error::statusBounce(ts('This field is inactive so it will not display on edit form.'));
       }
 
index 143096e3525826f0ec24af0a33f7bcf5b880c73a..b5b6b6fef0c2d8269d99508e656a3627cc190b53 100644 (file)
@@ -47,7 +47,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart {
     if ($participant->must_wait) {
       $participant_status = 'On waitlist';
     }
-    elseif (CRM_Utils_Array::value('is_pay_later', $params, FALSE)) {
+    elseif (!empty($params['is_pay_later'])) {
       $participant_status = 'Pending from pay later';
     }
     else {
index 9aad1cd161c099a6f28fe5c057e27c72a9578bdb..c7fb5591e1a2678c05ecf6d7564ed42c11a4206a 100644 (file)
@@ -207,7 +207,7 @@ class CRM_Event_Form_ManageEvent_Repeat extends CRM_Event_Form_ManageEvent {
       $participantDetails = CRM_Event_Form_ManageEvent_Repeat::getParticipantCountforEvent($getRelatedEntities);
       //Check if participants exists for events
       foreach ($getRelatedEntities as $key => $value) {
-        if (!CRM_Utils_Array::value($value['id'], $participantDetails['countByID']) && $value['id'] != $eventID) {
+        if (empty($participantDetails['countByID'][$value['id']]) && $value['id'] != $eventID) {
           //CRM_Event_BAO_Event::del($value['id']);
           $eventIdsWithNoRegistration[] = $value['id'];
         }
index d9a1825e149ade4153d5ce4d396d68802ee6695e..2ac411173084408c1538eda1749c9c219b116bc4 100644 (file)
@@ -476,7 +476,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form {
           $this->assign($v, $params[$v]);
         }
       }
-      elseif (CRM_Utils_Array::value('amount', $params) == 0) {
+      elseif (empty($params['amount'])) {
         $this->assign($v, CRM_Utils_Array::value($v, $params));
       }
     }
index b5d6739186d72fc346e3c1b3a4d7260cc8cdf116..66aca2e971b76dc902d4abf6d55299638b03feac 100644 (file)
@@ -457,7 +457,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration {
         $participantCount[$participantNum] = 'participant';
       }
       $totalTaxAmount += CRM_Utils_Array::value('tax_amount', $record, 0);
-      if (CRM_Utils_Array::value('is_primary', $record)) {
+      if (!empty($record['is_primary'])) {
         $taxAmount = &$params[$participantNum]['tax_amount'];
       }
       //lets get additional participant id to cancel.
index 12ff73031d93a75b50b094bbe874316590d19565..77297e325afd4d2eaba861e8438882e8eb3c5877 100644 (file)
@@ -103,7 +103,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
   protected static function isZeroAmount($fields, $form): bool {
     $isZeroAmount = FALSE;
     if (!empty($fields['priceSetId'])) {
-      if (CRM_Utils_Array::value('amount', $fields) == 0) {
+      if (empty($fields['amount'])) {
         $isZeroAmount = TRUE;
       }
     }
@@ -1155,7 +1155,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
           "_qf_Register_display=1&qfKey={$this->controller->_key}",
           TRUE, NULL, FALSE
         );
-        if (CRM_Utils_Array::value('additional_participants', $params, FALSE)) {
+        if (!empty($params['additional_participants'])) {
           $urlArgs = "_qf_Participant_1_display=1&rfp=1&qfKey={$this->controller->_key}";
         }
         else {
@@ -1194,7 +1194,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
     }
 
     // If registering > 1 participant, give status message
-    if (CRM_Utils_Array::value('additional_participants', $params, FALSE)) {
+    if (!empty($params['additional_participants'])) {
       $statusMsg = ts('Registration information for participant 1 has been saved.');
       CRM_Core_Session::setStatus($statusMsg, ts('Saved'), 'success');
     }
index b9154b1d6d98335997ce0ad340a492b32c581f0d..618bec0d194180bcee0c7f27e06dcf9958d91f6a 100644 (file)
@@ -487,7 +487,7 @@ class CRM_Financial_BAO_FinancialType extends CRM_Financial_DAO_FinancialType {
       $realSetting = \Civi::$statics[__CLASS__]['is_acl_enabled'] = Civi::settings()->get('acl_financial_type');
       if (!$realSetting) {
         $contributeSettings = Civi::settings()->get('contribution_invoice_settings');
-        if (CRM_Utils_Array::value('acl_financial_type', $contributeSettings)) {
+        if (!empty($contributeSettings['acl_financial_type'])) {
           \Civi::$statics[__CLASS__]['is_acl_enabled'] = TRUE;
         }
       }
index a4de716b08c26cfedca4f3ef54337e0097dc6fbb..bf82fd6bcb58a466f3ef0d6bcf7cce1df3292b94 100644 (file)
@@ -88,7 +88,7 @@ class CRM_Financial_BAO_Payment {
       $trxn = CRM_Core_BAO_FinancialTrxn::create($balanceTrxnParams);
 
       // @todo - this is just weird & historical & inconsistent - why 2 tracks?
-      if (CRM_Utils_Array::value('line_item', $params) && !empty($trxn)) {
+      if (!empty($params['line_item']) && !empty($trxn)) {
         foreach ($params['line_item'] as $values) {
           foreach ($values as $id => $amount) {
             $p = ['id' => $id];
index 227e6d01432b63ea59bb9bc61b5e7942fc72b363..724059888435b786647d486bd64771415267e97a 100644 (file)
@@ -143,7 +143,7 @@ class CRM_Financial_Form_FinancialAccount extends CRM_Contribute_Form {
       if ($values['financial_account_type_id'] != $financialAccountTypeId) {
         $errorMsg['financial_account_type_id'] = ts('Taxable accounts should have Financial Account Type set to Liability.');
       }
-      if (CRM_Utils_Array::value('tax_rate', $values) == NULL) {
+      if (!isset($values['tax_rate'])) {
         $errorMsg['tax_rate'] = ts('Please enter value for tax rate');
       }
     }
index b59eb1a4cfca9f1ebb891651e26725a097b3865c..46c1f0ddafd8aa2266a2d2d4d4acb53156f1cd2e 100644 (file)
@@ -381,14 +381,14 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership {
       foreach ($params['line_item'] as $priceSetId => $lineItems) {
         foreach ($lineItems as $lineIndex => $lineItem) {
           $lineMembershipType = CRM_Utils_Array::value('membership_type_id', $lineItem);
-          if (CRM_Utils_Array::value('contribution', $params)) {
+          if (!empty($params['contribution'])) {
             $params['line_item'][$priceSetId][$lineIndex]['contribution_id'] = $params['contribution']->id;
           }
           if ($lineMembershipType && $lineMembershipType == CRM_Utils_Array::value('membership_type_id', $params)) {
             $params['line_item'][$priceSetId][$lineIndex]['entity_id'] = $membership->id;
             $params['line_item'][$priceSetId][$lineIndex]['entity_table'] = 'civicrm_membership';
           }
-          elseif (!$lineMembershipType && CRM_Utils_Array::value('contribution', $params)) {
+          elseif (!$lineMembershipType && !empty($params['contribution'])) {
             $params['line_item'][$priceSetId][$lineIndex]['entity_id'] = $params['contribution']->id;
             $params['line_item'][$priceSetId][$lineIndex]['entity_table'] = 'civicrm_contribution';
           }
index 3169844fdc0bd2e722eec0f8235fe05eed9027bf..151ac140320108f79249054b5f489e24392bf1fe 100644 (file)
@@ -1165,7 +1165,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
     CRM_Price_BAO_PriceSet::processAmount($this->_priceSet['fields'],
       $formValues, $lineItem[$this->_priceSetId], NULL, $this->_priceSetId);
 
-    if (CRM_Utils_Array::value('tax_amount', $formValues)) {
+    if (!empty($formValues['tax_amount'])) {
       $params['tax_amount'] = $formValues['tax_amount'];
     }
     $params['total_amount'] = CRM_Utils_Array::value('amount', $formValues);
@@ -1739,7 +1739,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
     // if selected membership doesn't match with earlier membership
       !in_array($this->_memType, $this->_memTypeSelected)
     ) {
-      if (CRM_Utils_Array::value('is_recur', $inputParams)) {
+      if (!empty($inputParams['is_recur'])) {
         CRM_Core_Session::setStatus(ts('Associated recurring contribution cannot be updated on membership type change.', ts('Error'), 'error'));
         return;
       }
index 4e24c3e4e04ff3e126559d8096b864974b451d9b..0026d4a9ff0f6c4c987e09e9dcbf01a2c7dacbbb 100644 (file)
@@ -1200,7 +1200,7 @@ SELECT  pledge.contact_id              as contact_id,
   public static function getPledgeStartDate($date, $pledgeBlock) {
     $startDate = (array) json_decode($pledgeBlock['pledge_start_date']);
     foreach ($startDate as $field => $value) {
-      if (!empty($date) && !CRM_Utils_Array::value('is_pledge_start_date_editable', $pledgeBlock)) {
+      if (!empty($date) && empty($pledgeBlock['is_pledge_start_date_editable'])) {
         return $date;
       }
       if (empty($date)) {
index 732a61a450e53b1923f7dea4edc7261805cd5c44..9d63fd5db409089eac16fc328e73a2e4694007c9 100644 (file)
@@ -301,8 +301,8 @@ class CRM_Pledge_BAO_PledgeBlock extends CRM_Pledge_DAO_PledgeBlock {
       }
       $form->addElement('select', 'pledge_frequency_unit', NULL, $freqUnits, ['aria-label' => ts('Frequency Units')]);
       // CRM-18854
-      if (CRM_Utils_Array::value('is_pledge_start_date_visible', $pledgeBlock)) {
-        if (CRM_Utils_Array::value('pledge_start_date', $pledgeBlock)) {
+      if (!empty($pledgeBlock['is_pledge_start_date_visible'])) {
+        if (!empty($pledgeBlock['pledge_start_date'])) {
           $defaults = array();
           $date = (array) json_decode($pledgeBlock['pledge_start_date']);
           foreach ($date as $field => $value) {
@@ -335,7 +335,7 @@ class CRM_Pledge_BAO_PledgeBlock extends CRM_Pledge_DAO_PledgeBlock {
             $form->setDefaults($defaults);
             $form->assign('start_date_display', $paymentDate);
             $form->assign('start_date_editable', FALSE);
-            if (CRM_Utils_Array::value('is_pledge_start_date_editable', $pledgeBlock)) {
+            if (!empty($pledgeBlock['is_pledge_start_date_editable'])) {
               $form->assign('start_date_editable', TRUE);
               if ($field == 'calendar_month') {
                 $form->assign('is_date', FALSE);
index a64651d67019ff323bd2dbd607074297a4840d3f..04c5a5d3e25c0fee5e4feabb403060af53c5bd13 100644 (file)
@@ -70,7 +70,7 @@ class CRM_Price_BAO_LineItem extends CRM_Price_DAO_LineItem {
         $params['unit_price'] = 0;
       }
     }
-    if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && CRM_Utils_Array::value('check_permissions', $params)) {
+    if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && !empty($params['check_permissions'])) {
       if (empty($params['financial_type_id'])) {
         throw new Exception('Mandatory key(s) missing from params array: financial_type_id');
       }
index c5b7caaad66144818e3a0752f5ed04ab89941907..d178611508b9705d08c665b0ebe1eef5275e6794 100644 (file)
@@ -727,7 +727,7 @@ WHERE  id = %1";
               $field['options'][$optionValueId]['tax_amount'] = round($taxAmount['tax_amount'], 2);
             }
           }
-          if (CRM_Utils_Array::value('tax_rate', $field['options'][$optionValueId])) {
+          if (!empty($field['options'][$optionValueId]['tax_rate'])) {
             $lineItem = self::setLineItem($field, $lineItem, $optionValueId, $totalTax);
           }
           $totalPrice += $lineItem[$firstOption['id']]['line_total'] + CRM_Utils_Array::value('tax_amount', $lineItem[key($field['options'])]);
@@ -742,7 +742,7 @@ WHERE  id = %1";
           $optionValueId = CRM_Utils_Array::key(1, $params["price_{$id}"]);
 
           CRM_Price_BAO_LineItem::format($id, $params, $field, $lineItem, $amount_override);
-          if (CRM_Utils_Array::value('tax_rate', $field['options'][$optionValueId])) {
+          if (!empty($field['options'][$optionValueId]['tax_rate'])) {
             $lineItem = self::setLineItem($field, $lineItem, $optionValueId, $totalTax);
             if ($amount_override) {
               $lineItem[$optionValueId]['line_total'] = $lineItem[$optionValueId]['unit_price'] = CRM_Utils_Rule::cleanMoney($lineItem[$optionValueId]['line_total'] - $lineItem[$optionValueId]['tax_amount']);
@@ -765,7 +765,7 @@ WHERE  id = %1";
           $optionValueId = CRM_Utils_Array::key(1, $params["price_{$id}"]);
 
           CRM_Price_BAO_LineItem::format($id, $params, $field, $lineItem, CRM_Utils_Array::value('partial_payment_total', $params));
-          if (CRM_Utils_Array::value('tax_rate', $field['options'][$optionValueId])) {
+          if (!empty($field['options'][$optionValueId]['tax_rate'])) {
             $lineItem = self::setLineItem($field, $lineItem, $optionValueId, $totalTax);
           }
           $totalPrice += $lineItem[$optionValueId]['line_total'] + CRM_Utils_Array::value('tax_amount', $lineItem[$optionValueId]);
@@ -782,7 +782,7 @@ WHERE  id = %1";
 
           CRM_Price_BAO_LineItem::format($id, $params, $field, $lineItem, CRM_Utils_Array::value('partial_payment_total', $params));
           foreach ($params["price_{$id}"] as $optionId => $option) {
-            if (CRM_Utils_Array::value('tax_rate', $field['options'][$optionId])) {
+            if (!empty($field['options'][$optionId]['tax_rate'])) {
               $lineItem = self::setLineItem($field, $lineItem, $optionId, $totalTax);
             }
             $totalPrice += $lineItem[$optionId]['line_total'] + CRM_Utils_Array::value('tax_amount', $lineItem[$optionId]);
index dc237c1fa735a497ee4d21c81a8dfd9791375fe4..08ff9e40afb677af01779a5e23e029bed7eccd7e 100644 (file)
@@ -422,7 +422,7 @@ class CRM_Price_Form_Field extends CRM_Core_Form {
     }
 
     if ((is_numeric(CRM_Utils_Array::value('count', $fields)) &&
-        CRM_Utils_Array::value('count', $fields) == 0
+        empty($fields['count'])
       ) &&
       (CRM_Utils_Array::value('html_type', $fields) == 'Text')
     ) {
index a4c6e0d31f4bbe02ef8165248fb38384fb346e49..bea5471f545d3b9ff7f7b1954d28c3ce6d9b7e30 100644 (file)
@@ -380,7 +380,7 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form {
     $contributionOrSoftVal = $this->getElementValue('contribution_or_soft_value');
     if ($contributionOrSoftVal[0] == 'contributions_only') {
       $groupBySoft = $this->getElementValue('group_bys');
-      if (CRM_Utils_Array::value('soft_credit_id', $groupBySoft)) {
+      if (!empty($groupBySoft['soft_credit_id'])) {
         $this->setElementError('group_bys', ts('You cannot group by soft credit when displaying contributions only.  Please uncheck "Soft Credit" in the Grouping tab.'));
       }
     }
index ec4d864bb1513b8a34833bbe84a9c400ece6773f..bfbc8e5a9187fef7be3efd6db31c6e042c0b32f4 100644 (file)
@@ -349,7 +349,7 @@ class CRM_Report_Form_Event_Summary extends CRM_Report_Form {
           $rows[$key]['civicrm_event_id'] . ") ";
       }
 
-      if (CRM_Utils_Array::value('totalAmount', $rows[$key]) == 0) {
+      if (empty($rows[$key]['totalAmount'])) {
         $countEvent = count($rows);
       }
 
index 4eaa30cfe1df9d0938d152d97237720748cd0d16..6b0793a26f12538c613611b50d1f8565cfa7fe5f 100644 (file)
@@ -76,7 +76,7 @@ class CRM_Utils_API_ReloadOption implements API_Wrapper {
   public function toApiOutput($apiRequest, $result) {
     $reloadMode = NULL;
     if ($apiRequest['action'] === 'create' && isset($apiRequest['params'], $apiRequest['params']['options']) && is_array($apiRequest['params']['options']) && isset($apiRequest['params']['options']['reload'])) {
-      if (!CRM_Utils_Array::value('is_error', $result, FALSE)) {
+      if (empty($result['is_error'])) {
         $reloadMode = $apiRequest['params']['options']['reload'];
       }
       $id = (!empty($apiRequest['params']['sequential'])) ? 0 : $result['id'];
index 4f2cdc5f5ce3efc376719ee8ad78bede747df3b8..518c17e7727e0bd23cbd398bb356c5cda9b41d73 100644 (file)
@@ -343,7 +343,7 @@ class CRM_Utils_Address {
         $alternateName = $alternate2;
       }
       //Include values which prepend 'billing_' to country and state_province.
-      if (CRM_Utils_Array::value($alternateName, $params)) {
+      if (!empty($params[$alternateName])) {
         if (empty($value) || !is_numeric($value)) {
           $value = $params[$alternateName];
         }
index ff37983e6bf8785ec9fd0e82bf5ec895498d0ba1..9b784435c60e84ce298c9c4680c9fdeca83ecfc8 100644 (file)
@@ -78,7 +78,7 @@ function _civicrm_api3_line_item_create_spec(&$params) {
  *   Array of matching line_items
  */
 function civicrm_api3_line_item_get($params) {
-  if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && CRM_Utils_Array::value('check_permissions', $params)) {
+  if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && !empty($params['check_permissions'])) {
     CRM_Price_BAO_LineItem::getAPILineItemParams($params);
   }
   return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
@@ -95,7 +95,7 @@ function civicrm_api3_line_item_get($params) {
  * @throws API_Exception
  */
 function civicrm_api3_line_item_delete($params) {
-  if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && CRM_Utils_Array::value('check_permissions', $params)) {
+  if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && !empty($params['check_permissions'])) {
     CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($types, CRM_Core_Action::DELETE);
     if (empty($params['financial_type_id'])) {
       $params['financial_type_id'] = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_LineItem', $params['id'], 'financial_type_id');
index 6d3b4bad5e36fce3c2b1d7395bc378c775699934..e570855b57a9b1081237f7a8b2959c304d08b3d2 100644 (file)
@@ -45,7 +45,7 @@ function civicrm_api3_order_get($params) {
   $contributions = [];
   $params['api.line_item.get'] = ['qty' => ['<>' => 0]];
   $isSequential = FALSE;
-  if (CRM_Utils_Array::value('sequential', $params)) {
+  if (!empty($params['sequential'])) {
     $params['sequential'] = 0;
     $isSequential = TRUE;
   }
@@ -88,7 +88,7 @@ function civicrm_api3_order_create($params) {
 
   $entity = NULL;
   $entityIds = [];
-  if (CRM_Utils_Array::value('line_items', $params) && is_array($params['line_items'])) {
+  if (!empty($params['line_items']) && is_array($params['line_items'])) {
     $priceSetID = NULL;
     CRM_Contribute_BAO_Contribution::checkLineItems($params);
     foreach ($params['line_items'] as $lineItems) {
@@ -124,7 +124,7 @@ function civicrm_api3_order_create($params) {
   }
   $contribution = civicrm_api3('Contribution', 'create', $params);
   // add payments
-  if ($entity && CRM_Utils_Array::value('id', $contribution)) {
+  if ($entity && !empty($contribution['id'])) {
     foreach ($entityIds as $entityId) {
       $paymentParams = [
         'contribution_id' => $contribution['id'],
index a2deaf562c77c84ddc4172074e4c7f5cea207d50..6114835fa267a0b2b7a522817a5bb0796cd4b387 100644 (file)
@@ -43,7 +43,7 @@
 function civicrm_api3_payment_get($params) {
   $financialTrxn = [];
   $limit = '';
-  if (isset($params['options']) && CRM_Utils_Array::value('limit', $params['options'])) {
+  if (isset($params['options']) && !empty($params['options']['limit'])) {
     $limit = CRM_Utils_Array::value('limit', $params['options']);
   }
   $params['options']['limit'] = 0;
@@ -132,7 +132,7 @@ function civicrm_api3_payment_cancel($params) {
  */
 function civicrm_api3_payment_create($params) {
   // Check if it is an update
-  if (CRM_Utils_Array::value('id', $params)) {
+  if (!empty($params['id'])) {
     $amount = $params['total_amount'];
     civicrm_api3('Payment', 'cancel', $params);
     $params['total_amount'] = $amount;