Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add company colors to notifications #1569

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -278,10 +278,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 @@ -354,10 +357,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()

$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 @@ -272,10 +272,13 @@ private function notify_and_sync_appointment(array $appointment, string $action

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

$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'),
];
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