From f598ae72d6f715ec8011522373ade2088d217797 Mon Sep 17 00:00:00 2001 From: Eileen Date: Wed, 23 Oct 2013 09:38:50 +1300 Subject: [PATCH] CRM-13600 CiviMail form - allow CiviMails from advanced search for users with no group view permissions (ACL hook based permissions) ---------------------------------------- * CRM-13600: Contacts with access to no mailing groups cannot do search based CiviMails http://issues.civicrm.org/jira/browse/CRM-13600 --- CRM/Mailing/Form/Group.php | 3 +++ templates/CRM/Mailing/Form/Group.tpl | 13 ++++--------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/CRM/Mailing/Form/Group.php b/CRM/Mailing/Form/Group.php index c1f730c9f4..06f5e04f1c 100644 --- a/CRM/Mailing/Form/Group.php +++ b/CRM/Mailing/Form/Group.php @@ -315,6 +315,9 @@ class CRM_Mailing_Form_Group extends CRM_Contact_Form_Task { $this->assign('groupCount', count($groups)); $this->assign('mailingCount', count($mailings)); + if(count($groups) == 0 && count($mailings) == 0 && !$this->_searchBasedMailing) { + CRM_Core_Error::statusBounce("To send a mailing, you must have a valid group of recipients - either at least one group that's a Mailing List or at least one previous mailing or start from a search"); + } } public function postProcess() { diff --git a/templates/CRM/Mailing/Form/Group.tpl b/templates/CRM/Mailing/Form/Group.tpl index af02aacd0e..db43345d8c 100644 --- a/templates/CRM/Mailing/Form/Group.tpl +++ b/templates/CRM/Mailing/Form/Group.tpl @@ -23,12 +23,7 @@ | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ *} -{if $groupCount == 0 and $mailingCount == 0} -
-
- {ts}To send a mailing, you must have a valid group of recipients - either at least one group that's a Mailing List or at least one previous mailing.{/ts} -
-{else} +
{include file="CRM/common/WizardHeader.tpl"} @@ -51,7 +46,7 @@ - +{if ($groupCount > 0|| $mailingCount > 0)}
@@ -78,7 +73,7 @@ {/strip}
- +{/if}
{include file="CRM/common/formButtons.tpl"}
@@ -93,4 +88,4 @@ cj(function() { {* include jscript to warn if unsaved form field changes *} {include file="CRM/common/formNavigate.tpl"}
-{/if} + -- 2.25.1