/** * 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); }
// Cart Manager $o1 = new rtShopCartManager(); $t->isa_ok($o1, 'rtShopCartManager', '->class() rtShopCartManager object is available'); // Promotion Toolkit $o2 = new rtShopPromotionToolkit(); $t->isa_ok($o2, 'rtShopPromotionToolkit', '->class() rtShopPromotionToolkit class is available'); // Voucher Toolkit $o3 = new rtShopVoucherToolkit(); $t->isa_ok($o3, 'rtShopVoucherToolkit', '->class() rtShopVoucherToolkit class is available'); unset($o1, $o3, $o3); $t->diag('-----------------------------------------------------------------------------'); $t->diag('1. Check models'); $t->diag('-----------------------------------------------------------------------------'); rtShopOrderTestTools::clean(); try { $i1 = new rtShopOrder(); $i1->save(); $t->pass('->save() rtShopOrder allows empty saves'); $i1->delete(); } catch (Exception $e) { $t->fail('->save() rtShopOrder throws an Exception!'); } // Clean up unset($i1); try { $i1 = new rtShopProduct(); $i1->save(); $t->pass('->save() rtShopProduct allows empty saves'); $i1->delete(); } catch (Exception $e) { $t->fail('->save() rtShopProduct throws an Exception!');
/** * 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; }