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

fix: consider multiple currencies and user currency

Übergeordneter 71361fc6
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
2 Merge Requests!18Next,!17fix: consider multiple currencies and user currency
Pipeline-Nr. 4751 bestanden
......@@ -121,12 +121,12 @@ protected function readOrder()
$this->Order = QUI\ERP\Order\Handler::getInstance()->getOrderByHash($this->hash);
$this->Order->refresh();
$data = $this->Order->getArticles()->toArray();
$data = $this->Order->getArticles()->toArray();
$priceFactors = $this->Order->getArticles()->getPriceFactors()->toArray();
$articles = $data['articles'];
$this->List = new ProductList();
$this->List = new ProductList();
$this->List->duplicate = true;
$this->List->setOrder($this->Order);
......@@ -192,8 +192,8 @@ public function getProducts()
public function addProduct(Product $Product)
{
$Package = QUI::getPackage('quiqqer/order');
$Config = $Package->getConfig();
$merge = boolval($Config->getValue('orderProcess', 'mergeSameProducts'));
$Config = $Package->getConfig();
$merge = boolval($Config->getValue('orderProcess', 'mergeSameProducts'));
if (!$merge) {
$this->List->addProduct($Product);
......@@ -206,7 +206,7 @@ public function addProduct(Product $Product)
}
$Products = $this->List->getProducts();
$Products = $this->List->getProducts();
$foundProduct = false;
foreach ($Products as $P) {
......@@ -215,8 +215,8 @@ public function addProduct(Product $Product)
if ($p1 == $p2) {
$foundProduct = true;
$quantity = $P->getQuantity();
$quantity = $quantity + $Product->getQuantity();
$quantity = $P->getQuantity();
$quantity = $quantity + $Product->getQuantity();
$P->setQuantity($quantity);
break;
......@@ -270,8 +270,8 @@ public function import(array $products = [])
}
$Package = QUI::getPackage('quiqqer/order');
$Config = $Package->getConfig();
$merge = boolval($Config->getValue('orderProcess', 'mergeSameProducts'));
$Config = $Package->getConfig();
$merge = boolval($Config->getValue('orderProcess', 'mergeSameProducts'));
if ($merge) {
$products = OrderProductUtils::getMergedProductList($products);
......@@ -341,7 +341,7 @@ public function toArray(): array
{
$Products = $this->getProducts();
$products = $Products->getProducts();
$result = [];
$result = [];
/* @var $Product Product */
foreach ($products as $Product) {
......@@ -361,9 +361,9 @@ public function toArray(): array
}
$attributes = [
'id' => $Product->getId(),
'id' => $Product->getId(),
'quantity' => $Product->getQuantity(),
'fields' => $fields
'fields' => $fields
];
$result[] = $attributes;
......@@ -385,9 +385,9 @@ public function toArray(): array
return [
'id' => $this->getId(),
'orderHash' => $this->getOrder()->getHash(),
'products' => $result,
'id' => $this->getId(),
'orderHash' => $this->getOrder()->getHash(),
'products' => $result,
'priceFactors' => $Products->getPriceFactors()->toArray(),
'calculations' => $calculations
];
......@@ -456,13 +456,16 @@ public function updateOrder()
}
$Articles = $this->Order->getArticles();
$OrderCurrency = $this->Order->getCurrency();
$PriceFactors = $this->List->getPriceFactors();
$PriceFactors->setCurrency($OrderCurrency);
$this->Order->getArticles()->importPriceFactors(
$PriceFactors->toErpPriceFactorList()
);
$Articles->setCurrency($OrderCurrency);
$Articles->importPriceFactors($PriceFactors->toErpPriceFactorList());
$Articles->recalculate();
$this->Order->getArticles()->recalculate();
$this->Order->save();
}
......
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