mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2025-01-12 14:51:14 +01:00
rechnung archive XML and PDF separated
This commit is contained in:
parent
11ad104242
commit
bbe92dce2a
@ -2199,6 +2199,18 @@ public function NavigationHooks(&$menu)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Rechnung special treatment because of XML
|
||||||
|
function RechnungArchivieren($id) {
|
||||||
|
$sql = "SELECT xmlrechnung FROM rechnung WHERE id = '".$id."' LIMIT 1";
|
||||||
|
$xmlrechnung = $this->app->DB->Select($sql);
|
||||||
|
if ($xmlrechnung) {
|
||||||
|
$rechnungsmodul = $this->app->loadModule('rechnung', false);
|
||||||
|
return($rechnungsmodul->RechnungArchiviereXML($id));
|
||||||
|
} else {
|
||||||
|
$this->PDFArchivieren('rechnung',$id,true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// @refactor in Location Klasse
|
// @refactor in Location Klasse
|
||||||
function UrlOrigin($s, $use_forwarded_host=false)
|
function UrlOrigin($s, $use_forwarded_host=false)
|
||||||
{
|
{
|
||||||
@ -3267,7 +3279,7 @@ function LieferscheinEinlagern($id,$grund="Lieferschein Einlagern", $lpiids = nu
|
|||||||
);
|
);
|
||||||
$this->app->erp->ANABREGSNeuberechnen($invoice['id'], 'rechnung');
|
$this->app->erp->ANABREGSNeuberechnen($invoice['id'], 'rechnung');
|
||||||
if($invoice['schreibschutz']) {
|
if($invoice['schreibschutz']) {
|
||||||
$this->app->erp->PDFArchivieren('rechunng', $invoice['id'], true);
|
$this->app->erp->RechnungArchivieren($invoice['id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -15241,7 +15253,7 @@ function Gegenkonto($ust_befreit,$ustid='', $doctype = '', $doctypeId = 0)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!empty($rechnungarr['schreibschutz']) && !empty($rechnungarr['zuarchivieren'])) {
|
if(!empty($rechnungarr['schreibschutz']) && !empty($rechnungarr['zuarchivieren'])) {
|
||||||
$this->app->erp->PDFArchivieren('rechnung', $id, true);
|
$this->app->erp->RechnungArchivieren($id);
|
||||||
}
|
}
|
||||||
$adresse = $rechnungarr['adresse'];
|
$adresse = $rechnungarr['adresse'];
|
||||||
$to = $rechnungarr['email'];
|
$to = $rechnungarr['email'];
|
||||||
|
@ -202,9 +202,11 @@ class Rechnung extends GenRechnung
|
|||||||
$this->app->ExitXentral();
|
$this->app->ExitXentral();
|
||||||
}
|
}
|
||||||
|
|
||||||
function RechnungArchiviereXML() {
|
function RechnungArchiviereXML($id = null) {
|
||||||
$id = (int)$this->app->Secure->GetGET('id');
|
if ($id === null) {
|
||||||
$result = $this->RechnungSmarty(json: false, returnvalue: true);
|
$id = (int)$this->app->Secure->GetGET('id');
|
||||||
|
}
|
||||||
|
$result = $this->RechnungSmarty(id: $id, json: false, returnvalue: true);
|
||||||
|
|
||||||
if ($result['success']) {
|
if ($result['success']) {
|
||||||
$this->app->erp->CreateDateiWithStichwort(
|
$this->app->erp->CreateDateiWithStichwort(
|
||||||
@ -222,36 +224,14 @@ class Rechnung extends GenRechnung
|
|||||||
throw new exception("XML Rechnung fehlgeschlagen!");
|
throw new exception("XML Rechnung fehlgeschlagen!");
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->app->DB->Update("UPDATE rechnung SET schreibschutz='1' WHERE id='$id'");
|
$this->app->DB->Update("UPDATE rechnung SET schreibschutz='1', zuarchivieren = '0' WHERE id='$id'");
|
||||||
$this->app->Location->execute('index.php?module=rechnung&action=edit&id='.$id);
|
$this->app->Location->execute('index.php?module=rechnung&action=edit&id='.$id);
|
||||||
}
|
}
|
||||||
|
|
||||||
function RechnungArchivierePDF()
|
function RechnungArchivierePDF()
|
||||||
{
|
{
|
||||||
$id = (int)$this->app->Secure->GetGET('id');
|
$id = (int)$this->app->Secure->GetGET('id');
|
||||||
$projekt = $this->app->DB->Select("SELECT projekt FROM rechnung WHERE id = '$id' LIMIT 1");
|
$this->app->erp->PDFArchivieren('rechnung', $id, true);
|
||||||
$this->app->erp->BriefpapierHintergrunddisable = !$this->app->erp->BriefpapierHintergrunddisable;
|
|
||||||
if(class_exists('RechnungPDFCustom'))
|
|
||||||
{
|
|
||||||
$Brief = new RechnungPDFCustom($this->app,$projekt);
|
|
||||||
}else{
|
|
||||||
$Brief = new RechnungPDF($this->app,$projekt);
|
|
||||||
}
|
|
||||||
$Brief->GetRechnung($id);
|
|
||||||
$tmpfile = $Brief->displayTMP();
|
|
||||||
$Brief->ArchiviereDocument(1);
|
|
||||||
unlink($tmpfile);
|
|
||||||
$this->app->erp->BriefpapierHintergrunddisable = !$this->app->erp->BriefpapierHintergrunddisable;
|
|
||||||
if(class_exists('RechnungPDFCustom'))
|
|
||||||
{
|
|
||||||
$Brief = new RechnungPDFCustom($this->app,$projekt);
|
|
||||||
}else{
|
|
||||||
$Brief = new RechnungPDF($this->app,$projekt);
|
|
||||||
}
|
|
||||||
$Brief->GetRechnung($id);
|
|
||||||
$tmpfile = $Brief->displayTMP();
|
|
||||||
$Brief->ArchiviereDocument(1);
|
|
||||||
|
|
||||||
$this->app->DB->Update("UPDATE rechnung SET schreibschutz='1' WHERE id='$id'");
|
$this->app->DB->Update("UPDATE rechnung SET schreibschutz='1' WHERE id='$id'");
|
||||||
$this->app->Location->execute('index.php?module=rechnung&action=edit&id='.$id);
|
$this->app->Location->execute('index.php?module=rechnung&action=edit&id='.$id);
|
||||||
}
|
}
|
||||||
@ -1258,7 +1238,7 @@ class Rechnung extends GenRechnung
|
|||||||
$doppel = $this->app->Secure->GetGET('doppel');
|
$doppel = $this->app->Secure->GetGET('doppel');
|
||||||
$invoiceArr = $this->app->DB->SelectRow("SELECT schreibschutz, projekt, zuarchivieren FROM rechnung WHERE id='$id' LIMIT 1");
|
$invoiceArr = $this->app->DB->SelectRow("SELECT schreibschutz, projekt, zuarchivieren FROM rechnung WHERE id='$id' LIMIT 1");
|
||||||
if(!empty($invoiceArr['schreibschutz']) && !empty($invoiceArr['zuarchivieren'])) {
|
if(!empty($invoiceArr['schreibschutz']) && !empty($invoiceArr['zuarchivieren'])) {
|
||||||
$this->app->erp->PDFArchivieren('rechnung', $id, true);
|
$this->app->erp->RechnungArchivieren($id);
|
||||||
}
|
}
|
||||||
$projekt = $invoiceArr['projekt'];
|
$projekt = $invoiceArr['projekt'];
|
||||||
$schreibschutz = $invoiceArr['schreibschutz'];
|
$schreibschutz = $invoiceArr['schreibschutz'];
|
||||||
@ -1283,7 +1263,7 @@ class Rechnung extends GenRechnung
|
|||||||
|
|
||||||
// Print PHP array for SmartyXML
|
// Print PHP array for SmartyXML
|
||||||
function RechnungJSON() {
|
function RechnungJSON() {
|
||||||
$this->RechnungSmarty(true);
|
$this->RechnungSmarty(json: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function remove_html_entities_from_array(&$array) {
|
function remove_html_entities_from_array(&$array) {
|
||||||
@ -1308,8 +1288,10 @@ class Rechnung extends GenRechnung
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function RechnungSmarty($json = false, $returnvalue = false) {
|
function RechnungSmarty($id = null, $json = false, $returnvalue = false) {
|
||||||
$id = $this->app->Secure->GetGET('id');
|
if ($id === null) {
|
||||||
|
$id = $this->app->Secure->GetGET('id');
|
||||||
|
}
|
||||||
$result = Array();
|
$result = Array();
|
||||||
$success = true;
|
$success = true;
|
||||||
|
|
||||||
@ -2199,7 +2181,7 @@ class Rechnung extends GenRechnung
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
$this->app->erp->PDFArchivieren('rechnung', $id, true);
|
$this->app->erp->RechnungArchivieren($id);
|
||||||
}
|
}
|
||||||
$this->app->erp->MessageHandlerStandardForm();
|
$this->app->erp->MessageHandlerStandardForm();
|
||||||
|
|
||||||
@ -2288,7 +2270,7 @@ class Rechnung extends GenRechnung
|
|||||||
$invoiceId
|
$invoiceId
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$this->app->erp->PDFArchivieren('rechnung', $invoiceId, true);
|
$this->app->erp->RechnungArchivieren($invoiceId);
|
||||||
if(class_exists('RechnungPDFCustom')) {
|
if(class_exists('RechnungPDFCustom')) {
|
||||||
$Brief = new RechnungPDFCustom($this->app,$projekt);
|
$Brief = new RechnungPDFCustom($this->app,$projekt);
|
||||||
}
|
}
|
||||||
@ -2344,13 +2326,15 @@ class Rechnung extends GenRechnung
|
|||||||
if(!$v) {
|
if(!$v) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
$xmlrechnung = $this->app->DB->Select("SELECT xmlrechnung FROM rechnung WHERE id=$v LIMIT 1");
|
||||||
$checkpapier = $this->app->DB->Select(
|
$checkpapier = $this->app->DB->Select(
|
||||||
"SELECT a.rechnung_papier FROM rechnung AS r
|
"SELECT a.rechnung_papier FROM rechnung AS r
|
||||||
LEFT JOIN adresse AS a ON r.adresse=a.id
|
LEFT JOIN adresse AS a ON r.adresse=a.id
|
||||||
WHERE r.id='$v'
|
WHERE r.id='$v'
|
||||||
LIMIT 1"
|
LIMIT 1"
|
||||||
);
|
);
|
||||||
if($checkpapier!=1 &&
|
|
||||||
|
if((($checkpapier !=1) || $erechnung) &&
|
||||||
$this->app->DB->Select(
|
$this->app->DB->Select(
|
||||||
"SELECT r.id
|
"SELECT r.id
|
||||||
FROM rechnung AS r
|
FROM rechnung AS r
|
||||||
@ -2359,11 +2343,11 @@ class Rechnung extends GenRechnung
|
|||||||
LIMIT 1"
|
LIMIT 1"
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
$this->app->erp->PDFArchivieren('rechnung', $v, true);
|
$this->app->erp->RechnungArchivieren($v);
|
||||||
$this->app->erp->Rechnungsmail($v);
|
$this->app->erp->Rechnungsmail($v);
|
||||||
}
|
}
|
||||||
else if($checkpapier && $drucker) {
|
else if($checkpapier && $drucker && !$erechnung) {
|
||||||
$this->app->erp->PDFArchivieren('rechnung', $v, true);
|
$this->app->erp->RechnungArchivieren($v);
|
||||||
$projekt = $this->app->DB->Select(
|
$projekt = $this->app->DB->Select(
|
||||||
"SELECT projekt FROM rechnung WHERE id='$v' LIMIT 1"
|
"SELECT projekt FROM rechnung WHERE id='$v' LIMIT 1"
|
||||||
);
|
);
|
||||||
@ -2417,12 +2401,13 @@ class Rechnung extends GenRechnung
|
|||||||
$reArr = $this->app->DB->SelectRow(
|
$reArr = $this->app->DB->SelectRow(
|
||||||
sprintf(
|
sprintf(
|
||||||
"SELECT projekt,belegnr,status,usereditid,adresse,
|
"SELECT projekt,belegnr,status,usereditid,adresse,
|
||||||
DATE_SUB(NOW(), INTERVAL 30 SECOND) < useredittimestamp AS `open`
|
DATE_SUB(NOW(), INTERVAL 30 SECOND) < useredittimestamp AS `open`,
|
||||||
|
xmlrechnung
|
||||||
FROM rechnung WHERE id=%d LIMIT 1",
|
FROM rechnung WHERE id=%d LIMIT 1",
|
||||||
$v
|
$v
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
if($reArr['belegnr'] === '' || ($reArr['open'] && $reArr['status'] === 'freigegeben')) {
|
if($reArr['belegnr'] === '' || $reArr['xmlrechnung'] || ($reArr['open'] && $reArr['status'] === 'freigegeben')) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if($reArr['status'] === 'freigegeben') {
|
if($reArr['status'] === 'freigegeben') {
|
||||||
@ -2432,7 +2417,7 @@ class Rechnung extends GenRechnung
|
|||||||
$this->app->erp->RechnungProtokoll($v,'Rechnung gedruckt');
|
$this->app->erp->RechnungProtokoll($v,'Rechnung gedruckt');
|
||||||
$this->app->DB->Update("UPDATE rechnung SET schreibschutz=1, versendet = 1 WHERE id = '$v' LIMIT 1");
|
$this->app->DB->Update("UPDATE rechnung SET schreibschutz=1, versendet = 1 WHERE id = '$v' LIMIT 1");
|
||||||
$this->app->DB->Update("UPDATE rechnung SET status='versendet' WHERE id = '$v' AND status!='storniert' LIMIT 1");
|
$this->app->DB->Update("UPDATE rechnung SET status='versendet' WHERE id = '$v' AND status!='storniert' LIMIT 1");
|
||||||
$this->app->erp->PDFArchivieren('rechnung', $v, true);
|
$this->app->erp->RechnungArchivieren($v);
|
||||||
if(class_exists('RechnungPDFCustom')) {
|
if(class_exists('RechnungPDFCustom')) {
|
||||||
$Brief = new RechnungPDFCustom($this->app,$projekt);
|
$Brief = new RechnungPDFCustom($this->app,$projekt);
|
||||||
}
|
}
|
||||||
@ -2452,7 +2437,11 @@ class Rechnung extends GenRechnung
|
|||||||
case 'pdf':
|
case 'pdf':
|
||||||
$tmpfile = [];
|
$tmpfile = [];
|
||||||
foreach($auswahl as $v) {
|
foreach($auswahl as $v) {
|
||||||
$projekt = $this->app->DB->Select("SELECT projekt FROM rechnung WHERE id=$v LIMIT 1");
|
$xmlrechnung = $this->app->DB->Select("SELECT xmlrechnung FROM rechnung WHERE id=$v LIMIT 1");
|
||||||
|
if ($xmlrechnung) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$projekt = $this->app->DB->Select("SELECT projekt FROM rechnung WHERE id=$v LIMIT 1");
|
||||||
if(class_exists('RechnungPDFCustom')) {
|
if(class_exists('RechnungPDFCustom')) {
|
||||||
$Brief = new RechnungPDFCustom($this->app,$projekt);
|
$Brief = new RechnungPDFCustom($this->app,$projekt);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user