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();
|
$this->versandpakete_status_select();
|
||||||
|
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
versandpaket,
|
|
||||||
belegnr,
|
belegnr,
|
||||||
l.name
|
l.name
|
||||||
FROM
|
FROM
|
||||||
versandpaket_lieferschein_position vlp
|
lieferschein l
|
||||||
INNER JOIN
|
|
||||||
lieferschein_position lp ON lp.id = vlp.lieferschein_position
|
|
||||||
INNER JOIN
|
|
||||||
lieferschein l ON l.id = lp.lieferschein
|
|
||||||
WHERE l.id = ".$lieferschein_filter." LIMIT 1";
|
WHERE l.id = ".$lieferschein_filter." LIMIT 1";
|
||||||
|
|
||||||
$info = $this->app->DB->SelectArr($sql);
|
$info = $this->app->DB->SelectArr($sql);
|
||||||
@ -557,10 +552,11 @@ class Versandpakete {
|
|||||||
$this->app->Tpl->Set('BELEGNR', $info[0]['belegnr']);
|
$this->app->Tpl->Set('BELEGNR', $info[0]['belegnr']);
|
||||||
$this->app->Tpl->SetText('KURZUEBERSCHRIFT2', $info[0]['name']." Lieferung ".$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');
|
$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');
|
$this->app->Tpl->addMessage('info', 'Lieferung unvollständig.', false, 'MESSAGE');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -640,10 +636,9 @@ class Versandpakete {
|
|||||||
|
|
||||||
$sql = "SELECT status FROM versandpakete WHERE id = ".$id;
|
$sql = "SELECT status FROM versandpakete WHERE id = ".$id;
|
||||||
$input['status'] = $this->app->DB->SelectArr($sql)[0]['status'];
|
$input['status'] = $this->app->DB->SelectArr($sql)[0]['status'];
|
||||||
|
|
||||||
if ($input['status'] != 'neu') {
|
if ($input['status'] != 'neu') {
|
||||||
$input = Array('bemerkung' => $input['bemerkung']);
|
$input = Array('bemerkung' => $input['bemerkung']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$columns = "id, ";
|
$columns = "id, ";
|
||||||
$values = "$id, ";
|
$values = "$id, ";
|
||||||
@ -672,7 +667,7 @@ class Versandpakete {
|
|||||||
|
|
||||||
// Load values again from database
|
// Load values again from database
|
||||||
$dropnbox = "'<img src=./themes/new/images/details_open.png class=details>' AS `open`, CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',v.id,'\" />') AS `auswahl`";
|
$dropnbox = "'<img src=./themes/new/images/details_open.png class=details>' AS `open`, CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',v.id,'\" />') AS `auswahl`";
|
||||||
$result = $this->app->DB->SelectArr("SELECT SQL_CALC_FOUND_ROWS v.id, $dropnbox, ".$this->app->erp->FormatDate('datum')." as datum, v.versand, v.versandart, v.nr, v.tracking, v.tracking_link, v.versender, v.gewicht, v.bemerkung, v.status, v.id FROM versandpakete v"." WHERE id=$id");
|
$result = $this->app->DB->SelectArr("SELECT SQL_CALC_FOUND_ROWS v.id, $dropnbox, ".$this->app->erp->FormatDate('datum')." as datum, v.versand, v.versandart, v.nr, v.tracking, v.tracking_link, v.versender, v.gewicht, v.bemerkung, v.status, v.id FROM versandpakete v"." WHERE id=$id");
|
||||||
|
|
||||||
foreach ($result[0] as $key => $value) {
|
foreach ($result[0] as $key => $value) {
|
||||||
$this->app->Tpl->Set(strtoupper($key), $value);
|
$this->app->Tpl->Set(strtoupper($key), $value);
|
||||||
@ -733,7 +728,7 @@ class Versandpakete {
|
|||||||
} else {
|
} else {
|
||||||
$this->app->Tpl->Set('PAKETMARKE_HIDDEN', 'hidden');
|
$this->app->Tpl->Set('PAKETMARKE_HIDDEN', 'hidden');
|
||||||
$this->app->Tpl->Set('ABSENDEN_HIDDEN', 'hidden');
|
$this->app->Tpl->Set('ABSENDEN_HIDDEN', 'hidden');
|
||||||
}
|
}
|
||||||
|
|
||||||
$file_attachments = $this->app->erp->GetDateiSubjektObjekt('paketmarke','versandpaket',$id);
|
$file_attachments = $this->app->erp->GetDateiSubjektObjekt('paketmarke','versandpaket',$id);
|
||||||
if (!empty($file_attachments)) {
|
if (!empty($file_attachments)) {
|
||||||
@ -766,10 +761,11 @@ class Versandpakete {
|
|||||||
$icons = $this->app->DB->SelectArr($sql);
|
$icons = $this->app->DB->SelectArr($sql);
|
||||||
$this->app->Tpl->Set('ICONS', $icons[0]['icons']);
|
$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');
|
$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');
|
$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_lieferschein', $lieferschein);
|
||||||
$this->app->User->SetParameter('versandpakete_versandpaket', $id);
|
$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');
|
$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');
|
$this->app->Tpl->addMessage('info', 'Lieferung unvollständig.', false, 'MESSAGE');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -944,14 +941,24 @@ class Versandpakete {
|
|||||||
$this->app->Tpl->Parse('PAGE', "versandpakete_add.tpl");
|
$this->app->Tpl->Parse('PAGE', "versandpakete_add.tpl");
|
||||||
}
|
}
|
||||||
|
|
||||||
function versandpakete_check_completion($id) : bool {
|
// null if versandpaket not associated with lieferschein
|
||||||
$sql_lieferschein = "
|
function versandpakete_check_completion($lieferung, $versandpaket) : ?bool {
|
||||||
SELECT DISTINCT
|
|
||||||
lieferschein
|
if (!empty($lieferung)) {
|
||||||
FROM
|
$sql_where_lieferung = " AND l.id = ".$lieferung;
|
||||||
versandpaket_lieferschein_position vlp
|
} else {
|
||||||
INNER JOIN lieferschein_position lp ON vlp.lieferschein_position = lp.id
|
$sql_join_lieferschein = "
|
||||||
WHERE versandpaket = ".$id;
|
INNER JOIN (
|
||||||
|
SELECT DISTINCT
|
||||||
|
lieferschein
|
||||||
|
FROM
|
||||||
|
versandpaket_lieferschein_position vlp
|
||||||
|
INNER JOIN lieferschein_position lp ON vlp.lieferschein_position = lp.id
|
||||||
|
WHERE versandpaket = ".$versandpaket."
|
||||||
|
) lieferschein_filter
|
||||||
|
ON lieferschein_filter.lieferschein = lp.lieferschein
|
||||||
|
";
|
||||||
|
}
|
||||||
|
|
||||||
$sql_lieferschein_mengen = "
|
$sql_lieferschein_mengen = "
|
||||||
SELECT
|
SELECT
|
||||||
@ -964,11 +971,10 @@ class Versandpakete {
|
|||||||
artikel a ON a.id = lp.artikel
|
artikel a ON a.id = lp.artikel
|
||||||
INNER JOIN
|
INNER JOIN
|
||||||
lieferschein l on l.id = lp.lieferschein
|
lieferschein l on l.id = lp.lieferschein
|
||||||
INNER JOIN
|
".$sql_join_lieferschein."
|
||||||
(".$sql_lieferschein.") lieferschein_filter
|
|
||||||
ON lieferschein_filter.lieferschein = lp.lieferschein
|
|
||||||
WHERE
|
WHERE
|
||||||
a.lagerartikel
|
a.lagerartikel
|
||||||
|
".$sql_where_lieferung."
|
||||||
GROUP BY
|
GROUP BY
|
||||||
lp.id
|
lp.id
|
||||||
";
|
";
|
||||||
@ -1015,9 +1021,12 @@ class Versandpakete {
|
|||||||
if (!empty($completion)) {
|
if (!empty($completion)) {
|
||||||
if ($completion[0]['lmenge'] == $completion[0]['vmenge']) {
|
if ($completion[0]['lmenge'] == $completion[0]['vmenge']) {
|
||||||
return(true);
|
return(true);
|
||||||
}
|
} else {
|
||||||
|
return(false);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return(null);
|
||||||
}
|
}
|
||||||
return(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function versandpakete_minidetail() {
|
function versandpakete_minidetail() {
|
||||||
@ -1109,26 +1118,10 @@ class Versandpakete {
|
|||||||
public function GetInput(): array {
|
public function GetInput(): array {
|
||||||
$input = array();
|
$input = array();
|
||||||
$input['gewicht'] = $this->app->Secure->GetPOST('gewicht');
|
$input['gewicht'] = $this->app->Secure->GetPOST('gewicht');
|
||||||
$input['bemerkung'] = $this->app->Secure->GetPOST('bemerkung');
|
$input['bemerkung'] = $this->app->Secure->GetPOST('bemerkung');
|
||||||
return $input;
|
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) {
|
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`";
|
$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