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

Merge branch 'dev' into 'next'

refactor: code stability

See merge request !86
Übergeordnete cf6ad0d1 8e9023fa
No related branches found
No related tags found
2 Merge Requests!87refactor: code stability,!86refactor: code stability
Pipeline #7254 bestanden mit Phase
in 8 Sekunden
werden angezeigt mit 181 Ergänzungen und 169 Löschungen
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpstan" version="^1.10.67" installed="1.10.67" location="./tools/phpstan" copy="false"/>
</phive>
......@@ -15,8 +15,8 @@
'package_quiqqer_erp_ajax_calcPriceFactor',
function ($price, $vat, $currency) {
$Currency = CurrencyHandler::getCurrency($currency);
$price = Price::validatePrice($price);
$vat = floatval($vat);
$price = Price::validatePrice($price);
$vat = floatval($vat);
/* auskommentiert weil: quiqqer/erp/-/issues/78#note_144725
if (empty($vat)) {
......@@ -28,23 +28,23 @@ function ($price, $vat, $currency) {
}
*/
$nettoSum = $price;
$nettoSum = $price;
$nettoSumFormatted = $Currency->format($price);
$sum = $price * (($vat + 100) / 100);
$sumFormatted = $Currency->format($sum);
$sum = $price * (($vat + 100) / 100);
$sumFormatted = $Currency->format($sum);
$valueText = $sumFormatted;
if (strpos($valueText, '+') === false && strpos($valueText, '-') === false) {
if (!str_contains($valueText, '+') && !str_contains($valueText, '-')) {
$valueText = '+' . $valueText;
}
return [
'nettoSum' => $nettoSum,
'nettoSum' => $nettoSum,
'nettoSumFormatted' => $nettoSumFormatted,
'sum' => $sum,
'sumFormatted' => $sumFormatted,
'valueText' => $valueText
'sum' => $sum,
'sumFormatted' => $sumFormatted,
'valueText' => $valueText
];
},
['price', 'vat', 'currency'],
......
......@@ -16,7 +16,7 @@
'package_quiqqer_erp_ajax_customerFiles_getCustomer',
function ($hash) {
$Entity = (new Processes())->getEntity($hash);
return $Entity->getCustomer()->getUniqueId();
return $Entity->getCustomer()->getUUID();
},
['hash']
);
......@@ -16,9 +16,11 @@
'package_quiqqer_erp_ajax_customerFiles_update',
function ($hash, $files) {
$files = json_decode($files, true);
$Entity = (new Processes())->getEntity($hash);
$Entity->setCustomFiles($files);
if (method_exists($Entity, 'setCustomFiles')) {
$Entity->setCustomFiles($files);
}
},
['hash', 'files']
);
......@@ -18,7 +18,7 @@ function () {
$Group = $Groups->get($groupId);
$groups[] = [
'id' => $Group->getId(),
'id' => $Group->getUUID(),
'name' => $Group->getName()
];
}
......
......@@ -16,8 +16,8 @@
QUI::$Ajax->registerFunction(
'package_quiqqer_erp_ajax_manufacturers_create_newManufacturer',
function ($manufacturerId, $address, $groupIds) {
$address = Orthos::clearArray(\json_decode($address, true));
$groupIds = Orthos::clearArray(\json_decode($groupIds, true));
$address = Orthos::clearArray(json_decode($address, true));
$groupIds = Orthos::clearArray(json_decode($groupIds, true));
$manufacturerId = Orthos::clear($manufacturerId);
try {
......@@ -25,7 +25,7 @@ function ($manufacturerId, $address, $groupIds) {
} catch (ERPException $Exception) {
QUI\System\Log::writeDebugException($Exception);
throw $Exception;
} catch (\Exception $Exception) {
} catch (Exception $Exception) {
QUI\System\Log::writeException($Exception);
throw new ERPException([
......@@ -44,7 +44,7 @@ function ($manufacturerId, $address, $groupIds) {
)
);
return $User->getId();
return $User->getUUID();
},
['manufacturerId', 'address', 'groupIds'],
'Permission::checkAdminUser'
......
......@@ -13,7 +13,7 @@
QUI::$Ajax->registerFunction(
'package_quiqqer_erp_ajax_manufacturers_search',
function ($params) {
$searchParams = Orthos::clearArray(\json_decode($params, true));
$searchParams = Orthos::clearArray(json_decode($params, true));
$results = Manufacturers::search($searchParams);
$Grid = new Grid($searchParams);
......
......@@ -12,8 +12,8 @@
QUI::$Ajax->registerFunction(
'package_quiqqer_erp_ajax_output_getPreview',
function ($entity, $template) {
$entity = Orthos::clearArray(\json_decode($entity, true));
$template = Orthos::clearArray(\json_decode($template, true));
$entity = Orthos::clearArray(json_decode($entity, true));
$template = Orthos::clearArray(json_decode($template, true));
if (!isset($template['provider'])) {
return '';
......@@ -28,7 +28,7 @@ function ($entity, $template) {
$template['id'],
true
);
} catch (\Exception $Exception) {
} catch (Exception $Exception) {
QUI\System\Log::writeException($Exception);
return '';
......
......@@ -30,7 +30,7 @@ function ($articles, $priceFactors, $user, $currency, $nettoInput) {
try {
$User = QUI\ERP\User::convertUserDataToErpUser($user);
$Calc = QUI\ERP\Accounting\Calc::getInstance($User);
} catch (QUI\ERP\Exception $Exception) {
} catch (QUI\ERP\Exception) {
$Calc = QUI\ERP\Accounting\Calc::getInstance();
}
} else {
......@@ -62,7 +62,7 @@ function ($articles, $priceFactors, $user, $currency, $nettoInput) {
$Articles->setCurrency(
QUI\ERP\Currency\Handler::getCurrency($currency)
);
} catch (QUI\Exception $Exception) {
} catch (QUI\Exception) {
}
$result = $Articles->toArray();
......
......@@ -37,7 +37,7 @@ function ($productId, $attributes, $user, $fields) {
$Product = Products::getProduct((int)$productId);
foreach ($attributes as $field => $value) {
if (strpos($field, 'field-') === false) {
if (!str_contains($field, 'field-')) {
continue;
}
......@@ -83,7 +83,7 @@ function ($productId, $attributes, $user, $fields) {
$Field = $Product->getField($fieldId);
$fieldResult[$Field->getId()] = $Field->getValue();
} catch (QUI\Exception $Exception) {
} catch (QUI\Exception) {
}
}
......
......@@ -16,14 +16,14 @@ function ($article, $user) {
$article = json_decode($article, true);
$Brutto = new QUI\ERP\User([
'id' => 'BRUTTO',
'country' => '',
'username' => '',
'id' => 'BRUTTO',
'country' => '',
'username' => '',
'firstname' => '',
'lastname' => '',
'lang' => QUI::getLocale()->getCurrent(),
'lastname' => '',
'lang' => QUI::getLocale()->getCurrent(),
'isCompany' => 0,
'isNetto' => 0
'isNetto' => 0
]);
$Brutto->setAttribute(
......@@ -31,16 +31,14 @@ function ($article, $user) {
QUI\ERP\Utils\User::IS_BRUTTO_USER
);
$Calc = QUI\ERP\Accounting\Calc::getInstance($Brutto);
$Calc = QUI\ERP\Accounting\Calc::getInstance($Brutto);
$Article = new QUI\ERP\Accounting\Article($article);
//$Article->setCurrency();
$Article->setUser($Brutto);
$Article->calc($Calc);
$result = $Article->toArray();
return $result;
return $Article->toArray();
},
['article', 'user'],
'Permission::checkAdminUser'
......
......@@ -5,6 +5,7 @@
*/
use QUI\ERP\Api\Coordinator;
use QUI\ERP\Api\NumberRangeInterface;
/**
*
......@@ -16,7 +17,7 @@ function ($className, $newIndex) {
$ranges = Coordinator::getInstance()->getNumberRanges();
foreach ($ranges as $Range) {
/* @var $Range \QUI\ERP\Api\NumberRangeInterface */
/* @var $Range NumberRangeInterface */
if (get_class($Range) === $className) {
$Range->setRange((int)$newIndex);
}
......
......@@ -13,11 +13,11 @@
QUI::$Ajax->registerFunction(
'package_quiqqer_erp_ajax_settings_validateVat',
function ($vatId) {
if (!\class_exists('\SoapClient')) {
if (!class_exists('\SoapClient')) {
return -1;
}
if (!\class_exists('\QUI\ERP\Tax\Utils')) {
if (!class_exists('\QUI\ERP\Tax\Utils')) {
return -1;
}
......@@ -25,7 +25,7 @@ function ($vatId) {
QUI\ERP\Tax\Utils::validateVatId($vatId);
return 1;
} catch (QUI\ERP\Tax\Exception $Exception) {
} catch (QUI\ERP\Tax\Exception) {
return 0;
}
},
......
......@@ -14,7 +14,7 @@
function ($userId) {
try {
$email = Utils::getInstance()->getContactEmailByCustomer(
QUI::getUsers()->get((int)$userId)
QUI::getUsers()->get($userId)
);
} catch (Exception $Exception) {
QUI\System\Log::writeException($Exception);
......
......@@ -7,8 +7,6 @@
* @return array
*/
use QUI\Users\Address;
QUI::$Ajax->registerFunction(
'package_quiqqer_erp_ajax_userData_getDeliveryAddress',
function ($userId) {
......
......@@ -7,13 +7,15 @@
* @return string
*/
use QUI\Users\Address;
QUI::$Ajax->registerFunction(
'package_quiqqer_erp_ajax_userData_getUserEmailAddresses',
function ($userId) {
$emailAddresses = [];
try {
$User = QUI::getUsers()->get((int)$userId);
$User = QUI::getUsers()->get($userId);
} catch (Exception $Exception) {
QUI\System\Log::writeException($Exception);
return $emailAddresses;
......@@ -23,7 +25,7 @@ function ($userId) {
$emailAddresses[] = $User->getAttribute('email');
}
/** @var \QUI\Users\Address $Address */
/** @var Address $Address */
foreach ($User->getAddressList() as $Address) {
foreach ($Address->getMailList() as $email) {
$emailAddresses[] = $email;
......
......@@ -7,10 +7,12 @@
* @return string
*/
use QUI\ERP\Utils\Utils;
QUI::$Ajax->registerFunction(
'package_quiqqer_erp_ajax_utils_sanitizeArticleDescription',
function ($description) {
return \QUI\ERP\Utils\Utils::sanitizeArticleDescription($description);
return Utils::sanitizeArticleDescription($description);
},
['description'],
'Permission::checkAdminUser'
......
......@@ -393,7 +393,7 @@ define('package/quiqqer/erp/bin/backend/controls/manufacturers/Administration',
}
return this.$Grid.getSelectedData().map(function (entry) {
return parseInt(entry.id);
return entry.id;
});
},
......
Dieser Diff ist reduziert.
......@@ -20,7 +20,7 @@
},
"require": {
"php": "^8",
"quiqqer\/quiqqer": "^1.5",
"quiqqer\/core": "^2",
"quiqqer\/utils": "^1.6",
"quiqqer\/watcher": "^1|^0.12",
"quiqqer\/translator": "^1",
......
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