/** * Status update to "Picking", send email to random dispatch user to notify of * confirmation that order is ready to send. * * @param rtShopOrder $rt_shop_order */ protected function notifyStatusChangeToPicking($rt_shop_order) { // Retrieve active users with dispatch permission $dispatch_users = Doctrine::getTable('rtGuardUser')->getUsersArrayByPermissionQuery('admin_shop_order_dispatch')->execute(array(), Doctrine_Core::HYDRATE_SCALAR); // Stop if no dispatch user available if (count($dispatch_users) == 0) { return; } // Randomize selection shuffle($dispatch_users); $dispatch_user = $dispatch_users[0]; // Send mail $vars = array('dispatch_user' => $dispatch_user); $vars['rt_shop_order'] = $rt_shop_order; $vars['user'] = $rt_shop_order->getBillingAddress() ? $rt_shop_order->getBillingAddress()->getData() : ''; $message_html = $this->getPartial('rtShopOrderAdmin/email_status_dispatch_html', $vars); $message_html = $this->getPartial('rtEmail/layout_html', array('content' => $message_html)); $message_plain = $this->getPartial('rtShopOrderAdmin/email_status_dispatch_plain', $vars); $message_plain = $this->getPartial('rtEmail/layout_plain', array('content' => html_entity_decode($message_plain))); $message = Swift_Message::newInstance()->setFrom(sfConfig::get('app_rt_shop_order_admin_email', '*****@*****.**'))->setTo($dispatch_user['u_email_address'])->setSubject('Order #' . $rt_shop_order->getReference() . ' ready for picking')->setBody($message_html, 'text/html')->addPart($message_plain, 'text/plain'); $this->getMailer()->send($message); }
/** * Create voucher, notify recipient * * @param rtShopOrder $order * @return boolean */ public function createWithOrder(rtShopOrder $order) { $voucher = $this->persistSessionVoucher('Created with order: #' . $order->getReference(), 'Gift Voucher created by: ' . $order->getBillingAddress()->getFirstName() . ' ' . $order->getBillingAddress()->getLastName()); if ($voucher) { $this->notifyRecipientFromRtShopOrder($order); //$this->resetSessionVoucher(); return $voucher; } return false; }