lieferschein added direct link paketmarke without versandmodul

This commit is contained in:
OpenXE 2023-11-02 09:43:43 +01:00
parent 77092171c3
commit 3e69b8d7e0
2 changed files with 13 additions and 6 deletions

View File

@ -468,7 +468,8 @@ class Lieferschein extends GenLieferschein
AND v.aktiv = 1 AND v.ausprojekt = 0 AND v.modul != '' AND v.aktiv = 1 AND v.ausprojekt = 0 AND v.modul != ''
ORDER BY v.projekt DESC LIMIT 1"); ORDER BY v.projekt DESC LIMIT 1");
if (empty($result['modul']) || empty($result['id'])) { if (empty($result['modul']) || empty($result['id'])) {
$this->app->Tpl->addMessage('error', 'Bitte zuerst eine gültige Versandart auswählen', false, 'PAGE'); // $this->app->Tpl->addMessage('error', 'Bitte zuerst eine gültige Versandart auswählen', false, 'PAGE');
$this->app->Location->execute("index.php?module=versandpakete&action=add&lieferschein=".$id);
return; return;
} }
$versandmodul = $this->app->erp->LoadVersandModul($result['modul'], $result['id']); $versandmodul = $this->app->erp->LoadVersandModul($result['modul'], $result['id']);

View File

@ -303,6 +303,7 @@ class Versandpakete {
$menu = "<a href=\"index.php?module=versandpakete&action=add&lieferschein=%value%\"><img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/add.png\" border=\"0\"></a>"; $menu = "<a href=\"index.php?module=versandpakete&action=add&lieferschein=%value%\"><img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/add.png\" border=\"0\"></a>";
$sql = Versandpakete::versandpakete_lieferstatus_sql($app); $sql = Versandpakete::versandpakete_lieferstatus_sql($app);
$where = ""; $where = "";
// Toggle filters // Toggle filters
@ -815,6 +816,15 @@ class Versandpakete {
} else { } else {
$lieferschein_belegnr = $this->app->erp->ReplaceLieferschein(false, $lieferschein, false); // Parameters: Target db?, value, from form? $lieferschein_belegnr = $this->app->erp->ReplaceLieferschein(false, $lieferschein, false); // Parameters: Target db?, value, from form?
if (empty($lieferschein_belegnr)) {
$msg = $this->app->erp->base64_url_encode("<div class=\"error\">Lieferschein ist nicht freigegeben.</div>");
$this->app->Location->execute("Location: index.php?module=versandpakete&action=list&msg=$msg");
}
// Flag lieferschein for versand
$sql = "UPDATE lieferschein SET versand_status = 1 WHERE id = ".$lieferschein." AND versand_status = 0";
$this->app->DB->Update($sql);
// Check if there is an unused paket waiting... // Check if there is an unused paket waiting...
$sql = "SELECT $sql = "SELECT
v.id, v.id,
@ -835,13 +845,11 @@ class Versandpakete {
if (!empty($waiting_paket)) { if (!empty($waiting_paket)) {
// Use existing // Use existing
echo("use old");
$msg = $this->app->erp->base64_url_encode("<div class=\"success\">Versandpaket Paket Nr. ".$waiting_paket[0]['id']." wurde zugeordnet.</div>"); $msg = $this->app->erp->base64_url_encode("<div class=\"success\">Versandpaket Paket Nr. ".$waiting_paket[0]['id']." wurde zugeordnet.</div>");
$this->app->Location->execute("Location: index.php?module=versandpakete&action=add&id=".$waiting_paket[0]['id']."&lieferschein=".$lieferschein."&msg=$msg"); $this->app->Location->execute("Location: index.php?module=versandpakete&action=add&id=".$waiting_paket[0]['id']."&lieferschein=".$lieferschein."&msg=$msg");
} }
else { else {
// Create new paket and add the given lieferschein // Create new paket and add the given lieferschein
echo("nake new");
$sql = "INSERT INTO versandpakete (status, lieferschein_ohne_pos, versender) VALUES ('neu',".$lieferschein.",'".$this->app->User->GetName()."')"; $sql = "INSERT INTO versandpakete (status, lieferschein_ohne_pos, versender) VALUES ('neu',".$lieferschein.",'".$this->app->User->GetName()."')";
$this->app->DB->Insert($sql); $this->app->DB->Insert($sql);
$id = $this->app->DB->GetInsertId(); $id = $this->app->DB->GetInsertId();
@ -1199,15 +1207,13 @@ class Versandpakete {
FROM FROM
lieferschein l lieferschein l
INNER JOIN lieferschein_position lp ON lp.lieferschein = l.id INNER JOIN lieferschein_position lp ON lp.lieferschein = l.id
INNER JOIN artikel a ON lp.artikel = a.id
LEFT JOIN versandpaket_lieferschein_position vlp ON vlp.lieferschein_position = lp.id LEFT JOIN versandpaket_lieferschein_position vlp ON vlp.lieferschein_position = lp.id
LEFT JOIN versandpakete v ON vlp.versandpaket = v.id LEFT JOIN versandpakete v ON vlp.versandpaket = v.id
LEFT JOIN versandpakete vop ON vop.lieferschein_ohne_pos = l.id LEFT JOIN versandpakete vop ON vop.lieferschein_ohne_pos = l.id
WHERE WHERE
l.versand_status <> 0 AND l.versand_status <> 0 AND
l.belegnr <> '' AND l.belegnr <> '' AND
(v.status <> 'storniert' OR v.status IS NULL) AND (v.status <> 'storniert' OR v.status IS NULL)
a.lagerartikel
GROUP BY lp.id GROUP BY lp.id
"; ";