From 325d57adf78fe4e16d25e4387b362c5a5cfc1edb Mon Sep 17 00:00:00 2001 From: Daniel Camargo Date: Mon, 14 Jul 2014 13:37:37 -0300 Subject: [PATCH] Automate Pay Summaries for Drivers in cbtn.io #3234 --- include/library/Crunchbutton/Settlement.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/library/Crunchbutton/Settlement.php b/include/library/Crunchbutton/Settlement.php index 238344278..8e03b99cb 100644 --- a/include/library/Crunchbutton/Settlement.php +++ b/include/library/Crunchbutton/Settlement.php @@ -66,9 +66,11 @@ class Crunchbutton_Settlement extends Cana_Model { if( $_shift[ 'driver_paid' ] ){ $schedule_info = Cockpit_Payment_Schedule_Shift::checkShiftWasPaidDriver( $_shift[ 'id_admin_shift_assign' ] ); if( $schedule_info ){ - $payment_info = $schedule_info->payment(); - $date = $payment_info->date()->get( 0 ); - $_shift[ 'paid_info' ] = [ 'id_payment' => $payment_info->id_payment, 'date' => $date->format( 'M jS Y g:i:s A' ) ]; + $payment_info = $schedule_info->payment()->get( 0 ); + if( $payment_info ){ + $date = $payment_info->date(); + $_shift[ 'paid_info' ] = [ 'id_payment' => $payment_info->id_payment, 'date' => $date->format( 'M jS Y g:i:s A' ) ]; + } } } $_shifts[] = $_shift;