Fix for JO not displaying errors when required fields are blank. #424
This commit is contained in:
parent
bf572fa93c
commit
481420294e
3 changed files with 64 additions and 66 deletions
|
|
@ -443,15 +443,15 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface
|
|||
// check if new customer
|
||||
if ($req->request->get('new_customer', false))
|
||||
{
|
||||
if (empty($req->request->get('customer_customer_notes')))
|
||||
if (empty($req->request->get('customer_notes')))
|
||||
{
|
||||
$error_array['customer_customer_notes'] = 'Customer notes cannot be null.';
|
||||
$error_array['customer_notes'] = 'Customer notes cannot be null.';
|
||||
}
|
||||
|
||||
// validate mobile phone
|
||||
$valid_mobile = $this->cust_handler->validateMobileNumber($req->request->get('customer_phone_mobile'));
|
||||
$valid_mobile = $this->cust_handler->validateMobileNumber($req->request->get('phone_mobile'));
|
||||
if (!($valid_mobile))
|
||||
$error_array['customer_phone_mobile'] = 'Invalid mobile phone number.';
|
||||
$error_array['phone_mobile'] = 'Invalid mobile phone number.';
|
||||
|
||||
// check if plate number is in request
|
||||
if (empty(trim($req->request->get('plate_number'))))
|
||||
|
|
@ -469,13 +469,13 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface
|
|||
$new_cust = new Customer();
|
||||
$new_cv = new CustomerVehicle();
|
||||
|
||||
$new_cust->setLastName($req->request->get('customer_last_name'))
|
||||
->setFirstName($req->request->get('customer_first_name'))
|
||||
->setPhoneMobile($req->request->get('customer_phone_mobile'))
|
||||
->setPhoneLandline($req->request->get('customer_phone_landline'))
|
||||
->setPhoneOffice($req->request->get('customer_phone_office'))
|
||||
->setPhoneFax($req->request->get('customer_phone_fax'))
|
||||
->setCustomerNotes($req->request->get('customer_customer_notes'));
|
||||
$new_cust->setLastName($req->request->get('last_name'))
|
||||
->setFirstName($req->request->get('first_name'))
|
||||
->setPhoneMobile($req->request->get('phone_mobile'))
|
||||
->setPhoneLandline($req->request->get('phone_landline'))
|
||||
->setPhoneOffice($req->request->get('phone_office'))
|
||||
->setPhoneFax($req->request->get('phone_fax'))
|
||||
->setCustomerNotes($req->request->get('customer_notes'));
|
||||
|
||||
$new_cv->setCustomer($new_cust)
|
||||
->setVehicle($new_vehicle)
|
||||
|
|
@ -2479,15 +2479,15 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface
|
|||
// check if new customer
|
||||
if ($req->request->get('new_customer', false))
|
||||
{
|
||||
if (empty($req->request->get('customer_customer_notes')))
|
||||
if (empty($req->request->get('customer_notes')))
|
||||
{
|
||||
$error_array['customer_customer_notes'] = 'Customer notes cannot be null.';
|
||||
$error_array['customer_notes'] = 'Customer notes cannot be null.';
|
||||
}
|
||||
|
||||
// validate mobile phone
|
||||
$valid_mobile = $this->cust_handler->validateMobileNumber($req->request->get('customer_phone_mobile'));
|
||||
$valid_mobile = $this->cust_handler->validateMobileNumber($req->request->get('phone_mobile'));
|
||||
if (!($valid_mobile))
|
||||
$error_array['customer_phone_mobile'] = 'Invalid mobile phone number.';
|
||||
$error_array['phone_mobile'] = 'Invalid mobile phone number.';
|
||||
|
||||
// check if plate number is in request
|
||||
if (empty(trim($req->request->get('plate_number'))))
|
||||
|
|
@ -2506,13 +2506,13 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface
|
|||
$new_cust = new Customer();
|
||||
$new_cv = new CustomerVehicle();
|
||||
|
||||
$new_cust->setLastName($req->request->get('customer_last_name'))
|
||||
->setFirstName($req->request->get('customer_first_name'))
|
||||
->setPhoneMobile($req->request->get('customer_phone_mobile'))
|
||||
->setPhoneLandline($req->request->get('customer_phone_landline'))
|
||||
->setPhoneOffice($req->request->get('customer_phone_office'))
|
||||
->setPhoneFax($req->request->get('customer_phone_fax'))
|
||||
->setCustomerNotes($req->request->get('customer_customer_notes'));
|
||||
$new_cust->setLastName($req->request->get('last_name'))
|
||||
->setFirstName($req->request->get('first_name'))
|
||||
->setPhoneMobile($req->request->get('phone_mobile'))
|
||||
->setPhoneLandline($req->request->get('phone_landline'))
|
||||
->setPhoneOffice($req->request->get('phone_office'))
|
||||
->setPhoneFax($req->request->get('phone_fax'))
|
||||
->setCustomerNotes($req->request->get('customer_notes'));
|
||||
|
||||
$new_cv->setCustomer($new_cust)
|
||||
->setVehicle($new_vehicle)
|
||||
|
|
|
|||
|
|
@ -92,57 +92,57 @@
|
|||
</div>
|
||||
<div class="form-group m-form__group row">
|
||||
<div class="col-lg-6">
|
||||
<label data-field="customer_first_name">First Name</label>
|
||||
<input type="text" name="customer_first_name" id="customer-first-name" class="form-control m-input cust_field" value="{{ obj.getCustomer.getFirstName|default('') }}" data-vehicle-field="1" disabled>
|
||||
<div class="form-control-feedback hide" data-field="customer_first_name"></div>
|
||||
<label data-field="first_name">First Name</label>
|
||||
<input type="text" name="first_name" id="customer-first-name" class="form-control m-input cust_field" value="{{ obj.getCustomer.getFirstName|default('') }}" data-vehicle-field="1" disabled>
|
||||
<div class="form-control-feedback hide" data-field="first_name"></div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<label data-field="customer_last_name">Last Name</label>
|
||||
<input type="text" name="customer_last_name" id="customer-last-name" class="form-control m-input cust_field" value="{{ obj.getCustomer.getLastName|default('') }}" data-vehicle-field="1" disabled>
|
||||
<div class="form-control-feedback hide" data-field="customer_last_name"></div>
|
||||
<label data-field="last_name">Last Name</label>
|
||||
<input type="text" name="last_name" id="customer-last-name" class="form-control m-input cust_field" value="{{ obj.getCustomer.getLastName|default('') }}" data-vehicle-field="1" disabled>
|
||||
<div class="form-control-feedback hide" data-field="last_name"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group m-form__group row">
|
||||
<div class="col-lg-6">
|
||||
<label data-field="customer_phone_mobile">Mobile Phone</label>
|
||||
<label data-field="phone_mobile">Mobile Phone</label>
|
||||
<div class="input-group m-input-group">
|
||||
<span class="input-group-addon">{% trans %}country_code_prefix{% endtrans %}</span>
|
||||
<input type="text" name="customer_phone_mobile" id="customer-phone-mobile" class="form-control m-input cust_field" value="{{ obj.getCustomer.getPhoneMobile|default('') }}" data-vehicle-field="1" disabled>
|
||||
<div class="form-control-feedback hide" data-field="customer_phone_mobile"></div>
|
||||
<input type="text" name="phone_mobile" id="customer-phone-mobile" class="form-control m-input cust_field" value="{{ obj.getCustomer.getPhoneMobile|default('') }}" data-vehicle-field="1" disabled>
|
||||
<div class="form-control-feedback hide" data-field="phone_mobile"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<label data-field="customer_phone_landline">Landline</label>
|
||||
<label data-field="phone_landline">Landline</label>
|
||||
<div class="input-group m-input-group">
|
||||
<span class="input-group-addon">{% trans %}country_code_prefix{% endtrans %}</span>
|
||||
<input type="text" name="customer_phone_landline" id="customer-phone-landline" class="form-control m-input cust_field" value="{{ obj.getCustomer.getPhoneLandline|default('') }}" data-vehicle-field="1" disabled>
|
||||
<div class="form-control-feedback hide" data-field="customer_phone_landline"></div>
|
||||
<input type="text" name="phone_landline" id="customer-phone-landline" class="form-control m-input cust_field" value="{{ obj.getCustomer.getPhoneLandline|default('') }}" data-vehicle-field="1" disabled>
|
||||
<div class="form-control-feedback hide" data-field="phone_landline"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group m-form__group row">
|
||||
<div class="col-lg-6">
|
||||
<label data-field="customer_phone_office">Office Phone</label>
|
||||
<label data-field="phone_office">Office Phone</label>
|
||||
<div class="input-group m-input-group">
|
||||
<span class="input-group-addon">{% trans %}country_code_prefix{% endtrans %}</span>
|
||||
<input type="text" name="customer_phone_office" id="customer-phone-office" class="form-control m-input cust_field" value="{{ obj.getCustomer.getPhoneOffice|default('') }}" data-vehicle-field="1" disabled>
|
||||
<div class="form-control-feedback hide" data-field="customer_phone_office"></div>
|
||||
<input type="text" name="phone_office" id="customer-phone-office" class="form-control m-input cust_field" value="{{ obj.getCustomer.getPhoneOffice|default('') }}" data-vehicle-field="1" disabled>
|
||||
<div class="form-control-feedback hide" data-field="phone_office"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<label data-field="customer_phone_fax">Fax</label>
|
||||
<label data-field="phone_fax">Fax</label>
|
||||
<div class="input-group m-input-group">
|
||||
<span class="input-group-addon">{% trans %}country_code_prefix{% endtrans %}</span>
|
||||
<input type="text" name="customer_phone_fax" id="customer-phone-fax" class="form-control m-input cust_field" value="{{ obj.getCustomer.getPhoneFax|default('') }}" data-vehicle-field="1" disabled>
|
||||
<div class="form-control-feedback hide" data-field="customer_phone_fax"></div>
|
||||
<input type="text" name="phone_fax" id="customer-phone-fax" class="form-control m-input cust_field" value="{{ obj.getCustomer.getPhoneFax|default('') }}" data-vehicle-field="1" disabled>
|
||||
<div class="form-control-feedback hide" data-field="phone_fax"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group m-form__group row">
|
||||
<div class="col-lg-6">
|
||||
<label data-field="customer_customer_notes">Customer Notes</label>
|
||||
<textarea name="customer_customer_notes" id="customer-customer-notes" class="form-control m-input cust_field" data-vehicle-field="1" rows="4" disabled>{{ obj.getCustomer ? obj.getCustomer.getCustomerNotes }}</textarea>
|
||||
<div class="form-control-feedback hide" data-field="customer_customer_notes"></div>
|
||||
<label data-field="customer_notes">Customer Notes</label>
|
||||
<textarea name="customer_notes" id="customer-customer-notes" class="form-control m-input cust_field" data-vehicle-field="1" rows="4" disabled>{{ obj.getCustomer ? obj.getCustomer.getCustomerNotes }}</textarea>
|
||||
<div class="form-control-feedback hide" data-field="customer_notes"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -92,57 +92,57 @@
|
|||
</div>
|
||||
<div class="form-group m-form__group row">
|
||||
<div class="col-lg-6">
|
||||
<label data-field="customer_first_name">First Name</label>
|
||||
<input type="text" name="customer_first_name" id="customer-first-name" class="form-control m-input cust_field" value="{{ obj.getCustomer.getFirstName|default('') }}" data-vehicle-field="1" disabled>
|
||||
<div class="form-control-feedback hide" data-field="customer_first_name"></div>
|
||||
<label data-field="first_name">First Name</label>
|
||||
<input type="text" name="first_name" id="customer-first-name" class="form-control m-input cust_field" value="{{ obj.getCustomer.getFirstName|default('') }}" data-vehicle-field="1" disabled>
|
||||
<div class="form-control-feedback hide" data-field="first_name"></div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<label data-field="customer_last_name">Last Name</label>
|
||||
<input type="text" name="customer_last_name" id="customer-last-name" class="form-control m-input cust_field" value="{{ obj.getCustomer.getLastName|default('') }}" data-vehicle-field="1" disabled>
|
||||
<div class="form-control-feedback hide" data-field="customer_last_name"></div>
|
||||
<label data-field="last_name">Last Name</label>
|
||||
<input type="text" name="last_name" id="customer-last-name" class="form-control m-input cust_field" value="{{ obj.getCustomer.getLastName|default('') }}" data-vehicle-field="1" disabled>
|
||||
<div class="form-control-feedback hide" data-field="last_name"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group m-form__group row">
|
||||
<div class="col-lg-6">
|
||||
<label data-field="customer_phone_mobile">Mobile Phone</label>
|
||||
<label data-field="phone_mobile">Mobile Phone</label>
|
||||
<div class="input-group m-input-group">
|
||||
<span class="input-group-addon">{% trans %}country_code_prefix{% endtrans %}</span>
|
||||
<input type="text" name="customer_phone_mobile" id="customer-phone-mobile" class="form-control m-input cust_field" value="{{ obj.getCustomer.getPhoneMobile|default('') }}" data-vehicle-field="1" disabled>
|
||||
<div class="form-control-feedback hide" data-field="customer_phone_mobile"></div>
|
||||
<input type="text" name="phone_mobile" id="customer-phone-mobile" class="form-control m-input cust_field" value="{{ obj.getCustomer.getPhoneMobile|default('') }}" data-vehicle-field="1" disabled>
|
||||
<div class="form-control-feedback hide" data-field="phone_mobile"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<label data-field="customer_phone_landline">Landline</label>
|
||||
<label data-field="phone_landline">Landline</label>
|
||||
<div class="input-group m-input-group">
|
||||
<span class="input-group-addon">{% trans %}country_code_prefix{% endtrans %}</span>
|
||||
<input type="text" name="customer_phone_landline" id="customer-phone-landline" class="form-control m-input cust_field" value="{{ obj.getCustomer.getPhoneLandline|default('') }}" data-vehicle-field="1" disabled>
|
||||
<div class="form-control-feedback hide" data-field="customer_phone_landline"></div>
|
||||
<input type="text" name="phone_landline" id="customer-phone-landline" class="form-control m-input cust_field" value="{{ obj.getCustomer.getPhoneLandline|default('') }}" data-vehicle-field="1" disabled>
|
||||
<div class="form-control-feedback hide" data-field="phone_landline"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group m-form__group row">
|
||||
<div class="col-lg-6">
|
||||
<label data-field="customer_phone_office">Office Phone</label>
|
||||
<label data-field="phone_office">Office Phone</label>
|
||||
<div class="input-group m-input-group">
|
||||
<span class="input-group-addon">{% trans %}country_code_prefix{% endtrans %}</span>
|
||||
<input type="text" name="customer_phone_office" id="customer-phone-office" class="form-control m-input cust_field" value="{{ obj.getCustomer.getPhoneOffice|default('') }}" data-vehicle-field="1" disabled>
|
||||
<div class="form-control-feedback hide" data-field="customer_phone_office"></div>
|
||||
<input type="text" name="phone_office" id="customer-phone-office" class="form-control m-input cust_field" value="{{ obj.getCustomer.getPhoneOffice|default('') }}" data-vehicle-field="1" disabled>
|
||||
<div class="form-control-feedback hide" data-field="phone_office"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<label data-field="customer_phone_fax">Fax</label>
|
||||
<label data-field="phone_fax">Fax</label>
|
||||
<div class="input-group m-input-group">
|
||||
<span class="input-group-addon">{% trans %}country_code_prefix{% endtrans %}</span>
|
||||
<input type="text" name="customer_phone_fax" id="customer-phone-fax" class="form-control m-input cust_field" value="{{ obj.getCustomer.getPhoneFax|default('') }}" data-vehicle-field="1" disabled>
|
||||
<div class="form-control-feedback hide" data-field="customer_phone_fax"></div>
|
||||
<input type="text" name="phone_fax" id="customer-phone-fax" class="form-control m-input cust_field" value="{{ obj.getCustomer.getPhoneFax|default('') }}" data-vehicle-field="1" disabled>
|
||||
<div class="form-control-feedback hide" data-field="phone_fax"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group m-form__group row">
|
||||
<div class="col-lg-6">
|
||||
<label data-field="customer_customer_notes">Customer Notes</label>
|
||||
<textarea name="customer_customer_notes" id="customer-customer-notes" class="form-control m-input cust_field" data-vehicle-field="1" rows="4" disabled>{{ obj.getCustomer ? obj.getCustomer.getCustomerNotes }}</textarea>
|
||||
<div class="form-control-feedback hide" data-field="customer_customer_notes"></div>
|
||||
<label data-field="customer_notes">Customer Notes</label>
|
||||
<textarea name="customer_notes" id="customer-customer-notes" class="form-control m-input cust_field" data-vehicle-field="1" rows="4" disabled>{{ obj.getCustomer ? obj.getCustomer.getCustomerNotes }}</textarea>
|
||||
<div class="form-control-feedback hide" data-field="customer_notes"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -616,8 +616,6 @@ $(function() {
|
|||
|
||||
// display errors contextually
|
||||
$.each(errors, function(field, msg) {
|
||||
console.log(field);
|
||||
console.log(msg);
|
||||
var formfield = $("[name='" + field + "'], [data-name='" + field + "']");
|
||||
var label = $("label[data-field='" + field + "']");
|
||||
var msgbox = $(".form-control-feedback[data-field='" + field + "']");
|
||||
|
|
|
|||
Loading…
Reference in a new issue