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
1 changed files with 5 additions and 6 deletions

View File

@ -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');
}