partial #2358
This commit is contained in:
parent
95773955dc
commit
132c9f19d9
@ -25,10 +25,13 @@ class Crunchbutton_Restaurant_Payment_Type extends Cana_Table {
|
||||
function byRestaurant( $id_restaurant ){
|
||||
if( $id_restaurant ){
|
||||
$payment = Crunchbutton_User_Payment_Type::q( 'SELECT * FROM restaurant_payment_type WHERE id_restaurant = ' . $id_restaurant . ' LIMIT 1' );
|
||||
if( !$payment->count() ){
|
||||
return new Crunchbutton_Restaurant_Payment_Type();
|
||||
} else{
|
||||
if( $payment->id_restaurant_payment_type ){
|
||||
return Crunchbutton_Restaurant_Payment_Type::o( $payment->id_restaurant_payment_type );
|
||||
} else{
|
||||
$payment = new Crunchbutton_Restaurant_Payment_Type();
|
||||
$payment->id_restaurant = $id_restaurant;
|
||||
$payment->save();
|
||||
return $payment;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user