From 580855c9c1521e15b77653b137df7328fded6af5 Mon Sep 17 00:00:00 2001 From: Hidenori Goto Date: Mon, 27 Sep 2010 17:19:23 +0900 Subject: [PATCH] fixed: opMailSend::sendTemplateMail() --- lib/util/opMailSend.class.php | 31 +++++++++++++++++++++---------- 1 files changed, 21 insertions(+), 10 deletions(-) diff --git a/lib/util/opMailSend.class.php b/lib/util/opMailSend.class.php index dfd35ce..b9134e0 100644 --- a/lib/util/opMailSend.class.php +++ b/lib/util/opMailSend.class.php @@ -138,17 +138,28 @@ class opMailSend $signature = "\n".$signature; } - $subject = $params['subject']; - $notificationMail = Doctrine::getTable('NotificationMail')->fetchTemplate($target.'_'.$template); - if (($notificationMail instanceof NotificationMail) && $notificationMail->getTitle()) + if (!empty($params['subject'])) { - $subject = $notificationMail->getTitle(); - $templateStorage = new sfTemplateStorageString($subject); - $renderer = new opTemplateRendererTwig(); - $params['sf_type'] = null; - $parameterHolder = new sfViewParameterHolder($context->getEventDispatcher(), $params); - $subject = $renderer->evaluate($templateStorage, $parameterHolder->toArray()); - $notificationMail->free(true); + $subject = $params['subject']; + } + else + { + $notificationMail = Doctrine::getTable('NotificationMail')->fetchTemplate($target.'_'.$template); + if (($notificationMail instanceof NotificationMail) && $notificationMail->getTitle()) + { + $subject = $notificationMail->getTitle(); + $templateStorage = new sfTemplateStorageString($subject); + $renderer = new opTemplateRendererTwig(); + $params['sf_type'] = null; + $parameterHolder = new sfViewParameterHolder($context->getEventDispatcher(), $params); + $subject = $renderer->evaluate($templateStorage, $parameterHolder->toArray()); + $notificationMail->free(true); + } + } + + if (empty($subject)) + { + return false; } return self::execute($subject, $to, $from, $body.$signature); -- 1.7.2.3.msysgit.0