Resolve "Resq - additional dpa behavior" #1282

Merged
korina.cordero merged 2 commits from 408-resq-additional-dpa-behavior into master 2020-05-21 01:50:58 +00:00
3 changed files with 23 additions and 9 deletions
Showing only changes of commit af85a632e5 - Show all commits

View file

@ -156,6 +156,8 @@ access_keys:
label: Update
- id: customer.delete
label: Delete
- id: customer.dpa
label: Display DPA
- id: location

View file

@ -163,17 +163,22 @@ class ResqCustomerHandler implements CustomerHandlerInterface
// add new customer and customer vehicle, if any
public function addCustomer(Request $req)
{
// create new row
$em = $this->em;
$row = new Customer();
$this->setObject($row, $req);
// initialize error lists
$error_array = [];
$nerror_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
$vehicles = json_decode($req->request->get('vehicles'));
@ -325,6 +330,11 @@ class ResqCustomerHandler implements CustomerHandlerInterface
$nerror_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 vehicles

View file

@ -122,9 +122,11 @@
</div>
</div>
<div class="col-lg-4">
<input type="checkbox" name="flag_dpa_consent" id="flag-dpa_consent" value="1"{{ obj.isDpaConsent ? ' checked' }} >
<label class="switch-label">With DPA Consent</label>
<div class="form-control-feedback hide" data-field="flag_dpa_consent"></div>
{% if is_granted('customer.dpa') %}
<input type="checkbox" name="flag_dpa_consent" id="flag-dpa_consent" value="1"{{ obj.isDpaConsent ? ' checked' }} >
<label class="switch-label">With DPA Consent</label>
<div class="form-control-feedback hide" data-field="flag_dpa_consent"></div>
{% endif %}
</div>
</div>
<div class="form-group m-form__group row">