Fix error when rider is not selected. #424

This commit is contained in:
Korina Cordero 2020-06-23 09:40:39 +00:00
parent 21ae94c5b6
commit 0f5bf2e8d6

View file

@ -558,19 +558,6 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface
}
}
// set priority based on rider's existing open job orders
$rider_jos = $rider->getOpenJobOrders();
// get maximum priority then add 1
// NOTE: this can be a bit buggy due to concurrency issues
// ideally have to lock jo table, but that isn't feasible right now
$priority = 0;
foreach ($rider_jos as $rider_jo)
{
if ($priority < $rider_jo->getPriority())
$priority = $rider_jo->getPriority() + 1;
}
// get discount and set to meta
$discount = $req->request->get('invoice_discount', []);
@ -583,6 +570,19 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface
if (empty($error_array))
{
// set priority based on rider's existing open job orders
$rider_jos = $rider->getOpenJobOrders();
// get maximum priority then add 1
// NOTE: this can be a bit buggy due to concurrency issues
// ideally have to lock jo table, but that isn't feasible right now
$priority = 0;
foreach ($rider_jos as $rider_jo)
{
if ($priority < $rider_jo->getPriority())
$priority = $rider_jo->getPriority() + 1;
}
// get current user
$user = $this->security->getUser();