Add checking if JO is from the last 24 hours. #535
This commit is contained in:
parent
bba9060548
commit
9473609459
1 changed files with 18 additions and 3 deletions
|
|
@ -17,6 +17,9 @@ use App\Entity\JobOrder;
|
|||
|
||||
use App\Ramcar\TransactionOrigin;
|
||||
|
||||
use DateTime;
|
||||
use DateInterval;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
/**
|
||||
|
|
@ -75,13 +78,25 @@ class HomeController extends Controller
|
|||
continue;
|
||||
}
|
||||
|
||||
if ($jo->getSource() == TransactionOrigin::MOBILE_APP)
|
||||
// check if JO's date schedule is from the last 24 hours
|
||||
$date = new DateTime();
|
||||
$date_interval = new DateInterval('P1D');
|
||||
$date->sub($date_interval);
|
||||
|
||||
if ($jo->getDateSchedule() < $date)
|
||||
{
|
||||
$active_jos[$jo_id]['is_mobile'] = true;
|
||||
unset($active_jos[$jo_id]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$active_jos[$jo_id]['is_mobile'] = false;
|
||||
if ($jo->getSource() == TransactionOrigin::MOBILE_APP)
|
||||
{
|
||||
$active_jos[$jo_id]['is_mobile'] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$active_jos[$jo_id]['is_mobile'] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue