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 @@
</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[
......
......@@ -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);
}
......
......@@ -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);
}
......
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