Resolve "Resq - additional dpa behavior" #1282
3 changed files with 43 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,31 @@ 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.';
|
||||||
|
|
||||||
|
// check if email marketing promo is checked
|
||||||
|
$is_email_promo_checked = $req->request->get('flag_promo_email');
|
||||||
|
if ($is_email_promo_checked)
|
||||||
|
{
|
||||||
|
// check email field
|
||||||
|
if (empty($req->request->get('email')))
|
||||||
|
$error_array['email'] = 'Email address required.';
|
||||||
|
}
|
||||||
|
|
||||||
|
$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 +339,21 @@ 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.';
|
||||||
|
|
||||||
|
// check if email marketing promo is checked
|
||||||
|
$is_email_promo_checked = $req->request->get('flag_promo_email');
|
||||||
|
if ($is_email_promo_checked)
|
||||||
|
{
|
||||||
|
// check email field
|
||||||
|
if (empty($req->request->get('email')))
|
||||||
|
$error_array['email'] = 'Email address required.';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// TODO: validate mobile numbers
|
// TODO: validate mobile numbers
|
||||||
// TODO: validate vehicles
|
// TODO: validate vehicles
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,7 @@
|
||||||
E-mail
|
E-mail
|
||||||
</label>
|
</label>
|
||||||
<input type="text" name="email" class="form-control m-input" value="{{ obj.getEmail }}" data-name="email">
|
<input type="text" name="email" class="form-control m-input" value="{{ obj.getEmail }}" data-name="email">
|
||||||
|
<div class="form-control-feedback hide" data-field="email"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group m-form__group row">
|
<div class="form-group m-form__group row">
|
||||||
|
|
@ -122,9 +123,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