mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-11-14 20:17:14 +01:00
versandpakete bugfix check completion
This commit is contained in:
parent
662410fdc8
commit
3e70af8466
@ -540,15 +540,10 @@ class Versandpakete {
|
||||
$this->versandpakete_status_select();
|
||||
|
||||
$sql = "SELECT
|
||||
versandpaket,
|
||||
belegnr,
|
||||
l.name
|
||||
FROM
|
||||
versandpaket_lieferschein_position vlp
|
||||
INNER JOIN
|
||||
lieferschein_position lp ON lp.id = vlp.lieferschein_position
|
||||
INNER JOIN
|
||||
lieferschein l ON l.id = lp.lieferschein
|
||||
lieferschein l
|
||||
WHERE l.id = ".$lieferschein_filter." LIMIT 1";
|
||||
|
||||
$info = $this->app->DB->SelectArr($sql);
|
||||
@ -557,10 +552,11 @@ class Versandpakete {
|
||||
$this->app->Tpl->Set('BELEGNR', $info[0]['belegnr']);
|
||||
$this->app->Tpl->SetText('KURZUEBERSCHRIFT2', $info[0]['name']." Lieferung ".$info[0]['belegnr']);
|
||||
|
||||
if ($this->versandpakete_check_completion($info[0]['versandpaket'])) {
|
||||
$complete = $this->versandpakete_check_completion($lieferschein_filter, null);
|
||||
if ($complete === true) {
|
||||
$this->app->Tpl->addMessage('success', 'Lieferung vollständig in Paketen.', false, 'MESSAGE');
|
||||
}
|
||||
else {
|
||||
else if ($complete === false) {
|
||||
$this->app->Tpl->addMessage('info', 'Lieferung unvollständig.', false, 'MESSAGE');
|
||||
}
|
||||
}
|
||||
@ -640,7 +636,6 @@ class Versandpakete {
|
||||
|
||||
$sql = "SELECT status FROM versandpakete WHERE id = ".$id;
|
||||
$input['status'] = $this->app->DB->SelectArr($sql)[0]['status'];
|
||||
|
||||
if ($input['status'] != 'neu') {
|
||||
$input = Array('bemerkung' => $input['bemerkung']);
|
||||
}
|
||||
@ -766,10 +761,11 @@ class Versandpakete {
|
||||
$icons = $this->app->DB->SelectArr($sql);
|
||||
$this->app->Tpl->Set('ICONS', $icons[0]['icons']);
|
||||
|
||||
if ($this->versandpakete_check_completion($id)) {
|
||||
$complete = $this->versandpakete_check_completion(null, $id);
|
||||
if ($complete === true) {
|
||||
$this->app->Tpl->addMessage('success', 'Lieferung vollständig in Paketen.', false, 'MESSAGE');
|
||||
}
|
||||
else {
|
||||
else if ($complete === false) {
|
||||
$this->app->Tpl->addMessage('info', 'Lieferung unvollständig.', false, 'MESSAGE');
|
||||
}
|
||||
|
||||
@ -931,10 +927,11 @@ class Versandpakete {
|
||||
$this->app->User->SetParameter('versandpakete_lieferschein', $lieferschein);
|
||||
$this->app->User->SetParameter('versandpakete_versandpaket', $id);
|
||||
|
||||
if ($this->versandpakete_check_completion($id)) {
|
||||
$complete = $this->versandpakete_check_completion($lieferschein,null);
|
||||
if ($complete === true) {
|
||||
$this->app->Tpl->addMessage('success', 'Lieferung vollständig in Paketen.', false, 'MESSAGE');
|
||||
}
|
||||
else {
|
||||
else if ($complete === false) {
|
||||
$this->app->Tpl->addMessage('info', 'Lieferung unvollständig.', false, 'MESSAGE');
|
||||
}
|
||||
|
||||
@ -944,14 +941,24 @@ class Versandpakete {
|
||||
$this->app->Tpl->Parse('PAGE', "versandpakete_add.tpl");
|
||||
}
|
||||
|
||||
function versandpakete_check_completion($id) : bool {
|
||||
$sql_lieferschein = "
|
||||
// null if versandpaket not associated with lieferschein
|
||||
function versandpakete_check_completion($lieferung, $versandpaket) : ?bool {
|
||||
|
||||
if (!empty($lieferung)) {
|
||||
$sql_where_lieferung = " AND l.id = ".$lieferung;
|
||||
} else {
|
||||
$sql_join_lieferschein = "
|
||||
INNER JOIN (
|
||||
SELECT DISTINCT
|
||||
lieferschein
|
||||
FROM
|
||||
versandpaket_lieferschein_position vlp
|
||||
INNER JOIN lieferschein_position lp ON vlp.lieferschein_position = lp.id
|
||||
WHERE versandpaket = ".$id;
|
||||
WHERE versandpaket = ".$versandpaket."
|
||||
) lieferschein_filter
|
||||
ON lieferschein_filter.lieferschein = lp.lieferschein
|
||||
";
|
||||
}
|
||||
|
||||
$sql_lieferschein_mengen = "
|
||||
SELECT
|
||||
@ -964,11 +971,10 @@ class Versandpakete {
|
||||
artikel a ON a.id = lp.artikel
|
||||
INNER JOIN
|
||||
lieferschein l on l.id = lp.lieferschein
|
||||
INNER JOIN
|
||||
(".$sql_lieferschein.") lieferschein_filter
|
||||
ON lieferschein_filter.lieferschein = lp.lieferschein
|
||||
".$sql_join_lieferschein."
|
||||
WHERE
|
||||
a.lagerartikel
|
||||
".$sql_where_lieferung."
|
||||
GROUP BY
|
||||
lp.id
|
||||
";
|
||||
@ -1015,10 +1021,13 @@ class Versandpakete {
|
||||
if (!empty($completion)) {
|
||||
if ($completion[0]['lmenge'] == $completion[0]['vmenge']) {
|
||||
return(true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return(false);
|
||||
}
|
||||
} else {
|
||||
return(null);
|
||||
}
|
||||
}
|
||||
|
||||
function versandpakete_minidetail() {
|
||||
$id = $this->app->Secure->GetGET('id');
|
||||
@ -1113,22 +1122,6 @@ class Versandpakete {
|
||||
return $input;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set all fields in the page corresponding to $input
|
||||
*/
|
||||
function SetInput($input) {
|
||||
// $this->app->Tpl->Set('EMAIL', $input['email']);
|
||||
|
||||
$this->app->Tpl->Set('VERSAND', $input['versand']);
|
||||
$this->app->Tpl->Set('NR', $input['nr']);
|
||||
$this->app->Tpl->Set('TRACKING', $input['tracking']);
|
||||
$this->app->Tpl->Set('VERSENDER', $input['versender']);
|
||||
$this->app->Tpl->Set('GEWICHT', $input['gewicht']);
|
||||
$this->app->Tpl->Set('BEMERKUNG', $input['bemerkung']);
|
||||
$this->app->Tpl->Set('STATUS', $input['status']);
|
||||
|
||||
}
|
||||
|
||||
static function versandpakete_lieferstatus_sql($app) {
|
||||
|
||||
$dropnbox = "'<img src=./themes/new/images/details_open.png class=details>' AS `open`, CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',id,'\" />') AS `auswahl`";
|
||||
|
Loading…
Reference in New Issue
Block a user