From 33ccf435588bb3167d5916953df51e3a9941d3ba Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Sat, 16 Feb 2019 16:25:18 -0500 Subject: [PATCH] Auto-open campaign widget and sort by start date --- CRM/Campaign/BAO/Campaign.php | 1 + CRM/Campaign/Form/Petition.php | 1 + CRM/Campaign/Form/Survey/Main.php | 1 + api/v3/Campaign.php | 1 + 4 files changed, 4 insertions(+) diff --git a/CRM/Campaign/BAO/Campaign.php b/CRM/Campaign/BAO/Campaign.php index 9170beecb3..6929423cbb 100644 --- a/CRM/Campaign/BAO/Campaign.php +++ b/CRM/Campaign/BAO/Campaign.php @@ -602,6 +602,7 @@ INNER JOIN civicrm_group grp ON ( grp.id = campgrp.entity_id ) $campaign = $form->addEntityRef('campaign_id', ts('Campaign'), [ 'entity' => 'campaign', 'create' => TRUE, + 'select' => ['minimumInputLength' => 0], ]); //lets freeze when user does not has access or campaign is disabled. if (!$isCampaignEnabled || !$hasAccessCampaign) { diff --git a/CRM/Campaign/Form/Petition.php b/CRM/Campaign/Form/Petition.php index 7257478b1e..d04659c297 100644 --- a/CRM/Campaign/Form/Petition.php +++ b/CRM/Campaign/Form/Petition.php @@ -193,6 +193,7 @@ class CRM_Campaign_Form_Petition extends CRM_Core_Form { $this->addEntityRef('campaign_id', ts('Campaign'), [ 'entity' => 'campaign', 'create' => TRUE, + 'select' => ['minimumInputLength' => 0], ]); $customContactProfiles = CRM_Core_BAO_UFGroup::getProfiles(array('Individual')); diff --git a/CRM/Campaign/Form/Survey/Main.php b/CRM/Campaign/Form/Survey/Main.php index b69ea6602c..2ef5899ad9 100644 --- a/CRM/Campaign/Form/Survey/Main.php +++ b/CRM/Campaign/Form/Survey/Main.php @@ -132,6 +132,7 @@ class CRM_Campaign_Form_Survey_Main extends CRM_Campaign_Form_Survey { $this->addEntityRef('campaign_id', ts('Campaign'), [ 'entity' => 'campaign', 'create' => TRUE, + 'select' => ['minimumInputLength' => 0], ]); // script / instructions diff --git a/api/v3/Campaign.php b/api/v3/Campaign.php index f99feb3ab8..29c6be4720 100644 --- a/api/v3/Campaign.php +++ b/api/v3/Campaign.php @@ -100,6 +100,7 @@ function _civicrm_api3_campaign_getlist_params(&$request) { $fieldsToReturn = ['title', 'campaign_type_id', 'status_id', 'start_date', 'end_date']; $request['params']['return'] = array_unique(array_merge($fieldsToReturn, $request['extra'])); if (empty($request['params']['id'])) { + $request['params']['options']['sort'] = 'start_date DESC, title'; $request['params'] += [ 'is_active' => 1, ]; -- 2.25.1