Fix job order processing bugs
This commit is contained in:
parent
a318d5ffcb
commit
3b4c81f03c
1 changed files with 6 additions and 7 deletions
|
|
@ -385,6 +385,12 @@ class JobOrderController extends BaseController
|
|||
{
|
||||
$this->denyAccessUnlessGranted('jo_proc.list', null, 'No access.');
|
||||
|
||||
// get object data
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$obj = $em->getRepository(JobOrder::class)->find($id);
|
||||
$processor = $obj->getProcessedBy();
|
||||
$user = $this->getUser();
|
||||
|
||||
// check if we're the one processing, return error otherwise
|
||||
if ($processor == null)
|
||||
throw $this->createAccessDeniedException('Not the processor');
|
||||
|
|
@ -395,9 +401,6 @@ class JobOrderController extends BaseController
|
|||
// initialize error list
|
||||
$error_array = [];
|
||||
|
||||
// get object data
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$obj = $em->getRepository(JobOrder::class)->find($id);
|
||||
|
||||
// make sure this object exists
|
||||
if (empty($obj))
|
||||
|
|
@ -455,10 +458,6 @@ class JobOrderController extends BaseController
|
|||
], 422);
|
||||
}
|
||||
|
||||
// unlock job order and set version to 0, so someone else can modify it
|
||||
// NOTE: we don't touch processed_by since we're the one who processed it
|
||||
$obj->setVersion(0);
|
||||
|
||||
// validated! save the entity
|
||||
$em->flush();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue