Add acl entry for display of DPA Consent. Add checking when adding/updating customer for DPA consent. #408
This commit is contained in:
parent
5bfa881354
commit
af85a632e5
3 changed files with 23 additions and 9 deletions
|
|
@ -156,6 +156,8 @@ access_keys:
|
||||||
label: Update
|
label: Update
|
||||||
- id: customer.delete
|
- id: customer.delete
|
||||||
label: Delete
|
label: Delete
|
||||||
|
- id: customer.dpa
|
||||||
|
label: Display DPA
|
||||||
|
|
||||||
|
|
||||||
- id: location
|
- id: location
|
||||||
|
|
|
||||||
|
|
@ -163,17 +163,22 @@ class ResqCustomerHandler implements CustomerHandlerInterface
|
||||||
// add new customer and customer vehicle, if any
|
// add new customer and customer vehicle, if any
|
||||||
public function addCustomer(Request $req)
|
public function addCustomer(Request $req)
|
||||||
{
|
{
|
||||||
// create new row
|
|
||||||
$em = $this->em;
|
|
||||||
$row = new Customer();
|
|
||||||
|
|
||||||
$this->setObject($row, $req);
|
|
||||||
|
|
||||||
// initialize error lists
|
// initialize error lists
|
||||||
$error_array = [];
|
$error_array = [];
|
||||||
$nerror_array = [];
|
$nerror_array = [];
|
||||||
$verror_array = [];
|
$verror_array = [];
|
||||||
|
|
||||||
|
// create new row
|
||||||
|
$em = $this->em;
|
||||||
|
$row = new Customer();
|
||||||
|
|
||||||
|
// check if dpa consent is unticked
|
||||||
|
$is_dpa_checked = $req->request->get('flag_dpa_consent');
|
||||||
|
if (!$is_dpa_checked)
|
||||||
|
$error_array['flag_dpa_consent'] = 'DPA consent should be checked.';
|
||||||
|
|
||||||
|
$this->setObject($row, $req);
|
||||||
|
|
||||||
// custom validation for vehicles
|
// custom validation for vehicles
|
||||||
$vehicles = json_decode($req->request->get('vehicles'));
|
$vehicles = json_decode($req->request->get('vehicles'));
|
||||||
|
|
||||||
|
|
@ -325,6 +330,11 @@ class ResqCustomerHandler implements CustomerHandlerInterface
|
||||||
$nerror_array = [];
|
$nerror_array = [];
|
||||||
$verror_array = [];
|
$verror_array = [];
|
||||||
|
|
||||||
|
// check if dpa consent is unticked
|
||||||
|
$is_dpa_checked = $req->request->get('flag_dpa_consent');
|
||||||
|
if (!$is_dpa_checked)
|
||||||
|
$error_array['flag_dpa_consent'] = 'DPA consent should be checked.';
|
||||||
|
|
||||||
// TODO: validate mobile numbers
|
// TODO: validate mobile numbers
|
||||||
// TODO: validate vehicles
|
// TODO: validate vehicles
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -122,9 +122,11 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-4">
|
<div class="col-lg-4">
|
||||||
<input type="checkbox" name="flag_dpa_consent" id="flag-dpa_consent" value="1"{{ obj.isDpaConsent ? ' checked' }} >
|
{% if is_granted('customer.dpa') %}
|
||||||
<label class="switch-label">With DPA Consent</label>
|
<input type="checkbox" name="flag_dpa_consent" id="flag-dpa_consent" value="1"{{ obj.isDpaConsent ? ' checked' }} >
|
||||||
<div class="form-control-feedback hide" data-field="flag_dpa_consent"></div>
|
<label class="switch-label">With DPA Consent</label>
|
||||||
|
<div class="form-control-feedback hide" data-field="flag_dpa_consent"></div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group m-form__group row">
|
<div class="form-group m-form__group row">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue