From 5a553d379dfcb375223e20faf9cad7ec0513b418 Mon Sep 17 00:00:00 2001 From: Pererinha Date: Thu, 26 Feb 2015 16:24:26 -0300 Subject: [PATCH] partial #4866 --- include/library/Crunchbutton/Community/Shift.php | 8 ++++---- include/library/Crunchbutton/Hour.php | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/library/Crunchbutton/Community/Shift.php b/include/library/Crunchbutton/Community/Shift.php index 1dff4c51a..c61d4bd1b 100644 --- a/include/library/Crunchbutton/Community/Shift.php +++ b/include/library/Crunchbutton/Community/Shift.php @@ -954,14 +954,14 @@ class Crunchbutton_Community_Shift extends Cana_Table { if( $community->id_community ){ $now = new DateTime( 'now', new DateTimeZone( $community->timezone ) ); - $now->modify( '- 2 hours' ); - $from = $now->format( 'Y-m-d' ); + $now->modify( '+ 15 min' ); + $from = $now->format( 'Y-m-d H:i' ); $now->modify( '+ 7 days' ); - $to = $now->format( 'Y-m-d' ); + $to = $now->format( 'Y-m-d H:i' ); $query = 'SELECT DISTINCT( cs.id_community_shift ) AS id, cs.* FROM admin_shift_assign asa INNER JOIN community_shift cs ON cs.id_community_shift = asa.id_community_shift - WHERE DATE_FORMAT( cs.date_start, "%Y-%m-%d" ) >= "' . $from . '" AND DATE_FORMAT( cs.date_start, "%Y-%m-%d" ) <= "' . $to . '" AND cs.id_community = "' . $community->id_community . '"'; + WHERE DATE_FORMAT( cs.date_start, "%Y-%m-%d %H:%i" ) >= "' . $from . '" AND DATE_FORMAT( cs.date_start, "%Y-%m-%d %H:%i" ) <= "' . $to . '" AND cs.id_community = "' . $community->id_community . '"'; $nextShifts = Crunchbutton_Community_Shift::q( $query ); diff --git a/include/library/Crunchbutton/Hour.php b/include/library/Crunchbutton/Hour.php index 0a6d491d6..a165e7456 100644 --- a/include/library/Crunchbutton/Hour.php +++ b/include/library/Crunchbutton/Hour.php @@ -209,6 +209,7 @@ class Crunchbutton_Hour extends Cana_Table_Trackchange { // If the restaurant is 3rd party delivery and the community is auto close // due to it has no driver get the commuinity shift hours // added a config key if we need to disable it on live + if( $restaurant->delivery_service && $restaurant->isCommunityAutoClosed() && intval( Crunchbutton_Config::getVal( 'auto_close_use_community_hours' ) ) ){