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

fix(phpstan): optimize attribute checks and method calls in erp classes

In this commit, several changes have been made to streamline the Manufacturer and Process classes
within the ERP module:

- Replaced the non-empty check for 'firstname' and 'lastname' attributes in the User class with an
`empty()` function, resulting in cleaner code without changing the functionality.
- Replaced the argument in `User->activate()` from `false` to `''` for consistency.
- Removed unnecessary annotations and some unused `protected` properties from the Process class.
- Altered the procedure to retrieve `salesOrder` from the Entity in the Process class. Now, the
method first tries to retrieve it via `getPaymentDataEntry()`, and if unavailable, it attempts to
fetch it using `getCustomDataEntry()`. This ensures a more robust and reliable retrieval of the
'salesOrder' property.
- Added `@phpstan-ignore-next-line` in the Processes class to prevent phpstan from throwing
unwarranted warnings regarding the following code line in s...
Übergeordneter 511794c3
No related branches found
No related tags found
2 Merge Requests!170Update 'next-4.x' with latest changes from 'main',!169fix(phpstan): added exception handling for missing html2pdf module in OutputTemplate
Pipeline #15504 mit Warnungen bestanden mit Phase
in 2 Minuten und 19 Sekunden
......@@ -159,11 +159,11 @@ public static function createManufacturer(
$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']);
}
}
......@@ -183,7 +183,7 @@ public static function createManufacturer(
// Set random password and activate
$User->setPassword(QUI\Security\Password::generateRandom(), $SystemUser);
$User->activate(false, $SystemUser);
$User->activate('', $SystemUser);
return $User;
}
......
......@@ -31,19 +31,8 @@ class Process
*/
const PROCESS_ACTIVE_DATE = '2024-08-01 00:00:00';
/**
* @var string
*/
protected string $processId;
/**
* @var null|array
*/
protected ?array $transactions = null;
/**
* @var null|QUI\ERP\Comments
*/
protected ?Comments $History = null;
/**
......@@ -166,7 +155,11 @@ class_exists('QUI\ERP\Accounting\Invoice\Invoice')
$groups[$uuid][] = $Entity;
if (class_exists('QUI\ERP\SalesOrders\Handler')) {
$salesOrder = $Entity->getPaymentData('salesOrder');
$salesOrder = $Entity->getPaymentDataEntry('salesOrder');
if (empty($salesOrder)) {
$salesOrder = $Entity->getCustomDataEntry('salesOrder');
}
if ($salesOrder) {
try {
......
......@@ -43,6 +43,7 @@ public function getEntity($entityHash, $entityPlugin = false): ErpEntityInterfac
if ($entityPlugin === false || $entityPlugin === 'quiqqer/booking') {
try {
// @todo quiqqer/booking
// @phpstan-ignore-next-line
} catch (\Exception) {
}
}
......@@ -70,6 +71,7 @@ public function getEntity($entityHash, $entityPlugin = false): ErpEntityInterfac
if ($entityPlugin === false || $entityPlugin === 'quiqqer/delivery-notes') {
try {
// @todo quiqqer/delivery-notes
// @phpstan-ignore-next-line
} catch (\Exception) {
}
}
......
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren