Merge branch '473-cmb-reassign-issue' into '472-cmb-release'

Fix for error in JO creation. #473

See merge request jankstudio/resq!553
This commit is contained in:
Kendrick Chan 2020-08-24 04:09:00 +00:00
commit e4ad0169d7

View file

@ -449,6 +449,7 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface
$jo = $em->getRepository(JobOrder::class)->find($id); $jo = $em->getRepository(JobOrder::class)->find($id);
$old_jo_status = null; $old_jo_status = null;
$old_rider = null;
if (empty($jo)) if (empty($jo))
{ {
// new job order // new job order
@ -642,6 +643,11 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface
// retain old jo status if it's an update JO // retain old jo status if it's an update JO
// check old rider if it is also a reassignment // check old rider if it is also a reassignment
// old_rider should be null if JO has been rejected // old_rider should be null if JO has been rejected
if (($old_rider == null) && ($old_jo_status == null))
$jo->setStatus(JOStatus::ASSIGNED);
else
{
error_log('not a new JO');
$new_rider = $jo->getRider(); $new_rider = $jo->getRider();
if ($new_rider != $old_rider) if ($new_rider != $old_rider)
{ {
@ -653,6 +659,7 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface
if ($old_jo_status != null) if ($old_jo_status != null)
$jo->setStatus($old_jo_status); $jo->setStatus($old_jo_status);
} }
}
// check if user is null, meaning call to create came from API // check if user is null, meaning call to create came from API
if ($user != null) if ($user != null)