From 565b15f8bc72684ec86d9a00c21f7d59055831b8 Mon Sep 17 00:00:00 2001 From: Jon Goldberg Date: Mon, 7 Jun 2021 15:47:15 -0400 Subject: [PATCH] mailing#96: Warn on invalid mailing options --- CRM/Mailing/BAO/Mailing.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CRM/Mailing/BAO/Mailing.php b/CRM/Mailing/BAO/Mailing.php index 576a5cfffd..7cb36cdede 100644 --- a/CRM/Mailing/BAO/Mailing.php +++ b/CRM/Mailing/BAO/Mailing.php @@ -398,6 +398,9 @@ class CRM_Mailing_BAO_Mailing extends CRM_Mailing_DAO_Mailing { * @return array */ public static function getLocationFilterAndOrderBy($email_selection_method, $location_type_id) { + if ($email_selection_method !== 'automatic' && !$location_type_id) { + throw new \CRM_Core_Exception('You set an email Selection Method without specifying a Location Type. Please go back and change your recipient settings (using the wrench icon next to "Recipients".'); + } $email = CRM_Core_DAO_Email::getTableName(); // Note: When determining the ORDER that results are returned, it's // the record that comes last that counts. That's because we are -- 2.25.1