Add checking for source of awareness for ticket. #698
This commit is contained in:
parent
52545c8a4f
commit
772c472595
2 changed files with 14 additions and 7 deletions
|
|
@ -208,6 +208,9 @@ class TicketController extends Controller
|
||||||
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
|
// initialize error list
|
||||||
|
$error_array = [];
|
||||||
|
|
||||||
// get customer data
|
// get customer data
|
||||||
if ($customer_id) {
|
if ($customer_id) {
|
||||||
$customer = $em->getRepository(Customer::class)->find($customer_id);
|
$customer = $em->getRepository(Customer::class)->find($customer_id);
|
||||||
|
|
@ -254,6 +257,10 @@ class TicketController extends Controller
|
||||||
// get source of awareness if any
|
// get source of awareness if any
|
||||||
$soa_type = $req->request->get('source_of_awareness');
|
$soa_type = $req->request->get('source_of_awareness');
|
||||||
|
|
||||||
|
// source of awareness is now required
|
||||||
|
if (empty($soa_type))
|
||||||
|
$error_array['source_of_awareness'] = 'Source of awareness is required.';
|
||||||
|
|
||||||
// get remarks
|
// get remarks
|
||||||
$remarks = $req->request->get('remarks', '');
|
$remarks = $req->request->get('remarks', '');
|
||||||
|
|
||||||
|
|
@ -281,9 +288,6 @@ class TicketController extends Controller
|
||||||
$obj->setJobOrder($job_order);
|
$obj->setJobOrder($job_order);
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize error list
|
|
||||||
$error_array = [];
|
|
||||||
|
|
||||||
// validate
|
// validate
|
||||||
$errors = $validator->validate($obj);
|
$errors = $validator->validate($obj);
|
||||||
|
|
||||||
|
|
@ -423,6 +427,9 @@ class TicketController extends Controller
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
$obj = $em->getRepository(Ticket::class)->find($id);
|
$obj = $em->getRepository(Ticket::class)->find($id);
|
||||||
|
|
||||||
|
// initialize error list
|
||||||
|
$error_array = [];
|
||||||
|
|
||||||
// make sure this row exists
|
// make sure this row exists
|
||||||
if (empty($obj))
|
if (empty($obj))
|
||||||
throw $this->createNotFoundException('The item does not exist');
|
throw $this->createNotFoundException('The item does not exist');
|
||||||
|
|
@ -461,6 +468,10 @@ class TicketController extends Controller
|
||||||
// get source of awareness if any
|
// get source of awareness if any
|
||||||
$soa_type = $req->request->get('source_of_awareness');
|
$soa_type = $req->request->get('source_of_awareness');
|
||||||
|
|
||||||
|
// source of awareness is now required
|
||||||
|
if (empty($soa_type))
|
||||||
|
$error_array['source_of_awareness'] = 'Source of awareness is required.';
|
||||||
|
|
||||||
// get remarks
|
// get remarks
|
||||||
$remarks = $req->request->get('remarks', '');
|
$remarks = $req->request->get('remarks', '');
|
||||||
|
|
||||||
|
|
@ -476,9 +487,6 @@ class TicketController extends Controller
|
||||||
->setSourceOfAwareness($soa_type)
|
->setSourceOfAwareness($soa_type)
|
||||||
->setRemarks($remarks);
|
->setRemarks($remarks);
|
||||||
|
|
||||||
// initialize error list
|
|
||||||
$error_array = [];
|
|
||||||
|
|
||||||
// validate
|
// validate
|
||||||
$errors = $validator->validate($obj);
|
$errors = $validator->validate($obj);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,6 @@
|
||||||
<div class="col-lg-4">
|
<div class="col-lg-4">
|
||||||
<label data-field="status">Source of Awareness</label>
|
<label data-field="status">Source of Awareness</label>
|
||||||
<select class="form-control m-input" id="source-of-awareness" name="source_of_awareness">
|
<select class="form-control m-input" id="source-of-awareness" name="source_of_awareness">
|
||||||
<option value=""></option>
|
|
||||||
{% for key, soa in soa_types %}
|
{% for key, soa in soa_types %}
|
||||||
<option value="{{ key }}"{{ key == obj.getSourceOfAwareness ? ' selected' }}>{{ soa }}</option>
|
<option value="{{ key }}"{{ key == obj.getSourceOfAwareness ? ' selected' }}>{{ soa }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue