From 493fff1f9262d7949dab9148b30ae4e15688fef8 Mon Sep 17 00:00:00 2001 From: Marcel Link Date: Tue, 23 Jul 2024 14:46:08 +0200 Subject: [PATCH] Add company colors to notifications --- application/controllers/Booking.php | 3 +++ application/controllers/Booking_cancellation.php | 3 +++ application/controllers/Calendar.php | 6 ++++++ application/controllers/Google.php | 3 +++ application/controllers/Recovery.php | 3 +++ application/controllers/api/v1/Appointments_api_v1.php | 6 ++++++ application/views/emails/account_recovery_email.php | 2 +- application/views/emails/appointment_deleted_email.php | 2 +- application/views/emails/appointment_saved_email.php | 2 +- 9 files changed, 27 insertions(+), 3 deletions(-) diff --git a/application/controllers/Booking.php b/application/controllers/Booking.php index 860c5aa0..4ec1b4c5 100755 --- a/application/controllers/Booking.php +++ b/application/controllers/Booking.php @@ -447,10 +447,13 @@ class Booking extends EA_Controller $appointment_id = $this->appointments_model->save($appointment); $appointment = $this->appointments_model->find($appointment_id); + $company_color = setting('company_color'); + $settings = [ 'company_name' => setting('company_name'), 'company_link' => setting('company_link'), 'company_email' => setting('company_email'), + 'company_color' => !empty($company_color) && $company_color != DEFAULT_COMPANY_COLOR ? $company_color : null, 'date_format' => setting('date_format'), 'time_format' => setting('time_format'), ]; diff --git a/application/controllers/Booking_cancellation.php b/application/controllers/Booking_cancellation.php index 8bd646dc..ec2ca4a7 100755 --- a/application/controllers/Booking_cancellation.php +++ b/application/controllers/Booking_cancellation.php @@ -88,10 +88,13 @@ class Booking_cancellation extends EA_Controller $service = $this->services_model->find($appointment['id_services']); + $company_color = setting('company_color'); + $settings = [ 'company_name' => setting('company_name'), 'company_email' => setting('company_email'), 'company_link' => setting('company_link'), + 'company_color' => !empty($company_color) && $company_color != DEFAULT_COMPANY_COLOR ? $company_color : null, 'date_format' => setting('date_format'), 'time_format' => setting('time_format'), ]; diff --git a/application/controllers/Calendar.php b/application/controllers/Calendar.php index 250957bc..4c96a17d 100644 --- a/application/controllers/Calendar.php +++ b/application/controllers/Calendar.php @@ -278,10 +278,13 @@ class Calendar extends EA_Controller $customer = $this->customers_model->find($appointment['id_users_customer']); $service = $this->services_model->find($appointment['id_services']); + $company_color = setting('company_color'); + $settings = [ 'company_name' => setting('company_name'), 'company_link' => setting('company_link'), 'company_email' => setting('company_email'), + 'company_color' => !empty($company_color) && $company_color != DEFAULT_COMPANY_COLOR ? $company_color : null, 'date_format' => setting('date_format'), 'time_format' => setting('time_format'), ]; @@ -354,10 +357,13 @@ class Calendar extends EA_Controller $customer = $this->customers_model->find($appointment['id_users_customer']); $service = $this->services_model->find($appointment['id_services']); + $company_color = setting('company_color'); + $settings = [ 'company_name' => setting('company_name'), 'company_email' => setting('company_email'), 'company_link' => setting('company_link'), + 'company_color' => !empty($company_color) && $company_color != DEFAULT_COMPANY_COLOR ? $company_color : null, 'date_format' => setting('date_format'), 'time_format' => setting('time_format'), ]; diff --git a/application/controllers/Google.php b/application/controllers/Google.php index 32f609af..a59504c2 100644 --- a/application/controllers/Google.php +++ b/application/controllers/Google.php @@ -102,10 +102,13 @@ class Google extends EA_Controller $local_events = [...$appointments, ...$unavailabilities]; + $company_color = setting('company_color'); + $settings = [ 'company_name' => setting('company_name'), 'company_link' => setting('company_link'), 'company_email' => setting('company_email'), + 'company_color' => !empty($company_color) && $company_color != DEFAULT_COMPANY_COLOR ? $company_color : null, ]; $provider_timezone = new DateTimeZone($provider['timezone']); diff --git a/application/controllers/Recovery.php b/application/controllers/Recovery.php index dc257315..1c9e7e48 100644 --- a/application/controllers/Recovery.php +++ b/application/controllers/Recovery.php @@ -67,11 +67,14 @@ class Recovery extends EA_Controller $new_password = $this->accounts->regenerate_password($username, $email); + $company_color = setting('company_color'); + if ($new_password) { $settings = [ 'company_name' => setting('company_name'), 'company_link' => setting('company_link'), 'company_email' => setting('company_email'), + 'company_color' => !empty($company_color) && $company_color != DEFAULT_COMPANY_COLOR ? $company_color : null, ]; $this->email_messages->send_password($new_password, $email, $settings); diff --git a/application/controllers/api/v1/Appointments_api_v1.php b/application/controllers/api/v1/Appointments_api_v1.php index d3914e8d..0bad9124 100644 --- a/application/controllers/api/v1/Appointments_api_v1.php +++ b/application/controllers/api/v1/Appointments_api_v1.php @@ -272,10 +272,13 @@ class Appointments_api_v1 extends EA_Controller $customer = $this->customers_model->find($appointment['id_users_customer'], true); + $company_color = setting('company_color'); + $settings = [ 'company_name' => setting('company_name'), 'company_email' => setting('company_email'), 'company_link' => setting('company_link'), + 'company_color' => !empty($company_color) && $company_color != DEFAULT_COMPANY_COLOR ? $company_color : null, 'date_format' => setting('date_format'), 'time_format' => setting('time_format'), ]; @@ -352,10 +355,13 @@ class Appointments_api_v1 extends EA_Controller $customer = $this->customers_model->find($deleted_appointment['id_users_customer'], true); + $company_color = setting('company_color'); + $settings = [ 'company_name' => setting('company_name'), 'company_email' => setting('company_email'), 'company_link' => setting('company_link'), + 'company_color' => !empty($company_color) && $company_color != DEFAULT_COMPANY_COLOR ? $company_color : null, 'date_format' => setting('date_format'), 'time_format' => setting('time_format'), ]; diff --git a/application/views/emails/account_recovery_email.php b/application/views/emails/account_recovery_email.php index 19fa48c2..50ffa3fa 100644 --- a/application/views/emails/account_recovery_email.php +++ b/application/views/emails/account_recovery_email.php @@ -14,7 +14,7 @@
-