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 = [];
|
$driverAlreadyNotified = [];
|
||||||
|
$driversAlreadyReminded = [];
|
||||||
$drivers = Crunchbutton_Community_Shift::driversCouldDeliveryOrder( $order->id_order );
|
$drivers = Crunchbutton_Community_Shift::driversCouldDeliveryOrder( $order->id_order );
|
||||||
if( $drivers ){
|
if( $drivers ){
|
||||||
foreach( $drivers as $driver ){
|
foreach( $drivers as $driver ){
|
||||||
$driverAlreadyNotified[] = $driver->id_admin;
|
$driverAlreadyNotified[] = $driver->id_admin;
|
||||||
foreach( $driver->activeNotifications() as $adminNotification ){
|
foreach( $driver->activeNotifications() as $adminNotification ){
|
||||||
$adminNotification->send( $order );
|
// first notification
|
||||||
$hasDriversWorking = true;
|
if( $attempts == 0 ){
|
||||||
$message = '#'.$order->id_order.' sending ** NEW ** notification to ' . $driver->name . ' # ' . $adminNotification->value;
|
$adminNotification->send( $order );
|
||||||
Log::debug( [ 'order' => $order->id_order, 'action' => $message, 'type' => 'delivery-driver' ] );
|
$message = '#'.$order->id_order.' sending ** NEW ** notification to ' . $driver->name . ' # ' . $adminNotification->value . ' attempt: ' . $attempts;
|
||||||
echo $message."\n";
|
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 = [];
|
$driversAlreadyReminded = [];
|
||||||
// Send notification to drivers - legacy
|
|
||||||
if( count( $driversToNotify ) > 0 ){
|
if( count( $driversToNotify ) > 0 ){
|
||||||
foreach( $driversToNotify as $driver ){
|
foreach( $driversToNotify as $driver ){
|
||||||
if( $driver->isWorking() ){
|
if( $driver->isWorking() ){
|
||||||
|
|||||||
@ -44,7 +44,7 @@ class Crunchbutton_Admin_Notification_Log extends Cana_Table {
|
|||||||
$description = 'Notification #' . ( $attempts + 1 );
|
$description = 'Notification #' . ( $attempts + 1 );
|
||||||
|
|
||||||
if( $attempts == 0 ){
|
if( $attempts == 0 ){
|
||||||
$description .= ' regular notification';
|
$description .= ' First txt message';
|
||||||
}
|
}
|
||||||
|
|
||||||
if( $attempts == 1 ){
|
if( $attempts == 1 ){
|
||||||
|
|||||||
@ -194,13 +194,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</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' ] ) ) { ?>
|
<? if ( c::admin()->permission()->check( [ 'global','drivers-all', 'drivers-working-hours', 'drivers-working-hours-view' ] ) ) { ?>
|
||||||
<li class="">
|
<li class="">
|
||||||
<a href="/drivers/schedule">
|
<a href="/drivers/schedule">
|
||||||
@ -208,7 +202,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<? } ?>
|
<? } ?>
|
||||||
|
-->
|
||||||
<? if ( c::admin()->permission()->check( [ 'global','drivers-all', 'drivers-working-hours', 'drivers-working-hours-view' ] ) ) { ?>
|
<? if ( c::admin()->permission()->check( [ 'global','drivers-all', 'drivers-working-hours', 'drivers-working-hours-view' ] ) ) { ?>
|
||||||
<li class="">
|
<li class="">
|
||||||
<a href="/drivers/shift/community">
|
<a href="/drivers/shift/community">
|
||||||
@ -223,11 +217,6 @@
|
|||||||
<i class="icon-file-alt"></i> Summary
|
<i class="icon-file-alt"></i> Summary
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</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() ) { ?>
|
<? if ( c::admin()->permission()->check( [ 'global','drivers-all', 'drivers-working-hours', 'drivers-working-hours-view' ] ) || c::admin()->isDriver() ) { ?>
|
||||||
@ -238,6 +227,22 @@
|
|||||||
</li>
|
</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>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<? endif ; ?>
|
<? endif ; ?>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user