X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FPrice%2FBAO%2FLineItem.php;h=f381e971fd6421d03babd9085e67d99f04aba021;hb=4a00ebd175e4819197ddec91312675c58b25096a;hp=11043b9856cbc92184d0d813e9da2b493d33289f;hpb=810e5923b06228309b87eba162e4b9c58eaf8ce9;p=civicrm-core.git diff --git a/CRM/Price/BAO/LineItem.php b/CRM/Price/BAO/LineItem.php index 11043b9856..f381e971fd 100644 --- a/CRM/Price/BAO/LineItem.php +++ b/CRM/Price/BAO/LineItem.php @@ -32,7 +32,7 @@ class CRM_Price_BAO_LineItem extends CRM_Price_DAO_LineItem { * @throws \Exception */ public static function create(&$params) { - $id = CRM_Utils_Array::value('id', $params); + $id = $params['id'] ?? NULL; if ($id) { CRM_Utils_Hook::pre('edit', 'LineItem', $id, $params); $op = CRM_Core_Action::UPDATE; @@ -45,8 +45,8 @@ class CRM_Price_BAO_LineItem extends CRM_Price_DAO_LineItem { // unset entity table and entity id in $params // we never update the entity table and entity id during update mode if ($id) { - $entity_id = CRM_Utils_Array::value('entity_id', $params); - $entity_table = CRM_Utils_Array::value('entity_table', $params); + $entity_id = $params['entity_id'] ?? NULL; + $entity_table = $params['entity_table'] ?? NULL; unset($params['entity_id'], $params['entity_table']); } else { @@ -242,7 +242,7 @@ WHERE li.contribution_id = %1"; $getTaxDetails = FALSE; $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); - $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); + $invoicing = $invoiceSettings['invoicing'] ?? NULL; $dao = CRM_Core_DAO::executeQuery("$selectClause $fromClause $whereClause $orderByClause", $params); while ($dao->fetch()) { @@ -286,7 +286,7 @@ WHERE li.contribution_id = %1"; } if ($invoicing) { // @todo - this is an inappropriate place to be doing form level assignments. - $taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings); + $taxTerm = Civi::settings()->get('tax_term'); $smarty = CRM_Core_Smarty::singleton(); $smarty->assign('taxTerm', $taxTerm); $smarty->assign('getTaxDetails', $getTaxDetails); @@ -329,7 +329,7 @@ WHERE li.contribution_id = %1"; else { CRM_Price_BAO_PriceFieldValue::getValues($fid, $options, 'weight', TRUE); } - $fieldTitle = CRM_Utils_Array::value('label', $fields); + $fieldTitle = $fields['label'] ?? NULL; if (!$fieldTitle) { $fieldTitle = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $fid, 'label'); } @@ -342,21 +342,21 @@ WHERE li.contribution_id = %1"; $values[$oid] = [ 'price_field_id' => $fid, 'price_field_value_id' => $oid, - 'label' => CRM_Utils_Array::value('label', $options[$oid]), + 'label' => $options[$oid]['label'] ?? NULL, 'field_title' => $fieldTitle, - 'description' => CRM_Utils_Array::value('description', $options[$oid]), + 'description' => $options[$oid]['description'] ?? NULL, 'qty' => $qty, 'unit_price' => $price, 'line_total' => $qty * $price, 'participant_count' => $qty * $participantsPerField, - 'max_value' => CRM_Utils_Array::value('max_value', $options[$oid]), - 'membership_type_id' => CRM_Utils_Array::value('membership_type_id', $options[$oid]), - 'membership_num_terms' => CRM_Utils_Array::value('membership_num_terms', $options[$oid]), - 'auto_renew' => CRM_Utils_Array::value('auto_renew', $options[$oid]), + 'max_value' => $options[$oid]['max_value'] ?? NULL, + 'membership_type_id' => $options[$oid]['membership_type_id'] ?? NULL, + 'membership_num_terms' => $options[$oid]['membership_num_terms'] ?? NULL, + 'auto_renew' => $options[$oid]['auto_renew'] ?? NULL, 'html_type' => $fields['html_type'], - 'financial_type_id' => CRM_Utils_Array::value('financial_type_id', $options[$oid]), + 'financial_type_id' => $options[$oid]['financial_type_id'] ?? NULL, 'tax_amount' => CRM_Utils_Array::value('tax_amount', $options[$oid], 0), - 'non_deductible_amount' => CRM_Utils_Array::value('non_deductible_amount', $options[$oid]), + 'non_deductible_amount' => $options[$oid]['non_deductible_amount'] ?? NULL, ]; if ($values[$oid]['membership_type_id'] && empty($values[$oid]['auto_renew'])) { @@ -533,7 +533,7 @@ WHERE li.contribution_id = %1"; if (!$entityId) { $priceSetDetails = CRM_Price_BAO_PriceSet::getDefaultPriceSet($entityTable); $totalAmount = CRM_Utils_Array::value('partial_payment_total', $params, CRM_Utils_Array::value('total_amount', $params)); - $financialType = CRM_Utils_Array::value('financial_type_id', $params); + $financialType = $params['financial_type_id'] ?? NULL; foreach ($priceSetDetails as $values) { if ($entityTable == 'membership') { if ($isRelatedID != $values['membership_type_id']) {