Skip to content
Code-Schnipsel Gruppen Projekte
Bestätigt Commit b519a023 erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

fix: if linked entities, then do not set standard shipping

If a standard shipping is set, it is not automatically set to erp entities if these have linked erp entities.
In this case, these erp entities have been created from the others. the shipping has then been changed, deleted, etc.
Übergeordneter a5ecd6ae
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
2 Merge Requests!43Update 'next-3.x' with latest changes from 'main',!35fix: if linked entities, then do not set standard shipping
Pipeline-Nr. 8760 bestanden
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
use QUI\Smarty\Collector; use QUI\Smarty\Collector;
use function array_merge; use function array_merge;
use function count;
use function explode; use function explode;
use function json_decode; use function json_decode;
use function method_exists; use function method_exists;
...@@ -538,9 +539,14 @@ public static function onQuiqqerProductsPriceEnd(Collector $Collector, QUI\ERP\P ...@@ -538,9 +539,14 @@ public static function onQuiqqerProductsPriceEnd(Collector $Collector, QUI\ERP\P
public static function onQuiqqerOrderFactoryCreate(AbstractOrder $Order): void public static function onQuiqqerOrderFactoryCreate(AbstractOrder $Order): void
{ {
try { try {
self::addDefaultShipping($Order->getArticles()); $Process = new QUI\ERP\Process($Order->getGlobalProcessId());
$Order->update(QUI::getUsers()->getSystemUser()); // wenn verknüpfte entities, dann nicht standard versand setzen
// by mor
if (count($Process->getEntities()) <= 1) {
self::addDefaultShipping($Order->getArticles());
$Order->update(QUI::getUsers()->getSystemUser());
}
} catch (QUI\Exception $Exception) { } catch (QUI\Exception $Exception) {
QUI\System\Log::addError($Exception->getMessage()); QUI\System\Log::addError($Exception->getMessage());
} }
...@@ -560,9 +566,15 @@ public static function onQuiqqerInvoiceTemporaryInvoiceCreated( ...@@ -560,9 +566,15 @@ public static function onQuiqqerInvoiceTemporaryInvoiceCreated(
} }
try { try {
self::addDefaultShipping($TemporaryInvoice->getArticles()); $Process = new QUI\ERP\Process($TemporaryInvoice->getGlobalProcessId());
$TemporaryInvoice->addCustomDataEntry(self::DEFAULT_SHIPPING_TIME_KEY, time());
$TemporaryInvoice->update(QUI::getUsers()->getSystemUser()); // wenn verknüpfte entities, dann nicht standard versand setzen
// by mor
if (count($Process->getEntities()) <= 1) {
self::addDefaultShipping($TemporaryInvoice->getArticles());
$TemporaryInvoice->addCustomDataEntry(self::DEFAULT_SHIPPING_TIME_KEY, time());
$TemporaryInvoice->update(QUI::getUsers()->getSystemUser());
}
} catch (QUI\Exception $Exception) { } catch (QUI\Exception $Exception) {
QUI\System\Log::addError($Exception->getMessage()); QUI\System\Log::addError($Exception->getMessage());
} }
...@@ -581,9 +593,15 @@ public static function onQuiqqerOffersCreated(AbstractOffer $Offer): void ...@@ -581,9 +593,15 @@ public static function onQuiqqerOffersCreated(AbstractOffer $Offer): void
} }
try { try {
self::addDefaultShipping($Offer->getArticles()); $Process = new QUI\ERP\Process($Offer->getGlobalProcessId());
$Offer->addCustomDataEntry(self::DEFAULT_SHIPPING_TIME_KEY, time());
$Offer->update(QUI::getUsers()->getSystemUser()); // wenn verknüpfte entities, dann nicht standard versand setzen
// by mor
if (count($Process->getEntities()) <= 1) {
self::addDefaultShipping($Offer->getArticles());
$Offer->addCustomDataEntry(self::DEFAULT_SHIPPING_TIME_KEY, time());
$Offer->update(QUI::getUsers()->getSystemUser());
}
} catch (Exception $Exception) { } catch (Exception $Exception) {
QUI\System\Log::addError($Exception->getMessage()); QUI\System\Log::addError($Exception->getMessage());
} }
...@@ -598,8 +616,14 @@ public static function onQuiqqerOffersCreated(AbstractOffer $Offer): void ...@@ -598,8 +616,14 @@ public static function onQuiqqerOffersCreated(AbstractOffer $Offer): void
public static function onQuiqqerSalesOrdersCreated(SalesOrder $Sales): void public static function onQuiqqerSalesOrdersCreated(SalesOrder $Sales): void
{ {
try { try {
self::addDefaultShipping($Sales->getArticles()); $Process = new QUI\ERP\Process($Sales->getGlobalProcessId());
$Sales->update();
// wenn verknüpfte entities, dann nicht standard versand setzen
// by mor
if (count($Process->getEntities()) <= 1) {
self::addDefaultShipping($Sales->getArticles());
$Sales->update();
}
} catch (QUI\Exception $Exception) { } catch (QUI\Exception $Exception) {
QUI\System\Log::addError($Exception->getMessage()); QUI\System\Log::addError($Exception->getMessage());
} }
......
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