CRM-15932 - Cleanup unnecessary use of CRM_Utils_Array
authorColeman Watts <coleman@civicrm.org>
Tue, 3 Mar 2015 14:38:50 +0000 (09:38 -0500)
committerColeman Watts <coleman@civicrm.org>
Tue, 3 Mar 2015 14:38:50 +0000 (09:38 -0500)
12 files changed:
CRM/Activity/BAO/Activity.php
CRM/Activity/Page/AJAX.php
CRM/Badge/BAO/Badge.php
CRM/Contribute/Form/Contribution.php
CRM/Core/BAO/Dashboard.php
CRM/Core/BAO/RecurringEntity.php
CRM/Core/Form/RecurringEntity.php
CRM/Core/Page/AJAX/RecurringEntity.php
CRM/Dedupe/BAO/RuleGroup.php
CRM/Event/Form/ParticipantFeeSelection.php
CRM/Price/BAO/PriceSet.php
CRM/Report/BAO/ReportInstance.php

index 61fdb3c53f3c5fe6300a6a26b40eb3acb39ed375..446e661f248bd6de9b2a54437beb453a5a4be081 100644 (file)
@@ -2697,7 +2697,7 @@ INNER JOIN  civicrm_option_group grp ON ( grp.id = val.option_group_id AND grp.n
    * @param array $params
    */
   public function setApiFilter(&$params) {
-    if (CRM_Utils_Array::value('target_contact_id', $params)) {
+    if (!empty($params['target_contact_id'])) {
       $this->selectAdd();
       $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
       $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
index 6f657edeeeb7a1f7ef77ff1d77328d528bddf2be..dc6b5323ba1e0d57a6fc2c2d565c3e0636e98f8c 100644 (file)
@@ -486,7 +486,7 @@ class CRM_Activity_Page_AJAX {
 
     foreach ($activities as $key => $value) {
       //Check if recurring activity
-      if (CRM_Utils_Array::value('is_recurring_activity', $value)) {
+      if (!empty($value['is_recurring_activity'])) {
         if ($key == $value['is_recurring_activity']) {
           $activities[$key]['activity_type'] = $activities[$key]['activity_type'] . '<br/><span class="bold">Recurring Activity - (Parent)</span>';
         }
index 1576e347281c5eb172b5ba8fcf9374d77380d9c9..21972d54938408c97f8f8c52e0c1b2a594982401 100644 (file)
@@ -208,7 +208,7 @@ class CRM_Badge_BAO_Badge {
       $startOffset = CRM_Utils_Array::value('height_image_2', $formattedRow);
     }
 
-    if (CRM_Utils_Array::value('participant_image', $formattedRow)) {
+    if (!empty($formattedRow['participant_image'])) {
       $imageAlign = 0;
       switch (CRM_Utils_Array::value('alignment_participant_image', $formattedRow)) {
         case 'R':
index 8dbf4882610cb82446b1ec569e1110e6f2c88ff8..1abeefd2f97c389967263f6470b303ddc62482e6 100644 (file)
@@ -1357,7 +1357,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
           $this->assign('dataArray', $taxRate);
         }
         else {
-          if (CRM_Utils_Array::value('price_set_id', $submittedValues)) {
+          if (!empty($submittedValues['price_set_id'])) {
             $this->assign('totalTaxAmount', $submittedValues['tax_amount']);
             $this->assign('getTaxDetails', $getTaxDetails);
             $this->assign('dataArray', $taxRate);
index 9d589d8988ece41b3d7eee7648b939024ac0c4ba..c65fa536dcbc332634c7a5a3610a83168277ca2b 100644 (file)
@@ -164,7 +164,7 @@ class CRM_Core_BAO_Dashboard extends CRM_Core_DAO_Dashboard {
     $contactID = CRM_Core_Session::singleton()->get('userID');
     $allDashlets = CRM_Utils_Array::index(array('name'), $getDashlets['values']);
     $defaultDashlets = array();
-    if (CRM_Utils_Array::value('blog', $allDashlets)) {
+    if (!empty($allDashlets['blog'])) {
       $defaultDashlets['blog'] = array(
         'dashboard_id' => $allDashlets['blog']['id'],
         'is_active' => 1,
index cf5ee41829578677594897f87c17fe1449cc435f..31853c88450d03ce9e0669de493bf04eddd95c51 100644 (file)
@@ -155,7 +155,7 @@ class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity {
    * @return object
    */
   public static function add(&$params) {
-    if (CRM_Utils_Array::value('id', $params)) {
+    if (!empty($params['id'])) {
       CRM_Utils_Hook::pre('edit', 'RecurringEntity', $params['id'], $params);
     }
     else {
@@ -167,7 +167,7 @@ class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity {
     $daoRecurringEntity->find(TRUE);
     $result = $daoRecurringEntity->save();
 
-    if (CRM_Utils_Array::value('id', $params)) {
+    if (!empty($params['id'])) {
       CRM_Utils_Hook::post('edit', 'RecurringEntity', $daoRecurringEntity->id, $daoRecurringEntity);
     }
     else {
@@ -843,39 +843,39 @@ class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity {
    */
   public function mapFormValuesToDB($formParams = array()) {
     $dbParams = array();
-    if (CRM_Utils_Array::value('used_for', $formParams)) {
+    if (!empty($formParams['used_for'])) {
       $dbParams['used_for'] = $formParams['used_for'];
     }
 
-    if (CRM_Utils_Array::value('entity_id', $formParams)) {
+    if (!empty($formParams['entity_id'])) {
       $dbParams['entity_value'] = $formParams['entity_id'];
     }
 
-    if (CRM_Utils_Array::value('repetition_start_date', $formParams)) {
-      if (CRM_Utils_Array::value('repetition_start_date_display', $formParams)) {
+    if (!empty($formParams['repetition_start_date'])) {
+      if (!empty($formParams['repetition_start_date_display'])) {
         $repetitionStartDate = $formParams['repetition_start_date_display'];
       }
       else {
         $repetitionStartDate = $formParams['repetition_start_date'];
       }
-      if (CRM_Utils_Array::value('repetition_start_date_time', $formParams)) {
+      if (!empty($formParams['repetition_start_date_time'])) {
         $repetitionStartDate = $repetitionStartDate . " " . $formParams['repetition_start_date_time'];
       }
       $repetition_start_date = new DateTime($repetitionStartDate);
       $dbParams['start_action_date'] = CRM_Utils_Date::processDate($repetition_start_date->format('Y-m-d H:i:s'));
     }
 
-    if (CRM_Utils_Array::value('repetition_frequency_unit', $formParams)) {
+    if (!empty($formParams['repetition_frequency_unit'])) {
       $dbParams['repetition_frequency_unit'] = $formParams['repetition_frequency_unit'];
     }
 
-    if (CRM_Utils_Array::value('repetition_frequency_interval', $formParams)) {
+    if (!empty($formParams['repetition_frequency_interval'])) {
       $dbParams['repetition_frequency_interval'] = $formParams['repetition_frequency_interval'];
     }
 
     //For Repeats on:(weekly case)
     if ($formParams['repetition_frequency_unit'] == 'week') {
-      if (CRM_Utils_Array::value('start_action_condition', $formParams)) {
+      if (!empty($formParams['start_action_condition'])) {
         $repeats_on = CRM_Utils_Array::value('start_action_condition', $formParams);
         $dbParams['start_action_condition'] = implode(",", array_keys($repeats_on));
       }
@@ -884,7 +884,7 @@ class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity {
     //For Repeats By:(monthly case)
     if ($formParams['repetition_frequency_unit'] == 'month') {
       if ($formParams['repeats_by'] == 1) {
-        if (CRM_Utils_Array::value('limit_to', $formParams)) {
+        if (!empty($formParams['limit_to'])) {
           $dbParams['limit_to'] = $formParams['limit_to'];
         }
       }
@@ -897,14 +897,14 @@ class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity {
 
     //For "Ends" - After:
     if ($formParams['ends'] == 1) {
-      if (CRM_Utils_Array::value('start_action_offset', $formParams)) {
+      if (!empty($formParams['start_action_offset'])) {
         $dbParams['start_action_offset'] = $formParams['start_action_offset'];
       }
     }
 
     //For "Ends" - On:
     if ($formParams['ends'] == 2) {
-      if (CRM_Utils_Array::value('repeat_absolute_date', $formParams)) {
+      if (!empty($formParams['repeat_absolute_date'])) {
         $dbParams['absolute_date'] = CRM_Utils_Date::processDate($formParams['repeat_absolute_date']);
       }
     }
@@ -1046,7 +1046,7 @@ class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity {
         $r->count($scheduleReminderDetails['start_action_offset']);
       }
 
-      if (CRM_Utils_Array::value('absolute_date', $scheduleReminderDetails)) {
+      if (!empty($scheduleReminderDetails['absolute_date'])) {
         $absoluteDate = CRM_Utils_Date::setDateDefaults($scheduleReminderDetails['absolute_date']);
         $endDate = new DateTime($absoluteDate[0] . ' ' . $absoluteDate[1]);
         $endDate->modify('+1 day');
@@ -1140,7 +1140,7 @@ class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity {
       );
       $defaults = array();
       CRM_Core_DAO::commonRetrieve($dao, $params, $defaults);
-      if (CRM_Utils_Array::value('id', $defaults)) {
+      if (!empty($defaults['id'])) {
         $result['entityId'] = $defaults['id'];
         $result['entityTable'] = $entityTable;
       }
index ab9a3f466c88b6da8be23eab2dd6856bd1b7c4ee..f3247fe26916d4b27d373aa13bc843785c28de63 100644 (file)
@@ -250,15 +250,15 @@ class CRM_Core_Form_RecurringEntity {
     if ($values['allowRepeatConfigToSubmit'] == 1) {
       $dayOfTheWeek = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday');
       //Repeats
-      if (!CRM_Utils_Array::value('repetition_frequency_unit', $values)) {
+      if (empty($values['repetition_frequency_unit'])) {
         $errors['repetition_frequency_unit'] = ts('This is a required field');
       }
       //Repeats every
-      if (!CRM_Utils_Array::value('repetition_frequency_interval', $values)) {
+      if (empty($values['repetition_frequency_interval'])) {
         $errors['repetition_frequency_interval'] = ts('This is a required field');
       }
       //Ends
-      if (CRM_Utils_Array::value('ends', $values)) {
+      if (!empty($values['ends'])) {
         if ($values['ends'] == 1) {
           if (empty($values['start_action_offset'])) {
             $errors['start_action_offset'] = ts('This is a required field');
@@ -268,7 +268,7 @@ class CRM_Core_Form_RecurringEntity {
           }
         }
         if ($values['ends'] == 2) {
-          if (CRM_Utils_Array::value('repeat_absolute_date', $values)) {
+          if (!empty($values['repeat_absolute_date'])) {
             $entityStartDate = CRM_Utils_Date::processDate($values['repetition_start_date']);
             $end = CRM_Utils_Date::processDate($values['repeat_absolute_date']);
             if (($end < $entityStartDate) && ($end != 0)) {
@@ -285,9 +285,9 @@ class CRM_Core_Form_RecurringEntity {
       }
 
       //Repeats BY
-      if (CRM_Utils_Array::value('repeats_by', $values)) {
+      if (!empty($values['repeats_by'])) {
         if ($values['repeats_by'] == 1) {
-          if (CRM_Utils_Array::value('limit_to', $values)) {
+          if (!empty($values['limit_to'])) {
             if ($values['limit_to'] < 1 && $values['limit_to'] > 31) {
               $errors['limit_to'] = ts('Invalid day of the month');
             }
@@ -297,7 +297,7 @@ class CRM_Core_Form_RecurringEntity {
           }
         }
         if ($values['repeats_by'] == 2) {
-          if (CRM_Utils_Array::value('entity_status_1', $values)) {
+          if (!empty($values['entity_status_1'])) {
             $dayOfTheWeekNo = array('first', 'second', 'third', 'fourth', 'last');
             if (!in_array($values['entity_status_1'], $dayOfTheWeekNo)) {
               $errors['entity_status_1'] = ts('Invalid option');
@@ -306,7 +306,7 @@ class CRM_Core_Form_RecurringEntity {
           else {
             $errors['entity_status_1'] = ts('Invalid option');
           }
-          if (CRM_Utils_Array::value('entity_status_2', $values)) {
+          if (!empty($values['entity_status_2'])) {
             if (!in_array($values['entity_status_2'], $dayOfTheWeek)) {
               $errors['entity_status_2'] = ts('Invalid day name');
             }
@@ -328,17 +328,17 @@ class CRM_Core_Form_RecurringEntity {
    */
   public static function postProcess($params = array(), $type, $linkedEntities = array()) {
     //Check entity_id not present in params take it from class variable
-    if (!CRM_Utils_Array::value('entity_id', $params)) {
+    if (empty($params['entity_id'])) {
       $params['entity_id'] = self::$_entityId;
     }
     //Process this function only when you get this variable
     if ($params['allowRepeatConfigToSubmit'] == 1) {
       if (CRM_Utils_Array::value('entity_table', $params) && CRM_Utils_Array::value('entity_id', $params) && $type) {
         $params['used_for'] = $type;
-        if (!CRM_Utils_Array::value('parent_entity_id', $params)) {
+        if (empty($params['parent_entity_id'])) {
           $params['parent_entity_id'] = self::$_parentEntityId;
         }
-        if (CRM_Utils_Array::value('schedule_reminder_id', $params)) {
+        if (!empty($params['schedule_reminder_id'])) {
           $params['id'] = $params['schedule_reminder_id'];
         }
         else {
@@ -350,7 +350,7 @@ class CRM_Core_Form_RecurringEntity {
         $dbParams = $recurobj->mapFormValuesToDB($params);
 
         //Delete repeat configuration and rebuild
-        if (CRM_Utils_Array::value('id', $params)) {
+        if (!empty($params['id'])) {
           CRM_Core_BAO_ActionSchedule::del($params['id']);
           unset($params['id']);
         }
@@ -468,7 +468,7 @@ class CRM_Core_Form_RecurringEntity {
           $recursion->excludeDates = $excludeDateList;
           $recursion->excludeDateRangeColumns = $params['excludeDateRangeColumns'];
         }
-        if (CRM_Utils_Array::value('intervalDateColumns', $params)) {
+        if (!empty($params['intervalDateColumns'])) {
           $recursion->intervalDateColumns = $params['intervalDateColumns'];
         }
         $recursion->entity_id = $params['entity_id'];
index 726fcc0ddda8b57ab51debfd693badc48f8c3127..7265eeda26c6f08f0411fcab863d0be281bce36d 100644 (file)
@@ -20,7 +20,7 @@ class CRM_Core_Page_AJAX_RecurringEntity {
       $entityId = CRM_Utils_Type::escape($_REQUEST['entityId'], 'Integer');
       $entityTable = CRM_Utils_Type::escape($_REQUEST['entityTable'], 'String');
 
-      if (CRM_Utils_Array::value('linkedEntityTable', $_REQUEST)) {
+      if (!empty($_REQUEST['linkedEntityTable'])) {
         $result = CRM_Core_BAO_RecurringEntity::updateModeLinkedEntity($entityId, $_REQUEST['linkedEntityTable'], $entityTable);
       }
 
index f8dca07695b542eb85c1cdf74789157a911f5fd0..32befd8c0ab9ffd19084411b117acbed304e229e 100644 (file)
@@ -390,7 +390,7 @@ class CRM_Dedupe_BAO_RuleGroup extends CRM_Dedupe_DAO_RuleGroup {
   public static function dedupeRuleFieldsWeight($params) {
     $rgBao = new CRM_Dedupe_BAO_RuleGroup();
     $rgBao->contact_type = $params['contact_type'];
-    if (CRM_Utils_Array::value('id', $params)) {
+    if (!empty($params['id'])) {
       // accept an ID if provided
       $rgBao->id = $params['id'];
     }
index 178fbea43e5df92d80077b95ecc0389cb685d750..7aa096163b290102e87732674b499d7284884e8e 100644 (file)
@@ -241,7 +241,7 @@ class CRM_Event_Form_ParticipantFeeSelection extends CRM_Core_Form {
     CRM_Event_BAO_Participant::changeFeeSelections($params, $this->_participantId, $this->_contributionId, $feeBlock, $lineItems, $this->_paidAmount, $params['priceSetId']);
     $this->contributionAmt = CRM_Core_DAO::getFieldValue('CRM_Contribute_BAO_Contribution', $this->_contributionId, 'total_amount');
     // email sending
-    if (CRM_Utils_Array::value('send_receipt', $params)) {
+    if (!empty($params['send_receipt'])) {
       $fetchParticipantVals = array('id' => $this->_participantId);
       CRM_Event_BAO_Participant::getValues($fetchParticipantVals, $participantDetails, CRM_Core_DAO::$_nullArray);
       $participantParams = array_merge($params, $participantDetails[$this->_participantId]);
index 577105ed32e3e6981291f20d868573e95c1d960c..e0a6e90f064af65f86a58555644a4b15bd6c91c7 100644 (file)
@@ -1068,7 +1068,7 @@ WHERE  id = %1";
     foreach ($params['price_set_id'] as $priceSetID) {
       CRM_Price_BAO_PriceSet::addTo('civicrm_' . $entityName, $entity->id, $priceSetID);
       //@todo - how should we do this - copied from form
-      //if (CRM_Utils_Array::value('price_field_id', $params)) {
+      //if (!empty($params['price_field_id'])) {
       //  $priceSetID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $params['price_field_id'], 'price_set_id');
       //  CRM_Price_BAO_PriceSet::setIsQuickConfig($priceSetID, 0);
       //}
index 3e184f5945f6b5c9d9702c6b2b2b20b8132493c2..dbd180330e64d1f23dae8cd6cc6c7db36caa88d7 100644 (file)
@@ -209,7 +209,7 @@ class CRM_Report_BAO_ReportInstance extends CRM_Report_DAO_ReportInstance {
         $chart = "&charts=" . $params['charts'];
       }
       $limitResult = NULL;
-      if (CRM_Utils_Array::value('row_count', $params)) {
+      if (!empty($params['row_count'])) {
         $limitResult = '&rowCount=' . $params['row_count'];
       }
       $dashletParams['name'] = "report/{$instance->id}";