From 458595fa248c90b28810e461c2343b9c793b5648 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Mon, 24 Jan 2022 15:31:42 +0100 Subject: [PATCH] Add an option to deactivate the remove-all-data function for customers (#808). --- application/controllers/Booking.php | 2 + application/controllers/Privacy.php | 7 ++++ ...ay_delete_personal_information_setting.php | 41 +++++++++++++++++++ .../components/booking_cancellation_frame.php | 25 ++++++----- .../views/components/booking_header.php | 2 +- application/views/pages/booking.php | 3 +- application/views/pages/booking_settings.php | 16 ++++++++ 7 files changed, 83 insertions(+), 13 deletions(-) create mode 100644 application/migrations/029_add_display_delete_personal_information_setting.php diff --git a/application/controllers/Booking.php b/application/controllers/Booking.php index 8307c969..2fab9463 100755 --- a/application/controllers/Booking.php +++ b/application/controllers/Booking.php @@ -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, diff --git a/application/controllers/Privacy.php b/application/controllers/Privacy.php index a81ae536..90f9f7d9 100644 --- a/application/controllers/Privacy.php +++ b/application/controllers/Privacy.php @@ -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)) diff --git a/application/migrations/029_add_display_delete_personal_information_setting.php b/application/migrations/029_add_display_delete_personal_information_setting.php new file mode 100644 index 00000000..7092c19c --- /dev/null +++ b/application/migrations/029_add_display_delete_personal_information_setting.php @@ -0,0 +1,41 @@ + + * @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', + ]); + } + } +} diff --git a/application/views/components/booking_cancellation_frame.php b/application/views/components/booking_cancellation_frame.php index 9d62c8c4..71a31f43 100644 --- a/application/views/components/booking_cancellation_frame.php +++ b/application/views/components/booking_cancellation_frame.php @@ -1,9 +1,10 @@ @@ -27,15 +28,17 @@ -
-
- + +
+
+ +
+
+ +
-
- -
-
+ diff --git a/application/views/components/booking_header.php b/application/views/components/booking_header.php index e9809a46..82348ff0 100644 --- a/application/views/components/booking_header.php +++ b/application/views/components/booking_header.php @@ -10,7 +10,7 @@
- +   diff --git a/application/views/pages/booking.php b/application/views/pages/booking.php index 917f1f24..3b7d7f30 100755 --- a/application/views/pages/booking.php +++ b/application/views/pages/booking.php @@ -6,7 +6,8 @@ vars('manage_mode'), - 'appointment_data' => vars('appointment_data') + 'appointment_data' => vars('appointment_data'), + 'display_delete_personal_information' => vars('display_delete_personal_information'), ]) ?> diff --git a/application/views/pages/booking_settings.php b/application/views/pages/booking_settings.php index c9cc5f66..08d05a73 100755 --- a/application/views/pages/booking_settings.php +++ b/application/views/pages/booking_settings.php @@ -270,6 +270,22 @@
+ +
+
+ + +
+ +
+ + + +
+