Fix the routes for JOs coming from the Resq Dispatch page. #679
This commit is contained in:
parent
feade62c18
commit
d2591a3ffb
3 changed files with 27 additions and 26 deletions
|
|
@ -7,8 +7,3 @@ jo_resq_proc_rows:
|
||||||
path: /resq-job-order/processing-rows
|
path: /resq-job-order/processing-rows
|
||||||
controller: App\Controller\ResqJobOrderController::datatableRows
|
controller: App\Controller\ResqJobOrderController::datatableRows
|
||||||
methods: [POST]
|
methods: [POST]
|
||||||
|
|
||||||
jo_resq_proc_unlock:
|
|
||||||
path: /resq-job-order/{id}/unlock/processor
|
|
||||||
controller: App\Controller\ResqJobOrderController::unlockProcessor
|
|
||||||
methods: [GET]
|
|
||||||
|
|
|
||||||
|
|
@ -316,7 +316,7 @@ class JobOrderController extends Controller
|
||||||
/**
|
/**
|
||||||
* @Menu(selected="jo_proc")
|
* @Menu(selected="jo_proc")
|
||||||
*/
|
*/
|
||||||
public function processingForm(HubSelector $hub_selector, $id, JobOrderHandlerInterface $jo_handler, GISManagerInterface $gis, MotivConnector $motiv)
|
public function processingForm(HubSelector $hub_selector, $id, JobOrderHandlerInterface $jo_handler, GISManagerInterface $gis, MotivConnector $motiv, Request $req)
|
||||||
{
|
{
|
||||||
$this->denyAccessUnlessGranted('jo_proc.list', null, 'No access.');
|
$this->denyAccessUnlessGranted('jo_proc.list', null, 'No access.');
|
||||||
|
|
||||||
|
|
@ -337,6 +337,18 @@ class JobOrderController extends Controller
|
||||||
$params['return_url'] = $this->generateUrl('jo_proc');
|
$params['return_url'] = $this->generateUrl('jo_proc');
|
||||||
$params['map_js_file'] = $gis->getJSJOFile();
|
$params['map_js_file'] = $gis->getJSJOFile();
|
||||||
|
|
||||||
|
// check for origin parameter
|
||||||
|
$origin = $req->query->get('origin', '');
|
||||||
|
if (empty($origin))
|
||||||
|
{
|
||||||
|
// set return url to default dispatch
|
||||||
|
$params['return_url'] = $this->generateUrl('jo_proc');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// set return url to resq dispatch
|
||||||
|
$params['return_url'] = $this->generateUrl('jo_resq_proc');
|
||||||
|
}
|
||||||
$template = $params['template'];
|
$template = $params['template'];
|
||||||
|
|
||||||
// response
|
// response
|
||||||
|
|
@ -795,15 +807,25 @@ class JobOrderController extends Controller
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function unlockProcessor($id, JobOrderHandlerInterface $jo_handler)
|
public function unlockProcessor($id, JobOrderHandlerInterface $jo_handler, Request $req)
|
||||||
{
|
{
|
||||||
$this->denyAccessUnlessGranted('jo_proc.unlock', null, 'No access.');
|
$this->denyAccessUnlessGranted('jo_proc.unlock', null, 'No access.');
|
||||||
|
|
||||||
// call unlockProcessor in job order service
|
// call unlockProcessor in job order service
|
||||||
$jo_handler->unlockProcessor($id);
|
$jo_handler->unlockProcessor($id);
|
||||||
|
|
||||||
// redirect to list
|
// get the origin
|
||||||
return $this->redirectToRoute('jo_proc');
|
$origin = $req->query->get('origin', '');
|
||||||
|
if (empty($origin))
|
||||||
|
{
|
||||||
|
// redirect to list
|
||||||
|
return $this->redirectToRoute('jo_proc');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// redirect to resq list
|
||||||
|
return $this->redirectToRoute('jo_resq_proc');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function unlockAssignor($id, JobOrderHandlerInterface $jo_handler)
|
public function unlockAssignor($id, JobOrderHandlerInterface $jo_handler)
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ class ResqJobOrderController extends Controller
|
||||||
$jo_id = $orow->getID();
|
$jo_id = $orow->getID();
|
||||||
|
|
||||||
$row['meta']['update_url'] = $this->generateUrl('jo_proc_form', ['id' => $jo_id, 'origin' => 'resq']);
|
$row['meta']['update_url'] = $this->generateUrl('jo_proc_form', ['id' => $jo_id, 'origin' => 'resq']);
|
||||||
$row['meta']['unlock_url'] = $this->generateUrl('jo_resq_proc_unlock', ['id' => $jo_id, 'origin' => 'resq']);
|
$row['meta']['unlock_url'] = $this->generateUrl('jo_proc_unlock', ['id' => $jo_id, 'origin' => 'resq']);
|
||||||
|
|
||||||
$rows[] = $row;
|
$rows[] = $row;
|
||||||
}
|
}
|
||||||
|
|
@ -148,22 +148,6 @@ class ResqJobOrderController extends Controller
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @Menu(selected="jo_resq_proc")
|
|
||||||
* @ParamConverter("job_order", class="App\Entity\JobOrder")
|
|
||||||
* @IsGranted("jo_resq_proc.list")
|
|
||||||
*/
|
|
||||||
public function unlockProcessor($id, EntityManagerInterface $em, JobOrder $jo)
|
|
||||||
{
|
|
||||||
$jo->setProcessedBy(null);
|
|
||||||
|
|
||||||
$em->flush();
|
|
||||||
|
|
||||||
// redirect to list
|
|
||||||
return $this->redirectToRoute('jo_resq_proc');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected function setQueryFilters($datatable, &$query, $qb, $status, $source)
|
protected function setQueryFilters($datatable, &$query, $qb, $status, $source)
|
||||||
{
|
{
|
||||||
$query->where('q.status = :status')
|
$query->where('q.status = :status')
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue