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

refactor: code style

Übergeordneter ee256cbd
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
Keine zugehörigen Merge Requests gefunden
......@@ -7,11 +7,12 @@
namespace QUI\ERP\Order\Basket;
use QUI;
use QUI\ERP\Order\Utils\Utils as OrderProductUtils;
use QUI\ERP\Products\Field\UniqueField;
use QUI\ERP\Products\Product\ProductList;
use QUI\ERP\Order\Utils\Utils as OrderProductUtils;
use function boolval;
use function is_array;
/**
* Class BasketOrder
......@@ -120,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);
......@@ -191,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);
......@@ -205,17 +206,17 @@ public function addProduct(Product $Product)
}
$Products = $this->List->getProducts();
$Products = $this->List->getProducts();
$foundProduct = false;
foreach ($Products as $key => $P) {
foreach ($Products as $P) {
$p1 = OrderProductUtils::getCompareProductArray($Product->toArray());
$p2 = OrderProductUtils::getCompareProductArray($P->toArray());
if ($p1 == $p2) {
$foundProduct = true;
$quantity = $P->getQuantity();
$quantity = $quantity + $Product->getQuantity();
$quantity = $P->getQuantity();
$quantity = $quantity + $Product->getQuantity();
$P->setQuantity($quantity);
break;
......@@ -264,13 +265,13 @@ public function import(array $products = [])
{
$this->clear();
if (!\is_array($products)) {
if (!is_array($products)) {
$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);
......@@ -288,7 +289,7 @@ public function import(array $products = [])
);
try {
$this->List->calc();
$this->List->recalculate();
$this->save();
QUI::getEvents()->fireEvent(
......@@ -340,7 +341,7 @@ public function toArray(): array
{
$Products = $this->getProducts();
$products = $Products->getProducts();
$result = [];
$result = [];
/* @var $Product Product */
foreach ($products as $Product) {
......
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