partial #1382 - fixed the restaurants no open
This commit is contained in:
parent
44cfe28250
commit
9d418787e6
@ -37,6 +37,36 @@ class Crunchbutton_Restaurant_Hour_Override extends Cana_Table {
|
||||
return Crunchbutton_Restaurant_Hour_Override::q( $query );
|
||||
}
|
||||
|
||||
public function forceClose( $id_restaurant ){
|
||||
$restaurant = Restaurant::o( $id_restaurant );
|
||||
$today = new DateTime( 'now', new DateTimeZone( $restaurant->timezone ) );
|
||||
$today_mysql = $today->format('Y-m-d H:i');
|
||||
$overrides = Crunchbutton_Restaurant_Hour_Override::q( "SELECT * FROM restaurant_hour_override WHERE date_start <= '{$today_mysql}' and date_end >= '{$today_mysql}'" );
|
||||
if( $overrides->count() > 0 ){
|
||||
foreach( $overrides as $override ){
|
||||
if( $override->type == Crunchbutton_Restaurant_Hour_Override::TYPE_CLOSED ){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function forceOpen( $id_restaurant ){
|
||||
$restaurant = Restaurant::o( $id_restaurant );
|
||||
$today = new DateTime( 'now', new DateTimeZone( $restaurant->timezone ) );
|
||||
$today_mysql = $today->format('Y-m-d H:i');
|
||||
$overrides = Crunchbutton_Restaurant_Hour_Override::q( "SELECT * FROM restaurant_hour_override WHERE date_start <= '{$today_mysql}' and date_end >= '{$today_mysql}'" );
|
||||
if( $overrides->count() > 0 ){
|
||||
foreach( $overrides as $override ){
|
||||
if( $override->type == Crunchbutton_Restaurant_Hour_Override::TYPE_OPENED ){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function restaurantIsOpen( $id_restaurant ){
|
||||
$restaurant = Restaurant::o( $id_restaurant );
|
||||
$today = new DateTime( 'now', new DateTimeZone( $restaurant->timezone ) );
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user