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/customer
1 Ergebnis
Änderungen anzeigen
Commits auf Quelle (3)
  • Henning Leutz's avatar
    fix(phpstan): improve code clarity and formatting · 6e866030
    verfasst von Henning Leutz
    1. Simplified condition checks for 'firstname' and 'lastname' using the 'empty()' function.
    2. Refactored the type hinting of parameters for the 'addUserToCustomerGroup',
    'removeUserFromCustomerGroup', and 'setAttributesToCustomer' methods.
    3. Updated the type hinting for the 'getEntityTypeTitle' method, adding a possibility to receive
    null.
    
    Related: #67
    6e866030
  • Henning Leutz's avatar
    fix(phpstan): improve user verification and remove redundancies · b0e75b59
    verfasst von Henning Leutz
    Improve user verification in ajax backend passwordMail by adding an instance check for
    QUI\\Users\\User before calling sendPassword method.
    Remove redundant error messages in phpstan-baseline.neon associated with previously incorrect user
    activation logic and unsupported comparison evaluations in Customers.php and Search.php.
    Correct arguments for activate method in Customers.php from false to empty string.
    Add 'users.customerId' to allowed search columns and adjust type hints for arguments in `limit` and
    `setFilter` methods in Search.php to include spaces for better readability.
    
    Related: #67
    b0e75b59
  • Henning Leutz's avatar
    Merge branch 'next-2.x' into 'main' · 240a41f5
    verfasst von Henning Leutz
    fix(phpstan): improve code clarity and formatting
    
    See merge request !57
    240a41f5
......@@ -12,9 +12,11 @@
'package_quiqqer_customer_ajax_backend_customer_passwordMail',
function ($userId) {
$User = QUI::getUsers()->get($userId);
$Handler = QUI\Users\Auth\Handler::getInstance();
$Handler->sendPasswordResetVerificationMail($User);
if ($User instanceof QUI\Users\User) {
$Handler->sendPasswordResetVerificationMail($User);
}
QUI::getMessagesHandler()->addSuccess(
QUI::getLocale()->get('quiqqer/customer', 'message.customer.password.mail.send')
......
......@@ -15,11 +15,6 @@ parameters:
count: 1
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\\.$#"
count: 1
......@@ -75,26 +70,6 @@ parameters:
count: 1
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\\.$#"
count: 1
......@@ -319,8 +294,3 @@ parameters:
message: "#^Parameter \\$Order of method QUI\\\\ERP\\\\Customer\\\\OpenItemsList\\\\Handler\\:\\:parseOrderToOpenItem\\(\\) has invalid type QUI\\\\ERP\\\\Order\\\\Order\\.$#"
count: 2
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
$Address->save();
if (!$User->getAttribute('firstname') || $User->getAttribute('firstname') === '') {
if (empty($User->getAttribute('firstname'))) {
$User->setAttribute('firstname', $address['firstname']);
}
if (!$User->getAttribute('lastname') || $User->getAttribute('lastname') === '') {
if (empty($User->getAttribute('lastname'))) {
$User->setAttribute('lastname', $address['lastname']);
}
}
......@@ -221,8 +221,8 @@ public function getCustomerGroup(): ?QUI\Groups\Group
* @throws QUI\Users\Exception
*/
public function addUserToCustomerGroup(
bool|int|string $userId,
QUI\Interfaces\Users\User $PermissionUser = null
bool | int | string $userId,
null | QUI\Interfaces\Users\User $PermissionUser = null
): void {
if (!$userId) {
return;
......@@ -258,7 +258,7 @@ public function addUserToCustomerGroup(
* @throws QUI\Exception
* @throws QUI\Users\Exception
*/
public function removeUserFromCustomerGroup(bool|int|string $userId): void
public function removeUserFromCustomerGroup(bool | int | string $userId): void
{
$customerGroup = null;
......@@ -287,7 +287,7 @@ public function removeUserFromCustomerGroup(bool|int|string $userId): void
* @throws QUI\Permissions\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);
......@@ -343,8 +343,6 @@ public function setAttributesToCustomer(bool|int|string $userId, array $attribut
if (isset($attributes['group'])) {
$groups[] = $attributes['group'];
$User->setAttribute('mainGroup', $attributes['group']);
} elseif (isset($attributes['group']) && $attributes['group'] === null) {
$User->setAttribute('mainGroup', false);
}
if (!empty($attributes['groups'])) {
......@@ -385,7 +383,7 @@ public function setAttributesToCustomer(bool|int|string $userId, array $attribut
$SystemUser = QUI::getUsers()->getSystemUser();
try {
$User->activate(false, $SystemUser);
$User->activate('', $SystemUser);
} catch (QUI\Exception $Exception) {
// if no password, set a password
$userAttr = $User->getAttributes();
......@@ -396,7 +394,7 @@ public function setAttributesToCustomer(bool|int|string $userId, array $attribut
$SystemUser
);
$User->activate(false, $SystemUser);
$User->activate('', $SystemUser);
} else {
throw $Exception;
}
......
......@@ -37,7 +37,7 @@ public static function getEntityType(): string
* @param Locale|null $Locale $Locale (optional) - If ommitted use \QUI::getLocale()
* @return string
*/
public static function getEntityTypeTitle(Locale $Locale = null): string
public static function getEntityTypeTitle(null | Locale $Locale = null): string
{
if (empty($Locale)) {
$Locale = QUI::getLocale();
......
......@@ -332,7 +332,8 @@ protected function getQuery(bool $count = false): array
'company',
'customerId',
'ad.firstname',
'ad.lastname'
'ad.lastname',
'users.customerId'
];
$searchFilters = [];
......@@ -687,7 +688,7 @@ public function order(string $col, string $direction = 'ASC'): void
* @param integer|string $from - start
* @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];
}
......@@ -702,7 +703,7 @@ public function limit(int|string $from, int|string $count): void
* @param string $filter
* @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') {
$this->search = $value;
......