Added the restaurant Notification type at the Max Call SMS and Call

This commit is contained in:
Daniel Camargo 2013-12-23 17:37:51 -02:00
parent cb4342de11
commit 1008f6bb53
2 changed files with 26 additions and 2 deletions

View File

@ -252,6 +252,12 @@ class Controller_api_order extends Crunchbutton_Controller_Rest {
default:
$notification = Notification_Log::getMaxCallNotification( $order->id_order );
$types = $order->restaurant()->notification_types();
if( count( $types->get(0) ) > 0 ){
$notifications = 'Restaurant notifications . ' . join( ' . ', $types->get(0) );
} else {
$notifications = '';
}
Log::debug( [ 'order' => $order->id_order, 'id_notification' => $notification->id_notification_log ,'action' => 'MAX CB', 'data' => json_encode($_REQUEST), 'type' => 'notification' ]);
@ -260,6 +266,10 @@ class Controller_api_order extends Crunchbutton_Controller_Rest {
echo 'Max call back for order number ' . $order->id_order . ' has timed out to ' . htmlentities( $order->restaurant()->name ) . ' from ' . $order->name;
echo '</Say>';
echo '<Pause length="1" />';
echo '<Say voice="'.c::config()->twilio->voice.'">';
echo $notifications;
echo '</Say>';
echo '<Pause length="1" />';
echo '<Say voice="'.c::config()->twilio->voice.'">';
echo Notification_Log::maxCallMSayAtTheEndOfMessage();
echo '</Say>';

View File

@ -65,7 +65,15 @@ class Crunchbutton_Notification_Log extends Cana_Table {
foreach( $usersToReceiveSMS as $user ){
$sendSMSTo[ $user->name ] = $user->txt;
}
$message = '#'.$this->id_order.' MAX CB for '.$this->order()->restaurant()->name."\nR# ".$this->order()->restaurant()->phone()."\n C# ".$this->order()->name . ' / ' . $this->order()->phone();
$types = $this->order()->restaurant()->notification_types();
if( count( $types->get(0) ) > 0 ){
$notifications = '/ RN: ' . join( '/', $types->get(0) );
} else {
$notifications = '';
}
$message = '#'.$this->id_order.' MAX CB for '.$this->order()->restaurant()->name."\nR# ".$this->order()->restaurant()->phone(). $notifications . "\n C# ".$this->order()->name . ' / ' . $this->order()->phone();
$message = str_split($message,160);
foreach ( $sendSMSTo as $supportName => $supportPhone) {
$num = $supportPhone;
@ -145,7 +153,13 @@ class Crunchbutton_Notification_Log extends Cana_Table {
foreach( $usersToReceiveSMS as $user ){
$sendSMSTo[ $user->name ] = $user->txt;
}
$message = '#'.$this->id_order.' MAX CONFIRM CB for '.$this->order()->restaurant()->name."\nR# ".$this->order()->restaurant()->phone()."\nC# ".$this->order()->phone();
$types = $this->order()->restaurant()->notification_types();
if( count( $types->get(0) ) > 0 ){
$notifications = '/ RN: ' . join( '/', $types->get(0) );
} else {
$notifications = '';
}
$message = '#'.$this->id_order.' MAX CONFIRM CB for '.$this->order()->restaurant()->name."\nR# ".$this->order()->restaurant()->phone().$notifications."\nC# ".$this->order()->phone();
$message = str_split($message,160);
foreach ( $sendSMSTo as $supportName => $supportPhone) {
$num = $supportPhone;