Update email recipient logic for wash certificate bookings
- Added conditional logic to prioritize `wash_certificate_email` if provided for customer notifications. - Refactored email setup to use the selected email for wash certificate-related bookings.
This commit is contained in:
@@ -348,6 +348,10 @@ class email implements email_i
|
||||
$customer->requireSelected();
|
||||
$recipient_name = $customer->getCustomerName((int)$customer->customer_number->value());
|
||||
$recipient_email = $customer->email->value();
|
||||
// Check if the customer has a booking-specific email provided
|
||||
if (!empty($customer->wash_certificate_email->value())) {
|
||||
$recipient_email = (string)$customer->wash_certificate_email->value();
|
||||
}
|
||||
// Get the department details
|
||||
$department = (new departments_o())->select((int)$order_booking->department->value());
|
||||
$department->requireSelected();
|
||||
@@ -363,7 +367,7 @@ class email implements email_i
|
||||
$order_booking->reg_1->value(),
|
||||
$order_booking->reg_2->value(),
|
||||
($order_booking->containsWashCertificateItem() ? 'Ja' : 'Nej'),
|
||||
$customer->email->value(), // Wash certificate email is the customer's email
|
||||
$recipient_email,
|
||||
$order_booking->datetime->value(),
|
||||
(string)$department->getDepartmentName((int)$department->id),
|
||||
(string)$department->getBranding()->address->value(),
|
||||
|
||||
Reference in New Issue
Block a user