コード例 #1
0
 /**
  * @param OrderEvent $event
  *
  * Check if we're the payment module, and send the payment confirmation email to the customer if it's the case.
  */
 public function sendConfirmationEmail(OrderEvent $event)
 {
     if ($event->getOrder()->getPaymentModuleId() === Cheque::getModuleId()) {
         if ($event->getOrder()->isPaid(true)) {
             $order = $event->getOrder();
             $this->mailer->sendEmailToCustomer('order_confirmation_cheque', $order->getCustomer(), ['order_id' => $order->getId(), 'order_ref' => $order->getRef()]);
         }
     }
 }
コード例 #2
0
 public function createPassword(AdministratorEvent $event)
 {
     $admin = $event->getAdministrator();
     $email = $admin->getEmail();
     if (!empty($email)) {
         $renewToken = $this->tokenProvider->getToken();
         $admin->setPasswordRenewToken($renewToken)->save();
         $this->mailer->sendEmailMessage('new_admin_password', [ConfigQuery::getStoreEmail() => ConfigQuery::getStoreName()], [$email => $admin->getFirstname() . ' ' . $admin->getLastname()], ['token' => $renewToken, 'admin' => $admin]);
     }
 }
コード例 #3
0
ファイル: SendMail.php プロジェクト: vigourouxjulien/thelia
 /**
  * Send email to notify customer that files for virtual products are available
  *
  * @param OrderEvent $event
  * @throws \Exception
  */
 public function sendEmail(OrderEvent $event)
 {
     $order = $event->getOrder();
     // Be sure that we have a document to download
     $virtualProductCount = OrderProductQuery::create()->filterByOrderId($order->getId())->filterByVirtual(true)->filterByVirtualDocument(null, Criteria::NOT_EQUAL)->count();
     if ($virtualProductCount > 0) {
         $customer = $order->getCustomer();
         $this->mailer->sendEmailToCustomer('mail_virtualproduct', $customer, ['customer_id' => $customer->getId(), 'order_id' => $order->getId(), 'order_ref' => $order->getRef(), 'order_date' => $order->getCreatedAt(), 'update_date' => $order->getUpdatedAt()]);
     } else {
         Tlog::getInstance()->warning("Virtual product download message not sent to customer: there's nothing to downnload");
     }
 }
コード例 #4
0
 public function update_status(OrderEvent $event)
 {
     if ($event->getOrder()->getDeliveryModuleId() === FreeShipping::getModuleId()) {
         if ($event->getOrder()->isSent()) {
             $contact_email = ConfigQuery::getStoreEmail();
             if ($contact_email) {
                 $order = $event->getOrder();
                 $customer = $order->getCustomer();
                 $this->mailer->sendEmailToCustomer(FreeShipping::MESSAGE_SEND_CONFIRMATION, $order->getCustomer(), ['order_id' => $order->getId(), 'order_ref' => $order->getRef(), 'customer_id' => $customer->getId(), 'order_date' => $order->getCreatedAt(), 'update_date' => $order->getUpdatedAt(), 'package' => $order->getDeliveryRef()]);
             }
         }
     }
 }
コード例 #5
0
ファイル: SendConfirmationEmail.php プロジェクト: bibich/Atos
 public function updateStatus(OrderEvent $event)
 {
     $order = $event->getOrder();
     if ($order->isPaid() && $order->getPaymentModuleId() == Atos::getModuleId()) {
         if (Atos::getConfigValue('send_payment_confirmation_message')) {
             $this->mailer->sendEmailToCustomer(Atos::CONFIRMATION_MESSAGE_NAME, $order->getCustomer(), ['order_id' => $order->getId(), 'order_ref' => $order->getRef()]);
         }
         // Send confirmation email if required.
         if (Atos::getConfigValue('send_confirmation_message_only_if_paid')) {
             $event->getDispatcher()->dispatch(TheliaEvents::ORDER_SEND_CONFIRMATION_EMAIL, $event);
         }
         Tlog::getInstance()->debug("Confirmation email sent to customer " . $order->getCustomer()->getEmail());
     }
 }
コード例 #6
0
ファイル: Customer.php プロジェクト: gillesbourgeat/core
 public function lostPassword(LostPasswordEvent $event)
 {
     if (null !== ($customer = CustomerQuery::create()->filterByEmail($event->getEmail())->findOne())) {
         $password = Password::generateRandom(8);
         $customer->setPassword($password)->save();
         $this->mailer->sendEmailToCustomer('lost_password', $customer, ['password' => $password]);
     }
 }
コード例 #7
0
ファイル: CommentAction.php プロジェクト: blump/Comment
 /**
  * Notify shop managers of a new comment.
  * @param CommentCreateEvent $event
  */
 public function notifyAdminOfNewComment(CommentCreateEvent $event)
 {
     $config = \Comment\Comment::getConfig();
     if (!$config["notify_admin_new_comment"]) {
         return;
     }
     $comment = $event->getComment();
     if ($comment === null) {
         return;
     }
     // get the default shop locale
     $shopLang = LangQuery::create()->findOneByByDefault(true);
     if ($shopLang !== null) {
         $shopLocale = $shopLang->getLocale();
     } else {
         $shopLocale = null;
     }
     $getCommentRefEvent = new CommentReferenceGetterEvent($comment->getRef(), $comment->getRefId(), $shopLocale);
     $event->getDispatcher()->dispatch(CommentEvents::COMMENT_REFERENCE_GETTER, $getCommentRefEvent);
     $this->mailer->sendEmailToShopManagers('new_comment_notification_admin', ['comment_id' => $comment->getId(), 'ref_title' => $getCommentRefEvent->getTitle(), 'ref_type_title' => $getCommentRefEvent->getTypeTitle()]);
 }
コード例 #8
0
ファイル: Order.php プロジェクト: badelas/thelia
 /**
  * @param OrderEvent $event
  *
  * @throws \Exception if the message cannot be loaded.
  */
 public function sendNotificationEmail(OrderEvent $event)
 {
     $this->mailer->sendEmailToShopManagers('order_notification', ['order_id' => $event->getOrder()->getId(), 'order_ref' => $event->getOrder()->getRef()]);
 }
コード例 #9
0
ファイル: Newsletter.php プロジェクト: vigourouxjulien/thelia
 /**
  * @since 2.3.0-alpha2
  */
 public function confirmSubscription(NewsletterEvent $event)
 {
     $this->mailer->sendEmailMessage('newsletter_subscription_confirmation', [ConfigQuery::getStoreEmail() => ConfigQuery::getStoreName()], [$event->getEmail() => $event->getFirstname() . " " . $event->getLastname()], ['email' => $event->getEmail(), 'firstname' => $event->getFirstname(), 'lastname' => $event->getLastname()], $event->getLocale());
 }