Change 1st driver phone call to a text message #2812
This commit is contained in:
parent
eaad62fc65
commit
9f699e023d
@ -94,24 +94,35 @@ class Crunchbutton_Admin_Notification extends Cana_Table {
|
||||
}
|
||||
|
||||
$driverAlreadyNotified = [];
|
||||
|
||||
$driversAlreadyReminded = [];
|
||||
$drivers = Crunchbutton_Community_Shift::driversCouldDeliveryOrder( $order->id_order );
|
||||
if( $drivers ){
|
||||
foreach( $drivers as $driver ){
|
||||
$driverAlreadyNotified[] = $driver->id_admin;
|
||||
foreach( $driver->activeNotifications() as $adminNotification ){
|
||||
$adminNotification->send( $order );
|
||||
$hasDriversWorking = true;
|
||||
$message = '#'.$order->id_order.' sending ** NEW ** notification to ' . $driver->name . ' # ' . $adminNotification->value;
|
||||
Log::debug( [ 'order' => $order->id_order, 'action' => $message, 'type' => 'delivery-driver' ] );
|
||||
echo $message."\n";
|
||||
// first notification
|
||||
if( $attempts == 0 ){
|
||||
$adminNotification->send( $order );
|
||||
$message = '#'.$order->id_order.' sending ** NEW ** notification to ' . $driver->name . ' # ' . $adminNotification->value . ' attempt: ' . $attempts;
|
||||
Log::debug( [ 'order' => $order->id_order, 'action' => $message, 'type' => 'delivery-driver' ] );
|
||||
echo $message."\n";
|
||||
} else {
|
||||
// next notifications
|
||||
if( !$driversAlreadyReminded[ $driver->id_admin ] ){
|
||||
$adminNotification->send( $order );
|
||||
$message = '#'.$order->id_order.' sending ** NEW ** notification to ' . $driver->name . ' - attempt: ' . $attempts;
|
||||
Log::debug( [ 'order' => $order->id_order, 'action' => $message, 'type' => 'delivery-driver' ] );
|
||||
echo $message."\n";
|
||||
}
|
||||
}
|
||||
$driversAlreadyReminded[ $driver->id_admin ] = true;
|
||||
$hasDriversWorking = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Send notification to drivers - Working Hours legacy
|
||||
$driversAlreadyReminded = [];
|
||||
// Send notification to drivers - legacy
|
||||
if( count( $driversToNotify ) > 0 ){
|
||||
foreach( $driversToNotify as $driver ){
|
||||
if( $driver->isWorking() ){
|
||||
|
||||
@ -44,7 +44,7 @@ class Crunchbutton_Admin_Notification_Log extends Cana_Table {
|
||||
$description = 'Notification #' . ( $attempts + 1 );
|
||||
|
||||
if( $attempts == 0 ){
|
||||
$description .= ' regular notification';
|
||||
$description .= ' First txt message';
|
||||
}
|
||||
|
||||
if( $attempts == 1 ){
|
||||
|
||||
@ -194,13 +194,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<? } ?>
|
||||
<? if ( c::admin()->permission()->check( [ 'global','drivers-all', 'drivers-working-hours', 'drivers-working-hours-view' ] ) ) { ?>
|
||||
<li class="">
|
||||
<a href="/drivers/hours">
|
||||
<i class="icon-time"></i> Working hours
|
||||
</a>
|
||||
</li>
|
||||
<? } ?>
|
||||
<!--
|
||||
<? if ( c::admin()->permission()->check( [ 'global','drivers-all', 'drivers-working-hours', 'drivers-working-hours-view' ] ) ) { ?>
|
||||
<li class="">
|
||||
<a href="/drivers/schedule">
|
||||
@ -208,7 +202,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<? } ?>
|
||||
|
||||
-->
|
||||
<? if ( c::admin()->permission()->check( [ 'global','drivers-all', 'drivers-working-hours', 'drivers-working-hours-view' ] ) ) { ?>
|
||||
<li class="">
|
||||
<a href="/drivers/shift/community">
|
||||
@ -223,11 +217,6 @@
|
||||
<i class="icon-file-alt"></i> Summary
|
||||
</a>
|
||||
</li>
|
||||
<li class="">
|
||||
<a href="/drivers/shift/status/shift">
|
||||
<i class="icon-file-alt"></i> Status
|
||||
</a>
|
||||
</li>
|
||||
<? } ?>
|
||||
|
||||
<? if ( c::admin()->permission()->check( [ 'global','drivers-all', 'drivers-working-hours', 'drivers-working-hours-view' ] ) || c::admin()->isDriver() ) { ?>
|
||||
@ -238,6 +227,22 @@
|
||||
</li>
|
||||
<? } ?>
|
||||
|
||||
<? if ( c::admin()->permission()->check( [ 'global','drivers-all', 'drivers-working-hours', 'drivers-working-hours-view' ] ) || c::admin()->isDriver() ) { ?>
|
||||
<li class="">
|
||||
<a href="/drivers/shift/status/shift">
|
||||
<i class="icon-file-alt"></i> Status
|
||||
</a>
|
||||
</li>
|
||||
<? } ?>
|
||||
|
||||
|
||||
<? if ( c::admin()->permission()->check( [ 'global','drivers-all', 'drivers-working-hours', 'drivers-working-hours-view' ] ) ) { ?>
|
||||
<li class="">
|
||||
<a href="/drivers/hours">
|
||||
<i class="icon-time"></i> Working hours <i style="font-size:11px;">deprecated</i>
|
||||
</a>
|
||||
</li>
|
||||
<? } ?>
|
||||
</ul>
|
||||
</li>
|
||||
<? endif ; ?>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user