Add email sending for wash certificates and update form text.

Introduced `sendWashCertificateEmail` method to handle email dispatch, including necessary exception handling for MailerSend. Updated the wash booking form text to enhance clarity and ensure appropriate instructions in Danish.
This commit is contained in:
Jepp9350
2025-03-27 11:21:23 +01:00
parent 8aee687106
commit 95625e70b9
2 changed files with 18 additions and 3 deletions
@@ -106,9 +106,12 @@ class book_wash_f extends form_helper_c
public function setup(): void
{
self::setFormIdentifier('BOOK_WASH');
self::setFormName('Book a wash');
self::setFormDescription('This form is used to book a wash for a vehicle.');
self::setSubmitButtonText('Book udvendig vask');
self::setFormName('Book vask med reference');
self::setFormDescription('
Book en vask med reference. Dette er en formular, der bruges til at booke en vask med reference.
Det er vigtigt at udfylde alle felter korrekt for at sikre, at vasken bliver booket korrekt.
');
self::setSubmitButtonText('Book vask');
// Set the form fields
self::defineInputFieldsAdvanced([
'department_id' => [
@@ -7,6 +7,9 @@ use classes\email;
use classes\object_property;
use classes\pdf_generator;
use Exception;
use MailerSend\Exceptions\MailerSendAssertException;
use MailerSend\Exceptions\MailerSendException;
use Psr\Http\Client\ClientExceptionInterface;
use traits\db_object_t;
class bookings_new_o extends db
@@ -155,6 +158,7 @@ class bookings_new_o extends db
* @throws Exception If the booking is cancelled
* @throws Exception If the booking is completed
* @throws Exception If the booking status is unknown
* @throws ClientExceptionInterface
*/
public function generateWashCertificate(string|null $safety_seal, string|null $operator): void
{
@@ -205,6 +209,14 @@ class bookings_new_o extends db
self::sendWashCertificateEmail();
}
/**
* Send the wash certificate email
* @throws MailerSendException
* @throws ClientExceptionInterface
* @throws MailerSendAssertException
* @throws \JsonException
* @throws Exception
*/
public function sendWashCertificateEmail(): void
{
self::requireSelected();