CRM-14106 - Regex targeting the first part of if statements
[civicrm-core.git] / CRM / Campaign / BAO / Campaign.php
index 8a4979e916b7a9e73398cde960dc7d7309b0b681..707005b282dab4d0e439dc5d9064d4924076a675 100644 (file)
@@ -89,7 +89,7 @@ Class CRM_Campaign_BAO_Campaign extends CRM_Campaign_DAO_Campaign {
     }
 
     //store custom data
-    if (CRM_Utils_Array::value('custom', $params) &&
+    if (!empty($params['custom']) &&
       is_array($params['custom'])
     ) {
       CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_campaign', $campaign->id);
@@ -320,7 +320,7 @@ Order By  camp.title";
         'sortOrder' => 'desc',
       );
       foreach ($sortParams as $name => $default) {
-        if (CRM_Utils_Array::value($name, $params)) {
+        if (!empty($params[$name])) {
           $sortParams[$name] = $params[$name];
         }
       }
@@ -354,40 +354,40 @@ INNER JOIN civicrm_option_group grp ON ( campaign_type.option_group_id = grp.id
 
     //build the where clause.
     $queryParams = $where = array();
-    if (CRM_Utils_Array::value('id', $params)) {
+    if (!empty($params['id'])) {
       $where[] = "( campaign.id = %1 )";
       $queryParams[1] = array($params['id'], 'Positive');
     }
-    if (CRM_Utils_Array::value('name', $params)) {
+    if (!empty($params['name'])) {
       $where[] = "( campaign.name LIKE %2 )";
       $queryParams[2] = array('%' . trim($params['name']) . '%', 'String');
     }
-    if (CRM_Utils_Array::value('title', $params)) {
+    if (!empty($params['title'])) {
       $where[] = "( campaign.title LIKE %3 )";
       $queryParams[3] = array('%' . trim($params['title']) . '%', 'String');
     }
-    if (CRM_Utils_Array::value('start_date', $params)) {
+    if (!empty($params['start_date'])) {
       $startDate      = CRM_Utils_Date::processDate($params['start_date']);
       $where[]        = "( campaign.start_date >= %4 OR campaign.start_date IS NULL )";
       $queryParams[4] = array($startDate, 'String');
     }
-    if (CRM_Utils_Array::value('end_date', $params)) {
+    if (!empty($params['end_date'])) {
       $endDate        = CRM_Utils_Date::processDate($params['end_date'], '235959');
       $where[]        = "( campaign.end_date <= %5 OR campaign.end_date IS NULL )";
       $queryParams[5] = array($endDate, 'String');
     }
-    if (CRM_Utils_Array::value('description', $params)) {
+    if (!empty($params['description'])) {
       $where[] = "( campaign.description LIKE %6 )";
       $queryParams[6] = array('%' . trim($params['description']) . '%', 'String');
     }
-    if (CRM_Utils_Array::value('campaign_type_id', $params)) {
+    if (!empty($params['campaign_type_id'])) {
       $typeId = $params['campaign_type_id'];
       if (is_array($params['campaign_type_id'])) {
         $typeId = implode(' , ', $params['campaign_type_id']);
       }
       $where[] = "( campaign.campaign_type_id IN ( {$typeId} ) )";
     }
-    if (CRM_Utils_Array::value('status_id', $params)) {
+    if (!empty($params['status_id'])) {
       $statusId = $params['status_id'];
       if (is_array($params['status_id'])) {
         $statusId = implode(' , ', $params['status_id']);
@@ -396,7 +396,7 @@ INNER JOIN civicrm_option_group grp ON ( campaign_type.option_group_id = grp.id
     }
     if (array_key_exists('is_active', $params)) {
       $active = "( campaign.is_active = 1 )";
-      if (CRM_Utils_Array::value('is_active', $params)) {
+      if (!empty($params['is_active'])) {
         $active = "( campaign.is_active = 0 OR campaign.is_active IS NULL )";
       }
       $where[] = $active;