improve stability of versandarten

This commit is contained in:
Andreas Palm 2023-03-23 23:22:45 +01:00
parent 8f76574d00
commit 696e9efc76
2 changed files with 19 additions and 15 deletions

View File

@ -153,14 +153,14 @@ abstract class Versanddienstleister
lp.zollwaehrung
FROM lieferschein_position lp
JOIN artikel a on lp.artikel = a.id
LEFT JOIN auftrag_position ap on lp.auftrag_position_id = ap.id
LEFT JOIN rechnung_position rp on ap.id = rp.auftrag_position_id
LEFT JOIN rechnung r on rp.rechnung = r.id
LEFT OUTER JOIN auftrag_position ap on lp.auftrag_position_id = ap.id
LEFT OUTER JOIN rechnung_position rp on ap.id = rp.auftrag_position_id
LEFT OUTER JOIN rechnung r on rp.rechnung = r.id
WHERE lp.lieferschein = $lieferscheinId
AND a.lagerartikel = 1
AND r.status != 'storniert'
ORDER BY lp.sort";
$ret['positions'] = $this->app->DB->SelectArr($sql);
$ret['positions'] = $this->app->DB->SelectArr($sql) ?? [];
if ($sid === "lieferschein") {
$standardkg = $this->app->erp->VersandartMindestgewicht($lieferscheinId);

View File

@ -10,7 +10,7 @@
/*
**** COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
*
* Xentral (c) Xentral ERP Sorftware GmbH, Fuggerstrasse 11, D-86150 Augsburg, * Germany 2019
* Xentral (c) Xentral ERP Software GmbH, Fuggerstrasse 11, D-86150 Augsburg, * Germany 2019
*
* This file is licensed under the Embedded Projects General Public License *Version 3.1.
*
@ -190,12 +190,14 @@ class Versandarten {
))
$error[] = 'Typ ist bereits für eine andere Versandart vergeben';
foreach ($obj->AdditionalSettings() as $k => $v) {
$form[$k] = $this->app->Secure->GetPOST($k);
}
$error = array_merge($error, $obj->ValidateSettings($form));
foreach ($obj->AdditionalSettings() as $k => $v) {
$json[$k] = $form[$k];
if ($obj !== null) {
foreach ($obj->AdditionalSettings() as $k => $v) {
$form[$k] = $this->app->Secure->GetPOST($k);
}
$error = array_merge($error, $obj->ValidateSettings($form));
foreach ($obj->AdditionalSettings() as $k => $v) {
$json[$k] = $form[$k];
}
}
$json = json_encode($json ?? null);
@ -241,7 +243,7 @@ class Versandarten {
$form['paketmarke_drucker'] = $daten['paketmarke_drucker'];
}
$obj->RenderAdditionalSettings('MODULESETTINGS', $form);
$obj?->RenderAdditionalSettings('MODULESETTINGS', $form);
$this->app->Tpl->addSelect('EXPORT_DRUCKER', 'export_drucker', 'export_drucker',
$this->getPrinterByModule($obj, false), $form['export_drucker']);
@ -278,11 +280,11 @@ class Versandarten {
$this->app->Tpl->Parse('PAGE', 'versandarten_edit.tpl');
}
protected function getPrinterByModule(Versanddienstleister $obj, bool $includeLabelPrinter = true): array
protected function getPrinterByModule(?Versanddienstleister $obj, bool $includeLabelPrinter = true): array
{
$printer = $this->app->erp->GetDrucker();
if ($includeLabelPrinter && $obj->isEtikettenDrucker()) {
if ($includeLabelPrinter && $obj?->isEtikettenDrucker()) {
$labelPrinter = $this->app->erp->GetEtikettendrucker();
$printer = array_merge($printer ?? [], $labelPrinter ?? []);
}
@ -757,7 +759,7 @@ class Versandarten {
* @param string $module
* @param int $moduleId
*
* @return mixed|null
* @return ?Versanddienstleister
*/
public function loadModule(string $module, int $moduleId = 0) : ?Versanddienstleister
{
@ -821,6 +823,8 @@ class Versandarten {
continue;
$obj = $this->loadModule($modul);
if ($obj === null)
continue;
$result[$modul] = $obj->name ?? ucfirst($modul);
unset($obj);
}