Resolve "Source of Awareness field to be required and not optional" #1625

Open
korina.cordero wants to merge 2 commits from 698-source-of-awareness-field-to-be-required-and-not-optional into master
2 changed files with 28 additions and 1 deletions
Showing only changes of commit 65cba1842a - Show all commits

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 %}