diff --git a/locale.xml b/locale.xml index 12b2fb5f1dcb2e64405dbdf86a5d8e1931b15605..4b44ea5168a17951d1bc3113328b29961e988bdf 100644 --- a/locale.xml +++ b/locale.xml @@ -541,8 +541,8 @@ </locale> <locale name="shipping.status.notification.subject"> - <de><![CDATA[Änderung Ihrer Bestellung [orderNo]]]></de> - <en><![CDATA[Change of your order [orderNo]]]></en> + <de><![CDATA[Änderung Ihrer Bestellung [prefixedNumber]]]></de> + <en><![CDATA[Change of your order [prefixedNumber]]]></en> </locale> <locale name="shipping.status.notification.template" html="true"> <de><![CDATA[ diff --git a/src/QUI/ERP/Shipping/Shipping.php b/src/QUI/ERP/Shipping/Shipping.php index 1888cec761cc8906c90ecdc147a6558ee7224bff..6baa899a9130602f9045c8c7897e688376ecc6a7 100644 --- a/src/QUI/ERP/Shipping/Shipping.php +++ b/src/QUI/ERP/Shipping/Shipping.php @@ -541,7 +541,7 @@ public function getVat(QUI\ERP\ErpEntityInterface $ErpEntity): mixed /** * Notify customer about an Order status change (via e-mail) * - * @param QUI\ERP\Order\AbstractOrder $Order + * @param QUI\ERP\Order\AbstractOrder $ErpEntity * @param int $statusId * @param string|null $message (optional) - Custom notification message [default: default status change message] * @return void @@ -549,16 +549,16 @@ public function getVat(QUI\ERP\ErpEntityInterface $ErpEntity): mixed * @throws QUI\Exception */ public function sendStatusChangeNotification( - AbstractOrder $Order, + ErpEntityInterface $ErpEntity, int $statusId, string $message = null ): void { - $Customer = $Order->getCustomer(); + $Customer = $ErpEntity->getCustomer(); $customerEmail = $Customer->getAttribute('email'); if (empty($customerEmail)) { QUI\System\Log::addWarning( - 'Status change notification for order #' . $Order->getPrefixedId() . ' cannot be sent' + 'Status change notification for erp entity #' . $ErpEntity->getPrefixedNumber() . ' cannot be sent' . ' because customer #' . $Customer->getUUID() . ' has no e-mail address.' ); @@ -567,15 +567,15 @@ public function sendStatusChangeNotification( if (empty($message)) { $Status = ShippingStatus\Handler::getInstance()->getShippingStatus($statusId); - $message = $Status->getStatusChangeNotificationText($Order); + $message = $Status->getStatusChangeNotificationText($ErpEntity); } $Mailer = new QUI\Mail\Mailer(); - $Locale = $Order->getCustomer()->getLocale(); + $Locale = $ErpEntity->getCustomer()->getLocale(); $Mailer->setSubject( $Locale->get('quiqqer/shipping', 'shipping.status.notification.subject', [ - 'orderNo' => $Order->getPrefixedId() + 'prefixedNumber' => $ErpEntity->getPrefixedNumber() ]) ); @@ -584,7 +584,7 @@ public function sendStatusChangeNotification( try { $Mailer->send(); - $Order->addStatusMail($message); + $ErpEntity->addStatusMail($message); } catch (\Exception $Exception) { QUI\System\Log::writeException($Exception); } diff --git a/src/QUI/ERP/Shipping/ShippingStatus/Handler.php b/src/QUI/ERP/Shipping/ShippingStatus/Handler.php index 7fbf919d078931833827e670eed2afe7bab7328c..f4de39755edaab9c1ba5ac3ae0b1fa3660a008a7 100644 --- a/src/QUI/ERP/Shipping/ShippingStatus/Handler.php +++ b/src/QUI/ERP/Shipping/ShippingStatus/Handler.php @@ -267,21 +267,24 @@ public function createNotificationTranslations(int $id): void /** * Notify customer about an Order status change (via e-mail) * - * @param AbstractOrder $Order + * @param AbstractOrder $ErpEntity * @param int $statusId * @param string|null $message (optional) - Custom notification message [default: default status change message] * @return void * * @throws QUI\Exception */ - public function sendStatusChangeNotification(AbstractOrder $Order, int $statusId, string $message = null): void - { - $Customer = $Order->getCustomer(); + public function sendStatusChangeNotification( + QUI\ERP\ErpEntityInterface $ErpEntity, + int $statusId, + string $message = null + ): void { + $Customer = $ErpEntity->getCustomer(); $customerEmail = $Customer->getAttribute('email'); if (empty($customerEmail)) { QUI\System\Log::addWarning( - 'Status change notification for order #' . $Order->getPrefixedId() . ' cannot be sent' + 'Status change notification for entity #' . $ErpEntity->getPrefixedNumber() . ' cannot be sent' . ' because customer #' . $Customer->getUUID() . ' has no e-mail address.' ); @@ -290,15 +293,15 @@ public function sendStatusChangeNotification(AbstractOrder $Order, int $statusId if (empty($message)) { $Status = $this->getShippingStatus($statusId); - $message = $Status->getStatusChangeNotificationText($Order); + $message = $Status->getStatusChangeNotificationText($ErpEntity); } $Mailer = new QUI\Mail\Mailer(); - $Locale = $Order->getCustomer()->getLocale(); + $Locale = $ErpEntity->getCustomer()->getLocale(); $Mailer->setSubject( $Locale->get('quiqqer/shipping', 'shipping.status.notification.subject', [ - 'orderNo' => $Order->getPrefixedId() + 'prefixedNumber' => $ErpEntity->getPrefixedNumber() ]) ); @@ -307,7 +310,7 @@ public function sendStatusChangeNotification(AbstractOrder $Order, int $statusId try { $Mailer->send(); - $Order->addStatusMail($message); + $ErpEntity->addStatusMail($message); } catch (\Exception $Exception) { QUI\System\Log::writeException($Exception); }