partial: driver dumbphone tweaks #2673

This commit is contained in:
Daniel Camargo 2014-04-22 11:52:48 -03:00
parent 01c7278529
commit e3e664d282
2 changed files with 17 additions and 0 deletions

View File

@ -122,6 +122,19 @@ class Crunchbutton_Admin extends Cana_Table {
}
$adminCommunities = [];
$groups = $this->groups();
foreach ( $groups as $group ) {
$communities = Crunchbutton_Community::communityByDriverGroup( $group->name );
foreach( $communities as $community ){
$restaurants = $community->getRestaurants();
foreach( $restaurants as $restaurant ){
if( $restaurant->delivery_service ){
$deliveryFor[ $restaurant->id_restaurant ] = $restaurant->id_restaurant;
}
}
}
}
// legacy
foreach ( $groups as $group ) {
if( strpos( $group->name, Crunchbutton_Group::DRIVER_GROUPS_PREFIX ) !== false ){
$community = str_replace( Crunchbutton_Group::DRIVER_GROUPS_PREFIX, '', $group->name );

View File

@ -138,6 +138,10 @@ class Crunchbutton_Community extends Cana_Table {
return $group;
}
public function communityByDriverGroup( $group ){
return Crunchbutton_Community::q( 'SELECT * FROM community WHERE driver_group = "' . $group . '"' );
}
public function getDriversOfCommunity(){
$group = $this->driverGroup();
$query = 'SELECT a.* FROM admin a