diff --git a/src/QUI/ERP/Order/Basket/BasketOrder.php b/src/QUI/ERP/Order/Basket/BasketOrder.php index 469f1f6367822790ca0b2713a6936c285859c050..790d4aa00ce7e2a191ce36e3a0c06f2e81519b92 100644 --- a/src/QUI/ERP/Order/Basket/BasketOrder.php +++ b/src/QUI/ERP/Order/Basket/BasketOrder.php @@ -61,7 +61,7 @@ class BasketOrder * Basket constructor. * * @param string $orderHash - ID of the order - * @param ?QUI\Users\User $User + * @param ?QUI\Interfaces\Users\User $User * * @throws Exception * @throws QUI\Exception diff --git a/src/QUI/ERP/Order/Order.php b/src/QUI/ERP/Order/Order.php index f0fb2e489d556ebf6e5e390ff6c99a17ae1e6797..18f736a45ed925d1d39afe047efb283fa050e7ef 100644 --- a/src/QUI/ERP/Order/Order.php +++ b/src/QUI/ERP/Order/Order.php @@ -216,10 +216,6 @@ public function createInvoice( // set the data to the temporary invoice $payment = ''; - - $invoiceAddress = ''; - $invoiceAddressId = ''; - $deliveryAddress = ''; $deliveryAddressId = ''; @@ -227,16 +223,14 @@ public function createInvoice( $payment = $this->getPayment()->getId(); } - if ($this->getInvoiceAddress()) { - $invoiceAddress = $this->getInvoiceAddress()->toJSON(); - $invoiceAddressId = $this->getInvoiceAddress()->getUUID(); - } + $invoiceAddress = $this->getInvoiceAddress()->toJSON(); + $invoiceAddressId = $this->getInvoiceAddress()->getUUID(); if (empty($invoiceAddressId)) { $invoiceAddressId = $this->getCustomer()->getStandardAddress()->getUUID(); } - if ($this->getDeliveryAddress()) { + if ($this->getDeliveryAddress()->getUUID()) { $deliveryAddress = $this->getDeliveryAddress()->toJSON(); $deliveryAddressId = $this->getDeliveryAddress()->getUUID(); @@ -579,16 +573,18 @@ class_exists('QUI\ERP\Accounting\Invoice\Invoice') $shippingData = ''; $shippingStatus = null; - $Shipping = $this->getShipping(); + if (class_exists('QUI\ERP\Shipping\Types\ShippingEntry')) { + $Shipping = $this->getShipping(); - if ($Shipping) { - $shippingId = $Shipping->getId(); - $shippingData = $Shipping->toJSON(); + if ($Shipping) { + $shippingId = $Shipping->getId(); + $shippingData = $Shipping->toJSON(); + } } - if (QUI::getPackageManager()->isInstalled('quiqqer/shipping')) { + if (class_exists('QUI\ERP\Shipping\ShippingStatus\Status')) { $ShippingStatus = $this->getShippingStatus(); - $shippingStatus = $ShippingStatus ? $ShippingStatus->getId() : null; + $shippingStatus = $ShippingStatus?->getId(); } // project name diff --git a/src/QUI/ERP/Order/OrderInProcess.php b/src/QUI/ERP/Order/OrderInProcess.php index f654ccdd4db5a87e741821e54dec778fd2c68788..3a20cc52c5005d4c7f3f9e3d77818533cac4724c 100644 --- a/src/QUI/ERP/Order/OrderInProcess.php +++ b/src/QUI/ERP/Order/OrderInProcess.php @@ -246,8 +246,9 @@ public function addPriceFactors(array $priceFactors = []): void foreach ($products as $Product) { try { - /* @var QUI\ERP\Order\Basket\Product $Product */ - $ArticleList->addArticle($Product->toArticle(null, false)); + if (method_exists($Product, 'toArticle')) { + $ArticleList->addArticle($Product->toArticle(null, false)); + } } catch (Exception $Exception) { QUI\System\Log::writeDebugException($Exception); } @@ -640,16 +641,18 @@ protected function getDataForSaving(): array $shippingData = ''; $shippingStatus = null; - $Shipping = $this->getShipping(); + if (class_exists('QUI\ERP\Shipping\Types\ShippingEntry')) { + $Shipping = $this->getShipping(); - if ($Shipping) { - $shippingId = $Shipping->getId(); - $shippingData = $Shipping->toArray(); + if ($Shipping) { + $shippingId = $Shipping->getId(); + $shippingData = $Shipping->toArray(); + } } - if (QUI::getPackageManager()->isInstalled('quiqqer/shipping')) { + if (class_exists('QUI\ERP\Shipping\ShippingStatus\Status')) { $ShippingStatus = $this->getShippingStatus(); - $shippingStatus = $ShippingStatus ? $ShippingStatus->getId() : null; + $shippingStatus = $ShippingStatus?->getId(); } return [ diff --git a/src/QUI/ERP/Order/OrderProcess.php b/src/QUI/ERP/Order/OrderProcess.php index a4eaf65bc4e9eb230204bdd4ba12376bafbb55f3..d3e413cb1106edcbb0cccf24ed01876345b6341e 100644 --- a/src/QUI/ERP/Order/OrderProcess.php +++ b/src/QUI/ERP/Order/OrderProcess.php @@ -824,6 +824,7 @@ protected function checkProcessing(): bool | string $paymentIsSuccessful = false; $Payment = $Order->getPayment(); + // @phpstan-ignore-next-line if ($Payment && $Payment->isSuccessful($Order->getUUID())) { $paymentIsSuccessful = true; } @@ -1316,7 +1317,7 @@ public function getOrder(): ?AbstractOrder return $this->Order; } } - } catch (QUI\Erp\Order\Exception) { + } catch (QUI\ERP\Order\Exception) { } @@ -1327,7 +1328,7 @@ public function getOrder(): ?AbstractOrder if (!$OrderInProcess->getOrderId()) { $this->Order = $OrderInProcess; } - } catch (QUI\Erp\Order\Exception) { + } catch (QUI\ERP\Order\Exception) { } if ($this->Order === null) {