Add checking for source of awareness for job order. #698

This commit is contained in:
Korina Cordero 2022-08-16 03:49:32 +00:00
parent 772c472595
commit 65cba1842a
2 changed files with 28 additions and 1 deletions

View file

@ -450,6 +450,10 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
$ownertype_id = $req->request->get('ownership_type', 0);
$owner_type = $em->getRepository(OwnershipType::class)->find($ownertype_id);
// source of awareness is now required
if (empty($soa_type))
$error_array['source_of_awareness'] = 'Source of awareness is required.';
// TODO: check status before saving since JO might already
// have a status that needs to be retained
@ -710,6 +714,10 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
$ownertype_id = $req->request->get('ownership_type', 0);
$owner_type = $em->getRepository(OwnershipType::class)->find($ownertype_id);
// source of awareness is now required
if (empty($soa_type))
$error_array['source_of_awareness'] = 'Source of awareness is required.';
if (empty($error_array))
{
// get current user
@ -916,6 +924,10 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
$ownertype_id = $req->request->get('ownership_type', 0);
$owner_type = $em->getRepository(OwnershipType::class)->find($ownertype_id);
// source of awareness is now required
if (empty($soa_type))
$error_array['source_of_awareness'] = 'Source of awareness is required.';
if (empty($error_array))
{
// coordinates
@ -1065,6 +1077,10 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
$ownertype_id = $req->request->get('ownership_type', 0);
$owner_type = $em->getRepository(OwnershipType::class)->find($ownertype_id);
// source of awareness is now required
if (empty($soa_type))
$error_array['source_of_awareness'] = 'Source of awareness is required.';
// get current user
$user = $this->security->getUser();
@ -1205,6 +1221,10 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
$ownertype_id = $req->request->get('ownership_type', 0);
$owner_type = $em->getRepository(OwnershipType::class)->find($ownertype_id);
// source of awareness is now required
if (empty($soa_type))
$error_array['source_of_awareness'] = 'Source of awareness is required.';
if (empty($error_array)) {
// coordinates
$point = new Point($req->request->get('coord_lng'), $req->request->get('coord_lat'));
@ -1459,6 +1479,10 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
$ownertype_id = $req->request->get('ownership_type', 0);
$owner_type = $em->getRepository(OwnershipType::class)->find($ownertype_id);
// source of awareness is now required
if (empty($soa_type))
$error_array['source_of_awareness'] = 'Source of awareness is required.';
// get previously assigned hub, if any
$old_hub = $obj->getHub();
@ -1739,6 +1763,10 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
$ownertype_id = $req->request->get('ownership_type', 0);
$owner_type = $em->getRepository(OwnershipType::class)->find($ownertype_id);
// source of awareness is now required
if (empty($soa_type))
$error_array['source_of_awareness'] = 'Source of awareness is required.';
if (empty($error_array)) {
// rider mqtt event
// NOTE: need to send this before saving because rider will be cleared

View file

@ -510,7 +510,6 @@
<div class="col-lg-6">
<label data-field="status">Source of Awareness</label>
<select class="form-control m-input" id="source-of-awareness" name="source_of_awareness">
<option value=""></option>
{% for key, soa in soa_types %}
<option value="{{ key }}"{{ key == obj.getSourceOfAwareness ? ' selected' }}>{{ soa }}</option>
{% endfor %}