From f21e36e4be9875b5e33e7e5bb38efe40a40c3585 Mon Sep 17 00:00:00 2001 From: Pererinha Date: Fri, 20 Feb 2015 16:47:50 -0200 Subject: [PATCH] orders page text changes #2810 --- include/library/Crunchbutton/Message/Sms.php | 1 + include/library/Crunchbutton/Order.php | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/include/library/Crunchbutton/Message/Sms.php b/include/library/Crunchbutton/Message/Sms.php index a1b53a593..b8c57c810 100644 --- a/include/library/Crunchbutton/Message/Sms.php +++ b/include/library/Crunchbutton/Message/Sms.php @@ -9,6 +9,7 @@ class Crunchbutton_Message_Sms extends Crunchbutton_Message { const REASON_SUPPORT_SUGGESTION = 'support suggestion'; const REASON_PASSWORD_RESET = 'password reset'; const REASON_DRIVER_SETUP = 'driver setup notify'; + const REASON_DRIVER_ORDER_CANCELED = 'driver order canceled'; const REASON_DRIVER_ORDER = 'driver new order'; const REASON_DRIVER_NOTIFIES_CUSTOMER = 'driver notifies customer'; const REASON_DRIVER_SHIFT = 'driver shift'; diff --git a/include/library/Crunchbutton/Order.php b/include/library/Crunchbutton/Order.php index 5aa9c18c1..1695d5d7a 100644 --- a/include/library/Crunchbutton/Order.php +++ b/include/library/Crunchbutton/Order.php @@ -2151,6 +2151,15 @@ class Crunchbutton_Order extends Crunchbutton_Order_Trackchange { return $this->_refundedAmount; } + public function tellDriverTheOrderWasCanceled(){ + $driver = $this->getDeliveryDriver(); + if( $driver->id_admin && $driver->phone ){ + $message = 'Sorry, ' . $this->restaurant()->name . ' order #' . $this->id_order . ' from ' . $this->name . ' was canceled! :('; + Crunchbutton_Support::createNewWarning( [ 'body' => $message, 'phone' => $driver->phone, 'dont_open_ticket' => true ] ); + Crunchbutton_Message_Sms::send( [ 'to' => $driver->phone, 'message' => $message, 'reason' => Crunchbutton_Message_Sms::REASON_DRIVER_ORDER_CANCELED ] ); + } + } + public function refund() { if (!$this->refunded){