Fix for error in JO creation. #473
This commit is contained in:
parent
ed22eebdc2
commit
9fe4098ac4
1 changed files with 14 additions and 7 deletions
|
|
@ -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)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue