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