From e51abd6231ddbafc2bdefe5447b6ecd06fa9f8ae Mon Sep 17 00:00:00 2001 From: Daniel Camargo Date: Fri, 29 Nov 2013 12:21:46 -0200 Subject: [PATCH] fixed the next_open_time method at Restaurant class --- include/library/Crunchbutton/Restaurant.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/library/Crunchbutton/Restaurant.php b/include/library/Crunchbutton/Restaurant.php index 2d2d5412d..e44214bfd 100644 --- a/include/library/Crunchbutton/Restaurant.php +++ b/include/library/Crunchbutton/Restaurant.php @@ -811,15 +811,18 @@ class Crunchbutton_Restaurant extends Cana_Table_Trackchange { $today = new DateTime( 'now', new DateTimeZone( $this->timezone ) ); $day = strtolower( $today->format( 'D' ) ); $weekdays = array(); + // get next week 7 days for( $i = 0; $i <= 6; $i++ ){ - $weekdays[] = strtolower( date( 'D', mktime( 0, 0, 0, date( 'n', $time ), date('j', $time ) + $i ,date( 'Y', $time ) ) ) ); + $weekdays[] = strtolower( $today->format( 'D' ) ); + $today->modify( '+ 1 day' ); } + $today = new DateTime( 'now', new DateTimeZone( $this->timezone ) ); foreach ( $weekdays as $weekday ) { foreach ( $hours as $hour ) { if ( $hour->day != $weekday ) { continue; } - $open = new DateTime( $hour->time_open, new DateTimeZone( $this->timezone ) ); + $open = new DateTime( $hour->time_open, new DateTimeZone( $this->timezone ) ); if( $day == $weekday ){ $open->modify( '-7 days' ); }