From a7542fe3f51695a9c30224715f970045ef700863 Mon Sep 17 00:00:00 2001 From: arzynik Date: Thu, 19 Jul 2012 06:25:19 -0400 Subject: [PATCH] fixed email ordering --- cli/notify.php | 6 +++--- .../default/crunchbutton/api/test/index.php | 5 +++-- include/library/Crunchbutton/App.php | 15 ++++++++++++++- include/library/Crunchbutton/Email/Order.php | 11 +++++------ include/library/Crunchbutton/Notification.php | 2 +- include/library/Crunchbutton/Restaurant.php | 2 +- 6 files changed, 27 insertions(+), 14 deletions(-) diff --git a/cli/notify.php b/cli/notify.php index 6a109bd21..5c09bce8e 100755 --- a/cli/notify.php +++ b/cli/notify.php @@ -1,6 +1,6 @@ -#!/usr/bin/php +#!/usr/local/bin/php notify(); -//exec('nohup /usr/bin/my-command > /dev/null 2>&1 &'); \ No newline at end of file +//exec('nohup /usr/bin/my-command > /dev/null 2>&1 &'); diff --git a/include/controllers/default/crunchbutton/api/test/index.php b/include/controllers/default/crunchbutton/api/test/index.php index d8307926b..fbc93821f 100644 --- a/include/controllers/default/crunchbutton/api/test/index.php +++ b/include/controllers/default/crunchbutton/api/test/index.php @@ -2,7 +2,8 @@ class Controller_api_test extends Crunchbutton_Controller_Rest { public function init() { - $o = new Order(64); - $o->notify(); + + $o = new Order(111); + $o->notify(); } } \ No newline at end of file diff --git a/include/library/Crunchbutton/App.php b/include/library/Crunchbutton/App.php index b8f11cb60..3fb984a5c 100755 --- a/include/library/Crunchbutton/App.php +++ b/include/library/Crunchbutton/App.php @@ -38,7 +38,20 @@ class Crunchbutton_App extends Cana_App { $params['env'] = 'live'; break; default: - $params['env'] = 'local'; + switch (dirname(__FILE__)) { + case '/home/beta.crunchbutton/include/library/Crunchbutton': + $params['env'] = 'beta'; + $_SERVER['__HTTP_HOST'] = 'beta.crunchr.co'; + break; + case '/home/crunchbutton/include/library/Crunchbutton': + $params['env'] = 'live'; + $_SERVER['__HTTP_HOST'] = 'crunchr.co'; + break; + default: + $params['env'] = 'local'; + break; + } + break; } } diff --git a/include/library/Crunchbutton/Email/Order.php b/include/library/Crunchbutton/Email/Order.php index ae4f9b881..f907d30bc 100644 --- a/include/library/Crunchbutton/Email/Order.php +++ b/include/library/Crunchbutton/Email/Order.php @@ -6,12 +6,10 @@ class Crunchbutton_Email_Order extends Crunchbutton_Email { public function __construct($params) { - $params['toEmail'] = '_EMAIL'; - $params['toName'] = 'TREST'; - $params['subject'] = 'Contact'; - $params['fromEmail'] = 'ubertest@arzynik.com'; - $params['replyTo'] = 'replytome@arzynik.com'; - $params['fromName'] = 'TRESTER'; + $params['to'] = $params['email']; + $params['subject'] = 'Customer Order'; + $params['from'] = 'Crunchbutton '; + $params['reply'] = 'replytome@arzynik.com'; $this->buildView($params); $this->view()->subject = $params['subject']; @@ -19,6 +17,7 @@ class Crunchbutton_Email_Order extends Crunchbutton_Email { $this->view()->message = $params['message']; $params['messageHtml'] = $this->view()->render('order/index',['display' => true, 'set' => ['order' => $params['order']]]); + parent::__construct($params); } } diff --git a/include/library/Crunchbutton/Notification.php b/include/library/Crunchbutton/Notification.php index e9453c1f5..15ac31c6d 100644 --- a/include/library/Crunchbutton/Notification.php +++ b/include/library/Crunchbutton/Notification.php @@ -6,7 +6,7 @@ class Crunchbutton_Notification extends Cana_Table { //$env = c::env() == 'live' ? 'live' : 'dev'; $env = 'dev'; $num = ($env == 'live' ? $this->value : c::config()->twilio->testnumber); - $mail = ($env == 'live' ? $this->value : '_EMAIL'); + $mail = ($env == 'live' ? $this->value : 'arzynik@gmail.com'); $fax = ($env == 'live' ? $this->value : '_EMAIL'); switch ($this->type) { diff --git a/include/library/Crunchbutton/Restaurant.php b/include/library/Crunchbutton/Restaurant.php index 5f6513800..6aa6e57d1 100644 --- a/include/library/Crunchbutton/Restaurant.php +++ b/include/library/Crunchbutton/Restaurant.php @@ -72,7 +72,7 @@ class Crunchbutton_Restaurant extends Cana_Table { public function notifications() { if (!isset($this->_notifications)) { - $this->_notifications = Notification::q('select * from notification where id_restaurant="'.$this->id_restaurant.'"'); + $this->_notifications = Notification::q('select * from notification where id_restaurant="'.$this->id_restaurant.'" and active=1'); } return $this->_notifications; }