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

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

fix(phpstan): improve code clarity and formatting

See merge request !57
Übergeordnete 26e87825 b0e75b59
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
2 Merge Requests!58Update 'next-3.x' with latest changes from 'main',!57fix(phpstan): improve code clarity and formatting
Pipeline-Nr. 15245 mit Warnungen bestanden
...@@ -12,9 +12,11 @@ ...@@ -12,9 +12,11 @@
'package_quiqqer_customer_ajax_backend_customer_passwordMail', 'package_quiqqer_customer_ajax_backend_customer_passwordMail',
function ($userId) { function ($userId) {
$User = QUI::getUsers()->get($userId); $User = QUI::getUsers()->get($userId);
$Handler = QUI\Users\Auth\Handler::getInstance(); $Handler = QUI\Users\Auth\Handler::getInstance();
$Handler->sendPasswordResetVerificationMail($User);
if ($User instanceof QUI\Users\User) {
$Handler->sendPasswordResetVerificationMail($User);
}
QUI::getMessagesHandler()->addSuccess( QUI::getMessagesHandler()->addSuccess(
QUI::getLocale()->get('quiqqer/customer', 'message.customer.password.mail.send') QUI::getLocale()->get('quiqqer/customer', 'message.customer.password.mail.send')
......
...@@ -15,11 +15,6 @@ parameters: ...@@ -15,11 +15,6 @@ parameters:
count: 1 count: 1
path: ajax/backend/customer/getPagination.php path: ajax/backend/customer/getPagination.php
-
message: "#^Parameter \\#1 \\$User of method QUI\\\\Users\\\\Auth\\\\Handler\\:\\:sendPasswordResetVerificationMail\\(\\) expects QUI\\\\Users\\\\User, QUI\\\\Interfaces\\\\Users\\\\User given\\.$#"
count: 1
path: ajax/backend/customer/passwordMail.php
- -
message: "#^Call to method addUrl\\(\\) on an unknown class QUI\\\\UserDownloads\\\\DownloadEntry\\.$#" message: "#^Call to method addUrl\\(\\) on an unknown class QUI\\\\UserDownloads\\\\DownloadEntry\\.$#"
count: 1 count: 1
...@@ -75,26 +70,6 @@ parameters: ...@@ -75,26 +70,6 @@ parameters:
count: 1 count: 1
path: src/QUI/ERP/Customer/CustomerFiles.php path: src/QUI/ERP/Customer/CustomerFiles.php
-
message: "#^Parameter \\#1 \\$code of method QUI\\\\Interfaces\\\\Users\\\\User\\:\\:activate\\(\\) expects string, false given\\.$#"
count: 2
path: src/QUI/ERP/Customer/Customers.php
-
message: "#^Result of && is always false\\.$#"
count: 1
path: src/QUI/ERP/Customer/Customers.php
-
message: "#^Strict comparison using \\=\\=\\= between mixed and '' will always evaluate to false\\.$#"
count: 2
path: src/QUI/ERP/Customer/Customers.php
-
message: "#^Strict comparison using \\=\\=\\= between mixed and null will always evaluate to false\\.$#"
count: 1
path: src/QUI/ERP/Customer/Customers.php
- -
message: "#^Call to method getOrder\\(\\) on an unknown class QUI\\\\ERP\\\\Order\\\\Controls\\\\OrderProcess\\\\CustomerData\\.$#" message: "#^Call to method getOrder\\(\\) on an unknown class QUI\\\\ERP\\\\Order\\\\Controls\\\\OrderProcess\\\\CustomerData\\.$#"
count: 1 count: 1
...@@ -319,8 +294,3 @@ parameters: ...@@ -319,8 +294,3 @@ parameters:
message: "#^Parameter \\$Order of method QUI\\\\ERP\\\\Customer\\\\OpenItemsList\\\\Handler\\:\\:parseOrderToOpenItem\\(\\) has invalid type QUI\\\\ERP\\\\Order\\\\Order\\.$#" message: "#^Parameter \\$Order of method QUI\\\\ERP\\\\Customer\\\\OpenItemsList\\\\Handler\\:\\:parseOrderToOpenItem\\(\\) has invalid type QUI\\\\ERP\\\\Order\\\\Order\\.$#"
count: 2 count: 2
path: src/QUI/ERP/Customer/OpenItemsList/Handler.php path: src/QUI/ERP/Customer/OpenItemsList/Handler.php
-
message: "#^Strict comparison using \\=\\=\\= between 'ad\\.firstname'\\|'ad\\.lastname'\\|'company'\\|'customerId'\\|'email'\\|'firstname'\\|'lastname'\\|'usergroup'\\|'userId'\\|'username' and 'users\\.customerId' will always evaluate to false\\.$#"
count: 1
path: src/QUI/ERP/Customer/Search.php
...@@ -104,11 +104,11 @@ public function createCustomer($customerId, array $address = [], array $groupIds ...@@ -104,11 +104,11 @@ public function createCustomer($customerId, array $address = [], array $groupIds
$Address->save(); $Address->save();
if (!$User->getAttribute('firstname') || $User->getAttribute('firstname') === '') { if (empty($User->getAttribute('firstname'))) {
$User->setAttribute('firstname', $address['firstname']); $User->setAttribute('firstname', $address['firstname']);
} }
if (!$User->getAttribute('lastname') || $User->getAttribute('lastname') === '') { if (empty($User->getAttribute('lastname'))) {
$User->setAttribute('lastname', $address['lastname']); $User->setAttribute('lastname', $address['lastname']);
} }
} }
...@@ -221,8 +221,8 @@ public function getCustomerGroup(): ?QUI\Groups\Group ...@@ -221,8 +221,8 @@ public function getCustomerGroup(): ?QUI\Groups\Group
* @throws QUI\Users\Exception * @throws QUI\Users\Exception
*/ */
public function addUserToCustomerGroup( public function addUserToCustomerGroup(
bool|int|string $userId, bool | int | string $userId,
QUI\Interfaces\Users\User $PermissionUser = null null | QUI\Interfaces\Users\User $PermissionUser = null
): void { ): void {
if (!$userId) { if (!$userId) {
return; return;
...@@ -258,7 +258,7 @@ public function addUserToCustomerGroup( ...@@ -258,7 +258,7 @@ public function addUserToCustomerGroup(
* @throws QUI\Exception * @throws QUI\Exception
* @throws QUI\Users\Exception * @throws QUI\Users\Exception
*/ */
public function removeUserFromCustomerGroup(bool|int|string $userId): void public function removeUserFromCustomerGroup(bool | int | string $userId): void
{ {
$customerGroup = null; $customerGroup = null;
...@@ -287,7 +287,7 @@ public function removeUserFromCustomerGroup(bool|int|string $userId): void ...@@ -287,7 +287,7 @@ public function removeUserFromCustomerGroup(bool|int|string $userId): void
* @throws QUI\Permissions\Exception * @throws QUI\Permissions\Exception
* @throws QUI\Users\Exception * @throws QUI\Users\Exception
*/ */
public function setAttributesToCustomer(bool|int|string $userId, array $attributes): void public function setAttributesToCustomer(bool | int | string $userId, array $attributes): void
{ {
$User = QUI::getUsers()->get($userId); $User = QUI::getUsers()->get($userId);
...@@ -343,8 +343,6 @@ public function setAttributesToCustomer(bool|int|string $userId, array $attribut ...@@ -343,8 +343,6 @@ public function setAttributesToCustomer(bool|int|string $userId, array $attribut
if (isset($attributes['group'])) { if (isset($attributes['group'])) {
$groups[] = $attributes['group']; $groups[] = $attributes['group'];
$User->setAttribute('mainGroup', $attributes['group']); $User->setAttribute('mainGroup', $attributes['group']);
} elseif (isset($attributes['group']) && $attributes['group'] === null) {
$User->setAttribute('mainGroup', false);
} }
if (!empty($attributes['groups'])) { if (!empty($attributes['groups'])) {
...@@ -385,7 +383,7 @@ public function setAttributesToCustomer(bool|int|string $userId, array $attribut ...@@ -385,7 +383,7 @@ public function setAttributesToCustomer(bool|int|string $userId, array $attribut
$SystemUser = QUI::getUsers()->getSystemUser(); $SystemUser = QUI::getUsers()->getSystemUser();
try { try {
$User->activate(false, $SystemUser); $User->activate('', $SystemUser);
} catch (QUI\Exception $Exception) { } catch (QUI\Exception $Exception) {
// if no password, set a password // if no password, set a password
$userAttr = $User->getAttributes(); $userAttr = $User->getAttributes();
...@@ -396,7 +394,7 @@ public function setAttributesToCustomer(bool|int|string $userId, array $attribut ...@@ -396,7 +394,7 @@ public function setAttributesToCustomer(bool|int|string $userId, array $attribut
$SystemUser $SystemUser
); );
$User->activate(false, $SystemUser); $User->activate('', $SystemUser);
} else { } else {
throw $Exception; throw $Exception;
} }
......
...@@ -37,7 +37,7 @@ public static function getEntityType(): string ...@@ -37,7 +37,7 @@ public static function getEntityType(): string
* @param Locale|null $Locale $Locale (optional) - If ommitted use \QUI::getLocale() * @param Locale|null $Locale $Locale (optional) - If ommitted use \QUI::getLocale()
* @return string * @return string
*/ */
public static function getEntityTypeTitle(Locale $Locale = null): string public static function getEntityTypeTitle(null | Locale $Locale = null): string
{ {
if (empty($Locale)) { if (empty($Locale)) {
$Locale = QUI::getLocale(); $Locale = QUI::getLocale();
......
...@@ -332,7 +332,8 @@ protected function getQuery(bool $count = false): array ...@@ -332,7 +332,8 @@ protected function getQuery(bool $count = false): array
'company', 'company',
'customerId', 'customerId',
'ad.firstname', 'ad.firstname',
'ad.lastname' 'ad.lastname',
'users.customerId'
]; ];
$searchFilters = []; $searchFilters = [];
...@@ -687,7 +688,7 @@ public function order(string $col, string $direction = 'ASC'): void ...@@ -687,7 +688,7 @@ public function order(string $col, string $direction = 'ASC'): void
* @param integer|string $from - start * @param integer|string $from - start
* @param integer|string $count - count of entries * @param integer|string $count - count of entries
*/ */
public function limit(int|string $from, int|string $count): void public function limit(int | string $from, int | string $count): void
{ {
$this->limit = [(int)$from, (int)$count]; $this->limit = [(int)$from, (int)$count];
} }
...@@ -702,7 +703,7 @@ public function limit(int|string $from, int|string $count): void ...@@ -702,7 +703,7 @@ public function limit(int|string $from, int|string $count): void
* @param string $filter * @param string $filter
* @param array|string $value * @param array|string $value
*/ */
public function setFilter(string $filter, array|string $value): void public function setFilter(string $filter, array | string $value): void
{ {
if ($filter === 'search') { if ($filter === 'search') {
$this->search = $value; $this->search = $value;
......
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