Skip to content
Code-Schnipsel Gruppen Projekte

Revisionen vergleichen

Änderungen werden so angezeigt, als ob die Quellrevision mit der Zielrevision zusammengeführt würde. Erfahre mehr über den Vergleich von Revisionen.

Quelle

Zielprojekt auswählen
No results found

Ziel

Zielprojekt auswählen
  • quiqqer/shipping
1 Ergebnis
Änderungen anzeigen
Commits auf Quelle (9)
  • Henning Leutz's avatar
    fix(phpstan): allow null as parameter in various functions · 8490a644
    verfasst von Henning Leutz
    This commit does the following changes:
    
    1. Updated the PHPStan version from 1.11.8 to 1.12.13 in phars.xml
    2. In various classes, added the possibility to pass `null` as a parameter to a number of
    functions. Affected classes include but are not limited to: `ShippingInterface`, `Handler`,
    `Status`, `StatusUnknown`, and `ShippingEntry`.
    3. Updated return types in the `ShippingEntry` class to include `null` option.
    4. Simplified return types in various places from `datatype|datatype|null` to possibly nullable
    `datatype`.
    
    PHP9 + PHP8.4 null deprecated
    8490a644
  • Henning Leutz's avatar
    fix(phpstan): adjust method argument typings for better code readability · ac6dda13
    verfasst von Henning Leutz
    Updated method argument typings from `Type $var = null` to `null | Type $var = null` across
    multiple files to improve readability and understanding of the code. This change aligns with modern
    coding standards and the principle of explicit over implicit.
    Affected files:
    - `AbstractShippingEntry.php`
    - `AbstractShippingType.php`
    - `ShippingInterface.php`
    - `ShippingTypeInterface.php`
    - `Factory.php`
    - `ShippingRule.php`
    - `Shipping.php`
    
    PHP9 + PHP8.3 null deprecated
    ac6dda13
  • Henning Leutz's avatar
    fix(phpstan): improve type handling and method returns · e5ed940a
    verfasst von Henning Leutz
    This commit includes several changes to improve type handling and the returns of various methods.
    It includes changes in files related to Shipping rules and status, as well as tracking. Notable
    changes include:
    
    - Refactoring of method signatures and corresponding usages to use type hinting for better error
    handling.
    - Fixed return types in Factory.php to return more specific types (ShippingRule and ShippingEntry).
    - Adjusted the createShippingStatus method to convert `id` to string before passing it to setValue
    method in Config.
    - Fixed active carrier filtering in Tracking for boolean conversion.
    - Modified handling and events related to shipping in ShippingEntry.php and Factory.php.
    - Other minor cleanups and refactorings.
    
    Related: #55
    e5ed940a
  • Henning Leutz's avatar
    refactor(phpstan): enhance type enforcement and error handling in shipping rules · c79bc5df
    verfasst von Henning Leutz
    This commit enhances the type enforcement in the Shipping module by explicitly checking for method
    existence before calls on variable types. In addition, it enforces argument type checks for several
    function and method declarations to avoid type-related errors. Moreover, the error handling in
    different functions has been improved by catching potential exceptions and logging them for debug
    purposes. The commit also optimizes a PHP sorting function by leveraging the spaceship operator
    instead of using conventional comparisons.
    
    Related: #55
    c79bc5df
  • Henning Leutz's avatar
    refactor(phpcs): improve readability in getShippingPriceFactor method · c87fe722
    verfasst von Henning Leutz
    This commit refactors the getShippingPriceFactor method in the Shipping.php file, by adding a line
    break for the method's parameter for better visibility and readability.
    c87fe722
  • Henning Leutz's avatar
    fix: resolve erroneous types and classes in phpstan baseline · 7da729e9
    verfasst von Henning Leutz
    This commit resolves multiple issues identified by the phpstan static analysis tool. The erroneous
    types and classes in `AbstractShippingEntry.php`, `EventHandler.php`, `ShippingTimePeriod.php` have
    been refractored to match the correct class and method signatures. The erroneous sections have been
    updated with the appropriate classes and methods for QUI\\\\ERP\\\\Accounting\\\\Invoice,
    QUI\\\\ERP\\\\Accounting\\\\Offers, and QUI\\\\ERP\\\\SalesOrders.
    
    Related: #55
    7da729e9
  • Henning Leutz's avatar
    chore(phpstan): error message compatibility for getFrontendView method · b5ad037d
    verfasst von Henning Leutz
    Updated the error message in the phpstan-baseline to reflect the compatibility between the
    getFrontendView methods in ShippingTimePeriod and TimePeriod classes.
    b5ad037d
  • Henning Leutz's avatar
    chore(phpstan): update erroneous return type message in phpstan-baseline · ab8fc62b
    verfasst von Henning Leutz
    This commit changes the incorrect return type message found in the phpstan-baseline.neon file.
    Return type of method ShippingTimePeriod::getFrontendView() has been correctly aligned to match
    that of TimePeriod::getFrontendView(). This ensures clear and accurate type error messages that
    adhere to the standard format.
    ab8fc62b
  • Henning Leutz's avatar
    Merge branch 'next-2.x' into 'main' · c805f1dd
    verfasst von Henning Leutz
    fix(phpstan): allow null as parameter in various functions
    
    See merge request !45
    c805f1dd
