Skip to content

Commit

Permalink
Merge pull request #1569 from UPONU-GmbH/feature/companycolor
Browse files Browse the repository at this point in the history
Add company colors to notifications
  • Loading branch information
alextselegidis authored Jan 17, 2025
2 parents 2d0014a + 493fff1 commit 0c59b43
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 3 deletions.
3 changes: 3 additions & 0 deletions application/controllers/Booking.php
Original file line number Diff line number Diff line change
Expand Up @@ -447,10 +447,13 @@ public function register(): void
$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'),
];
Expand Down
3 changes: 3 additions & 0 deletions application/controllers/Booking_cancellation.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,13 @@ public function of(string $appointment_hash): void

$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'),
];
Expand Down
6 changes: 6 additions & 0 deletions application/controllers/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,13 @@ public function save_appointment(): void
$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'),
];
Expand Down Expand Up @@ -367,10 +370,13 @@ public function delete_appointment(): void
$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'),
];
Expand Down
3 changes: 3 additions & 0 deletions application/controllers/Google.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,13 @@ public static function sync(?string $provider_id = null): void

$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']);
Expand Down
3 changes: 3 additions & 0 deletions application/controllers/Recovery.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,14 @@ public function perform(): void

$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);
Expand Down
6 changes: 6 additions & 0 deletions application/controllers/api/v1/Appointments_api_v1.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,13 @@ private function notify_and_sync_appointment(array $appointment, string $action

$customer = $this->customers_model->find($appointment['id_users_customer']);

$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'),
];
Expand Down Expand Up @@ -349,10 +352,13 @@ public function destroy(int $id): void

$customer = $this->customers_model->find($deleted_appointment['id_users_customer']);

$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'),
];
Expand Down
2 changes: 1 addition & 1 deletion application/views/emails/account_recovery_email.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<body style="font: 13px arial, helvetica, tahoma;">

<div class="email-container" style="width: 650px; border: 1px solid #eee; margin: 30px auto;">
<div id="header" style="background-color: #429a82; height: 45px; padding: 10px 15px;">
<div id="header" style="background-color: <?= $settings['company_color'] ?? '#429a82' ?>; height: 45px; padding: 10px 15px;">
<strong id="logo" style="color: white; font-size: 20px; margin-top: 10px; display: inline-block">
<?= e($settings['company_name']) ?>
</strong>
Expand Down
2 changes: 1 addition & 1 deletion application/views/emails/appointment_deleted_email.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<body style="font: 13px arial, helvetica, tahoma;">

<div class="email-container" style="width: 650px; border: 1px solid #eee; margin: 30px auto;">
<div id="header" style="background-color: #429a82; height: 45px; padding: 10px 15px;">
<div id="header" style="background-color: <?= $settings['company_color'] ?? '#429a82' ?>; height: 45px; padding: 10px 15px;">
<strong id="logo" style="color: white; font-size: 20px; margin-top: 10px; display: inline-block">
<?= e($settings['company_name']) ?>
</strong>
Expand Down
2 changes: 1 addition & 1 deletion application/views/emails/appointment_saved_email.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<body style="font: 13px arial, helvetica, tahoma;">

<div class="email-container" style="width: 650px; border: 1px solid #eee; margin: 30px auto;">
<div id="header" style="background-color: #429a82; height: 45px; padding: 10px 15px;">
<div id="header" style="background-color: <?= $settings['company_color'] ?? '#429a82' ?>; height: 45px; padding: 10px 15px;">
<strong id="logo" style="color: white; font-size: 20px; margin-top: 10px; display: inline-block">
<?= e($settings['company_name']) ?>
</strong>
Expand Down

0 comments on commit 0c59b43

Please sign in to comment.