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

Merge branch 'next-2.x' into 'main'

fix: phpstan level 5

See merge request !23
Übergeordnete de3c88aa 52844e03
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
1 Merge Request!23fix: phpstan level 5
Pipeline-Nr. 10970 mit Warnungen bestanden
......@@ -88,14 +88,17 @@ function ($orderHash, $data) {
]);
}
$missing = InvoiceUtils::getMissingAddressData($Address->getAttributes());
if (class_exists('QUI\ERP\Accounting\Invoice\Utils\Invoice')) {
$missing = InvoiceUtils::getMissingAddressData($Address->getAttributes());
if (!empty($missing)) {
throw new QUI\Exception(
InvoiceUtils::getMissingAttributeMessage($missing[0])
);
if (!empty($missing)) {
throw new QUI\Exception(
InvoiceUtils::getMissingAttributeMessage($missing[0])
);
}
}
// all is fine, we can create the users
$email = $Customer->getAttribute('email');
$message = '<p>' .
......@@ -133,7 +136,11 @@ function ($orderHash, $data) {
->getConfig()
->getValue('guestorder', 'invoicing_for_guests');
if ($guestInvoicing) {
if (
$guestInvoicing
&& class_exists('QUI\ERP\Accounting\Invoice\InvoiceTemporary')
&& class_exists('QUI\ERP\Accounting\Invoice\Invoice')
) {
if ($Order->hasInvoice()) {
$Invoice = $Order->getInvoice();
} else {
......
parameters:
ignoreErrors:
-
message: "#^Call to method post\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceTemporary\\.$#"
count: 1
path: ajax/frontend/submitCustomerData.php
-
message: "#^Call to method sendTo\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Invoice\\.$#"
count: 1
path: ajax/frontend/submitCustomerData.php
-
message: "#^Call to static method getMissingAddressData\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Utils\\\\Invoice\\.$#"
count: 1
path: ajax/frontend/submitCustomerData.php
-
message: "#^Call to static method getMissingAttributeMessage\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Utils\\\\Invoice\\.$#"
count: 1
path: ajax/frontend/submitCustomerData.php
-
message: "#^Class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Invoice not found\\.$#"
count: 1
path: ajax/frontend/submitCustomerData.php
-
message: "#^Class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceTemporary not found\\.$#"
count: 1
path: ajax/frontend/submitCustomerData.php
-
message: "#^Call to static method getMissingAddressData\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Utils\\\\Invoice\\.$#"
count: 1
path: src/QUI/ERP/Order/Guest/Controls/MissingAddressData.php
-
message: "#^Call to an undefined method QUI\\\\ERP\\\\Order\\\\AbstractOrder\\:\\:save\\(\\)\\.$#"
count: 2
path: src/QUI/ERP/Order/Guest/EventHandler.php
-
message: "#^Call to an undefined method QUI\\\\Interfaces\\\\Projects\\\\Site\\:\\:getUrlRewrittenWithHost\\(\\)\\.$#"
count: 1
path: src/QUI/ERP/Order/Guest/EventHandler.php
-
message: "#^Call to an undefined method QUI\\\\Interfaces\\\\Users\\\\User\\:\\:getGuestOrderId\\(\\)\\.$#"
count: 1
path: src/QUI/ERP/Order/Guest/EventHandler.php
-
message: "#^Call to static method getMissingAddressData\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Utils\\\\Invoice\\.$#"
count: 1
path: src/QUI/ERP/Order/Guest/EventHandler.php
-
message: "#^Class QUI\\\\ERP\\\\Shipping\\\\Order\\\\Shipping not found\\.$#"
count: 1
path: src/QUI/ERP/Order/Guest/EventHandler.php
-
message: "#^Method QUI\\\\ERP\\\\Order\\\\Guest\\\\EventHandler\\:\\:extendMail\\(\\) with return type void returns null but should not return anything\\.$#"
count: 1
path: src/QUI/ERP/Order/Guest/EventHandler.php
-
message: "#^Method QUI\\\\ERP\\\\Order\\\\Guest\\\\EventHandler\\:\\:onOrderProcessGetOrder\\(\\) should return QUI\\\\ERP\\\\Order\\\\OrderInProcess\\|null but returns QUI\\\\ERP\\\\Order\\\\Order\\.$#"
count: 1
path: src/QUI/ERP/Order/Guest/EventHandler.php
-
message: "#^Method QUI\\\\ERP\\\\Order\\\\Guest\\\\EventHandler\\:\\:onQuiqqerOrderClear\\(\\) with return type void returns null but should not return anything\\.$#"
count: 1
path: src/QUI/ERP/Order/Guest/EventHandler.php
-
message: "#^Parameter \\#1 \\$code of method QUI\\\\Interfaces\\\\Users\\\\User\\:\\:activate\\(\\) expects string, false given\\.$#"
count: 1
path: src/QUI/ERP/Order/Guest/GuestOrder.php
-
message: "#^Parameter \\#1 \\$groupId of method QUI\\\\Interfaces\\\\Users\\\\User\\:\\:addToGroup\\(\\) expects int, string given\\.$#"
count: 2
path: src/QUI/ERP/Order/Guest/GuestOrder.php
-
message: "#^Parameter \\#2 \\$User of class QUI\\\\ERP\\\\Address constructor expects QUI\\\\ERP\\\\User\\|null, \\$this\\(QUI\\\\ERP\\\\Order\\\\Guest\\\\GuestOrderUser\\) given\\.$#"
count: 1
path: src/QUI/ERP/Order/Guest/GuestOrderUser.php
......@@ -5,6 +5,8 @@
use QUI;
use QUI\ERP\Order\AbstractOrder;
use function class_exists;
class MissingAddressData extends QUI\Control
{
public function __construct(array $attributes = [])
......@@ -30,7 +32,11 @@ public function getBody(): string
$Engine = QUI::getTemplateManager()->getEngine();
$Address = $Order->getInvoiceAddress();
$missing = QUI\ERP\Accounting\Invoice\Utils\Invoice::getMissingAddressData($Address->getAttributes());
$missing = [];
if (class_exists('QUI\ERP\Accounting\Invoice\Utils\Invoice')) {
$missing = QUI\ERP\Accounting\Invoice\Utils\Invoice::getMissingAddressData($Address->getAttributes());
}
$CustomerData = new QUI\ERP\Order\Controls\OrderProcess\CustomerData([
'Order' => $Order,
......@@ -41,11 +47,11 @@ public function getBody(): string
$Guest = new QUI\ERP\Order\Guest\GuestOrderUser();
$Engine->assign([
'orderHash' => $Order->getHash(),
'orderHash' => $Order->getUUID(),
'email' => $Order->getCustomer()->getAttribute('email'),
'missing' => $missing,
'CustomerData' => $CustomerData,
'showAccountCreation' => $Customer->getId() === $Guest->getId()
'showAccountCreation' => $Customer->getUUID() === $Guest->getUUID()
]);
return $Engine->fetch(dirname(__FILE__) . '/MissingAddressData.html');
......
......@@ -15,10 +15,12 @@
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
use function class_exists;
use function count;
use function date;
use function floatval;
use function json_decode;
use function method_exists;
class EventHandler
{
......@@ -110,7 +112,7 @@ public static function onUserGet(int $id): ?GuestOrderUser
* this event hooks into the getOrder process and returns the guest order if necessary
*
* @param $OrderProcess
* @return QUI\ERP\Order\OrderInProcess|null
* @return AbstractOrder|null
* @throws QUI\Database\Exception
*/
public static function onOrderProcessGetOrder($OrderProcess): ?AbstractOrder
......@@ -264,7 +266,9 @@ public static function onQuiqqerOrderProcessSend(QUI\ERP\Order\OrderProcess $Ord
$Order->setInvoiceAddress($User->getStandardAddress());
}
$Order->save($SystemUser);
if (method_exists($Order, 'save')) {
$Order->save($SystemUser);
}
return;
}
......@@ -285,7 +289,10 @@ public static function onQuiqqerOrderProcessSend(QUI\ERP\Order\OrderProcess $Ord
$Order->setCustomer($User);
$Order->setInvoiceAddress($Address);
$Order->save($SystemUser);
if (method_exists($Order, 'save')) {
$Order->save($SystemUser);
}
} catch (\Exception $exception) {
QUI\System\Log::writeException($exception);
QUI\System\Log::addError($exception->getMessage());
......@@ -338,10 +345,10 @@ public static function onQuiqqerOrderCreated(AbstractOrder $Order): void
* @param AbstractOrder $Order
* @return void
*/
public static function onQuiqqerOrderClear(AbstractOrder $Order)
public static function onQuiqqerOrderClear(AbstractOrder $Order): void
{
if (!GuestOrder::isActive()) {
return null;
return;
}
if (!QUI::isFrontend()) {
......@@ -363,6 +370,10 @@ public static function onQuiqqerOrderClear(AbstractOrder $Order)
$SessionUser = QUI::getUserBySession();
$Handler = QUI\ERP\Order\Handler::getInstance();
if (!method_exists($SessionUser, 'getGuestOrderId')) {
return;
}
$guestOrderId = $SessionUser->getGuestOrderId();
$orderId = $Order->getId();
......@@ -452,7 +463,7 @@ public static function onQuiqqerOrderProcessStepsEnd(
foreach ($steps as $Step) {
if (
$Step instanceof QUI\ERP\Order\Controls\OrderProcess\CustomerData
|| $Step instanceof QUI\ERP\Shipping\Order\Shipping
|| class_exists('QUI\ERP\Shipping\Order\Shipping') && $Step instanceof QUI\ERP\Shipping\Order\Shipping
) {
continue;
}
......@@ -533,10 +544,10 @@ public static function extendCheckout(Collector $Collector, mixed $User, mixed $
* @return void
* @throws Exception
*/
public static function extendMail(Collector $Collector, AbstractOrder $Order, array $Articles)
public static function extendMail(Collector $Collector, AbstractOrder $Order, array $Articles): void
{
if (!GuestOrder::isActive()) {
return null;
return;
}
// activated users do not need activation links
......@@ -689,7 +700,10 @@ protected static function onRequestUserCreation(): void
*/
protected static function onRequestInvoiceCreation(): void
{
if (!QUI::getPackageManager()->isInstalled('quiqqer/invoice')) {
if (
!QUI::getPackageManager()->isInstalled('quiqqer/invoice')
|| !class_exists('QUI\ERP\Accounting\Invoice\Utils\Invoice')
) {
self::redirectToMainSite();
}
......@@ -767,9 +781,12 @@ protected static function setSiteContent(string $content): void
$Site = QUI::getRewrite()->getSite();
$Site->setAttribute('short', '');
$Site->setAttribute('type', 'standard');
$Site->setAttribute('meta.canonical', $Site->getUrlRewrittenWithHost());
$Site->setAttribute('quiqqer.bricks.areas', '');
$Site->setAttribute('content', $content);
if (method_exists($Site, 'getUrlRewrittenWithHost')) {
$Site->setAttribute('meta.canonical', $Site->getUrlRewrittenWithHost());
}
}
/**
......
......@@ -274,7 +274,7 @@ public static function sendNewPasswordMail(User $User): void
$User->save(QUI::getUsers()->getSystemUser());
if (!$User->isActive()) {
$User->activate(false, QUI::getUsers()->getSystemUser());
$User->activate('', QUI::getUsers()->getSystemUser());
}
// send mail
......
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