From e4774ee991047b095f68ce9664b3b4467df5d7d5 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Mon, 20 Dec 2021 09:39:01 +0100 Subject: [PATCH] Do not send an email to customer if no email is provided. --- application/libraries/Notifications.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/application/libraries/Notifications.php b/application/libraries/Notifications.php index 27fdd562..61354c60 100644 --- a/application/libraries/Notifications.php +++ b/application/libraries/Notifications.php @@ -85,10 +85,10 @@ class Notifications { $ics_stream = $this->CI->ics_file->get_stream($appointment, $service, $provider, $customer); // Notify customer. - $send_customer = filter_var( - setting('customer_notifications'), - FILTER_VALIDATE_BOOLEAN - ); + $send_customer = ! empty($customer['email']) && filter_var( + setting('customer_notifications'), + FILTER_VALIDATE_BOOLEAN + ); if ($send_customer === TRUE) { @@ -232,10 +232,10 @@ class Notifications { } // Notify customer. - $send_customer = filter_var( - setting('customer_notifications'), - FILTER_VALIDATE_BOOLEAN - ); + $send_customer = ! empty($customer['email']) && filter_var( + setting('customer_notifications'), + FILTER_VALIDATE_BOOLEAN + ); if ($send_customer === TRUE) {