CRM-14106 - Regex targeting the first part of if statements
[civicrm-core.git] / CRM / Contribute / Form / AdditionalInfo.php
index ead4c9c4f921d34a548e579afbec029383dab310..713f87066281298c6e53dceb45fbb39ef072fb6b 100644 (file)
@@ -218,7 +218,7 @@ class CRM_Contribute_Form_AdditionalInfo {
     $productDetails = array();
     CRM_Contribute_BAO_ManagePremiums::retrieve($premiumParams, $productDetails);
     $dao->financial_type_id = CRM_Utils_Array::value('financial_type_id', $productDetails);
-    if (CRM_Utils_Array::value($params['product_name'][0], $options)) {
+    if (!empty($options[$params['product_name'][0]])) {
       $dao->product_option = $options[$params['product_name'][0]][$params['product_name'][1]];
     }
     if ($premiumID) {
@@ -300,14 +300,14 @@ class CRM_Contribute_Form_AdditionalInfo {
       $formatted[$f] = CRM_Utils_Array::value($f, $params);
     }
 
-    if (CRM_Utils_Array::value('thankyou_date', $params) && !CRM_Utils_System::isNull($params['thankyou_date'])) {
+    if (!empty($params['thankyou_date']) && !CRM_Utils_System::isNull($params['thankyou_date'])) {
       $formatted['thankyou_date'] = CRM_Utils_Date::processDate($params['thankyou_date'], $params['thankyou_date_time']);
     }
     else {
       $formatted['thankyou_date'] = 'null';
     }
 
-    if (CRM_Utils_Array::value('is_email_receipt', $params)) {
+    if (!empty($params['is_email_receipt'])) {
       $params['receipt_date'] = $formatted['receipt_date'] = date('YmdHis');
     }
 
@@ -342,13 +342,13 @@ class CRM_Contribute_Form_AdditionalInfo {
     // Retrieve Financial Type Name from financial_type_id
     $params['contributionType_name'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialType',
       $params['financial_type_id']);
-    if (CRM_Utils_Array::value('payment_instrument_id', $params)) {
+    if (!empty($params['payment_instrument_id'])) {
       $paymentInstrument = CRM_Contribute_PseudoConstant::paymentInstrument();
       $params['paidBy'] = $paymentInstrument[$params['payment_instrument_id']];
     }
 
     // retrieve individual prefix value for honoree
-    if (CRM_Utils_Array::value('hidden_Honoree', $params)) {
+    if (!empty($params['hidden_Honoree'])) {
       $individualPrefix = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'prefix_id');
       $honor = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'honor_type_id');
       $params['honor_prefix'] = CRM_Utils_Array::value(CRM_Utils_Array::value('honor_prefix_id',
@@ -365,7 +365,7 @@ class CRM_Contribute_Form_AdditionalInfo {
 
     // retrieve premium product name and assigned fulfilled
     // date to template
-    if (CRM_Utils_Array::value('hidden_Premium', $params)) {
+    if (!empty($params['hidden_Premium'])) {
       if (isset($params['product_name']) &&
         is_array($params['product_name']) &&
         !empty($params['product_name'])
@@ -376,7 +376,7 @@ class CRM_Contribute_Form_AdditionalInfo {
         $params['product_name'] = $productDAO->name;
         $params['product_sku'] = $productDAO->sku;
 
-        if (!CRM_Utils_Array::value('product_option', $params) &&
+        if (empty($params['product_option']) &&
           CRM_Utils_Array::value($params['product_name'][0],
             $form->_options
           )
@@ -385,7 +385,7 @@ class CRM_Contribute_Form_AdditionalInfo {
         }
       }
 
-      if (CRM_Utils_Array::value('fulfilled_date', $params)) {
+      if (!empty($params['fulfilled_date'])) {
         $form->assign('fulfilled_date', CRM_Utils_Date::processDate($params['fulfilled_date']));
       }
     }
@@ -394,7 +394,7 @@ class CRM_Contribute_Form_AdditionalInfo {
     if ($ccContribution) {
       //build the name.
       $name = CRM_Utils_Array::value('billing_first_name', $params);
-      if (CRM_Utils_Array::value('billing_middle_name', $params)) {
+      if (!empty($params['billing_middle_name'])) {
         $name .= " {$params['billing_middle_name']}";
       }
       $name .= ' ' . CRM_Utils_Array::value('billing_last_name', $params);
@@ -429,10 +429,10 @@ class CRM_Contribute_Form_AdditionalInfo {
       // assigned various dates to the templates
       $form->assign('receipt_date', CRM_Utils_Date::processDate($params['receipt_date']));
 
-      if (CRM_Utils_Array::value('cancel_date', $params)) {
+      if (!empty($params['cancel_date'])) {
         $form->assign('cancel_date', CRM_Utils_Date::processDate($params['cancel_date']));
       }
-      if (CRM_Utils_Array::value('thankyou_date', $params)) {
+      if (!empty($params['thankyou_date'])) {
         $form->assign('thankyou_date', CRM_Utils_Date::processDate($params['thankyou_date']));
       }
       if ($form->_action & CRM_Core_Action::UPDATE) {
@@ -441,7 +441,7 @@ class CRM_Contribute_Form_AdditionalInfo {
     }
 
     //handle custom data
-    if (CRM_Utils_Array::value('hidden_custom', $params)) {
+    if (!empty($params['hidden_custom'])) {
       $contribParams = array(array('contribution_id', '=', $params['contribution_id'], 0, 0));
       if ($form->_mode == 'test') {
         $contribParams[] = array('contribution_test', '=', 1, 0, 0);
@@ -475,11 +475,11 @@ class CRM_Contribute_Form_AdditionalInfo {
     $form->assign('contactID', $params['contact_id']);
     $form->assign('contributionID', $params['contribution_id']);
 
-    if (CRM_Utils_Array::value('currency', $params)) {
+    if (!empty($params['currency'])) {
       $form->assign('currency', $params['currency']);
     }
 
-    if (CRM_Utils_Array::value('receive_date', $params)) {
+    if (!empty($params['receive_date'])) {
       $form->assign('receive_date', CRM_Utils_Date::processDate($params['receive_date']));
     }