Auto-open campaign widget and sort by start date
authorColeman Watts <coleman@civicrm.org>
Sat, 16 Feb 2019 21:25:18 +0000 (16:25 -0500)
committerColeman Watts <coleman@civicrm.org>
Sat, 16 Feb 2019 21:49:53 +0000 (16:49 -0500)
CRM/Campaign/BAO/Campaign.php
CRM/Campaign/Form/Petition.php
CRM/Campaign/Form/Survey/Main.php
api/v3/Campaign.php

index 9170beecb3b578fd0faf047e82468633b6407dea..6929423cbb244b9ce3a9375cd7cc78e9b635b2c2 100644 (file)
@@ -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) {
index 7257478b1ebaa7f6b3e75da3b43a702ef8787bde..d04659c297f98344a545aa943da420bbc7d74895 100644 (file)
@@ -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'));
index b69ea6602cb068afa347132fb49bb6254fdadf3a..2ef5899ad9f08b2dd0de09cc24b4b24c476a35d2 100644 (file)
@@ -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
index f99feb3ab8a1e2b79cf8aa49b6b60b2722dae2c7..29c6be4720f3bcb954333b627679790363480b2b 100644 (file)
@@ -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,
     ];