Add blank option for customer location dropdown. Add checking for blank option. #739
This commit is contained in:
parent
4717d7d925
commit
2aef8e64e7
2 changed files with 71 additions and 49 deletions
|
|
@ -426,14 +426,17 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
}
|
||||
|
||||
// check if customer location is set
|
||||
// since we didn't provide a blank option in the dropdown, there is
|
||||
// always a customer location set.
|
||||
$cust_location_id = $req->request->get('cust_location');
|
||||
|
||||
$cust_location_id = $req->request->get('cust_location', 0);
|
||||
if ($cust_location_id == 0)
|
||||
$error_array['cust_location'] = 'Customer location is required.';
|
||||
else
|
||||
{
|
||||
// get customer location
|
||||
$cust_location = $em->getRepository(CustomerLocation::class)->find($cust_location_id);
|
||||
|
||||
if ($cust_location == null)
|
||||
$error_array['cust_location'] = 'Invalid customer location';
|
||||
}
|
||||
|
||||
// get source of awareness if any
|
||||
$soa_type = $req->request->get('source_of_awareness', '');
|
||||
|
|
@ -723,14 +726,17 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$owner_type = $em->getRepository(OwnershipType::class)->find($ownertype_id);
|
||||
|
||||
// check if customer location is set
|
||||
// since we didn't provide a blank option in the dropdown, there is
|
||||
// always a customer location set.
|
||||
$cust_location_id = $req->request->get('cust_location');
|
||||
|
||||
$cust_location_id = $req->request->get('cust_location', 0);
|
||||
if ($cust_location_id == 0)
|
||||
$error_array['cust_location'] = 'Customer location is required.';
|
||||
else
|
||||
{
|
||||
// get customer location
|
||||
$cust_location = $em->getRepository(CustomerLocation::class)->find($cust_location_id);
|
||||
|
||||
if ($cust_location == null)
|
||||
$error_array['cust_location'] = 'Invalid customer location';
|
||||
}
|
||||
|
||||
if (empty($error_array))
|
||||
{
|
||||
|
|
@ -940,14 +946,17 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$owner_type = $em->getRepository(OwnershipType::class)->find($ownertype_id);
|
||||
|
||||
// check if customer location is set
|
||||
// since we didn't provide a blank option in the dropdown, there is
|
||||
// always a customer location set.
|
||||
$cust_location_id = $req->request->get('cust_location');
|
||||
|
||||
$cust_location_id = $req->request->get('cust_location', 0);
|
||||
if ($cust_location_id == 0)
|
||||
$error_array['cust_location'] = 'Customer location is required.';
|
||||
else
|
||||
{
|
||||
// get customer location
|
||||
$cust_location = $em->getRepository(CustomerLocation::class)->find($cust_location_id);
|
||||
|
||||
if ($cust_location == null)
|
||||
$error_array['cust_location'] = 'Invalid customer location';
|
||||
}
|
||||
|
||||
if (empty($error_array))
|
||||
{
|
||||
|
|
@ -1100,14 +1109,17 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$owner_type = $em->getRepository(OwnershipType::class)->find($ownertype_id);
|
||||
|
||||
// check if customer location is set
|
||||
// since we didn't provide a blank option in the dropdown, there is
|
||||
// always a customer location set.
|
||||
$cust_location_id = $req->request->get('cust_location');
|
||||
|
||||
$cust_location_id = $req->request->get('cust_location', 0);
|
||||
if ($cust_location_id == 0)
|
||||
$error_array['cust_location'] = 'Customer location is required.';
|
||||
else
|
||||
{
|
||||
// get customer location
|
||||
$cust_location = $em->getRepository(CustomerLocation::class)->find($cust_location_id);
|
||||
|
||||
if ($cust_location == null)
|
||||
$error_array['cust_location'] = 'Invalid customer location';
|
||||
}
|
||||
|
||||
// get current user
|
||||
$user = $this->security->getUser();
|
||||
|
|
@ -1251,14 +1263,17 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$owner_type = $em->getRepository(OwnershipType::class)->find($ownertype_id);
|
||||
|
||||
// check if customer location is set
|
||||
// since we didn't provide a blank option in the dropdown, there is
|
||||
// always a customer location set.
|
||||
$cust_location_id = $req->request->get('cust_location');
|
||||
|
||||
$cust_location_id = $req->request->get('cust_location', 0);
|
||||
if ($cust_location_id == 0)
|
||||
$error_array['cust_location'] = 'Customer location is required.';
|
||||
else
|
||||
{
|
||||
// get customer location
|
||||
$cust_location = $em->getRepository(CustomerLocation::class)->find($cust_location_id);
|
||||
|
||||
if ($cust_location == null)
|
||||
$error_array['cust_location'] = 'Invalid customer location';
|
||||
}
|
||||
|
||||
if (empty($error_array)) {
|
||||
// coordinates
|
||||
|
|
@ -1516,14 +1531,17 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$owner_type = $em->getRepository(OwnershipType::class)->find($ownertype_id);
|
||||
|
||||
// check if customer location is set
|
||||
// since we didn't provide a blank option in the dropdown, there is
|
||||
// always a customer location set.
|
||||
$cust_location_id = $req->request->get('cust_location');
|
||||
|
||||
$cust_location_id = $req->request->get('cust_location', 0);
|
||||
if ($cust_location_id == 0)
|
||||
$error_array['cust_location'] = 'Customer location is required.';
|
||||
else
|
||||
{
|
||||
// get customer location
|
||||
$cust_location = $em->getRepository(CustomerLocation::class)->find($cust_location_id);
|
||||
|
||||
if ($cust_location == null)
|
||||
$error_array['cust_location'] = 'Invalid customer location';
|
||||
}
|
||||
|
||||
// get previously assigned hub, if any
|
||||
$old_hub = $obj->getHub();
|
||||
|
|
@ -1812,14 +1830,17 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$owner_type = $em->getRepository(OwnershipType::class)->find($ownertype_id);
|
||||
|
||||
// check if customer location is set
|
||||
// since we didn't provide a blank option in the dropdown, there is
|
||||
// always a customer location set.
|
||||
$cust_location_id = $req->request->get('cust_location');
|
||||
|
||||
$cust_location_id = $req->request->get('cust_location', 0);
|
||||
if ($cust_location_id == 0)
|
||||
$error_array['cust_location'] = 'Customer location is required.';
|
||||
else
|
||||
{
|
||||
// get customer location
|
||||
$cust_location = $em->getRepository(CustomerLocation::class)->find($cust_location_id);
|
||||
|
||||
if ($cust_location == null)
|
||||
$error_array['cust_location'] = 'Invalid customer location';
|
||||
}
|
||||
|
||||
if (empty($error_array)) {
|
||||
// rider mqtt event
|
||||
|
|
|
|||
|
|
@ -564,6 +564,7 @@
|
|||
<div class="col-lg-6">
|
||||
<label for="cust_location" data-field="cust_location"> Customer Location </label>
|
||||
<select class="form-control m-input" id="cust-location" name="cust_location">
|
||||
<option value=""></option>
|
||||
{% for id, label in cust_locations %}
|
||||
{% if obj.getCustomerLocation %}
|
||||
<option value="{{ id }}"{{ obj.getCustomerLocation.getID == id ? ' selected' }}>{{ label }}</option>
|
||||
|
|
|
|||
Loading…
Reference in a new issue