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
This commit is contained in:
Ingo Schommer 2007-09-16 01:00:10 +00:00
parent 137f302fbc
commit 8e583e2a4d

View File

@ -430,12 +430,11 @@ class NewsletterAdmin extends LeftAndMain {
switch($_REQUEST['SendType']) { switch($_REQUEST['SendType']) {
case "Test": case "Test":
if($_REQUEST['TestEmail']) { if($_REQUEST['TestEmail']) {
if( $nlType->Template ) { $e->To = $_REQUEST['TestEmail'];
self::sendToAddress( $e, $_REQUEST['TestEmail'], $messageID ); $e->setTemplate( $nlType->Template );
FormResponse::status_message('Sent test to ' . $_REQUEST['TestEmail'],'good');
} else { self::sendToAddress( $e, $_REQUEST['TestEmail'], $messageID );
FormResponse::status_message('No template selected','bad'); FormResponse::status_message('Sent test to ' . $_REQUEST['TestEmail'],'good');
}
} else { } else {
FormResponse::status_message('Please enter an email address','bad'); FormResponse::status_message('Please enter an email address','bad');
} }