From bb01a4e92d3df8e0546afbd76bc922126da4d576 Mon Sep 17 00:00:00 2001 From: OpenXE <> Date: Thu, 13 Feb 2025 15:05:30 +0100 Subject: [PATCH 1/5] onlineshops moved from logfile to logger --- www/pages/onlineshops.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/www/pages/onlineshops.php b/www/pages/onlineshops.php index 9ea25bf6..877379f5 100644 --- a/www/pages/onlineshops.php +++ b/www/pages/onlineshops.php @@ -13,6 +13,7 @@ */ ?> app=$app; + $this->logger = $app->Container->get('Logger'); if($intern) { return; } @@ -2860,7 +2864,8 @@ INNER JOIN shopexport s ON LEFT JOIN (SELECT artikel FROM artikel_onlineshops WHERE shop = '$id' AND aktiv = 1 GROUP BY artikel) oa ON a.id = oa.artikel SET a.cache_lagerplatzinhaltmenge = -999 WHERE (a.shop = '$id' OR a.shop2 = '$id' OR a.shop3 = '$id' OR NOT ISNULL(oa.artikel)) AND a.geloescht = 0 AND ($where)"); $anz = $this->app->DB->affected_rows(); - $this->app->erp->LogFile("Lagerzahlencache zurückgesetzt für $anz Artikel, shopid: $id"); +// $this->app->erp->LogFile("Lagerzahlencache zurückgesetzt für $anz Artikel, shopid: $id"); + $this->Log(Logger::INFO, "Lagerzahlencache zurückgesetzt für $anz Artikel, shopid: $id"); $this->app->Tpl->Add('MESSAGE','
Lagerzahlencache zurückgesetzt für '.$anz.' Artikel, shopid: '.$id.'
'); } } @@ -3156,7 +3161,8 @@ INNER JOIN shopexport s ON } } }catch(Exception $ex){ - $this->app->erp->LogFile('Fehlerhafter Aufruf in Modul: '.$moduleName); +// $this->app->erp->LogFile('Fehlerhafter Aufruf in Modul: '.$moduleName); + $this->Log(Logger::INFO, 'Fehlerhafter Aufruf in Modul: '.$moduleName, $ex); } $username = $this->app->DB->real_escape_string($this->app->User->GetUsername()); @@ -3337,6 +3343,8 @@ INNER JOIN shopexport s ON if($this->app->Secure->GetPOST('pruefen')) { + $this->Log(Logger::DEBUG, "Verbindung prüfen"); + $className = 'Remote'; $methodName = 'RemoteConnection'; $r = new ReflectionMethod($className, $methodName); @@ -4980,4 +4988,10 @@ INNER JOIN shopexport s ON return $ret; } + + private function Log($level, $message, $dump = array()) { + $shopid = (int)$this->app->Secure->GetGET('id'); + $this->logger->Log($level, 'Onlineshops (Shop '.$shopid.') '.$message, (array) $dump); + } + } From f03a52474d5c418377be7e8a9716525614c08d03 Mon Sep 17 00:00:00 2001 From: OpenXE <> Date: Mon, 24 Feb 2025 14:21:06 +0100 Subject: [PATCH 2/5] bugfixes auftrag change versandart and auto-versand when changing project --- www/widgets/templates/_gen/projekt.tpl | 8 ++++++-- www/widgets/widget.auftrag.php | 8 ++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/www/widgets/templates/_gen/projekt.tpl b/www/widgets/templates/_gen/projekt.tpl index acb3f52f..de4b5794 100644 --- a/www/widgets/templates/_gen/projekt.tpl +++ b/www/widgets/templates/_gen/projekt.tpl @@ -122,7 +122,12 @@ {|Auto-Versand als Standard deaktivieren|}: - [DEACTIVATEAUTOSHIPPING][MSGDEACTIVATEAUTOSHIPPING] + [DEACTIVATEAUTOSHIPPING][MSGDEACTIVATEAUTOSHIPPING] + + + + Standard Versandart:[VERSANDART][MSGVERSANDART] + {|Drucker Stufe (Kommissionierung)|}[DRUCKERLOGISTIKSTUFE1][MSGDRUCKERLOGISTIKSTUFE1] {|z.B. Lieferschein drucken|} {|Drucker Stufe (Versand)|}[DRUCKERLOGISTIKSTUFE2][MSGDRUCKERLOGISTIKSTUFE2] {|Belege bei Versandstation|} @@ -338,7 +343,6 @@ Standard Zahlungsweise Kunde:[ZAHLUNGSWEISE][MSGZAHLUNGSWEISE] Standard Zahlungsweise Lieferant:[ZAHLUNGSWEISELIEFERANT][MSGZAHLUNGSWEISELIEFERANT] - Standard Versandart:[VERSANDART][MSGVERSANDART] {|Währung|}:[WAEHRUNG][MSGWAEHRUNG]  {|USt.-ID|}:[STEUERNUMMER][MSGSTEUERNUMMER]  {|Mahnwesen aktiv|}:[MAHNWESEN][MSGMAHNWESEN] diff --git a/www/widgets/widget.auftrag.php b/www/widgets/widget.auftrag.php index 69181b03..ac1586f8 100644 --- a/www/widgets/widget.auftrag.php +++ b/www/widgets/widget.auftrag.php @@ -54,9 +54,9 @@ class WidgetAuftrag extends WidgetGenAuftrag $this->form->HTMLList['standardlager']->dbvalue = $standardlager; } $deactivateautoshipping = $this->app->erp->Projektdaten($projektdanach, 'deactivateautoshipping'); - if($deactivateautoshipping && $this->form->CallbackAndMandatorycheck(true)) { - $this->form->HTMLList['autoversand']->htmlvalue = 0; - $this->form->HTMLList['autoversand']->dbvalue = 0; + if($this->form->CallbackAndMandatorycheck(true)) { + $this->form->HTMLList['autoversand']->htmlvalue = ($deactivateautoshipping == 0); + $this->form->HTMLList['autoversand']->dbvalue = ($deactivateautoshipping == 0); } $query = sprintf("SELECT zahlungsweise, zahlungsweiselieferant, versandart FROM projekt WHERE id='%s'", $projektdanach); @@ -219,7 +219,7 @@ class WidgetAuftrag extends WidgetGenAuftrag // $field->onchange="versand(this.form.versandart.options[this.form.versandart.selectedIndex].value);"; $field->AddOptionsSimpleArray($versandart); $this->form->NewField($field); - if(!empty($overwriteZahlungsweise)){ + if(!empty($overwriteVersandart)){ $this->form->HTMLList['versandart']->htmlvalue = $overwriteVersandart; $this->form->HTMLList['versandart']->dbvalue = $overwriteVersandart; } From 94043a6609ce0d8127fa97ed2fd1d6fa28849f79 Mon Sep 17 00:00:00 2001 From: OpenXE <> Date: Tue, 25 Feb 2025 17:07:52 +0100 Subject: [PATCH 3/5] Bugfix etiketten embedded images --- www/lib/dokumente/class.etiketten.php | 30 +++++++++++++++++---------- www/pages/content/etiketten_bild.tpl | 3 ++- www/pages/etiketten.php | 16 +++++++------- 3 files changed, 30 insertions(+), 19 deletions(-) diff --git a/www/lib/dokumente/class.etiketten.php b/www/lib/dokumente/class.etiketten.php index c6b6927b..c87a46be 100644 --- a/www/lib/dokumente/class.etiketten.php +++ b/www/lib/dokumente/class.etiketten.php @@ -68,20 +68,27 @@ class EtikettenPDF extends SuperFPDF { break; case "image": - $filename = ''; - if(isset($items->attributes()->src)) - { - $src = str_replace('&','&',$items->attributes()->src); - if(stripos($src,'http://') === false && stripos($src,'https://') === false) + $filename = ''; + if(isset($items->attributes()->src)) { - $src = 'http://'.$src; + $src = str_replace('&','&',$items->attributes()->src); + if(stripos($src,'http://') === false && stripos($src,'https://') === false) + { + $src = 'http://'.$src; + } + $content = file_get_contents($src); + } else { + $content = base64_decode($items[0]); + if ($content === false) { + throw new RuntimeException('invalid image data'); + } } - $content = file_get_contents($src); + if($content) { $filename = rtrim($this->app->erp->GetTMP(),'/').'/'.md5(microtime(true).$items[0]); file_put_contents($filename.'1.jpg', $content); - + $bildbreite = trim($items->attributes()->width); $bildhoehe = trim($items->attributes()->height); if(!class_exists('image'))include_once(__DIR__.'/../class.image.php'); @@ -120,9 +127,8 @@ class EtikettenPDF extends SuperFPDF { $manipulator->save($filename.'2.jpg', $typ); $items[0] = $filename.'2.jpg'; } - } - - } + } + $type = exif_imagetype ( trim($items[0]) ); switch($type) @@ -132,10 +138,12 @@ class EtikettenPDF extends SuperFPDF { case IMAGETYPE_PNG: $type="png"; break; default: $type=""; } + if($type!="") { $this->Image(trim($items[0]),trim($items->attributes()->x),trim($items->attributes()->y),trim($items->attributes()->width),trim($items->attributes()->height),$type); } + if($filename != '') { unlink($filename.'1.jpg'); diff --git a/www/pages/content/etiketten_bild.tpl b/www/pages/content/etiketten_bild.tpl index 7c866edf..6fea83bb 100644 --- a/www/pages/content/etiketten_bild.tpl +++ b/www/pages/content/etiketten_bild.tpl @@ -7,9 +7,10 @@
+[MESSAGE]
{|Bild heraufladen|} -Hinweis: Es werden aktuell nur Monochrom PNG Dateien unterstützt. Die Bildbreite muss durch 8 teilbar sein! z.B. 520 Pixel oder 640 Pixel. 800 Pixel entsprechen 10 cm. +Hinweis: Es werden aktuell nur JPG-Dateien unterstützt.
Datei:
diff --git a/www/pages/etiketten.php b/www/pages/etiketten.php index 3044bbd0..107890be 100644 --- a/www/pages/etiketten.php +++ b/www/pages/etiketten.php @@ -96,14 +96,16 @@ class Etiketten extends GenEtiketten { { if(file_exists($pfad)) { - $result = $this->app->erp->PNG2Etikett($pfad); - if($result['result']=="1") - { - $this->app->Tpl->Set('BILD',""); - $this->app->Tpl->Set('BILD2',""); + $result = getimagesize($pfad); + $stream = base64_encode(file_get_contents($pfad)); + if($result !== false) + { + $this->app->Tpl->Set('BILD',""); + $this->app->Tpl->Set('BILD2',""); } - else - $this->app->Tpl->Set('BILD',"
".$result['message']."
"); + else { + $this->app->Tpl->Set('MESSAGE',"
Datei konnte nicht geladen werden
"); + } } } From 834588c347699163b889c5323e4ac2f39e436eae Mon Sep 17 00:00:00 2001 From: OpenXE <> Date: Tue, 25 Feb 2025 17:49:52 +0100 Subject: [PATCH 4/5] Fix ticket mails with application/pdf but no content disposition --- classes/Components/MailClient/Data/MailAttachmentData.php | 5 +++++ classes/Modules/Ticket/Task/TicketImportHelper.php | 8 +------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/classes/Components/MailClient/Data/MailAttachmentData.php b/classes/Components/MailClient/Data/MailAttachmentData.php index 2d40fdd7..f4d8c430 100644 --- a/classes/Components/MailClient/Data/MailAttachmentData.php +++ b/classes/Components/MailClient/Data/MailAttachmentData.php @@ -74,6 +74,11 @@ class MailAttachmentData implements MailAttachmentInterface if ($content_type == 'application/octet-stream') { return('application/octet-stream'); } + // Check for application/pdf + $content_type = $part->getContentType(); + if ($content_type == 'application/pdf') { + return('application/pdf'); + } // Check for Content-id $contentIdHeader = $part->getHeader('content-id'); if ($contentIdHeader !== null) { diff --git a/classes/Modules/Ticket/Task/TicketImportHelper.php b/classes/Modules/Ticket/Task/TicketImportHelper.php index 1ebbf7f8..07528cb9 100644 --- a/classes/Modules/Ticket/Task/TicketImportHelper.php +++ b/classes/Modules/Ticket/Task/TicketImportHelper.php @@ -558,13 +558,7 @@ class TicketImportHelper } if ($plainTextBody == '' && $htmlBody == '') { - $simple_content = $message->getContent(); - if (empty($simple_content)) { - $this->logger->debug('Empty mail',[]); - } else { - $plainTextBody = $simple_content; - $htmlBody = nl2br(htmlentities($simple_content)); - } + $this->logger->debug('Empty mail',[]); } $this->logger->debug('Text',['plain' => $plainTextBody, 'html' => $htmlBody, 'simple_content' => $simple_content]); From b7caf63c82b913a2958bcabda90ac700d38e518a Mon Sep 17 00:00:00 2001 From: faser2k Date: Fri, 28 Feb 2025 14:37:03 +0100 Subject: [PATCH 5/5] fill exchange rate on auftrag creation for foreign currency Not sure why Bruno commented this out. Who is Bruno? --- www/lib/class.erpapi.php | 4 ++-- www/pages/waehrungumrechnung.php | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/www/lib/class.erpapi.php b/www/lib/class.erpapi.php index 25968da1..696237e9 100644 --- a/www/lib/class.erpapi.php +++ b/www/lib/class.erpapi.php @@ -33269,7 +33269,7 @@ function Firmendaten($field,$projekt="") } if($kurs<>0) { - $this->app->DB->Update("UPDATE $typ SET kurs='$kurs' WHERE id='$id' LIMIT 1"); + $this->app->DB->Update("UPDATE $typ SET kurs='$kurs' WHERE id='$id' AND kurs = 0 LIMIT 1"); } } @@ -34128,7 +34128,7 @@ function Firmendaten($field,$projekt="") } //$this->LoadSteuersaetze($id,$art); //03.01.2019 Bruno entfernt, da Shopaufträge umsgestellt werden - //$this->LoadKurs($id,$art); //03.01.2019 Bruno entfernt + $this->LoadKurs($id,$art); //03.01.2019 Bruno entfernt $belegarr = $this->app->DB->SelectRow("SELECT * FROM $art WHERE id='$id' LIMIT 1"); if(empty($belegarr)) { diff --git a/www/pages/waehrungumrechnung.php b/www/pages/waehrungumrechnung.php index 9b623e55..f172cc2e 100644 --- a/www/pages/waehrungumrechnung.php +++ b/www/pages/waehrungumrechnung.php @@ -220,4 +220,11 @@ class Waehrungumrechnung { } + public function GetWaehrungUmrechnungskurs($von, $nach, $onlytable) { + $result = $this->app->DB->Select("SELECT kurs FROM waehrung_umrechnung WHERE waehrung_von = '$von' AND waehrung_nach = '$nach' AND gueltig_bis is NULL"); + if (!is_null($result)) { + return $result; + } + return 0; + } }