Add an option to deactivate the remove-all-data function for customers (#808).

This commit is contained in:
Alex Tselegidis 2022-01-24 15:31:42 +01:00
parent 5982a79852
commit 458595fa24
7 changed files with 83 additions and 13 deletions

View file

@ -103,6 +103,7 @@ class Booking extends EA_Controller {
$display_privacy_policy = setting('display_privacy_policy');
$privacy_policy_content = setting('privacy_policy_content');
$display_any_provider = setting('display_any_provider');
$display_delete_personal_information = setting('display_delete_personal_information');
$book_advance_timeout = setting('book_advance_timeout');
$google_analytics_code = setting('google_analytics_code');
$matomo_analytics_url = setting('matomo_analytics_url');
@ -224,6 +225,7 @@ class Booking extends EA_Controller {
'display_privacy_policy' => $display_privacy_policy,
'privacy_policy_content' => $privacy_policy_content,
'display_any_provider' => $display_any_provider,
'display_delete_personal_information' => $display_delete_personal_information,
'google_analytics_code' => $google_analytics_code,
'matomo_analytics_url' => $matomo_analytics_url,
'timezones' => $timezones,

View file

@ -38,6 +38,13 @@ class Privacy extends EA_Controller {
{
try
{
$display_delete_personal_information = setting('display_delete_personal_information');
if ( ! $display_delete_personal_information)
{
abort(403, 'Forbidden');
}
$customer_token = request('customer_token');
if (empty($customer_token))

View file

@ -0,0 +1,41 @@
<?php defined('BASEPATH') or exit('No direct script access allowed');
/* ----------------------------------------------------------------------------
* Easy!Appointments - Online Appointment Scheduler
*
* @package EasyAppointments
* @author A.Tselegidis <alextselegidis@gmail.com>
* @copyright Copyright (c) Alex Tselegidis
* @license https://opensource.org/licenses/GPL-3.0 - GPLv3
* @link https://easyappointments.org
* @since v1.4.0
* ---------------------------------------------------------------------------- */
class Migration_Add_display_delete_personal_information_setting extends EA_Migration {
/**
* Upgrade method.
*/
public function up()
{
if ( ! $this->db->get_where('settings', ['name' => 'display_delete_personal_information'])->num_rows())
{
$this->db->insert('settings', [
'name' => 'display_delete_personal_information',
'value' => '0'
]);
}
}
/**
* Downgrade method.
*/
public function down()
{
if ( ! $this->db->get_where('settings', ['name' => 'display_delete_personal_information'])->num_rows())
{
$this->db->delete('settings', [
'name' => 'display_delete_personal_information',
]);
}
}
}

View file

@ -4,6 +4,7 @@
*
* @var bool $manage_mode
* @var array $appointment_data
* @var bool $display_delete_personal_information
*/
?>
@ -27,6 +28,7 @@
</form>
</div>
</div>
<?php if ($display_delete_personal_information): ?>
<div class="booking-header-bar row">
<div class="col-md-10">
<small><?= lang('delete_personal_information_hint') ?></small>
@ -39,3 +41,4 @@
</div>
</div>
<?php endif ?>
<?php endif ?>

View file

@ -10,7 +10,7 @@
<div id="company-name">
<?= $company_name ?>
<div class="d-flex justify-content-between">
<span class="display-selected-service">
<span class="display-selected-service me-2">
&nbsp;
</span>
<span class="display-selected-provider">

View file

@ -6,7 +6,8 @@
<?php component('booking_cancellation_frame', [
'manage_mode' => vars('manage_mode'),
'appointment_data' => vars('appointment_data')
'appointment_data' => vars('appointment_data'),
'display_delete_personal_information' => vars('display_delete_personal_information'),
]) ?>
<!-- Select Service & Provider -->

View file

@ -270,6 +270,22 @@
</small>
</div>
</div>
<div class="mb-3">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" id="display-delete-personal-information"
data-field="display_delete_personal_information">
<label class="form-check-label" for="display-delete-personal-information">
<?= lang('delete_personal_information') ?>
</label>
</div>
<div class="form-text text-muted">
<small>
<?= lang('delete_personal_information_hint') ?>
</small>
</div>
</div>
</div>
</div>
</fieldset>