Skip to content
Code-Schnipsel Gruppen Projekte
Commit 8ce78fab erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

Merge branch 'next-2.x' into 'main'

fix: sendStatusChangeNotification allowes every erp entity

See merge request !33
Übergeordnete bc09573d 94c35851
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
3 Merge Requests!43Update 'next-3.x' with latest changes from 'main',!33fix: sendStatusChangeNotification allowes every erp entity,!32Add QUIQQER Tooling
Pipeline-Nr. 8679 bestanden
...@@ -541,8 +541,8 @@ ...@@ -541,8 +541,8 @@
</locale> </locale>
<locale name="shipping.status.notification.subject"> <locale name="shipping.status.notification.subject">
<de><![CDATA[Änderung Ihrer Bestellung [orderNo]]]></de> <de><![CDATA[Änderung Ihrer Bestellung [prefixedNumber]]]></de>
<en><![CDATA[Change of your order [orderNo]]]></en> <en><![CDATA[Change of your order [prefixedNumber]]]></en>
</locale> </locale>
<locale name="shipping.status.notification.template" html="true"> <locale name="shipping.status.notification.template" html="true">
<de><![CDATA[ <de><![CDATA[
......
...@@ -541,7 +541,7 @@ public function getVat(QUI\ERP\ErpEntityInterface $ErpEntity): mixed ...@@ -541,7 +541,7 @@ public function getVat(QUI\ERP\ErpEntityInterface $ErpEntity): mixed
/** /**
* Notify customer about an Order status change (via e-mail) * 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 int $statusId
* @param string|null $message (optional) - Custom notification message [default: default status change message] * @param string|null $message (optional) - Custom notification message [default: default status change message]
* @return void * @return void
...@@ -549,16 +549,16 @@ public function getVat(QUI\ERP\ErpEntityInterface $ErpEntity): mixed ...@@ -549,16 +549,16 @@ public function getVat(QUI\ERP\ErpEntityInterface $ErpEntity): mixed
* @throws QUI\Exception * @throws QUI\Exception
*/ */
public function sendStatusChangeNotification( public function sendStatusChangeNotification(
AbstractOrder $Order, ErpEntityInterface $ErpEntity,
int $statusId, int $statusId,
string $message = null string $message = null
): void { ): void {
$Customer = $Order->getCustomer(); $Customer = $ErpEntity->getCustomer();
$customerEmail = $Customer->getAttribute('email'); $customerEmail = $Customer->getAttribute('email');
if (empty($customerEmail)) { if (empty($customerEmail)) {
QUI\System\Log::addWarning( 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.' . ' because customer #' . $Customer->getUUID() . ' has no e-mail address.'
); );
...@@ -567,15 +567,15 @@ public function sendStatusChangeNotification( ...@@ -567,15 +567,15 @@ public function sendStatusChangeNotification(
if (empty($message)) { if (empty($message)) {
$Status = ShippingStatus\Handler::getInstance()->getShippingStatus($statusId); $Status = ShippingStatus\Handler::getInstance()->getShippingStatus($statusId);
$message = $Status->getStatusChangeNotificationText($Order); $message = $Status->getStatusChangeNotificationText($ErpEntity);
} }
$Mailer = new QUI\Mail\Mailer(); $Mailer = new QUI\Mail\Mailer();
$Locale = $Order->getCustomer()->getLocale(); $Locale = $ErpEntity->getCustomer()->getLocale();
$Mailer->setSubject( $Mailer->setSubject(
$Locale->get('quiqqer/shipping', 'shipping.status.notification.subject', [ $Locale->get('quiqqer/shipping', 'shipping.status.notification.subject', [
'orderNo' => $Order->getPrefixedId() 'prefixedNumber' => $ErpEntity->getPrefixedNumber()
]) ])
); );
...@@ -584,7 +584,7 @@ public function sendStatusChangeNotification( ...@@ -584,7 +584,7 @@ public function sendStatusChangeNotification(
try { try {
$Mailer->send(); $Mailer->send();
$Order->addStatusMail($message); $ErpEntity->addStatusMail($message);
} catch (\Exception $Exception) { } catch (\Exception $Exception) {
QUI\System\Log::writeException($Exception); QUI\System\Log::writeException($Exception);
} }
......
...@@ -267,21 +267,24 @@ public function createNotificationTranslations(int $id): void ...@@ -267,21 +267,24 @@ public function createNotificationTranslations(int $id): void
/** /**
* Notify customer about an Order status change (via e-mail) * Notify customer about an Order status change (via e-mail)
* *
* @param AbstractOrder $Order * @param AbstractOrder $ErpEntity
* @param int $statusId * @param int $statusId
* @param string|null $message (optional) - Custom notification message [default: default status change message] * @param string|null $message (optional) - Custom notification message [default: default status change message]
* @return void * @return void
* *
* @throws QUI\Exception * @throws QUI\Exception
*/ */
public function sendStatusChangeNotification(AbstractOrder $Order, int $statusId, string $message = null): void public function sendStatusChangeNotification(
{ QUI\ERP\ErpEntityInterface $ErpEntity,
$Customer = $Order->getCustomer(); int $statusId,
string $message = null
): void {
$Customer = $ErpEntity->getCustomer();
$customerEmail = $Customer->getAttribute('email'); $customerEmail = $Customer->getAttribute('email');
if (empty($customerEmail)) { if (empty($customerEmail)) {
QUI\System\Log::addWarning( 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.' . ' because customer #' . $Customer->getUUID() . ' has no e-mail address.'
); );
...@@ -290,15 +293,15 @@ public function sendStatusChangeNotification(AbstractOrder $Order, int $statusId ...@@ -290,15 +293,15 @@ public function sendStatusChangeNotification(AbstractOrder $Order, int $statusId
if (empty($message)) { if (empty($message)) {
$Status = $this->getShippingStatus($statusId); $Status = $this->getShippingStatus($statusId);
$message = $Status->getStatusChangeNotificationText($Order); $message = $Status->getStatusChangeNotificationText($ErpEntity);
} }
$Mailer = new QUI\Mail\Mailer(); $Mailer = new QUI\Mail\Mailer();
$Locale = $Order->getCustomer()->getLocale(); $Locale = $ErpEntity->getCustomer()->getLocale();
$Mailer->setSubject( $Mailer->setSubject(
$Locale->get('quiqqer/shipping', 'shipping.status.notification.subject', [ $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 ...@@ -307,7 +310,7 @@ public function sendStatusChangeNotification(AbstractOrder $Order, int $statusId
try { try {
$Mailer->send(); $Mailer->send();
$Order->addStatusMail($message); $ErpEntity->addStatusMail($message);
} catch (\Exception $Exception) { } catch (\Exception $Exception) {
QUI\System\Log::writeException($Exception); QUI\System\Log::writeException($Exception);
} }
......
0% Lade oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren