}
//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);
'sortOrder' => 'desc',
);
foreach ($sortParams as $name => $default) {
- if (CRM_Utils_Array::value($name, $params)) {
+ if (!empty($params[$name])) {
$sortParams[$name] = $params[$name];
}
}
//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']);
}
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;