Merge pull request #187 from faser2k/auto_exchange_rate_on_auftrag_creation

fill exchange rate on auftrag creation for foreign currency
This commit is contained in:
OpenXE-ERP 2025-03-02 09:36:41 +01:00 committed by GitHub
commit f6be3051cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 71 additions and 36 deletions

View File

@ -74,6 +74,11 @@ class MailAttachmentData implements MailAttachmentInterface
if ($content_type == 'application/octet-stream') { if ($content_type == 'application/octet-stream') {
return('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 // Check for Content-id
$contentIdHeader = $part->getHeader('content-id'); $contentIdHeader = $part->getHeader('content-id');
if ($contentIdHeader !== null) { if ($contentIdHeader !== null) {

View File

@ -558,13 +558,7 @@ class TicketImportHelper
} }
if ($plainTextBody == '' && $htmlBody == '') { if ($plainTextBody == '' && $htmlBody == '') {
$simple_content = $message->getContent(); $this->logger->debug('Empty mail',[]);
if (empty($simple_content)) {
$this->logger->debug('Empty mail',[]);
} else {
$plainTextBody = $simple_content;
$htmlBody = nl2br(htmlentities($simple_content));
}
} }
$this->logger->debug('Text',['plain' => $plainTextBody, 'html' => $htmlBody, 'simple_content' => $simple_content]); $this->logger->debug('Text',['plain' => $plainTextBody, 'html' => $htmlBody, 'simple_content' => $simple_content]);

View File

@ -33269,7 +33269,7 @@ function Firmendaten($field,$projekt="")
} }
if($kurs<>0) 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->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"); $belegarr = $this->app->DB->SelectRow("SELECT * FROM $art WHERE id='$id' LIMIT 1");
if(empty($belegarr)) if(empty($belegarr))
{ {

View File

@ -68,20 +68,27 @@ class EtikettenPDF extends SuperFPDF {
break; break;
case "image": case "image":
$filename = ''; $filename = '';
if(isset($items->attributes()->src)) if(isset($items->attributes()->src))
{
$src = str_replace('&amp;','&',$items->attributes()->src);
if(stripos($src,'http://') === false && stripos($src,'https://') === false)
{ {
$src = 'http://'.$src; $src = str_replace('&amp;','&',$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) if($content)
{ {
$filename = rtrim($this->app->erp->GetTMP(),'/').'/'.md5(microtime(true).$items[0]); $filename = rtrim($this->app->erp->GetTMP(),'/').'/'.md5(microtime(true).$items[0]);
file_put_contents($filename.'1.jpg', $content); file_put_contents($filename.'1.jpg', $content);
$bildbreite = trim($items->attributes()->width); $bildbreite = trim($items->attributes()->width);
$bildhoehe = trim($items->attributes()->height); $bildhoehe = trim($items->attributes()->height);
if(!class_exists('image'))include_once(__DIR__.'/../class.image.php'); if(!class_exists('image'))include_once(__DIR__.'/../class.image.php');
@ -120,9 +127,8 @@ class EtikettenPDF extends SuperFPDF {
$manipulator->save($filename.'2.jpg', $typ); $manipulator->save($filename.'2.jpg', $typ);
$items[0] = $filename.'2.jpg'; $items[0] = $filename.'2.jpg';
} }
} }
}
$type = exif_imagetype ( trim($items[0]) ); $type = exif_imagetype ( trim($items[0]) );
switch($type) switch($type)
@ -132,10 +138,12 @@ class EtikettenPDF extends SuperFPDF {
case IMAGETYPE_PNG: $type="png"; break; case IMAGETYPE_PNG: $type="png"; break;
default: $type=""; default: $type="";
} }
if($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); $this->Image(trim($items[0]),trim($items->attributes()->x),trim($items->attributes()->y),trim($items->attributes()->width),trim($items->attributes()->height),$type);
} }
if($filename != '') if($filename != '')
{ {
unlink($filename.'1.jpg'); unlink($filename.'1.jpg');

View File

@ -7,9 +7,10 @@
<!-- erstes tab --> <!-- erstes tab -->
<div id="tabs-1"> <div id="tabs-1">
[MESSAGE]
<form action="" method="post" enctype="multipart/form-data"> <form action="" method="post" enctype="multipart/form-data">
<fieldset><legend>{|Bild heraufladen|}</legend> <fieldset><legend>{|Bild heraufladen|}</legend>
<i>Hinweis: Es werden aktuell nur Monochrom PNG Dateien unterst&uuml;tzt. Die Bildbreite muss durch 8 teilbar sein! z.B. 520 Pixel oder 640 Pixel. 800 Pixel entsprechen 10 cm.</i> <i>Hinweis: Es werden aktuell nur JPG-Dateien unterst&uuml;tzt.</i>
<table> <table>
<tr><td>Datei:</td><td><input type="file" name="image"></td><td><input type="submit" name="submit" value="Hochladen"></td> <tr><td>Datei:</td><td><input type="file" name="image"></td><td><input type="submit" name="submit" value="Hochladen"></td>
</tr></table> </tr></table>

View File

@ -96,14 +96,16 @@ class Etiketten extends GenEtiketten {
{ {
if(file_exists($pfad)) if(file_exists($pfad))
{ {
$result = $this->app->erp->PNG2Etikett($pfad); $result = getimagesize($pfad);
if($result['result']=="1") $stream = base64_encode(file_get_contents($pfad));
{ if($result !== false)
$this->app->Tpl->Set('BILD',"<textarea rows=\"10\" cols=\"80\"><image x=\"1\" y=\"1\" width=\"".$result['width']."\" height=\"".$result['height']."\">".$result['stream']."</image></textarea>"); {
$this->app->Tpl->Set('BILD2',"<textarea rows=\"10\" cols=\"80\"><label><image x=\"1\" y=\"1\" width=\"".$result['width']."\" height=\"".$result['height']."\">".$result['stream']."</image></label></textarea>"); $this->app->Tpl->Set('BILD',"<textarea rows=\"10\" cols=\"80\">\n<image x=\"1\" y=\"1\" width=\"".$result[0]."\" height=\"".$result[1]."\">\n".$stream."\n</image>\n</textarea>");
$this->app->Tpl->Set('BILD2',"<textarea rows=\"10\" cols=\"80\">\n<label>\n<image x=\"1\" y=\"1\" width=\"".$result[0]."\" height=\"".$result[1]."\">".$stream."</image>\n</label>\n</textarea>");
} }
else else {
$this->app->Tpl->Set('BILD',"<div class=\"error\">".$result['message']."</div>"); $this->app->Tpl->Set('MESSAGE',"<div class=\"error\">Datei konnte nicht geladen werden</div>");
}
} }
} }

View File

@ -13,6 +13,7 @@
*/ */
?> ?>
<?php <?php
use Xentral\Components\Logger\Logger;
use Xentral\Components\Http\JsonResponse; use Xentral\Components\Http\JsonResponse;
use Xentral\Modules\TransferSmartyTemplate\TransferSmartyTemplate; use Xentral\Modules\TransferSmartyTemplate\TransferSmartyTemplate;
@ -48,6 +49,8 @@ class Onlineshops extends GenShopexport {
/** @var string $segment */ /** @var string $segment */
protected $segment; protected $segment;
public $logger;
/** /**
* @param Application $app * @param Application $app
* @param string $name * @param string $name
@ -211,6 +214,7 @@ INNER JOIN shopexport s ON
public function __construct($app, $intern = false) { public function __construct($app, $intern = false) {
//parent::GenShopexport($app); //parent::GenShopexport($app);
$this->app=$app; $this->app=$app;
$this->logger = $app->Container->get('Logger');
if($intern) { if($intern) {
return; 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 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)"); 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(); $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','<div class="info">Lagerzahlencache zurückgesetzt für '.$anz.' Artikel, shopid: '.$id.'</div>'); $this->app->Tpl->Add('MESSAGE','<div class="info">Lagerzahlencache zurückgesetzt für '.$anz.' Artikel, shopid: '.$id.'</div>');
} }
} }
@ -3156,7 +3161,8 @@ INNER JOIN shopexport s ON
} }
} }
}catch(Exception $ex){ }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()); $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')) { if($this->app->Secure->GetPOST('pruefen')) {
$this->Log(Logger::DEBUG, "Verbindung prüfen");
$className = 'Remote'; $className = 'Remote';
$methodName = 'RemoteConnection'; $methodName = 'RemoteConnection';
$r = new ReflectionMethod($className, $methodName); $r = new ReflectionMethod($className, $methodName);
@ -4980,4 +4988,10 @@ INNER JOIN shopexport s ON
return $ret; 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);
}
} }

View File

@ -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;
}
} }

View File

@ -122,7 +122,12 @@
</tr> </tr>
<tr> <tr>
<td>{|Auto-Versand als Standard deaktivieren|}:</td> <td>{|Auto-Versand als Standard deaktivieren|}:</td>
<td>[DEACTIVATEAUTOSHIPPING][MSGDEACTIVATEAUTOSHIPPING]</td> <td>[DEACTIVATEAUTOSHIPPING][MSGDEACTIVATEAUTOSHIPPING]</td>
</tr>
<tr>
<td>
Standard Versandart:</td><td>[VERSANDART][MSGVERSANDART]
</td>
</tr> </tr>
<tr><td>{|Drucker Stufe (Kommissionierung)|}</td><td>[DRUCKERLOGISTIKSTUFE1][MSGDRUCKERLOGISTIKSTUFE1]&nbsp;<i>{|z.B. Lieferschein drucken|}</i></td></tr> <tr><td>{|Drucker Stufe (Kommissionierung)|}</td><td>[DRUCKERLOGISTIKSTUFE1][MSGDRUCKERLOGISTIKSTUFE1]&nbsp;<i>{|z.B. Lieferschein drucken|}</i></td></tr>
<tr><td>{|Drucker Stufe (Versand)|}</td><td>[DRUCKERLOGISTIKSTUFE2][MSGDRUCKERLOGISTIKSTUFE2]&nbsp;<i>{|Belege bei Versandstation|}</i></td></tr> <tr><td>{|Drucker Stufe (Versand)|}</td><td>[DRUCKERLOGISTIKSTUFE2][MSGDRUCKERLOGISTIKSTUFE2]&nbsp;<i>{|Belege bei Versandstation|}</i></td></tr>
@ -338,7 +343,6 @@
</tr> </tr>
<tr><td>Standard Zahlungsweise Kunde:</td><td>[ZAHLUNGSWEISE][MSGZAHLUNGSWEISE]</td></tr> <tr><td>Standard Zahlungsweise Kunde:</td><td>[ZAHLUNGSWEISE][MSGZAHLUNGSWEISE]</td></tr>
<tr><td>Standard Zahlungsweise Lieferant:</td><td>[ZAHLUNGSWEISELIEFERANT][MSGZAHLUNGSWEISELIEFERANT]</td></tr> <tr><td>Standard Zahlungsweise Lieferant:</td><td>[ZAHLUNGSWEISELIEFERANT][MSGZAHLUNGSWEISELIEFERANT]</td></tr>
<tr><td>Standard Versandart:</td><td>[VERSANDART][MSGVERSANDART]</td></tr>
<tr><td>{|W&auml;hrung|}:</td><td>[WAEHRUNG][MSGWAEHRUNG]&nbsp;</td></tr> <tr><td>{|W&auml;hrung|}:</td><td>[WAEHRUNG][MSGWAEHRUNG]&nbsp;</td></tr>
<tr><td width="300">{|USt.-ID|}:</td><td>[STEUERNUMMER][MSGSTEUERNUMMER]&nbsp;</td></tr> <tr><td width="300">{|USt.-ID|}:</td><td>[STEUERNUMMER][MSGSTEUERNUMMER]&nbsp;</td></tr>
<tr><td>{|Mahnwesen aktiv|}:</td><td>[MAHNWESEN][MSGMAHNWESEN]</td></tr> <tr><td>{|Mahnwesen aktiv|}:</td><td>[MAHNWESEN][MSGMAHNWESEN]</td></tr>

View File

@ -54,9 +54,9 @@ class WidgetAuftrag extends WidgetGenAuftrag
$this->form->HTMLList['standardlager']->dbvalue = $standardlager; $this->form->HTMLList['standardlager']->dbvalue = $standardlager;
} }
$deactivateautoshipping = $this->app->erp->Projektdaten($projektdanach, 'deactivateautoshipping'); $deactivateautoshipping = $this->app->erp->Projektdaten($projektdanach, 'deactivateautoshipping');
if($deactivateautoshipping && $this->form->CallbackAndMandatorycheck(true)) { if($this->form->CallbackAndMandatorycheck(true)) {
$this->form->HTMLList['autoversand']->htmlvalue = 0; $this->form->HTMLList['autoversand']->htmlvalue = ($deactivateautoshipping == 0);
$this->form->HTMLList['autoversand']->dbvalue = 0; $this->form->HTMLList['autoversand']->dbvalue = ($deactivateautoshipping == 0);
} }
$query = sprintf("SELECT zahlungsweise, zahlungsweiselieferant, versandart FROM projekt WHERE id='%s'", $query = sprintf("SELECT zahlungsweise, zahlungsweiselieferant, versandart FROM projekt WHERE id='%s'",
$projektdanach); $projektdanach);
@ -219,7 +219,7 @@ class WidgetAuftrag extends WidgetGenAuftrag
// $field->onchange="versand(this.form.versandart.options[this.form.versandart.selectedIndex].value);"; // $field->onchange="versand(this.form.versandart.options[this.form.versandart.selectedIndex].value);";
$field->AddOptionsSimpleArray($versandart); $field->AddOptionsSimpleArray($versandart);
$this->form->NewField($field); $this->form->NewField($field);
if(!empty($overwriteZahlungsweise)){ if(!empty($overwriteVersandart)){
$this->form->HTMLList['versandart']->htmlvalue = $overwriteVersandart; $this->form->HTMLList['versandart']->htmlvalue = $overwriteVersandart;
$this->form->HTMLList['versandart']->dbvalue = $overwriteVersandart; $this->form->HTMLList['versandart']->dbvalue = $overwriteVersandart;
} }