diff --git a/www/pages/auftrag.php b/www/pages/auftrag.php index 673baad50..8ccdb4276 100644 --- a/www/pages/auftrag.php +++ b/www/pages/auftrag.php @@ -949,8 +949,9 @@ public function __construct($app, $intern = false) $this->app->ActionHandler("pdf","AuftragPDF"); $this->app->ActionHandler("inlinepdf","AuftragInlinePDF"); $this->app->ActionHandler("proforma","AuftragProforma"); - $this->app->ActionHandler("versand","AuftragVersand"); - $this->app->ActionHandler("zahlungsmail","AuftragZahlungsmail"); + $this->app->ActionHandler("versand","AuftragVersand"); + $this->app->ActionHandler("zahlungsmail","AuftragZahlungsmail"); + $this->app->ActionHandler("paidlock","AuftragPaidAndLock"); $this->app->ActionHandler("reservieren","AuftragReservieren"); $this->app->ActionHandler("nachlieferung","AuftragNachlieferung"); $this->app->ActionHandler("protokoll","AuftragProtokoll"); @@ -1577,11 +1578,12 @@ function onchangeauftrag(cmd) case 'versand': if(!confirm('Wirklich als Versand weiterführen oder Auftrag abschliessen?')) return document.getElementById('aktion$prefix').selectedIndex = 0; else window.location.href='index.php?module=auftrag&action=versand&id=%value%&cmd=manually'; break; case 'abschicken': ".$this->app->erp->DokumentAbschickenPopup()." break; $caselieferkette - case 'freigabe': window.location.href='index.php?module=auftrag&action=freigabe&id=%value%'; break; - case 'abschluss': if(!confirm('Wirklich manuell ohne erstellen von Lieferschein und/oder Rechnung als abgeschlossen markieren?')) return document.getElementById('aktion$prefix').selectedIndex = 0; else window.location.href='index.php?module=auftrag&action=abschluss&id=%value%&abschluss=%value%'; break; - case 'alsfreigegeben': if(!confirm('Wirklich als freigegeben markieren?')) return document.getElementById('aktion$prefix').selectedIndex = 0; else window.location.href='index.php?module=auftrag&action=alsfreigegeben&id=%value%&alsfreigegeben=%value%'; break; - $menueinlagern - $menuauslagern + case 'freigabe': window.location.href='index.php?module=auftrag&action=freigabe&id=%value%'; break; + case 'abschluss': if(!confirm('Wirklich manuell ohne erstellen von Lieferschein und/oder Rechnung als abgeschlossen markieren?')) return document.getElementById('aktion$prefix').selectedIndex = 0; else window.location.href='index.php?module=auftrag&action=abschluss&id=%value%&abschluss=%value%'; break; + case 'alsfreigegeben': if(!confirm('Wirklich als freigegeben markieren?')) return document.getElementById('aktion$prefix').selectedIndex = 0; else window.location.href='index.php?module=auftrag&action=alsfreigegeben&id=%value%&alsfreigegeben=%value%'; break; + case 'paidlock': if(!confirm('Schreibschutz kurz entfernen, Auftrag als bezahlt markieren und wieder sperren?')) return document.getElementById('aktion$prefix').selectedIndex = 0; else window.location.href='index.php?module=auftrag&action=paidlock&id=%value%'; break; + $menueinlagern + $menuauslagern case 'freigabemail': window.location.href='index.php?module=auftrag&action=freigabe&id=%value%&freigabe=%value%&cmd=mail'; break; $zertifikatcase @@ -1614,11 +1616,12 @@ function onchangeauftrag(cmd) $kreditlimit $teillieferungen - $auswahlentsprechendkommissionierung - $zertifikatoption - $artikeleinlagern - $artikelauslagern - $shopexport + $auswahlentsprechendkommissionierung + $zertifikatoption + + $artikeleinlagern + $artikelauslagern + $shopexport $optionlieferkette $optioncustom $optionhook @@ -1863,20 +1866,64 @@ protected function ajaxMiniDetailLager($id = null) * * @return array */ - protected function ajaxMiniDetailLagerSaveInterneBemerkung($id = null) - { - if($id === null){ - $id = (int)$this->app->Secure->GetGET('id'); - } + protected function ajaxMiniDetailLagerSaveInterneBemerkung($id = null) + { + if($id === null){ + $id = (int)$this->app->Secure->GetGET('id'); + } $internebemerkung = $this->app->Secure->GetPOST('internebemerkung'); $this->app->DB->Update( sprintf( "UPDATE `auftrag` SET `internebemerkung` = '%s' WHERE `id` = %d LIMIT 1", $internebemerkung, $id ) - ); - return ['status' => 1]; - } + ); + return ['status' => 1]; + } + + /** + * Entfernt kurzzeitig den Schreibschutz, markiert den Auftrag als bezahlt und setzt den Schreibschutz erneut. + */ + public function AuftragPaidAndLock($id = null, bool $redirect = true) + { + if($id === null){ + $id = (int)$this->app->Secure->GetGET('id'); + } + + if($id <= 0){ + if($redirect){ + $this->app->Location->execute('index.php?module=auftrag&action=list'); + } + return; + } + + if(!$this->app->erp->RechteVorhanden('auftrag','edit')) { + $this->app->erp->RunHook('permission_denied', 4, 'auftrag', 'edit'); + if($redirect){ + $this->app->Location->execute('index.php?module=auftrag&action=edit&id='.$id); + } + return; + } + + $this->app->DB->Update( + sprintf("UPDATE auftrag SET schreibschutz = 0 WHERE id = %d LIMIT 1", $id) + ); + $this->app->erp->AuftragProtokoll($id,'Schreibschutz fuer Bezahlmarkierung entfernt'); + + $this->app->DB->Update( + sprintf("UPDATE auftrag SET vorabbezahltmarkieren = 1, saldogeprueft = 1 WHERE id = %d LIMIT 1", $id) + ); + $this->app->erp->AuftragProtokoll($id,'Auftrag manuell als bezahlt markiert'); + + $this->app->DB->Update( + sprintf("UPDATE auftrag SET schreibschutz = 1 WHERE id = %d LIMIT 1", $id) + ); + $this->app->erp->AuftragProtokoll($id,'Schreibschutz nach Bezahlmarkierung gesetzt'); + + if($redirect){ + $this->app->Location->execute('index.php?module=auftrag&action=edit&id='.$id); + } + } /** * @param mixed $ret @@ -6827,16 +6874,26 @@ public function AuftragList() } } break; - case 'versandfreigeben': - if(!empty($selectedIds)) { - $this->app->DB->Update('UPDATE auftrag SET autoversand = 1 WHERE id IN ('. implode(', ', $selectedIds) . ')'); - } - break; - case 'versandentfernen': - if(!empty($selectedIds)) { - $this->app->DB->Update('UPDATE auftrag SET autoversand = 0 WHERE id IN ('. implode(', ', $selectedIds) . ')'); - } - break; + case 'versandfreigeben': + if(!empty($selectedIds)) { + $this->app->DB->Update('UPDATE auftrag SET autoversand = 1 WHERE id IN ('. implode(', ', $selectedIds) . ')'); + } + break; + case 'paidlock': + if(empty($selectedIds)){ + break; + } + foreach($selectedIds as $v){ + $this->AuftragPaidAndLock($v,false); + } + $msg = $this->app->erp->base64_url_encode('
Ausgewählte Aufträge wurden als bezahlt markiert und wieder gesperrt.
'); + $this->app->Location->execute('index.php?module=auftrag&action=list&msg='.$msg); + break; + case 'versandentfernen': + if(!empty($selectedIds)) { + $this->app->DB->Update('UPDATE auftrag SET autoversand = 0 WHERE id IN ('. implode(', ', $selectedIds) . ')'); + } + break; case 'mail': foreach($selectedIds as $v) { $auftragarr = $this->app->DB->SelectRow("SELECT email,adresse,projekt,name,sprache FROM auftrag WHERE id = '$v' LIMIT 1"); diff --git a/www/pages/content/auftraguebersicht.tpl b/www/pages/content/auftraguebersicht.tpl index 0d313ffb4..1e27c5c27 100644 --- a/www/pages/content/auftraguebersicht.tpl +++ b/www/pages/content/auftraguebersicht.tpl @@ -90,6 +90,7 @@ document.onkeydown = function(evt) { +