From 8e583e2a4d4e67e726cf60c895591f8c6c4ce3a2 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sun, 16 Sep 2007 01:00:10 +0000 Subject: [PATCH] elofgren: Don't show a 'No template selected' error when sending a test Newsletter if no template has been selected since templates for Emails are optional. See Email::parseVariables(). Resolves gsoc trac ticket: #53 "No template selected" error only occurs when "Send test to", but not when "Send to the mailing list" is selected (merged from branches/gsoc) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@41998 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/NewsletterAdmin.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/code/NewsletterAdmin.php b/code/NewsletterAdmin.php index 525b1efd..8681956d 100755 --- a/code/NewsletterAdmin.php +++ b/code/NewsletterAdmin.php @@ -430,12 +430,11 @@ class NewsletterAdmin extends LeftAndMain { switch($_REQUEST['SendType']) { case "Test": if($_REQUEST['TestEmail']) { - if( $nlType->Template ) { - self::sendToAddress( $e, $_REQUEST['TestEmail'], $messageID ); - FormResponse::status_message('Sent test to ' . $_REQUEST['TestEmail'],'good'); - } else { - FormResponse::status_message('No template selected','bad'); - } + $e->To = $_REQUEST['TestEmail']; + $e->setTemplate( $nlType->Template ); + + self::sendToAddress( $e, $_REQUEST['TestEmail'], $messageID ); + FormResponse::status_message('Sent test to ' . $_REQUEST['TestEmail'],'good'); } else { FormResponse::status_message('Please enter an email address','bad'); }