From da16bf54a32d1ef8dd946feb8e17c466468b3621 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Thu, 30 Apr 2020 07:17:34 +0000 Subject: [PATCH] Add scheduleOptionStatus API call. #392 --- src/Controller/APIController.php | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/Controller/APIController.php b/src/Controller/APIController.php index 908dda39..7c99f912 100644 --- a/src/Controller/APIController.php +++ b/src/Controller/APIController.php @@ -2696,23 +2696,19 @@ class APIController extends Controller implements LoggedController if ($res->isError()) return $res->getReturnResponse(); - // TODO: end of ECQ, have this return true $schedule_choice = true; - // TODO: remove the time check after ECQ + // TODO: remove the time check after ECQ. This will then always return true // get current time - $current_time = time(); - $start_advance_order_time = strtotime('17:00'); - $end_advance_order_time = strtotime('08:00'); - //$start_advance_order_time = strtotime('08:00'); - //$end_advance_order_time = strtotime('17:00'); + $current_datetime = new DateTime(); - error_log(date('Y-m-d H:i:s', $current_time)); - error_log(date('Y-m-d H:i:s', $start_advance_order_time)); - error_log(date('Y-m-d H:i:s', $end_advance_order_time)); + // get the hour + $current_time = $current_datetime->format('g:i A'); - if (($current_time > $start_advance_order_time) && - ($current_time < $end_advance_order_time)) + $time_array = explode(':', $current_time); + $hour = $time_array[0]; + + if (($hour < 8) && ($hour > 5)) $schedule_choice = false; $data = [