werden angezeigt mit 177 Ergänzungen und 340 Löschungen
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpstan" version="1.11.8" installed="1.11.8" location="./tools/phpstan" copy="false"/>
<phar name="phpstan" version="1.*" installed="1.12.13" location="./tools/phpstan" copy="false"/>
<phar name="phpunit" version="^10.5.20" installed="10.5.20" location="./tools/phpunit" copy="false"/>
<phar name="phpcs" version="^3.10.1" installed="3.10.1" location="./tools/phpcs" copy="false"/>
<phar name="phpcbf" version="^3.10.1" installed="3.10.1" location="./tools/phpcbf" copy="false"/>
......
......@@ -9,6 +9,9 @@
*
* @return array
*/
use QUI\System\Log;
QUI::$Ajax->registerFunction(
'package_quiqqer_shipping_ajax_backend_rules_getRules',
function ($ruleIds) {
......@@ -25,28 +28,20 @@ function ($ruleIds) {
try {
$result[] = $Rules->getChild($ruleId)->toArray();
} catch (QUI\Exception $Exception) {
\QUI\System\Log::addDebug($Exception);
Log::addDebug($Exception);
}
}
// sort by priority
usort($result, function ($a, $b) {
if (!isset($a['priority'])) {
$a['priority'] = 0;
}
if (!isset($b['priority'])) {
$b['priority'] = 0;
}
$priorityA = (int)$a['priority'];
$priorityB = (int)$b['priority'];
$priorityA = $a['priority'] ?? 0;
$priorityB = $b['priority'] ?? 0;
if ($priorityA === $priorityB) {
return $a['id'] > $b['priority'];
return $a['id'] <=> $b['id'];
}
return $priorityA > $priorityB;
return $priorityB <=> $priorityA;
});
return $result;
......
parameters:
ignoreErrors:
-
message: "#^Parameter \\#2 \\$callback of function usort expects callable\\(array, array\\)\\: int, Closure\\(mixed, mixed\\)\\: bool given\\.$#"
count: 1
path: ajax/backend/rules/getRules.php
-
message: "#^Call to an undefined method QUI\\\\ERP\\\\Shipping\\\\Api\\\\AbstractShippingEntry\\:\\:setTitle\\(\\)\\.$#"
count: 1
path: ajax/backend/rules/update.php
-
message: "#^Call to an undefined method QUI\\\\ERP\\\\Shipping\\\\Api\\\\AbstractShippingEntry\\:\\:setWorkingTitle\\(\\)\\.$#"
count: 1
path: ajax/backend/rules/update.php
-
message: "#^Parameter \\$Invoice of method QUI\\\\ERP\\\\Shipping\\\\Api\\\\AbstractShippingEntry\\:\\:getInvoiceInformationText\\(\\) has invalid type QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Invoice\\.$#"
count: 2
path: src/QUI/ERP/Shipping/Api/AbstractShippingEntry.php
-
message: "#^Parameter \\$Invoice of method QUI\\\\ERP\\\\Shipping\\\\Api\\\\AbstractShippingEntry\\:\\:getInvoiceInformationText\\(\\) has invalid type QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceTemporary\\.$#"
count: 2
path: src/QUI/ERP/Shipping/Api/AbstractShippingEntry.php
-
message: "#^Parameter \\$Invoice of method QUI\\\\ERP\\\\Shipping\\\\Api\\\\AbstractShippingEntry\\:\\:getInvoiceInformationText\\(\\) has invalid type QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceView\\.$#"
count: 2
path: src/QUI/ERP/Shipping/Api/AbstractShippingEntry.php
-
message: "#^Call to an undefined method QUI\\\\ERP\\\\Order\\\\AbstractOrder\\:\\:save\\(\\)\\.$#"
count: 5
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Call to method addCustomDataEntry\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceTemporary\\.$#"
count: 1
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Call to method addCustomDataEntry\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Offers\\\\AbstractOffer\\.$#"
count: 1
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Call to method getArticles\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceTemporary\\.$#"
count: 1
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Call to method getArticles\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Offers\\\\AbstractOffer\\.$#"
count: 1
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Call to method getArticles\\(\\) on an unknown class QUI\\\\ERP\\\\SalesOrders\\\\SalesOrder\\.$#"
count: 1
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Call to method getCustomDataEntry\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceTemporary\\.$#"
count: 1
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Call to method getCustomDataEntry\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Offers\\\\AbstractOffer\\.$#"
count: 1
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Call to method getGlobalProcessId\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceTemporary\\.$#"
count: 1
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Call to method getGlobalProcessId\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Offers\\\\AbstractOffer\\.$#"
count: 1
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Call to method getGlobalProcessId\\(\\) on an unknown class QUI\\\\ERP\\\\SalesOrders\\\\SalesOrder\\.$#"
count: 1
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Call to method update\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceTemporary\\.$#"
count: 1
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Call to method update\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Offers\\\\AbstractOffer\\.$#"
count: 1
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Call to method update\\(\\) on an unknown class QUI\\\\ERP\\\\SalesOrders\\\\SalesOrder\\.$#"
count: 1
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Negated boolean expression is always false\\.$#"
count: 2
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Offset 'options' does not exist on array\\{title\\: array\\{de\\: 'Lieferzeit', en\\: 'Delivery time'\\}, type\\: 'shipping…', public\\: true, standard\\: true\\}\\.$#"
count: 1
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Offset 'options' on array\\{title\\: array\\{de\\: 'Lieferzeit', en\\: 'Delivery time'\\}, type\\: 'shipping…', public\\: true, standard\\: true\\} in empty\\(\\) does not exist\\.$#"
count: 1
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Offset 'public' on array\\{title\\: array\\{de\\: 'Lieferzeit', en\\: 'Delivery time'\\}, type\\: 'shipping…', public\\: true, standard\\: true\\} in empty\\(\\) always exists and is not falsy\\.$#"
count: 1
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Offset 'standard' on array\\{title\\: array\\{de\\: 'Lieferzeit', en\\: 'Delivery time'\\}, type\\: 'shipping…', public\\: true, standard\\: true\\} in empty\\(\\) always exists and is not falsy\\.$#"
count: 1
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Parameter \\#1 \\$Locale of method QUI\\\\ERP\\\\Shipping\\\\Types\\\\ShippingEntry\\:\\:toPriceFactor\\(\\) expects null, QUI\\\\Locale given\\.$#"
count: 1
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Parameter \\$Offer of method QUI\\\\ERP\\\\Shipping\\\\EventHandler\\:\\:onQuiqqerOffersCreated\\(\\) has invalid type QUI\\\\ERP\\\\Accounting\\\\Offers\\\\AbstractOffer\\.$#"
count: 2
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Parameter \\$Sales of method QUI\\\\ERP\\\\Shipping\\\\EventHandler\\:\\:onQuiqqerSalesOrdersCreated\\(\\) has invalid type QUI\\\\ERP\\\\SalesOrders\\\\SalesOrder\\.$#"
count: 2
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Parameter \\$TemporaryInvoice of method QUI\\\\ERP\\\\Shipping\\\\EventHandler\\:\\:onQuiqqerInvoiceTemporaryInvoiceCreated\\(\\) has invalid type QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceTemporary\\.$#"
count: 2
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Negated boolean expression is always false\\.$#"
count: 1
path: src/QUI/ERP/Shipping/Methods/Digital/ShippingType.php
-
message: "#^Negated boolean expression is always false\\.$#"
count: 1
path: src/QUI/ERP/Shipping/Methods/Standard/ShippingType.php
-
message: "#^Call to an undefined method QUI\\\\ERP\\\\Order\\\\AbstractOrder\\:\\:save\\(\\)\\.$#"
count: 2
path: src/QUI/ERP/Shipping/Order/Shipping.php
-
message: "#^Method QUI\\\\ERP\\\\Shipping\\\\Products\\\\Fields\\\\ShippingTimeFrontendView\\:\\:getValue\\(\\) should return array\\|string but returns null\\.$#"
count: 1
path: src/QUI/ERP/Shipping/Products/Fields/ShippingTimeFrontendView.php
-
message: "#^Variable \\$Field in PHPDoc tag @var does not match assigned variable \\$value\\.$#"
count: 1
path: src/QUI/ERP/Shipping/Products/Fields/ShippingTimeFrontendView.php
-
message: "#^Return type \\(QUI\\\\ERP\\\\Shipping\\\\Products\\\\Fields\\\\ShippingTimeFrontendView\\) of method QUI\\\\ERP\\\\Shipping\\\\Products\\\\Fields\\\\ShippingTimePeriod\\:\\:getFrontendView\\(\\) should be compatible with return type \\(QUI\\\\ERP\\\\Products\\\\Field\\\\Types\\\\UnitSelectFrontendView\\) of method QUI\\\\ERP\\\\Products\\\\Field\\\\Types\\\\TimePeriod\\:\\:getFrontendView\\(\\)$#"
count: 1
path: src/QUI/ERP/Shipping/Products/Fields/ShippingTimePeriod.php
-
message: "#^Method QUI\\\\ERP\\\\Shipping\\\\Rules\\\\Factory\\:\\:createChild\\(\\) should return QUI\\\\ERP\\\\Shipping\\\\Rules\\\\ShippingRule but returns QUI\\\\CRUD\\\\Child\\.$#"
count: 1
path: src/QUI/ERP/Shipping/Rules/Factory.php
-
message: "#^Method QUI\\\\ERP\\\\Shipping\\\\Rules\\\\Factory\\:\\:getChild\\(\\) should return QUI\\\\ERP\\\\Shipping\\\\Api\\\\AbstractShippingEntry but returns QUI\\\\CRUD\\\\Child\\.$#"
count: 1
path: src/QUI/ERP/Shipping/Rules/Factory.php
-
message: "#^Call to an undefined method QUI\\\\ERP\\\\ErpEntityInterface\\:\\:count\\(\\)\\.$#"
count: 1
path: src/QUI/ERP/Shipping/Rules/ShippingRule.php
-
message: "#^Parameter \\#1 \\$precision of method QUI\\\\ERP\\\\Accounting\\\\CalculationValue\\:\\:precision\\(\\) expects bool, int given\\.$#"
count: 1
path: src/QUI/ERP/Shipping/Rules/ShippingRule.php
-
message: "#^Parameter \\#2 \\$key of method QUI\\\\Config\\:\\:setValue\\(\\) expects string\\|null, int given\\.$#"
count: 1
path: src/QUI/ERP/Shipping/ShippingStatus/Factory.php
-
message: "#^Parameter \\#2 \\$key of method QUI\\\\Config\\:\\:del\\(\\) expects string\\|null, int given\\.$#"
count: 1
path: src/QUI/ERP/Shipping/ShippingStatus/Handler.php
-
message: "#^Parameter \\#2 \\$key of method QUI\\\\Config\\:\\:setValue\\(\\) expects string\\|null, int given\\.$#"
count: 2
path: src/QUI/ERP/Shipping/ShippingStatus/Handler.php
-
message: "#^Parameter \\#2 \\$callback of function array_filter expects \\(callable\\(mixed\\)\\: bool\\)\\|null, Closure\\(mixed\\)\\: int given\\.$#"
count: 1
path: src/QUI/ERP/Shipping/Tracking/Tracking.php
-
message: "#^Call to an undefined method QUI\\\\CRUD\\\\Child\\:\\:getShippingType\\(\\)\\.$#"
count: 2
path: src/QUI/ERP/Shipping/Types/Factory.php
-
message: "#^Method QUI\\\\ERP\\\\Shipping\\\\Types\\\\Factory\\:\\:createChild\\(\\) should return QUI\\\\ERP\\\\Shipping\\\\Types\\\\ShippingEntry but returns QUI\\\\CRUD\\\\Child\\.$#"
count: 1
path: src/QUI/ERP/Shipping/Types/Factory.php
-
message: "#^Method QUI\\\\ERP\\\\Shipping\\\\Types\\\\Factory\\:\\:getChild\\(\\) should return QUI\\\\ERP\\\\Shipping\\\\Types\\\\ShippingEntry but returns QUI\\\\CRUD\\\\Child\\.$#"
count: 1
path: src/QUI/ERP/Shipping/Types/Factory.php
-
message: "#^Call to an undefined method QUI\\\\ERP\\\\Shipping\\\\Api\\\\AbstractShippingEntry\\:\\:canUsedIn\\(\\)\\.$#"
count: 1
path: src/QUI/ERP/Shipping/Types/ShippingEntry.php
-
message: "#^Call to an undefined method QUI\\\\ERP\\\\Shipping\\\\Api\\\\AbstractShippingEntry\\:\\:getPriority\\(\\)\\.$#"
count: 2
path: src/QUI/ERP/Shipping/Types/ShippingEntry.php
-
message: "#^Call to an undefined method QUI\\\\ERP\\\\Shipping\\\\Api\\\\AbstractShippingEntry\\:\\:isValid\\(\\)\\.$#"
count: 1
path: src/QUI/ERP/Shipping/Types/ShippingEntry.php
-
message: "#^Call to an undefined method QUI\\\\ERP\\\\Shipping\\\\Api\\\\AbstractShippingEntry\\:\\:noRulesAfter\\(\\)\\.$#"
count: 1
path: src/QUI/ERP/Shipping/Types/ShippingEntry.php
-
message: "#^Method QUI\\\\ERP\\\\Shipping\\\\Types\\\\ShippingEntry\\:\\:getShippingRules\\(\\) should return array\\<QUI\\\\ERP\\\\Shipping\\\\Rules\\\\ShippingRule\\> but returns array\\<int\\<0, max\\>, QUI\\\\ERP\\\\Shipping\\\\Api\\\\AbstractShippingEntry\\>\\.$#"
count: 1
path: src/QUI/ERP/Shipping/Types/ShippingEntry.php
-
message: "#^Parameter \\#1 \\$Rule of method QUI\\\\ERP\\\\Shipping\\\\Types\\\\ShippingEntry\\:\\:addShippingRule\\(\\) expects QUI\\\\ERP\\\\Shipping\\\\Rules\\\\ShippingRule, QUI\\\\ERP\\\\Shipping\\\\Api\\\\AbstractShippingEntry given\\.$#"
count: 1
path: src/QUI/ERP/Shipping/Types/ShippingEntry.php
ignoreErrors:
-
message: "#^Parameter \\$Invoice of method QUI\\\\ERP\\\\Shipping\\\\Api\\\\AbstractShippingEntry::getInvoiceInformationText\\(\\) has invalid type QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Invoice\\.$#"
path: src/QUI/ERP/Shipping/Api/AbstractShippingEntry.php
-
message: "#^Parameter \\$Invoice of method QUI\\\\ERP\\\\Shipping\\\\Api\\\\AbstractShippingEntry::getInvoiceInformationText\\(\\) has invalid type QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceTemporary\\.$#"
path: src/QUI/ERP/Shipping/Api/AbstractShippingEntry.php
-
message: "#^Parameter \\$Invoice of method QUI\\\\ERP\\\\Shipping\\\\Api\\\\AbstractShippingEntry::getInvoiceInformationText\\(\\) has invalid type QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceView\\.$#"
path: src/QUI/ERP/Shipping/Api/AbstractShippingEntry.php
-
message: "#^Parameter \\$TemporaryInvoice of method QUI\\\\ERP\\\\Shipping\\\\EventHandler::onQuiqqerInvoiceTemporaryInvoiceCreated\\(\\) has invalid type QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceTemporary\\.$#"
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Call to method getCustomDataEntry\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceTemporary\\.$#"
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Call to method getGlobalProcessId\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceTemporary\\.$#"
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Call to method getArticles\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceTemporary\\.$#"
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Call to method addCustomDataEntry\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceTemporary\\.$#"
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Call to method update\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceTemporary\\.$#"
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Parameter \\$Offer of method QUI\\\\ERP\\\\Shipping\\\\EventHandler::onQuiqqerOffersCreated\\(\\) has invalid type QUI\\\\ERP\\\\Accounting\\\\Offers\\\\AbstractOffer\\.$#"
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Call to method getCustomDataEntry\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Offers\\\\AbstractOffer\\.$#"
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Call to method getGlobalProcessId\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Offers\\\\AbstractOffer\\.$#"
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Call to method getArticles\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Offers\\\\AbstractOffer\\.$#"
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Call to method addCustomDataEntry\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Offers\\\\AbstractOffer\\.$#"
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Call to method update\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Offers\\\\AbstractOffer\\.$#"
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Parameter \\$Sales of method QUI\\\\ERP\\\\Shipping\\\\EventHandler::onQuiqqerSalesOrdersCreated\\(\\) has invalid type QUI\\\\ERP\\\\SalesOrders\\\\SalesOrder\\.$#"
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Call to method getGlobalProcessId\\(\\) on an unknown class QUI\\\\ERP\\\\SalesOrders\\\\SalesOrder\\.$#"
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Call to method getArticles\\(\\) on an unknown class QUI\\\\ERP\\\\SalesOrders\\\\SalesOrder\\.$#"
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Call to method update\\(\\) on an unknown class QUI\\\\ERP\\\\SalesOrders\\\\SalesOrder\\.$#"
path: src/QUI/ERP/Shipping/EventHandler.php
-
message: "#^Return type \\(QUI\\\\ERP\\\\Shipping\\\\Products\\\\Fields\\\\ShippingTimeFrontendView\\) of method QUI\\\\ERP\\\\Shipping\\\\Products\\\\Fields\\\\ShippingTimePeriod::getFrontendView\\(\\) should be compatible with return type \\(QUI\\\\ERP\\\\Products\\\\Field\\\\Types\\\\UnitSelectFrontendView\\) of method QUI\\\\ERP\\\\Products\\\\Field\\\\Types\\\\TimePeriod::getFrontendView\\(\\)\\s*$#"
path: src/QUI/ERP/Shipping/Products/Fields/ShippingTimePeriod.php
\ No newline at end of file
......@@ -92,7 +92,7 @@ abstract public function getTitle($Locale = null): string;
* @param null|QUI\Locale $Locale
* @return string
*/
abstract public function getDescription(QUI\Locale $Locale = null): string;
abstract public function getDescription(null | QUI\Locale $Locale = null): string;
/**
* @return string
......@@ -146,7 +146,7 @@ public function isVisible(): bool
* @return string
*/
public function getInvoiceInformationText(
QUI\ERP\Accounting\Invoice\Invoice|QUI\ERP\Accounting\Invoice\InvoiceTemporary|QUI\ERP\Accounting\Invoice\InvoiceView $Invoice
QUI\ERP\Accounting\Invoice\Invoice | QUI\ERP\Accounting\Invoice\InvoiceTemporary | QUI\ERP\Accounting\Invoice\InvoiceView $Invoice
): string {
return '';
}
......
......@@ -30,7 +30,7 @@ public function getType(): string
* @param QUI\Locale|null $Locale
* @return array
*/
public function toArray(QUI\Locale $Locale = null): array
public function toArray(null | QUI\Locale $Locale = null): array
{
if ($Locale === null) {
$Locale = QUI::getLocale();
......@@ -46,7 +46,7 @@ public function toArray(QUI\Locale $Locale = null): array
* @param QUI\Locale|null $Locale
* @return string
*/
abstract public function getTitle(QUI\Locale $Locale = null): string;
abstract public function getTitle(null | QUI\Locale $Locale = null): string;
/**
* @return string
......
......@@ -18,19 +18,19 @@ interface ShippingInterface
/**
* @return int|string
*/
public function getId(): int|string;
public function getId(): int | string;
/**
* @param null|QUI\Locale $Locale
* @return string
*/
public function getTitle(QUI\Locale $Locale = null): string;
public function getTitle(null | QUI\Locale $Locale = null): string;
/**
* @param null|QUI\Locale $Locale
* @return string
*/
public function getDescription(QUI\Locale $Locale = null): string;
public function getDescription(null | QUI\Locale $Locale = null): string;
/**
* @return string
......@@ -48,7 +48,7 @@ public function getShippingType(): ShippingTypeInterface;
*
* @return float|int
*/
public function getPrice(): float|int;
public function getPrice(): float | int;
/**
* Return the price display
......
......@@ -22,7 +22,7 @@ public function getType(): string;
* @param null|QUI\Locale $Locale
* @return string
*/
public function getTitle(QUI\Locale $Locale = null): string;
public function getTitle(null | QUI\Locale $Locale = null): string;
/**
* @return string
......@@ -35,5 +35,5 @@ public function getIcon(): string;
* @param QUI\Locale|null $Locale
* @return array
*/
public function toArray(QUI\Locale $Locale = null): array;
public function toArray(null | QUI\Locale $Locale = null): array;
}
......@@ -9,6 +9,7 @@
use Exception;
use QUI;
use QUI\ERP\Accounting\ArticleList;
use QUI\ERP\Accounting\ArticleListUnique;
use QUI\ERP\Accounting\Invoice\InvoiceTemporary;
use QUI\ERP\Accounting\Offers\AbstractOffer;
use QUI\ERP\Order\AbstractOrder;
......@@ -16,6 +17,7 @@
use QUI\ERP\Products\Handler\Fields as ProductFields;
use QUI\ERP\SalesOrders\SalesOrder;
use QUI\ERP\Shipping\Shipping as ShippingHandler;
use QUI\ExceptionStack;
use QUI\Smarty\Collector;
use function array_merge;
......@@ -271,7 +273,10 @@ public static function onQuiqqerOrderOrderProcessCheckoutOutputBefore(
try {
$DeliveryAddress = $Customer->getAddress($addressId);
$Order->setDeliveryAddress($DeliveryAddress);
$Order->save(QUI::getUsers()->getSystemUser());
if (method_exists($Order, 'save')) {
$Order->save(QUI::getUsers()->getSystemUser());
}
} catch (Exception) {
}
}
......@@ -283,6 +288,10 @@ public static function onQuiqqerOrderOrderProcessCheckoutOutputBefore(
* @param OrderCheckoutStepControl $Checkout
* @param string $text
* @return void
*
* @throws QUI\Database\Exception
* @throws QUI\Exception
* @throws ExceptionStack
*/
public static function onQuiqqerOrderOrderProcessCheckoutOutput(
OrderCheckoutStepControl $Checkout,
......@@ -324,7 +333,10 @@ class_exists('QUI\ERP\Order\Guest\GuestOrderUser')
);
$Order->setDeliveryAddress($ErpDeliveryAddress);
$Order->save(QUI::getUsers()->getSystemUser());
if (method_exists($Order, 'save')) {
$Order->save(QUI::getUsers()->getSystemUser());
}
} catch (Exception $Exception) {
QUI\System\Log::writeException($Exception);
}
......@@ -362,7 +374,10 @@ public static function onQuiqqerOrderCustomerDataSave(
// same address like the invoice address
if ((int)$_REQUEST['shipping-address'] === -1) {
$Order->setDeliveryAddress($Order->getInvoiceAddress());
$Order->save();
if (method_exists($Order, 'save')) {
$Order->save();
}
return;
}
......@@ -370,7 +385,10 @@ public static function onQuiqqerOrderCustomerDataSave(
$Address = $User->getAddress($_REQUEST['shipping-address']);
} catch (QUI\Exception) {
$Order->clearAddressDelivery();
$Order->save();
if (method_exists($Order, 'save')) {
$Order->save();
}
return;
}
......@@ -379,7 +397,10 @@ public static function onQuiqqerOrderCustomerDataSave(
);
$Order->setDeliveryAddress($ErpAddress);
$Order->save();
if (method_exists($Order, 'save')) {
$Order->save();
}
}
/**
......@@ -499,9 +520,9 @@ protected static function createProductFields(): void
'titles' => $field['title'],
'workingtitles' => $field['title'],
'systemField' => 0,
'standardField' => !empty($field['standard']) ? 1 : 0,
'publicField' => !empty($field['public']) ? 1 : 0,
'options' => !empty($field['options']) ? $field['options'] : null
'standardField' => !empty($field['standard']) ? 1 : 0, // @phpstan-ignore-line
'publicField' => !empty($field['public']) ? 1 : 0, // @phpstan-ignore-line
'options' => !empty($field['options']) ? $field['options'] : null // @phpstan-ignore-line
]);
} catch (Exception $Exception) {
QUI\System\Log::writeException($Exception);
......@@ -610,7 +631,10 @@ public static function onQuiqqerOffersCreated(AbstractOffer $Offer): void
if (count($Process->getEntities()) <= 1) {
self::addDefaultShipping($Offer->getArticles());
$Offer->addCustomDataEntry(self::DEFAULT_SHIPPING_TIME_KEY, time());
$Offer->update(QUI::getUsers()->getSystemUser());
if (method_exists($Offer, 'update')) {
$Offer->update(QUI::getUsers()->getSystemUser());
}
}
} catch (Exception $Exception) {
QUI\System\Log::addError($Exception->getMessage());
......@@ -642,11 +666,11 @@ public static function onQuiqqerSalesOrdersCreated(SalesOrder $Sales): void
/**
* event: addDefaultShipping
*
* @param ArticleList $Articles
* @param ArticleList|ArticleListUnique $Articles
* @return void
* @throws QUI\Exception
*/
protected static function addDefaultShipping(ArticleList $Articles): void
protected static function addDefaultShipping(ArticleList | ArticleListUnique $Articles): void
{
if (!QUI::isBackend()) {
return;
......@@ -675,7 +699,11 @@ protected static function addDefaultShipping(ArticleList $Articles): void
if (!$shippingFactor) {
$PriceFactor = Shipping::getInstance()->getDefaultPriceFactor();
$Articles->addPriceFactor($PriceFactor);
if (method_exists($Articles, 'addPriceFactor')) {
$Articles->addPriceFactor($PriceFactor);
}
$Articles->recalculate();
}
} catch (QUI\Exception) {
......
......@@ -67,7 +67,6 @@ public function canUsedInOrder(
}
// Check if order contains NON-digital products
/** @var QUI\ERP\Accounting\Article $Article */
foreach ($Entity->getArticles() as $Article) {
try {
// Do not parse coupon codes / discounts
......
......@@ -80,7 +80,6 @@ public function canUsedInOrder(
// Check if order contains only digital products
$digitalProductsOnly = true;
/** @var QUI\ERP\Accounting\Article $Article */
foreach ($ArticleList as $Article) {
try {
// Do not parse coupon codes / discounts
......
......@@ -38,7 +38,7 @@ public function __construct(array $attributes = [])
* @param null|QUI\Locale $Locale
* @return string
*/
public function getName($Locale = null): string
public function getName(null | QUI\Locale $Locale = null): string
{
return 'Shipping';
}
......@@ -55,6 +55,7 @@ public function getIcon(): string
* @return string
*
* @throws QUI\Exception
* @throws \PHPMailer\PHPMailer\Exception
*/
public function getBody(): string
{
......@@ -166,7 +167,10 @@ public function validate(): void
if ($Shipping === null && count($shippingList) === 1) {
try {
$Order->setShipping($shippingList[0]);
$Order->save();
if (method_exists($Order, 'save')) {
$Order->save();
}
} catch (QUI\Exception $Exception) {
QUI\System\Log::addDebug($Exception->getMessage());
}
......@@ -260,11 +264,13 @@ public function save(): void
}
} catch (QUI\ERP\Shipping\Exception $Exception) {
QUI\System\Log::writeDebugException($Exception);
return;
}
$Order->setShipping($ShippingEntry);
$Order->save();
if (method_exists($Order, 'save')) {
$Order->save();
}
}
}
......@@ -29,8 +29,6 @@ public function create(): string
$Engine = QUI::getTemplateManager()->getEngine();
$L = QUI::getLocale();
$lg = 'quiqqer/shipping';
/** @var ShippingTimePeriod $Field */
$value = $this->getValue();
if (empty($value)) {
......@@ -113,7 +111,7 @@ public function create(): string
/**
* Return the current value
*
* @return string|array
* @return mixed
*/
public function getValue(): mixed
{
......
......@@ -66,10 +66,11 @@ public function __construct()
*
* @throws QUI\Exception
*/
public function createChild(array $data = []): QUI\CRUD\Child
public function createChild(array $data = []): ShippingRule
{
// filter
$allowed = array_flip([
'active',
'title',
'workingTitle',
'date_from',
......@@ -229,6 +230,7 @@ public function createChild(array $data = []): QUI\CRUD\Child
QUI::getEvents()->fireEvent('shippingCreateEnd', [$NewChild]);
// @phpstan-ignore-next-line
return $NewChild;
}
......@@ -284,25 +286,26 @@ public function getChildAttributes(): array
/**
* @param int $id
*
* @return QUI\ERP\Shipping\Api\AbstractShippingEntry
* @return ShippingRule
*
* @throws QUI\Exception
*/
public function getChild($id): QUI\CRUD\Child
public function getChild($id): ShippingRule
{
/* @var QUI\ERP\Shipping\Api\AbstractShippingEntry $Shipping */
/* @var ShippingRule $Shipping */
$Shipping = parent::getChild($id);
// @phpstan-ignore-next-line
return $Shipping;
}
/**
* Creates a locale
*
* @param $var
* @param $title
* @param string $var
* @param string $title
*/
protected function createShippingLocale($var, $title): void
protected function createShippingLocale(string $var, string $title): void
{
$current = QUI::getLocale()->getCurrent();
......
......@@ -191,7 +191,7 @@ public function toArray(): array
* @param Locale|null $Locale
* @return string
*/
public function getTitle(QUI\Locale $Locale = null): string
public function getTitle(null | QUI\Locale $Locale = null): string
{
if ($Locale === null) {
$Locale = QUI::getLocale();
......@@ -337,7 +337,7 @@ public function canUsedBy(QUI\Interfaces\Users\User $User): bool
* @param Address|QUI\Users\Address|null $Address
* @return bool
*/
public function canUsedWithAddress(QUI\ERP\Address|QUI\Users\Address $Address = null): bool
public function canUsedWithAddress(null | QUI\ERP\Address | QUI\Users\Address $Address = null): bool
{
if (!$Address) {
return false;
......@@ -365,7 +365,7 @@ public function canUsedWithAddress(QUI\ERP\Address|QUI\Users\Address $Address =
* @param QUI\ERP\ErpEntityInterface|null $ErpEntity
* @return bool
*/
public function canUsedIn(QUI\ERP\ErpEntityInterface $ErpEntity = null): bool
public function canUsedIn(null | QUI\ERP\ErpEntityInterface $ErpEntity = null): bool
{
if (!$this->isValid()) {
Debug::addLog("{$this->getTitle()} :: is not valid");
......@@ -649,7 +649,12 @@ public function canUsedIn(QUI\ERP\ErpEntityInterface $ErpEntity = null): bool
// quantity check
$count = $ErpEntity->count();
$count = 0;
if (method_exists($ErpEntity, 'count')) {
$count = $ErpEntity->count();
}
if (!empty($quantityFrom) && $quantityFrom < $count) {
QUI\ERP\Shipping\Debug::addLog(
......@@ -819,7 +824,7 @@ public function getDiscountType(): int
*
* @return bool|array
*/
public function getUnitTerms(): bool|array
public function getUnitTerms(): bool | array
{
$unitTerms = $this->getAttribute('unit_terms');
......
......@@ -239,7 +239,7 @@ public function getShippingType(string $shippingType): Api\ShippingTypeInterface
*
* @throws Exception
*/
public function getShippingEntry(int|string $shippingId): Types\ShippingEntry
public function getShippingEntry(int | string $shippingId): Types\ShippingEntry
{
try {
return Factory::getInstance()->getChild($shippingId);
......@@ -277,8 +277,10 @@ public function getShippingList(array $queryParams = []): array
* @param QUI\ERP\ErpEntityInterface|null $Entity - optional
* @return QUI\ERP\Shipping\Types\ShippingEntry[]
*/
public function getUserShipping(User $User = null, QUI\ERP\ErpEntityInterface $Entity = null): array
{
public function getUserShipping(
null | User $User = null,
null | QUI\ERP\ErpEntityInterface $Entity = null
): array {
if ($User === null) {
$User = QUI::getUserBySession();
}
......@@ -302,8 +304,9 @@ public function getUserShipping(User $User = null, QUI\ERP\ErpEntityInterface $E
* @param QUI\ERP\ErpEntityInterface $Entity
* @return PriceFactorInterface|ErpPriceFactor|null
*/
public function getShippingPriceFactor(QUI\ERP\ErpEntityInterface $Entity): ErpPriceFactor|PriceFactorInterface|null
{
public function getShippingPriceFactor(
QUI\ERP\ErpEntityInterface $Entity
): ErpPriceFactor | PriceFactorInterface | null {
$PriceFactors = $Entity->getArticles()->getPriceFactors();
foreach ($PriceFactors as $PriceFactor) {
......@@ -321,7 +324,7 @@ public function getShippingPriceFactor(QUI\ERP\ErpEntityInterface $Entity): ErpP
*
* @deprecated use getShippingPriceFactor
*/
public function getShippingPriceFactorByOrder(AbstractOrder $Order): ErpPriceFactor|PriceFactorInterface|null
public function getShippingPriceFactorByOrder(AbstractOrder $Order): ErpPriceFactor | PriceFactorInterface | null
{
QUI\System\Log::addNotice(
'Shipping->getShippingPriceFactorByOrder() is deprecated, use getShippingPriceFactor'
......@@ -421,7 +424,7 @@ public function getHost(): string
*/
public function getShippingByObject(
QUI\ERP\ErpEntityInterface $Entity
): Types\ShippingEntry|Types\ShippingUnique|null {
): Types\ShippingEntry | Types\ShippingUnique | null {
$Shipping = null;
$Delivery = $Entity->getDeliveryAddress();
......@@ -440,7 +443,7 @@ public function getShippingByObject(
* @param $orderId
* @return ShippingEntry|ShippingUnique|null
*/
public function getShippingByOrderId($orderId): ShippingEntry|ShippingUnique|null
public function getShippingByOrderId($orderId): ShippingEntry | ShippingUnique | null
{
try {
$Order = QUI\ERP\Order\Handler::getInstance()->getOrderById($orderId);
......@@ -551,7 +554,7 @@ public function getVat(QUI\ERP\ErpEntityInterface $ErpEntity): mixed
public function sendStatusChangeNotification(
ErpEntityInterface $ErpEntity,
int $statusId,
string $message = null
null | string $message = null
): void {
$Customer = $ErpEntity->getCustomer();
$customerEmail = $Customer->getAttribute('email');
......
......@@ -32,7 +32,7 @@ class Factory extends QUI\Utils\Singleton
*
* @todo permissions
*/
public function createShippingStatus(int|string $id, string $color, array $title): void
public function createShippingStatus(int | string $id, string $color, array $title): void
{
$list = Handler::getInstance()->getList();
$id = (int)$id;
......@@ -49,7 +49,7 @@ public function createShippingStatus(int|string $id, string $color, array $title
$Package = QUI::getPackage('quiqqer/shipping');
$Config = $Package->getConfig();
$Config->setValue('shipping_status', $id, $color);
$Config->setValue('shipping_status', (string)$id, $color);
$Config->save();
// translations
......
......@@ -111,7 +111,7 @@ public function getShippingStatusList(): array
*
* @throws Exception
*/
public function getShippingStatus(int $id): StatusUnknown|Status
public function getShippingStatus(int $id): StatusUnknown | Status
{
if ($id === 0) {
return new StatusUnknown();
......@@ -130,7 +130,7 @@ public function getShippingStatus(int $id): StatusUnknown|Status
*
* @todo permissions
*/
public function deleteShippingStatus(int|string $id): void
public function deleteShippingStatus(int | string $id): void
{
$Status = $this->getShippingStatus($id);
......@@ -146,7 +146,7 @@ public function deleteShippingStatus(int|string $id): void
$Package = QUI::getPackage('quiqqer/shipping');
$Config = $Package->getConfig();
$Config->del('shipping_status', $Status->getId());
$Config->del('shipping_status', (string)$Status->getId());
$Config->save();
}
......@@ -168,7 +168,7 @@ public function setShippingStatusNotification(int $id, bool $notify): void
$Package = QUI::getPackage('quiqqer/shipping');
$Config = $Package->getConfig();
$Config->setValue('shipping_status_notification', $Status->getId(), $notify ? "1" : "0");
$Config->setValue('shipping_status_notification', (string)$Status->getId(), $notify ? "1" : "0");
$Config->save();
}
......@@ -183,7 +183,7 @@ public function setShippingStatusNotification(int $id, bool $notify): void
*
* @todo permissions
*/
public function updateShippingStatus(int $id, int|string $color, array $title): void
public function updateShippingStatus(int $id, int | string $color, array $title): void
{
$Status = $this->getShippingStatus($id);
......@@ -216,7 +216,7 @@ public function updateShippingStatus(int $id, int|string $color, array $title):
$Package = QUI::getPackage('quiqqer/shipping');
$Config = $Package->getConfig();
$Config->setValue('shipping_status', $Status->getId(), $color);
$Config->setValue('shipping_status', (string)$Status->getId(), $color);
$Config->save();
}
......@@ -277,7 +277,7 @@ public function createNotificationTranslations(int $id): void
public function sendStatusChangeNotification(
QUI\ERP\ErpEntityInterface $ErpEntity,
int $statusId,
string $message = null
null | string $message = null
): void {
$Customer = $ErpEntity->getCustomer();
$customerEmail = $Customer->getAttribute('email');
......
......@@ -85,7 +85,7 @@ public function getId(): int
* @param null|QUI\Locale $Locale (optional) $Locale
* @return string
*/
public function getTitle(QUI\Locale $Locale = null): string
public function getTitle(null | QUI\Locale $Locale = null): string
{
if (!($Locale instanceof QUI\Locale)) {
$Locale = QUI::getLocale();
......@@ -101,7 +101,7 @@ public function getTitle(QUI\Locale $Locale = null): string
* @param QUI\Locale|null $Locale (optional) - [default: QUI::getLocale()]
* @return string
*/
public function getStatusChangeNotificationText(AbstractOrder $Order, QUI\Locale $Locale = null): string
public function getStatusChangeNotificationText(AbstractOrder $Order, null | QUI\Locale $Locale = null): string
{
if (!($Locale instanceof QUI\Locale)) {
$Locale = QUI::getLocale();
......@@ -156,7 +156,7 @@ public function isAutoNotification(): bool
* @param null|QUI\Locale $Locale - optional. if no locale, all translations would be returned
* @return array
*/
public function toArray(QUI\Locale $Locale = null): array
public function toArray(null |QUI\Locale $Locale = null): array
{
$title = $this->getTitle($Locale);
$statusChangeText = [];
......
......@@ -43,7 +43,7 @@ public function __construct()
* @param null|QUI\Locale $Locale (optional) $Locale
* @return string
*/
public function getTitle(QUI\Locale $Locale = null): string
public function getTitle(null | QUI\Locale $Locale = null): string
{
if (!($Locale instanceof QUI\Locale)) {
$Locale = QUI::getLocale();
......
......@@ -131,7 +131,7 @@ public static function getActiveCarriers(): array
);
return array_filter($data, function ($entry) {
return (int)$entry['active'];
return (bool)(int)$entry['active'];
});
}
......