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') {
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) {

View File

@ -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('Text',['plain' => $plainTextBody, 'html' => $htmlBody, 'simple_content' => $simple_content]);

View File

@ -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))
{

View File

@ -77,6 +77,13 @@ class EtikettenPDF extends SuperFPDF {
$src = 'http://'.$src;
}
$content = file_get_contents($src);
} else {
$content = base64_decode($items[0]);
if ($content === false) {
throw new RuntimeException('invalid image data');
}
}
if($content)
{
$filename = rtrim($this->app->erp->GetTMP(),'/').'/'.md5(microtime(true).$items[0]);
@ -122,7 +129,6 @@ class EtikettenPDF extends SuperFPDF {
}
}
}
$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');

View File

@ -7,9 +7,10 @@
<!-- erstes tab -->
<div id="tabs-1">
[MESSAGE]
<form action="" method="post" enctype="multipart/form-data">
<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>
<tr><td>Datei:</td><td><input type="file" name="image"></td><td><input type="submit" name="submit" value="Hochladen"></td>
</tr></table>

View File

@ -96,14 +96,16 @@ class Etiketten extends GenEtiketten {
{
if(file_exists($pfad))
{
$result = $this->app->erp->PNG2Etikett($pfad);
if($result['result']=="1")
$result = getimagesize($pfad);
$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 {
$this->app->Tpl->Set('MESSAGE',"<div class=\"error\">Datei konnte nicht geladen werden</div>");
}
else
$this->app->Tpl->Set('BILD',"<div class=\"error\">".$result['message']."</div>");
}
}

View File

@ -13,6 +13,7 @@
*/
?>
<?php
use Xentral\Components\Logger\Logger;
use Xentral\Components\Http\JsonResponse;
use Xentral\Modules\TransferSmartyTemplate\TransferSmartyTemplate;
@ -48,6 +49,8 @@ class Onlineshops extends GenShopexport {
/** @var string $segment */
protected $segment;
public $logger;
/**
* @param Application $app
* @param string $name
@ -211,6 +214,7 @@ INNER JOIN shopexport s ON
public function __construct($app, $intern = false) {
//parent::GenShopexport($app);
$this->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','<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){
$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);
}
}

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

@ -124,6 +124,11 @@
<td>{|Auto-Versand als Standard deaktivieren|}:</td>
<td>[DEACTIVATEAUTOSHIPPING][MSGDEACTIVATEAUTOSHIPPING]</td>
</tr>
<tr>
<td>
Standard Versandart:</td><td>[VERSANDART][MSGVERSANDART]
</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>
</table>
@ -338,7 +343,6 @@
</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 Versandart:</td><td>[VERSANDART][MSGVERSANDART]</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>{|Mahnwesen aktiv|}:</td><td>[MAHNWESEN][MSGMAHNWESEN]</td></tr>

View File

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