From 31815c2b91726ba0feb0e40cbb3b4f7476c13365 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Thu, 24 Aug 2017 06:46:34 +1000 Subject: [PATCH] CRM-21100 Hotfix to ensure that testGroup list is still the same as previous, need to work on converting to AJAX list --- CRM/Mailing/Info.php | 8 +++++++- ang/crmMailing/BlockPreview.html | 2 +- ang/crmMailing/BlockPreview.js | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CRM/Mailing/Info.php b/CRM/Mailing/Info.php index c73f45d26d..59ec9e1235 100644 --- a/CRM/Mailing/Info.php +++ b/CRM/Mailing/Info.php @@ -95,7 +95,11 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info { 'options' => array('limit' => 0), 'sequential' => 1, ); - + $groupNames = civicrm_api3('Group', 'get', $params + array( + 'is_active' => 1, + 'check_permissions' => TRUE, + 'return' => array('title', 'visibility', 'group_type', 'is_hidden'), + )); $headerfooterList = civicrm_api3('MailingComponent', 'get', $params + array( 'is_active' => 1, 'return' => array('name', 'component_type', 'is_default', 'body_html', 'body_text'), @@ -130,6 +134,8 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info { 'civiMails' => array(), 'campaignEnabled' => in_array('CiviCampaign', $config->enableComponents), 'groupNames' => array(), + // @todo see if we can remove this by dynamically generating the test group list + 'testGroupNames' => $groupNames['values'], 'headerfooterList' => $headerfooterList['values'], 'mesTemplate' => $mesTemplate['values'], 'emailAdd' => $emailAdd['values'], diff --git a/ang/crmMailing/BlockPreview.html b/ang/crmMailing/BlockPreview.html index 0949fd619c..747c7b0e04 100644 --- a/ang/crmMailing/BlockPreview.html +++ b/ang/crmMailing/BlockPreview.html @@ -49,7 +49,7 @@ Vars: mailing:obj, testContact:obj, testGroup:obj, crmMailing:FormController ui-jq="crmSelect2" ui-options="{dropdownAutoWidth : true, allowClear: true, placeholder: ts('Select Group')}" ng-model="testGroup.gid" - ng-options="group.id as group.title for group in crmMailingConst.groupNames|orderBy:'title'" + ng-options="group.id as group.title for group in crmMailingConst.testGroupNames|orderBy:'title'" class="crm-action-menu fa-envelope-o" > diff --git a/ang/crmMailing/BlockPreview.js b/ang/crmMailing/BlockPreview.js index 561ddf0950..36b72ea981 100644 --- a/ang/crmMailing/BlockPreview.js +++ b/ang/crmMailing/BlockPreview.js @@ -29,7 +29,7 @@ scope.previewTestGroup = function(e) { var $dialog = $(this); $dialog.html('
').parent().find('button[data-op=yes]').prop('disabled', true); - $dialog.dialog('option', 'title', ts('Send to %1', {1: _.pluck(_.where(scope.crmMailingConst.groupNames, {id: scope.testGroup.gid}), 'title')[0]})); + $dialog.dialog('option', 'title', ts('Send to %1', {1: _.pluck(_.where(scope.crmMailingConst.testGroupNames, {id: scope.testGroup.gid}), 'title')[0]})); CRM.api3('contact', 'get', { group: scope.testGroup.gid, options: {limit: 0}, -- 2.25.1