From a5f5f4aede130e73b9654cd05937182cf60737fb Mon Sep 17 00:00:00 2001
From: OpenXE <>
Date: Wed, 5 Jun 2024 09:48:56 +0200
Subject: [PATCH 01/11] reimplemented module artikeltexte
---
phpwf/plugins/class.yui.php | 11 +-
www/lib/class.erpapi.php | 27 ++-
www/lib/class.remote.php | 21 +-
www/pages/artikel.php | 6 +-
www/pages/artikeltexte.php | 270 ++++++++++++++++++++++++
www/pages/content/artikeltexte_edit.tpl | 144 +++++++++++++
www/pages/content/artikeltexte_list.tpl | 10 +
www/pages/importvorlage.php | 4 +-
www/widgets/templates/_gen/artikel.tpl | 6 +-
9 files changed, 465 insertions(+), 34 deletions(-)
create mode 100644 www/pages/artikeltexte.php
create mode 100644 www/pages/content/artikeltexte_edit.tpl
create mode 100644 www/pages/content/artikeltexte_list.tpl
diff --git a/phpwf/plugins/class.yui.php b/phpwf/plugins/class.yui.php
index d78eb336..c2d2398e 100644
--- a/phpwf/plugins/class.yui.php
+++ b/phpwf/plugins/class.yui.php
@@ -1921,8 +1921,17 @@ class YUI {
}
}
-
$this->app->erp->RunHook('AARLGPositionenSprache', 6, $module, $id, $artikel_id, $sprache, $bezeichnung, $beschreibung);
+
+ // OpenXE artikel_texte
+ $language = $this->app->erp->GetSpracheBeleg($module,$id);
+ $sql = "SELECT * FROM artikel_texte WHERE artikel = '".$artikel_id."' AND sprache = '".$language."'";
+ $uebersetzung = $this->app->DB->SelectRow($sql);
+ if ($uebersetzung) {
+ $bezeichnung = $uebersetzung['name'];
+ $beschreibung = $uebersetzung['beschreibung'];
+ }
+
$bezeichnung = $this->app->DB->real_escape_string($bezeichnung);
$beschreibung = $this->app->DB->real_escape_string($beschreibung);
diff --git a/www/lib/class.erpapi.php b/www/lib/class.erpapi.php
index b855b0f3..9ec83a60 100644
--- a/www/lib/class.erpapi.php
+++ b/www/lib/class.erpapi.php
@@ -31396,15 +31396,15 @@ function Firmendaten($field,$projekt="")
$variante_von = $this->app->DB->Select("SELECT variante_von FROM artikel WHERE id = '$artikel' LIMIT 1");
if($variante_von)$beschreibung = $this->app->DB->real_escape_string($this->app->DB->Select("SELECT anabregs_text FROM artikel WHERE id='$variante_von' LIMIT 1"));
}
- if($this->ModulVorhanden('artikel_texte')){
- if(array_key_exists($belegsprache,$adresssprachen)){
+
+ if(array_key_exists($belegsprache,$adresssprachen)){
$belegsprache = $adresssprachen[$belegsprache];
- }
- $artikelbeschreibung = $this->app->DB->Select("SELECT beschreibung FROM artikel_texte WHERE artikel=$artikel AND sprache='$belegsprache'");
- if($artikelbeschreibung){
- $beschreibung = $artikelbeschreibung;
- }
}
+ $artikelbeschreibung = $this->app->DB->Select("SELECT beschreibung FROM artikel_texte WHERE artikel=$artikel AND sprache='$belegsprache'");
+ if($artikelbeschreibung){
+ $beschreibung = $artikelbeschreibung;
+ }
+
}
//$vpe = $this->app->DB->Select("SELECT vpe FROM verkaufspreise WHERE id='$verkauf' LIMIT 1");
$sort = $this->app->DB->Select("SELECT MAX(sort) FROM ".$typ."_position WHERE $typ='$id' LIMIT 1");
@@ -31419,20 +31419,19 @@ function Firmendaten($field,$projekt="")
if($this->app->DB->Select("SELECT adr.id FROM auftrag auf INNER JOIN adresse adr ON auf.adresse = adr.id AND adr.sprache = 'englisch' WHERE auf.id = '$id' LIMIT 1"))
$name = $this->app->DB->Select("SELECT name_en FROM artikel WHERE id = '$artikel'");
if($name === '')$name = $this->app->DB->Select("SELECT name_de FROM artikel WHERE id = '$artikel'");
- if($this->ModulVorhanden('artikel_texte')){
- if(array_key_exists($belegsprache,$adresssprachen)){
+
+ if(array_key_exists($belegsprache,$adresssprachen)){
$belegsprache = $adresssprachen[$belegsprache];
- }
- $artikelbezeichnung = $this->app->DB->Select(
+ }
+ $artikelbezeichnung = $this->app->DB->Select(
"SELECT name
FROM artikel_texte
WHERE artikel=$artikel AND sprache='$belegsprache'
ORDER BY name <> '' DESC
LIMIT 1"
- );
- if($artikelbezeichnung){
+ );
+ if($artikelbezeichnung){
$name = $artikelbezeichnung;
- }
}
}
diff --git a/www/lib/class.remote.php b/www/lib/class.remote.php
index 0eb67ede..3880b024 100644
--- a/www/lib/class.remote.php
+++ b/www/lib/class.remote.php
@@ -1177,11 +1177,7 @@ class Remote
}
$shopexportarr = $this->app->DB->SelectRow("SELECT * FROM shopexport WHERE id='$id' LIMIT 1");
$artikelexport = $shopexportarr['artikelexport'];
- $translationpossible = false;
- if($this->app->erp->ModulVorhanden('artikel_texte'))
- {
- $translationpossible = true;
- }
+
$loadElements = [
'foreign_numbers' => true,
'article_descriptions' => true,
@@ -1811,7 +1807,7 @@ class Remote
foreach ($db->yieldAll($query) as $matrixdaten) {
$data[$i]['matrix_varianten']['gruppen'][$matrixdaten['gruppe']][$matrixdaten['wert']] = true;
- if ($translationpossible && !empty($loadElements['translations'])) {
+ if (!empty($loadElements['translations'])) {
if (empty($gruppenuebersetzung[$matrixdaten['gruppe']])) {
$gruppennamen = $this->app->DB->SelectArr("SELECT
IF(name_external_from<>'',name_external_from,name_from) AS name_from,
@@ -2092,17 +2088,16 @@ class Remote
$variantennettopreis = $this->app->erp->GetVerkaufspreis($v['id'], 1, 0);
}
}
- if(!empty($loadElements['translations']) && $this->app->erp->ModulVorhanden('artikel_texte')){
- $sprachen = ['de','en'];
- foreach ($sprachen as $sprache){
+ $sprachen = ['de','en'];
+ foreach ($sprachen as $sprache){
$query = sprintf("SELECT * FROM artikel_texte WHERE shop=%d AND sprache='%s' AND artikel=%d AND aktiv=1 LIMIT 1",
- $id,strtoupper($sprache),$v['id']);
+ $id,strtoupper($sprache),$v['id']);
$ersetzeStandardbeschreibung = $this->app->DB->SelectRow($query);
- if(!empty($ersetzeStandardbeschreibung)){
- $v['name_'.$sprache] = $ersetzeStandardbeschreibung['name'];
+ if(!empty($ersetzeStandardbeschreibung)) {
+ $v['name_'.$sprache] = $ersetzeStandardbeschreibung['name'];
}
- }
}
+
$this->app->erp->RunHook('remote_send_article_list_pseudostorage', 3, $id, $v['id'], $v['pseudolager']);
if(is_numeric($v['pseudolager']) && $v['pseudolager'] < 0) {
$v['pseudolager'] = 0;
diff --git a/www/pages/artikel.php b/www/pages/artikel.php
index 34af81c7..4412e536 100644
--- a/www/pages/artikel.php
+++ b/www/pages/artikel.php
@@ -7333,6 +7333,10 @@ class Artikel extends GenArtikel {
$this->app->erp->MenuEintrag('index.php?module=artikel&action=eigenschaften&id='.$id, 'Eigenschaften');
}
+ $this->app->erp->MenuEintrag("index.php?module=artikeltexte&action=list&artikel=$id",'Übersetzung');
+
+ $this->app->erp->MenuEintrag("index.php?module=artikel&action=baum&id=$id",'Artikelbaum');
+
if($rabatt!='1'){
$this->app->erp->MenuEintrag("index.php?module=artikel&action=einkauf&id=$id",'Einkauf');
if($this->app->erp->RechteVorhanden('einkaufabgleich','einkaufapi'))
@@ -7393,7 +7397,7 @@ class Artikel extends GenArtikel {
}
$this->app->erp->MenuEintrag('index.php?module=artikel&action=list','Zurück zur Übersicht');
- $this->app->erp->InsertMenuAfter("index.php?module=artikel&action=baum&id=$id",'Artikelbaum','artikel','eigenschaften');
+
}
}
$this->app->erp->MenuEintrag('index.php?module=artikel&action=create','Neuen Artikel anlegen');
diff --git a/www/pages/artikeltexte.php b/www/pages/artikeltexte.php
new file mode 100644
index 00000000..adc4f311
--- /dev/null
+++ b/www/pages/artikeltexte.php
@@ -0,0 +1,270 @@
+app = $app;
+ if ($intern)
+ return;
+
+ $this->app->ActionHandlerInit($this);
+ $this->app->ActionHandler("list", "artikel_texte_list");
+ $this->app->ActionHandler("create", "artikel_texte_edit"); // This automatically adds a "New" button
+ $this->app->ActionHandler("edit", "artikel_texte_edit");
+ $this->app->ActionHandler("delete", "artikel_texte_delete");
+ $this->app->DefaultActionHandler("list");
+ $this->app->ActionHandlerListen($app);
+ }
+
+ public function Install() {
+ /* Fill out manually later */
+ }
+
+ static function TableSearch(&$app, $name, $erlaubtevars) {
+ switch ($name) {
+ case "artikel_texte_list":
+ $allowed['artikel_texte_list'] = array('list');
+ $heading = array('','','Nummer','Artikel','Sprache', 'Name', 'Kurztext', 'Beschreibung', 'Beschreibung_online', 'Meta title', 'Meta description', 'Meta keywords', 'Katalogartikel', 'Katalogbezeichnung', 'Katalogtext', 'Shop', 'Aktiv', 'Menü');
+ $width = array('1%','1%','1%'); // Fill out manually later
+
+ $artikel = $app->User->GetParameter('artikeltexte_artikel');
+
+ // columns that are aligned right (numbers etc)
+ // $alignright = array(4,5,6,7,8);
+
+ $findcols = array('a.id','a.id','art.nummer', 'art.name_de', 'a.sprache', 'a.name', 'a.kurztext', 'a.beschreibung', 'a.beschreibung_online', 'a.meta_title', 'a.meta_description', 'a.meta_keywords', 'a.katalogartikel', 'a.katalog_bezeichnung', 'a.katalog_text', 'a.shop', 'a.aktiv');
+ $searchsql = array('a.artikel', 'a.sprache', 'a.name', 'a.kurztext', 'a.beschreibung', 'a.beschreibung_online', 'a.meta_title', 'a.meta_description', 'a.meta_keywords', 'a.katalogartikel', 'a.katalog_bezeichnung', 'a.katalog_text', 'a.shop', 'a.aktiv');
+
+ $defaultorder = 1;
+ $defaultorderdesc = 0;
+ $aligncenter = array();
+ $alignright = array();
+ $numbercols = array();
+ $sumcol = array();
+
+ $dropnbox = "'' AS `open`, CONCAT('') AS `auswahl`";
+
+// $moreinfo = true; // Allow drop down details
+// $moreinfoaction = "lieferschein"; // specify suffix for minidetail-URL to allow different minidetails
+// $mencol = 11; // Set id col for moredata/menu
+
+ $menu = "
";
+
+ $sql = "
+ SELECT SQL_CALC_FOUND_ROWS a.id, $dropnbox,
+ art.nummer,
+ art.name_de,
+ a.sprache,
+ a.name,
+ a.kurztext,
+ a.beschreibung,
+ a.beschreibung_online,
+ a.meta_title,
+ a.meta_description,
+ a.meta_keywords,
+ a.katalogartikel,
+ a.katalog_bezeichnung,
+ a.katalog_text,
+ a.shop,
+ a.aktiv,
+ a.id FROM artikel_texte a
+ INNER JOIN artikel art ON art.id = a.artikel
+ ";
+
+ $where = "1";
+
+ if ($artikel) {
+ // $where .= " AND a.artikel = '".$artikel."'";
+ }
+
+ $count = "SELECT count(DISTINCT id) FROM artikel_texte a WHERE $where";
+// $groupby = "";
+
+ break;
+ }
+
+ $erg = false;
+
+ foreach ($erlaubtevars as $k => $v) {
+ if (isset($$v)) {
+ $erg[$v] = $$v;
+ }
+ }
+ return $erg;
+ }
+
+ function artikel_texte_list() {
+
+ $this->app->erp->MenuEintrag("index.php?module=artikeltexte&action=list", "Übersicht");
+ $this->app->erp->MenuEintrag("index.php?module=artikeltexte&action=create", "Neu anlegen");
+
+ $this->app->erp->MenuEintrag("index.php", "Zurück");
+
+ $artikel = $this->app->Secure->GetGET('artikel');
+ $this->app->User->SetParameter('artikeltexte_artikel', $artikel);
+
+ $this->app->YUI->TableSearch('TAB1', 'artikel_texte_list', "show", "", "", basename(__FILE__), __CLASS__);
+ $this->app->Tpl->Parse('PAGE', "artikeltexte_list.tpl");
+ }
+
+ public function artikel_texte_delete() {
+ $id = (int) $this->app->Secure->GetGET('id');
+ $this->app->DB->Delete("DELETE FROM `artikel_texte` WHERE `id` = '{$id}'");
+ $this->app->Tpl->addMessage('error', 'Der Eintrag wurde gelöscht');
+ $this->artikel_texte_list();
+ }
+
+ /*
+ * Edit artikel_texte item
+ * If id is empty, create a new one
+ */
+
+ function artikel_texte_edit() {
+ $id = $this->app->Secure->GetGET('id');
+ // Check if other users are editing this id
+/* if($this->app->erp->DisableModul('artikel_texte',$id))
+ {
+ return;
+ } */
+
+ $this->app->Tpl->Set('ID', $id);
+
+ $this->app->erp->MenuEintrag("index.php?module=artikeltexte&action=edit&id=$id", "Details");
+ $this->app->erp->MenuEintrag("index.php?module=artikeltexte&action=list", "Zurück zur Übersicht");
+ $id = $this->app->Secure->GetGET('id');
+ $input = $this->GetInput();
+ $submit = $this->app->Secure->GetPOST('submit');
+
+ if (empty($id)) {
+ // New item
+ $id = 'NULL';
+ }
+
+ if ($submit != '')
+ {
+
+ // Write to database
+
+ // Add checks here
+
+ // $input['projekt'] = $this->app->erp->ReplaceProjekt(true,$input['projekt'],true); // Parameters: Target db?, value, from form?
+
+ $columns = "id, ";
+ $values = "$id, ";
+ $update = "";
+
+ $fix = "";
+
+ foreach ($input as $key => $value) {
+ $columns = $columns.$fix.$key;
+ $values = $values.$fix."'".$value."'";
+ $update = $update.$fix.$key." = '$value'";
+
+ $fix = ", ";
+ }
+
+// echo($columns."
");
+// echo($values."
");
+// echo($update."
");
+
+ $sql = "INSERT INTO artikel_texte (".$columns.") VALUES (".$values.") ON DUPLICATE KEY UPDATE ".$update;
+
+// echo($sql);
+
+ $this->app->DB->Update($sql);
+
+ if ($id == 'NULL') {
+ $msg = $this->app->erp->base64_url_encode("Das Element wurde erfolgreich angelegt.
");
+ header("Location: index.php?module=artikeltexte&action=list&msg=$msg");
+ } else {
+ $this->app->Tpl->addMessage('success', 'Die Einstellungen wurden erfolgreich übernommen.');
+ }
+ }
+
+
+ // Load values again from database
+ if ($id != 'NULL') {
+
+ $dropnbox = "'' AS `open`, CONCAT('') AS `auswahl`";
+ $result = $this->app->DB->SelectArr("
+ SELECT SQL_CALC_FOUND_ROWS
+ a.id,
+ $dropnbox,
+ art.name_de,
+ a.sprache,
+ a.name,
+ a.kurztext,
+ a.beschreibung,
+ a.beschreibung_online,
+ a.meta_title,
+ a.meta_description,
+ a.meta_keywords,
+ a.katalogartikel,
+ a.katalog_bezeichnung,
+ a.katalog_text,
+ a.shop,
+ a.aktiv,
+ a.id
+ FROM
+ artikel_texte a
+ INNER JOIN artikel art ON a.artikel = art.id
+ WHERE a.id=$id
+ ");
+
+
+ foreach ($result[0] as $key => $value) {
+ $this->app->Tpl->Set(strtoupper($key), $value);
+ }
+
+ if (!empty($result)) {
+ $artikel_texte_from_db = $result[0];
+ } else {
+ return;
+ }
+ }
+
+ /*
+ * Add displayed items later
+ *
+ $this->app->Tpl->Add('EMAIL', $email);
+ $this->app->Tpl->Add('ANGEZEIGTERNAME', $angezeigtername);
+
+ $this->app->YUI->AutoComplete("artikel", "artikelnummer");
+
+ */
+
+ $sprachenOptions = $this->app->erp->GetSprachenSelect();
+ $this->app->Tpl->Set('SPRACHE', $this->app->erp->GetSelectAsso($sprachenOptions, $artikel_texte_from_db['sprache']));
+ $this->app->Tpl->Parse('PAGE', "artikeltexte_edit.tpl");
+ }
+
+ /**
+ * Get all paramters from html form and save into $input
+ */
+ public function GetInput(): array {
+ $input = array();
+ //$input['EMAIL'] = $this->app->Secure->GetPOST('email');
+
+ $input['sprache'] = $this->app->Secure->GetPOST('sprache');
+ $input['name'] = $this->app->Secure->GetPOST('name');
+ $input['kurztext'] = $this->app->Secure->GetPOST('kurztext');
+ $input['beschreibung'] = $this->app->Secure->GetPOST('beschreibung');
+ $input['beschreibung_online'] = $this->app->Secure->GetPOST('beschreibung_online');
+ $input['meta_title'] = $this->app->Secure->GetPOST('meta_title');
+ $input['meta_description'] = $this->app->Secure->GetPOST('meta_description');
+ $input['meta_keywords'] = $this->app->Secure->GetPOST('meta_keywords');
+ $input['katalogartikel'] = $this->app->Secure->GetPOST('katalogartikel');
+ $input['katalog_bezeichnung'] = $this->app->Secure->GetPOST('katalog_bezeichnung');
+ $input['katalog_text'] = $this->app->Secure->GetPOST('katalog_text');
+ $input['shop'] = $this->app->Secure->GetPOST('shop');
+ $input['aktiv'] = $this->app->Secure->GetPOST('aktiv')?'1':'0';
+
+ return $input;
+ }
+ }
diff --git a/www/pages/content/artikeltexte_edit.tpl b/www/pages/content/artikeltexte_edit.tpl
new file mode 100644
index 00000000..9e784335
--- /dev/null
+++ b/www/pages/content/artikeltexte_edit.tpl
@@ -0,0 +1,144 @@
+
+
diff --git a/www/pages/content/artikeltexte_list.tpl b/www/pages/content/artikeltexte_list.tpl
new file mode 100644
index 00000000..394c103a
--- /dev/null
+++ b/www/pages/content/artikeltexte_list.tpl
@@ -0,0 +1,10 @@
+
+
+
+ [MESSAGE]
+ [TAB1]
+ [TAB1NEXT]
+
+
diff --git a/www/pages/importvorlage.php b/www/pages/importvorlage.php
index a096fb1d..ea9be2ee 100644
--- a/www/pages/importvorlage.php
+++ b/www/pages/importvorlage.php
@@ -3990,7 +3990,6 @@ class Importvorlage extends GenImportvorlage {
if($this->app->DB->Select("SELECT id FROM artikel WHERE id ='$artikelid' LIMIT 1")){
//Sprachen
- if($this->app->erp->ModulVorhanden('artikel_texte')){
$erlaubtefelder= array('name','kurztext','beschreibung','beschreibung_online','meta_title',
'meta_description','meta_keywords','katalog_bezeichnung','katalog_text','katalogartikel','shop','aktiv');
$zuImportierendeSprachen = [];
@@ -4066,8 +4065,7 @@ class Importvorlage extends GenImportvorlage {
}
}
}
- }
- }
+ } // Sprachen
//freifelduebersetzungen
foreach ($tmp as $feldname => $feldwerte) {
diff --git a/www/widgets/templates/_gen/artikel.tpl b/www/widgets/templates/_gen/artikel.tpl
index a7cc327e..3230ce71 100644
--- a/www/widgets/templates/_gen/artikel.tpl
+++ b/www/widgets/templates/_gen/artikel.tpl
@@ -566,11 +566,13 @@
-
From 575c15c3338d0b60a163e6fb662d3fbf3d0ef561 Mon Sep 17 00:00:00 2001
From: OpenXE <>
Date: Sat, 8 Jun 2024 10:03:14 +0200
Subject: [PATCH 03/11] adress search filter search in delivery adress
---
phpwf/plugins/class.yui.php | 19 +++++++++++++++++++
www/pages/content/adresse_table_filter.tpl | 20 +++++++++++++-------
2 files changed, 32 insertions(+), 7 deletions(-)
diff --git a/phpwf/plugins/class.yui.php b/phpwf/plugins/class.yui.php
index c2d2398e..a276877c 100644
--- a/phpwf/plugins/class.yui.php
+++ b/phpwf/plugins/class.yui.php
@@ -5275,6 +5275,25 @@ url:strUrl, success:function(html){strReturn = html;}, async:false
)
";
}
+
+ if(isset($parameter['lieferadresse']) && !empty($parameter['lieferadresse'])) {
+ $paramsArray[] = "
+ (
+ a.id IN
+ (
+ SELECT
+ adresse
+ FROM
+ lieferadressen lfadr
+ WHERE
+ lfadr.name LIKE '%" . $parameter['lieferadresse'] . "%' OR
+ lfadr.strasse LIKE '%" . $parameter['lieferadresse'] . "%' OR
+ lfadr.plz LIKE '%" . $parameter['lieferadresse'] . "%' OR
+ lfadr.ort LIKE '%" . $parameter['lieferadresse'] . "%'
+ )
+ )
+ ";
+ }
if(isset($parameter['abteilung']) && !empty($parameter['abteilung'])) {
$paramsArray[] = "a.abteilung LIKE '%".$parameter['abteilung']."%' ";
diff --git a/www/pages/content/adresse_table_filter.tpl b/www/pages/content/adresse_table_filter.tpl
index 28437af7..551aaecb 100644
--- a/www/pages/content/adresse_table_filter.tpl
+++ b/www/pages/content/adresse_table_filter.tpl
@@ -62,10 +62,14 @@
{|E-Mail|}: |
|
-
- {|Kunde hat Abo|} | {|Marketingsperre|}: {|Lead|}:
- |
-
+
+ {|Lieferadresse|}: |
+ |
+
+
+ {|Kunde hat Abo|} | {|Marketingsperre|}: {|Lead|}:
+ |
+
@@ -150,13 +154,15 @@
[ROLLEN]
- Gruppen: |
-
+
+ |
+ Gruppen: |
+
- |
+
From 3c170318dfe27aabba76623f1aef7970d8df782b Mon Sep 17 00:00:00 2001
From: OpenXE <>
Date: Mon, 10 Jun 2024 17:43:16 +0200
Subject: [PATCH 04/11] gruppen module reimplemented
---
www/pages/content/gruppen_edit.tpl | 784 +++++++++++++++++++++++++++++
www/pages/content/gruppen_list.tpl | 667 +-----------------------
www/pages/gruppen.php | 351 +++++++++++--
3 files changed, 1107 insertions(+), 695 deletions(-)
create mode 100644 www/pages/content/gruppen_edit.tpl
diff --git a/www/pages/content/gruppen_edit.tpl b/www/pages/content/gruppen_edit.tpl
new file mode 100644
index 00000000..33b41335
--- /dev/null
+++ b/www/pages/content/gruppen_edit.tpl
@@ -0,0 +1,784 @@
+
+
+
+
+ [MESSAGE]
+
+
+
+
+
diff --git a/www/pages/content/gruppen_list.tpl b/www/pages/content/gruppen_list.tpl
index 860568d6..394c103a 100644
--- a/www/pages/content/gruppen_list.tpl
+++ b/www/pages/content/gruppen_list.tpl
@@ -1,661 +1,10 @@
-
-
-
- [MESSAGE]
-
-
-
-[TAB1]
+
+
+ [MESSAGE]
+ [TAB1]
+ [TAB1NEXT]
+
-
-
-[TAB3]
-
-
-
-
-[EXTRA]
-
-
-
-
-
-
-
-
-
diff --git a/www/pages/gruppen.php b/www/pages/gruppen.php
index 6fd22eab..41b52b5c 100644
--- a/www/pages/gruppen.php
+++ b/www/pages/gruppen.php
@@ -1,43 +1,322 @@
-
app=$app;
- if($intern) {
- return;
- }
- $this->app->ActionHandlerInit($this);
+/*
+ * Copyright (c) 2022 OpenXE project
+ */
- $this->app->ActionHandler("list","GruppenList");
- $this->app->DefaultActionHandler("list");
+use Xentral\Components\Database\Exception\QueryFailureException;
+class Gruppen {
- $this->app->ActionHandlerListen($app);
- }
- function GruppenList()
- {
- $this->app->Tpl->Set('VERS','Professional');
- $this->app->Tpl->Set('MODUL','Professional');
- $this->app->Tpl->Parse('PAGE', "only_version.tpl");
+ function __construct($app, $intern = false) {
+ $this->app = $app;
+ if ($intern)
+ return;
+
+ $this->app->ActionHandlerInit($this);
+ $this->app->ActionHandler("list", "gruppen_list");
+ $this->app->ActionHandler("create", "gruppen_edit"); // This automatically adds a "New" button
+ $this->app->ActionHandler("edit", "gruppen_edit");
+ $this->app->ActionHandler("delete", "gruppen_delete");
+ $this->app->DefaultActionHandler("list");
+ $this->app->ActionHandlerListen($app);
}
- }
-}
+ public function Install() {
+ /* Fill out manually later */
+ }
+
+ static function TableSearch(&$app, $name, $erlaubtevars) {
+ switch ($name) {
+ case "gruppen_list":
+ $allowed['gruppen_list'] = array('list');
+ $heading = array(
+ '',
+ '',
+ 'Kennziffer',
+ 'Name',
+ 'Art',
+ 'Internebemerkung',
+ 'Projekt',
+ 'Aktiv',
+ 'Menü');
+ $width = array('1%','1%','10%'); // Fill out manually later
+
+ // columns that are aligned right (numbers etc)
+ // $alignright = array(4,5,6,7,8);
+
+ $findcols = array(
+ 'g.id',
+ 'g.id',
+ 'g.kennziffer',
+ 'g.name',
+ 'g.art',
+ 'g.internebemerkung',
+ 'p.abkuerzung',
+ 'g.aktiv',
+ 'g.id'
+ );
+ $searchsql = array('g.name', 'g.art', 'g.kennziffer', 'g.internebemerkung');
+
+ $defaultorder = 1;
+ $defaultorderdesc = 0;
+ $aligncenter = array();
+ $alignright = array();
+ $numbercols = array();
+ $sumcol = array();
+
+ $dropnbox = "'' AS `open`, CONCAT('') AS `auswahl`";
+
+// $moreinfo = true; // Allow drop down details
+// $moreinfoaction = "lieferschein"; // specify suffix for minidetail-URL to allow different minidetails
+// $menucol = 11; // Set id col for moredata/menu
+
+ $menu = "";
+
+ $sql = "SELECT SQL_CALC_FOUND_ROWS g.id, $dropnbox, g.kennziffer, g.name, g.art, g.internebemerkung, p.abkuerzung, g.aktiv, g.id FROM gruppen g LEFT JOIN projekt p ON g.projekt = p.id";
+
+ $where = "1";
+ $count = "SELECT count(DISTINCT id) FROM gruppen WHERE $where";
+// $groupby = "";
+
+ break;
+ }
+
+ $erg = false;
+
+ foreach ($erlaubtevars as $k => $v) {
+ if (isset($$v)) {
+ $erg[$v] = $$v;
+ }
+ }
+ return $erg;
+ }
+
+ function gruppen_list() {
+ $this->app->erp->MenuEintrag("index.php?module=gruppen&action=list", "Übersicht");
+ $this->app->erp->MenuEintrag("index.php?module=gruppen&action=create", "Neu anlegen");
+
+ $this->app->erp->MenuEintrag("index.php", "Zurück");
+
+ $this->app->YUI->TableSearch('TAB1', 'gruppen_list', "show", "", "", basename(__FILE__), __CLASS__);
+ $this->app->Tpl->Parse('PAGE', "gruppen_list.tpl");
+ }
+
+ public function gruppen_delete() {
+ $id = (int) $this->app->Secure->GetGET('id');
+
+ $this->app->DB->Delete("DELETE FROM `gruppen` WHERE `id` = '{$id}'");
+ $this->app->Tpl->Set('MESSAGE', "Der Eintrag wurde gelöscht.
");
+
+ $this->gruppen_list();
+ }
+
+ /*
+ * Edit gruppen item
+ * If id is empty, create a new one
+ */
+
+ function gruppen_edit() {
+ $id = $this->app->Secure->GetGET('id');
+
+ // Check if other users are editing this id
+/* if($this->app->erp->DisableModul('gruppen',$id))
+ {
+ return;
+ } */
+
+ $this->app->Tpl->Set('ID', $id);
+
+ $this->app->erp->MenuEintrag("index.php?module=gruppen&action=edit&id=$id", "Details");
+ $this->app->erp->MenuEintrag("index.php?module=gruppen&action=list", "Zurück zur Übersicht");
+ $id = $this->app->Secure->GetGET('id');
+ $input = $this->GetInput();
+
+ // Convert here
+ $input['aktiv'] = !empty($this->app->Secure->GetPOST('aktiv'))?"1":"0";
+
+ $submit = $this->app->Secure->GetPOST('submit');
+
+ if (empty($id)) {
+ // New item
+ $id = 'NULL';
+ }
+
+ if ($submit != '')
+ {
+
+ // Write to database
+
+ // Add checks here
+
+ $input['projekt'] = $this->app->erp->ReplaceProjekt(true,$input['projekt'],true); // Parameters: Target db?, value, from form?
+
+ $columns = "id, ";
+ $values = "$id, ";
+ $update = "";
+
+ $fix = "";
+
+ foreach ($input as $key => $value) {
+ $columns = $columns.$fix.$key;
+ $values = $values.$fix."'".$value."'";
+ $update = $update.$fix.$key." = '$value'";
+
+ $fix = ", ";
+ }
+
+// echo($columns."
");
+// echo($values."
");
+// echo($update."
");
+
+ $sql = "INSERT INTO gruppen (".$columns.") VALUES (".$values.") ON DUPLICATE KEY UPDATE ".$update;
+
+// echo($sql);
+
+ $this->app->DB->Update($sql);
+
+ if ($id == 'NULL') {
+ $msg = $this->app->erp->base64_url_encode("Das Element wurde erfolgreich angelegt.
");
+ header("Location: index.php?module=gruppen&action=list&msg=$msg");
+ } else {
+ $this->app->Tpl->Set('MESSAGE', "Die Einstellungen wurden erfolgreich übernommen.
");
+ }
+ }
+
+
+ // Load values again from database
+ $dropnbox = "'' AS `open`, CONCAT('') AS `auswahl`";
+ $result = $this->app->DB->SelectArr("SELECT SQL_CALC_FOUND_ROWS g.id, $dropnbox, g.name, g.art, g.kennziffer, g.internebemerkung, g.grundrabatt, g.rabatt1, g.rabatt2, g.rabatt3, g.rabatt4, g.rabatt5, g.sonderrabatt_skonto, g.provision, g.kundennummer, g.partnerid, g.dta_aktiv, g.dta_periode, g.dta_dateiname, g.dta_mail, g.dta_mail_betreff, g.dta_mail_text, g.dtavariablen, g.dta_variante, g.bonus1, g.bonus1_ab, g.bonus2, g.bonus2_ab, g.bonus3, g.bonus3_ab, g.bonus4, g.bonus4_ab, g.bonus5, g.bonus5_ab, g.bonus6, g.bonus6_ab, g.bonus7, g.bonus7_ab, g.bonus8, g.bonus8_ab, g.bonus9, g.bonus9_ab, g.bonus10, g.bonus10_ab, g.zahlungszieltage, g.zahlungszielskonto, g.zahlungszieltageskonto, g.portoartikel, g.portofreiab, g.erweiterteoptionen, g.zentralerechnung, g.zentralregulierung, g.gruppe, g.preisgruppe, g.verbandsgruppe, g.rechnung_name, g.rechnung_strasse, g.rechnung_ort, g.rechnung_plz, g.rechnung_abteilung, g.rechnung_land, g.rechnung_email, g.rechnung_periode, g.rechnung_anzahlpapier, g.rechnung_permail, g.webid, g.portofrei_aktiv, g.projekt, g.objektname, g.objekttyp, g.parameter, g.objektname2, g.objekttyp2, g.parameter2, g.objektname3, g.objekttyp3, g.parameter3, g.kategorie, g.aktiv, g.id FROM gruppen g"." WHERE id=$id");
+
+ foreach ($result[0] as $key => $value) {
+ $this->app->Tpl->Set(strtoupper($key), $value);
+ }
+
+ if (!empty($result)) {
+ $gruppen_from_db = $result[0];
+ } else {
+
+ }
+
+ /*
+ * Add displayed items later
+ *
+
+ $this->app->Tpl->Add('KURZUEBERSCHRIFT2', $email);
+ $this->app->Tpl->Add('EMAIL', $email);
+ $this->app->Tpl->Add('ANGEZEIGTERNAME', $angezeigtername);
+
+ $this->app->YUI->AutoComplete("artikel", "artikelnummer");
+
+ */
+
+ $this->app->YUI->AutoComplete("kennziffer", "gruppekennziffer");
+
+ if ($gruppen_from_db['art'] != 'preisgruppe') {
+ $this->app->Tpl->Set('PREISGRUPPEHIDDEN','hidden');
+ }
+
+ $art_select = Array(
+ 'gruppe' => 'Gruppe',
+ 'preisgruppe' => 'Preisgruppe'
+ );
+ $art_select = $this->app->erp->GetSelectAsso($art_select,$gruppen_from_db['art']);
+ $this->app->Tpl->Set('ARTSELECT',$art_select);
+
+ $this->app->YUI->AutoComplete("projekt","projektname",1);
+ $this->app->Tpl->Set('PROJEKT',$this->app->erp->ReplaceProjekt(false,$gruppen_from_db['projekt'],false));
+
+ $this->app->Tpl->Set('AKTIV', $gruppen_from_db['aktiv']==1?"checked":"");
+
+ $this->app->Tpl->Parse('PAGE', "gruppen_edit.tpl");
+ }
+
+ /**
+ * Get all paramters from html form and save into $input
+ */
+ public function GetInput(): array {
+ $input = array();
+ //$input['EMAIL'] = $this->app->Secure->GetPOST('email');
+
+ $input['name'] = $this->app->Secure->GetPOST('name');
+ $input['art'] = $this->app->Secure->GetPOST('art');
+ $input['kennziffer'] = $this->app->Secure->GetPOST('kennziffer');
+ $input['internebemerkung'] = $this->app->Secure->GetPOST('internebemerkung');
+ $input['grundrabatt'] = $this->app->Secure->GetPOST('grundrabatt');
+ $input['rabatt1'] = $this->app->Secure->GetPOST('rabatt1');
+ $input['rabatt2'] = $this->app->Secure->GetPOST('rabatt2');
+ $input['rabatt3'] = $this->app->Secure->GetPOST('rabatt3');
+ $input['rabatt4'] = $this->app->Secure->GetPOST('rabatt4');
+ $input['rabatt5'] = $this->app->Secure->GetPOST('rabatt5');
+ $input['sonderrabatt_skonto'] = $this->app->Secure->GetPOST('sonderrabatt_skonto');
+ $input['provision'] = $this->app->Secure->GetPOST('provision');
+ $input['kundennummer'] = $this->app->Secure->GetPOST('kundennummer');
+ $input['partnerid'] = $this->app->Secure->GetPOST('partnerid');
+ $input['dta_aktiv'] = $this->app->Secure->GetPOST('dta_aktiv');
+ $input['dta_periode'] = $this->app->Secure->GetPOST('dta_periode');
+ $input['dta_dateiname'] = $this->app->Secure->GetPOST('dta_dateiname');
+ $input['dta_mail'] = $this->app->Secure->GetPOST('dta_mail');
+ $input['dta_mail_betreff'] = $this->app->Secure->GetPOST('dta_mail_betreff');
+ $input['dta_mail_text'] = $this->app->Secure->GetPOST('dta_mail_text');
+ $input['dtavariablen'] = $this->app->Secure->GetPOST('dtavariablen');
+ $input['dta_variante'] = $this->app->Secure->GetPOST('dta_variante');
+ $input['bonus1'] = $this->app->Secure->GetPOST('bonus1');
+ $input['bonus1_ab'] = $this->app->Secure->GetPOST('bonus1_ab');
+ $input['bonus2'] = $this->app->Secure->GetPOST('bonus2');
+ $input['bonus2_ab'] = $this->app->Secure->GetPOST('bonus2_ab');
+ $input['bonus3'] = $this->app->Secure->GetPOST('bonus3');
+ $input['bonus3_ab'] = $this->app->Secure->GetPOST('bonus3_ab');
+ $input['bonus4'] = $this->app->Secure->GetPOST('bonus4');
+ $input['bonus4_ab'] = $this->app->Secure->GetPOST('bonus4_ab');
+ $input['bonus5'] = $this->app->Secure->GetPOST('bonus5');
+ $input['bonus5_ab'] = $this->app->Secure->GetPOST('bonus5_ab');
+ $input['bonus6'] = $this->app->Secure->GetPOST('bonus6');
+ $input['bonus6_ab'] = $this->app->Secure->GetPOST('bonus6_ab');
+ $input['bonus7'] = $this->app->Secure->GetPOST('bonus7');
+ $input['bonus7_ab'] = $this->app->Secure->GetPOST('bonus7_ab');
+ $input['bonus8'] = $this->app->Secure->GetPOST('bonus8');
+ $input['bonus8_ab'] = $this->app->Secure->GetPOST('bonus8_ab');
+ $input['bonus9'] = $this->app->Secure->GetPOST('bonus9');
+ $input['bonus9_ab'] = $this->app->Secure->GetPOST('bonus9_ab');
+ $input['bonus10'] = $this->app->Secure->GetPOST('bonus10');
+ $input['bonus10_ab'] = $this->app->Secure->GetPOST('bonus10_ab');
+ $input['zahlungszieltage'] = $this->app->Secure->GetPOST('zahlungszieltage');
+ $input['zahlungszielskonto'] = $this->app->Secure->GetPOST('zahlungszielskonto');
+ $input['zahlungszieltageskonto'] = $this->app->Secure->GetPOST('zahlungszieltageskonto');
+ $input['portoartikel'] = $this->app->Secure->GetPOST('portoartikel');
+ $input['portofreiab'] = $this->app->Secure->GetPOST('portofreiab');
+ $input['erweiterteoptionen'] = $this->app->Secure->GetPOST('erweiterteoptionen');
+ $input['zentralerechnung'] = $this->app->Secure->GetPOST('zentralerechnung');
+ $input['zentralregulierung'] = $this->app->Secure->GetPOST('zentralregulierung');
+ $input['gruppe'] = $this->app->Secure->GetPOST('gruppe');
+ $input['preisgruppe'] = $this->app->Secure->GetPOST('preisgruppe');
+ $input['verbandsgruppe'] = $this->app->Secure->GetPOST('verbandsgruppe');
+ $input['rechnung_name'] = $this->app->Secure->GetPOST('rechnung_name');
+ $input['rechnung_strasse'] = $this->app->Secure->GetPOST('rechnung_strasse');
+ $input['rechnung_ort'] = $this->app->Secure->GetPOST('rechnung_ort');
+ $input['rechnung_plz'] = $this->app->Secure->GetPOST('rechnung_plz');
+ $input['rechnung_abteilung'] = $this->app->Secure->GetPOST('rechnung_abteilung');
+ $input['rechnung_land'] = $this->app->Secure->GetPOST('rechnung_land');
+ $input['rechnung_email'] = $this->app->Secure->GetPOST('rechnung_email');
+ $input['rechnung_periode'] = $this->app->Secure->GetPOST('rechnung_periode');
+ $input['rechnung_anzahlpapier'] = $this->app->Secure->GetPOST('rechnung_anzahlpapier');
+ $input['rechnung_permail'] = $this->app->Secure->GetPOST('rechnung_permail');
+ $input['webid'] = $this->app->Secure->GetPOST('webid');
+ $input['portofrei_aktiv'] = $this->app->Secure->GetPOST('portofrei_aktiv');
+ $input['projekt'] = $this->app->Secure->GetPOST('projekt');
+ $input['objektname'] = $this->app->Secure->GetPOST('objektname');
+ $input['objekttyp'] = $this->app->Secure->GetPOST('objekttyp');
+ $input['parameter'] = $this->app->Secure->GetPOST('parameter');
+ $input['objektname2'] = $this->app->Secure->GetPOST('objektname2');
+ $input['objekttyp2'] = $this->app->Secure->GetPOST('objekttyp2');
+ $input['parameter2'] = $this->app->Secure->GetPOST('parameter2');
+ $input['objektname3'] = $this->app->Secure->GetPOST('objektname3');
+ $input['objekttyp3'] = $this->app->Secure->GetPOST('objekttyp3');
+ $input['parameter3'] = $this->app->Secure->GetPOST('parameter3');
+ $input['kategorie'] = $this->app->Secure->GetPOST('kategorie');
+ $input['aktiv'] = $this->app->Secure->GetPOST('aktiv');
+
+
+ return $input;
+ }
+ }
From 0b5b7cbed19ca2d075b0779100980c538949da5c Mon Sep 17 00:00:00 2001
From: OpenXE <>
Date: Tue, 11 Jun 2024 19:45:39 +0200
Subject: [PATCH 05/11] Bugfixes adressstammdatenblatt
---
www/lib/dokumente/class.adressstammblatt.php | 465 +++++++++---------
www/lib/dokumente/class.dokumentenvorlage.php | 6 +-
www/pages/adresse.php | 2 +-
3 files changed, 238 insertions(+), 235 deletions(-)
diff --git a/www/lib/dokumente/class.adressstammblatt.php b/www/lib/dokumente/class.adressstammblatt.php
index 93904637..2a7c8507 100644
--- a/www/lib/dokumente/class.adressstammblatt.php
+++ b/www/lib/dokumente/class.adressstammblatt.php
@@ -1,235 +1,236 @@
-app=$app;
- //parent::Dokumentenvorlage();
- $this->doctype="adresse";
- $this->doctypeOrig="Adressstammblatt";
- parent::__construct($this->app,$projekt);
- }
-
- public function renderDocument() {
- // prepare page details
- SuperFPDF::__construct('P','mm','A4');
-
-
- $this->AddPage();
- $this->SetDisplayMode("real","single");
-
- $this->SetMargins(15,50);
- $this->SetAutoPageBreak(true,40);
- $this->AliasNbPages('{nb}');
-
-
- // Bei Adressstammblatt immer oben beginnen
- $this->abstand_betreffzeileoben=0;
- $this->logofile = "";//$this->app->erp->GetTMP()."/".$this->app->Conf->WFdbname."_logo.jpg";
- $this->briefpapier="";
-
-
- $schrift = $this->app->erp->Firmendaten('schriftgroesse');
-
- $this->SetFontSize($schrift);
- $this->SetFont($this->GetFont(),'','10');
- $this->SetX($this->GetX()+160);
- $this->Cell(10,0,date("d.m.Y"),"","","L");
-
- $this->renderDoctype();
-
- $adresse = $this->app->DB->SelectArr("SELECT * FROM adresse WHERE id='".$this->id."'");
- $adresse = reset($adresse);
-
- if($adresse['typ']=="firma")
- {
- $infofields[]=array("Firma",$adresse['name']);
- if($adresse['ansprechpartner']!="")
- $infofields[]=array("Ansprechpartner",$adresse['ansprechpartner']);
- } else {
- $infofields[]=array("Name",$adresse['name']);
- }
-
- $infofields[]=array("Anschrift",$adresse['land']."-".$adresse['plz']." ".$adresse['ort'].", ".$adresse['strasse']);
-
- $felder = array('telefon','telefax','mobil','email','web');
- foreach($felder as $feldname)
- {
- $infofields[]=array(ucfirst($feldname),$adresse[$feldname=='web'?'internetseite':$feldname]);
- }
-
-
- if($this->app->erp->Firmendaten("modul_mlm")==1)
- {
- $mlmvertragsbeginn = $this->app->DB->Select("SELECT DATE_FORMAT(mlmvertragsbeginn,'%d.%m.%Y') FROM adresse WHERE id='".$adresse['id']."' LIMIT 1");
- if($mlmvertragsbeginn=="00.00.0000") $mlmvertragsbeginn = "kein Vertragsbeginn eingestellt";
- $sponsorid = $this->app->DB->Select("SELECT sponsor FROM adresse WHERE id='".$adresse['id']."' LIMIT 1");
- if($sponsorid> 0)
- $sponsor = $this->app->DB->Select("SELECT CONCAT(kundennummer,' ',name) FROM adresse WHERE id='$sponsorid' LIMIT 1");
- else
- $sponsor = "Kein Sponsor vorhanden";
-
- $erfasstam = $this->app->DB->Select("SELECT DATE_FORMAT(zeitstempel,'%d.%m.%Y') FROM objekt_protokoll WHERE objekt='adresse' AND objektid='".$adresse['id']."' AND action_long='adresse_create' LIMIT 1");
-
- $infofields[]=array("Sponsor",$sponsor);
- $infofields[]=array("Erfasst am",$erfasstam);
- $infofields[]=array("Vertragsbeginn am",$mlmvertragsbeginn);
- }
-
-
-
- $infofields[]=array("UST-ID",$adresse['ustid']);
-
-
- if($adresse['kundennummer']!="")
- $numbers[] = array("Kunden Nr.",$adresse['kundennummer']);
-
- if($adresse['lieferantennummer']!="")
- $numbers[] = array("Lieferanten Nr.",$adresse['lieferantennummer']);
-
- if($adresse['mitarbeiternummer']!="")
- $numbers[] = array("Mitarbeiter Nr.",$adresse['mitarbeiternummer']);
-
- if(count($numbers)>0)
- $this->renderInfoBox($numbers);
-
- $this->Ln(5);
- $this->renderHeading("Adressstammblatt",8);
- $this->renderInfoBox($infofields);
-
-
-
- $ansprechpartner_tmp = $this->app->DB->SelectArr("SELECT CONCAT(name,', ',if(bereich='','-',bereich),
- ', Telefon: ',telefon,
- ', Mobil: ',mobil,
- ', E-Mail: ',email
- ) as 'value' FROM ansprechpartner WHERE adresse='".$adresse['id']."'");
-
- for($i=0;$i 0)
- {
- $this->Ln(5);
- $this->renderHeading("Ansprechpartner",8);
- $this->renderInfoBoxSingle($ansprechpartner);
- }
-
- $lieferadressen_tmp = $this->app->DB->SelectArr("SELECT name,abteilung,unterabteilung,adresszusatz,strasse,plz,ort,land,
- telefon,email
- FROM lieferadressen WHERE adresse='".$adresse['id']."' ORDER by standardlieferadresse DESC");
-
- for($i=0;$i$value)
- {
- switch($key)
- {
- case "email":
- $lieferadressen_tmp[$i]['value'] .= "E-Mail: $value, ";
- break;
-
- case "telefon":
- $lieferadressen_tmp[$i]['value'] .= "Telefon: $value, ";
- break;
- case "telefax":
- $lieferadressen_tmp[$i]['value'] .= "Telefax: $value, ";
- break;
-
- default:
- if($value!="")
- $lieferadressen_tmp[$i]['value'] .= "$value, ";
- }
- }
-
- $lieferadressen_tmp[$i]['value'] = trim($lieferadressen_tmp[$i]['value'],', ');
- if($i==0) $standard = " (Standard)"; else $standard="";
-
- $lieferadressen[] = $lieferadressen_tmp[$i]['value'].$standard;
- }
-
- if(count($lieferadressen) > 0)
- {
- $this->Ln(5);
- $this->renderHeading("Lieferadressen",8);
- $this->renderInfoBoxSingle($lieferadressen);
- }
-
-
- $this->Ln(5);
-
- if($adresse['sonstiges']!="")
- {
- $this->renderHeading("Sonstiges",8);
- $this->SetFont($this->GetFont(),'',7);
- $this->MultiCell(180,4,$this->WriteHTML($adresse['sonstiges']));
- }
-
- $this->renderFooter();
- }
-
-
- function GetAdressstammblatt($id,$info="",$extrafreitext="")
- {
- $this->id = $id;
- // das muss vom reisekosten sein!!!!
- //$this->setRecipientLieferadresse($id,"reisekosten");
-
- // OfferNo, customerId, OfferDate
- /*$auftrag = $this->app->DB->Select("SELECT auftragid FROM reisekosten WHERE id='$id' LIMIT 1");
- $auftrag = $this->app->DB->Select("SELECT belegnr FROM auftrag WHERE id='$auftrag' LIMIT 1");
- $bearbeiter = $this->app->DB->Select("SELECT bearbeiter FROM reisekosten WHERE id='$id' LIMIT 1");
- $prefix = $this->app->DB->Select("SELECT prefix FROM reisekosten WHERE id='$id' LIMIT 1");
- $bestellbestaetigung = $this->app->DB->Select("SELECT bestellbestaetigung FROM reisekosten WHERE id='$id' LIMIT 1");
- $this->datum = $this->app->DB->Select("SELECT DATE_FORMAT(datum,'%d.%m.%Y') FROM reisekosten WHERE id='$id' LIMIT 1");
-
- $this->von = $this->app->DB->Select("SELECT DATE_FORMAT(von,'%d.%m.%Y') FROM reisekosten WHERE id='$id' LIMIT 1");
- $this->bis = $this->app->DB->Select("SELECT DATE_FORMAT(bis,'%d.%m.%Y') FROM reisekosten WHERE id='$id' LIMIT 1");
- $this->von_zeit = $this->app->DB->Select("SELECT von_zeit FROM reisekosten WHERE id='$id' LIMIT 1");
- $this->bis_zeit = $this->app->DB->Select("SELECT bis_zeit FROM reisekosten WHERE id='$id' LIMIT 1");
- $belegnr = $this->app->DB->Select("SELECT belegnr FROM reisekosten WHERE id='$id' LIMIT 1");
- $this->anlass = $this->app->DB->Select("SELECT anlass FROM reisekosten WHERE id='$id' LIMIT 1");
- $this->freitext = $this->app->DB->Select("SELECT freitext FROM reisekosten WHERE id='$id' LIMIT 1");
- $projekt = $this->app->DB->Select("SELECT projekt FROM reisekosten WHERE id='$id' LIMIT 1");
- $mitarbeiter = $this->app->DB->Select("SELECT mitarbeiter FROM reisekosten WHERE id='$id' LIMIT 1");*/
- $kunde= $this->app->DB->SelectArr("SELECT name,kundennummer,lieferantennummer FROM adresse WHERE id='$id' LIMIT 1");
- $kunde = reset($kunde);
-
- $kundennummer = $kunde['kundennummer'];
- $this->name = $kunde['name'];
-
- $this->projektabkuerzung = $this->app->DB->Select("SELECT abkuerzung FROM projekt WHERE id='$projekt'");
- $this->firmenname = $this->app->erp->Firmendaten('name');
- $this->doctypeOrig="Adresse: ".$kunde['name'];
- $this->barcode=$belegnr;
-
- //$ohne_briefpapier = $this->app->DB->Select("SELECT ohne_briefpapier FROM reisekosten WHERE id='$id' LIMIT 1");
-
-
-
-
- //$artikel = $this->app->DB->SelectArr("SELECT *,DATE_FORMAT(datum,'%d.%m.%Y') as datum, CONCAT(rk.nummer,'- ',rk.beschreibung) as reisekostenart FROM reisekosten_position rp LEFT JOIN reisekostenart rk ON rk.id=rp.reisekostenart WHERE rp.reisekosten='$id' ORDER By rp.sort");
-
- //$waehrung = $this->app->DB->Select("SELECT waehrung FROM reisekosten_position WHERE reisekosten='$id' LIMIT 1");
-
- /* Dateiname */
- $this->filename = date('Ymd')."_STAMMDATEN_ADRESSE_".$this->app->erp->Dateinamen($kunde['name']).".pdf";
-
- $this->setBarcode($id);
- }
-
-
-}
+app=$app;
+ //parent::Dokumentenvorlage();
+ $this->doctype="adresse";
+ $this->table="adresse";
+ $this->doctypeOrig="Adressstammblatt";
+ parent::__construct($this->app,$projekt);
+ }
+
+ public function renderDocument() {
+ // prepare page details
+ SuperFPDF::__construct('P','mm','A4');
+
+
+ $this->AddPage();
+ $this->SetDisplayMode("real","single");
+
+ $this->SetMargins(15,50);
+ $this->SetAutoPageBreak(true,40);
+ $this->AliasNbPages('{nb}');
+
+
+ // Bei Adressstammblatt immer oben beginnen
+ $this->abstand_betreffzeileoben=0;
+ $this->logofile = "";//$this->app->erp->GetTMP()."/".$this->app->Conf->WFdbname."_logo.jpg";
+ $this->briefpapier="";
+
+
+ $schrift = $this->app->erp->Firmendaten('schriftgroesse');
+
+ $this->SetFontSize($schrift);
+ $this->SetFont($this->GetFont(),'','10');
+ $this->SetX($this->GetX()+160);
+ $this->Cell(10,0,date("d.m.Y"),"","","L");
+
+ $this->renderDoctype();
+
+ $adresse = $this->app->DB->SelectArr("SELECT * FROM adresse WHERE id='".$this->id."'");
+ $adresse = reset($adresse);
+
+ if($adresse['typ']=="firma")
+ {
+ $infofields[]=array("Firma",$adresse['name']);
+ if($adresse['ansprechpartner']!="")
+ $infofields[]=array("Ansprechpartner",$adresse['ansprechpartner']);
+ } else {
+ $infofields[]=array("Name",$adresse['name']);
+ }
+
+ $infofields[]=array("Anschrift",$adresse['land']."-".$adresse['plz']." ".$adresse['ort'].", ".$adresse['strasse']);
+
+ $felder = array('telefon','telefax','mobil','email','web');
+ foreach($felder as $feldname)
+ {
+ $infofields[]=array(ucfirst($feldname),$adresse[$feldname=='web'?'internetseite':$feldname]);
+ }
+
+
+ if($this->app->erp->Firmendaten("modul_mlm")==1)
+ {
+ $mlmvertragsbeginn = $this->app->DB->Select("SELECT DATE_FORMAT(mlmvertragsbeginn,'%d.%m.%Y') FROM adresse WHERE id='".$adresse['id']."' LIMIT 1");
+ if($mlmvertragsbeginn=="00.00.0000") $mlmvertragsbeginn = "kein Vertragsbeginn eingestellt";
+ $sponsorid = $this->app->DB->Select("SELECT sponsor FROM adresse WHERE id='".$adresse['id']."' LIMIT 1");
+ if($sponsorid> 0)
+ $sponsor = $this->app->DB->Select("SELECT CONCAT(kundennummer,' ',name) FROM adresse WHERE id='$sponsorid' LIMIT 1");
+ else
+ $sponsor = "Kein Sponsor vorhanden";
+
+ $erfasstam = $this->app->DB->Select("SELECT DATE_FORMAT(zeitstempel,'%d.%m.%Y') FROM objekt_protokoll WHERE objekt='adresse' AND objektid='".$adresse['id']."' AND action_long='adresse_create' LIMIT 1");
+
+ $infofields[]=array("Sponsor",$sponsor);
+ $infofields[]=array("Erfasst am",$erfasstam);
+ $infofields[]=array("Vertragsbeginn am",$mlmvertragsbeginn);
+ }
+
+
+
+ $infofields[]=array("UST-ID",$adresse['ustid']);
+
+
+ if($adresse['kundennummer']!="")
+ $numbers[] = array("Kunden Nr.",$adresse['kundennummer']);
+
+ if($adresse['lieferantennummer']!="")
+ $numbers[] = array("Lieferanten Nr.",$adresse['lieferantennummer']);
+
+ if($adresse['mitarbeiternummer']!="")
+ $numbers[] = array("Mitarbeiter Nr.",$adresse['mitarbeiternummer']);
+
+ if($numbers?count($numbers):0>0)
+ $this->renderInfoBox($numbers);
+
+ $this->Ln(5);
+ $this->renderHeading("Adressstammblatt",8);
+ $this->renderInfoBox($infofields);
+
+
+
+ $ansprechpartner_tmp = $this->app->DB->SelectArr("SELECT CONCAT(name,', ',if(bereich='','-',bereich),
+ ', Telefon: ',telefon,
+ ', Mobil: ',mobil,
+ ', E-Mail: ',email
+ ) as 'value' FROM ansprechpartner WHERE adresse='".$adresse['id']."'");
+
+ for($i=0;$i<($ansprechpartner_tmp?count($ansprechpartner_tmp):0);$i++) $ansprechpartner[] = $ansprechpartner_tmp[$i]['value'];
+ if($ansprechpartner_tmp?count($ansprechpartner):0 > 0)
+ {
+ $this->Ln(5);
+ $this->renderHeading("Ansprechpartner",8);
+ $this->renderInfoBoxSingle($ansprechpartner);
+ }
+
+ $lieferadressen_tmp = $this->app->DB->SelectArr("SELECT name,abteilung,unterabteilung,adresszusatz,strasse,plz,ort,land,
+ telefon,email
+ FROM lieferadressen WHERE adresse='".$adresse['id']."' ORDER by standardlieferadresse DESC");
+
+ for($i=0;$i<($lieferadressen_tmp?count($lieferadressen_tmp):0);$i++) {
+ $lieferadressen_tmp[$i]['value']="";
+ foreach($lieferadressen_tmp[$i] as $key=>$value)
+ {
+ switch($key)
+ {
+ case "email":
+ $lieferadressen_tmp[$i]['value'] .= "E-Mail: $value, ";
+ break;
+
+ case "telefon":
+ $lieferadressen_tmp[$i]['value'] .= "Telefon: $value, ";
+ break;
+ case "telefax":
+ $lieferadressen_tmp[$i]['value'] .= "Telefax: $value, ";
+ break;
+
+ default:
+ if($value!="")
+ $lieferadressen_tmp[$i]['value'] .= "$value, ";
+ }
+ }
+
+ $lieferadressen_tmp[$i]['value'] = trim($lieferadressen_tmp[$i]['value'],', ');
+ if($i==0) $standard = " (Standard)"; else $standard="";
+
+ $lieferadressen[] = $lieferadressen_tmp[$i]['value'].$standard;
+ }
+
+ if($lieferadressen?count($lieferadressen):0 > 0)
+ {
+ $this->Ln(5);
+ $this->renderHeading("Lieferadressen",8);
+ $this->renderInfoBoxSingle($lieferadressen);
+ }
+
+
+ $this->Ln(5);
+
+ if($adresse['sonstiges']!="")
+ {
+ $this->renderHeading("Sonstiges",8);
+ $this->SetFont($this->GetFont(),'',7);
+ $this->MultiCell(180,4,$this->WriteHTML($adresse['sonstiges']));
+ }
+
+ $this->renderFooter();
+ }
+
+
+ function GetAdressstammblatt($id,$info="",$extrafreitext="")
+ {
+ $this->id = $id;
+ // das muss vom reisekosten sein!!!!
+ //$this->setRecipientLieferadresse($id,"reisekosten");
+
+ // OfferNo, customerId, OfferDate
+ /*$auftrag = $this->app->DB->Select("SELECT auftragid FROM reisekosten WHERE id='$id' LIMIT 1");
+ $auftrag = $this->app->DB->Select("SELECT belegnr FROM auftrag WHERE id='$auftrag' LIMIT 1");
+ $bearbeiter = $this->app->DB->Select("SELECT bearbeiter FROM reisekosten WHERE id='$id' LIMIT 1");
+ $prefix = $this->app->DB->Select("SELECT prefix FROM reisekosten WHERE id='$id' LIMIT 1");
+ $bestellbestaetigung = $this->app->DB->Select("SELECT bestellbestaetigung FROM reisekosten WHERE id='$id' LIMIT 1");
+ $this->datum = $this->app->DB->Select("SELECT DATE_FORMAT(datum,'%d.%m.%Y') FROM reisekosten WHERE id='$id' LIMIT 1");
+
+ $this->von = $this->app->DB->Select("SELECT DATE_FORMAT(von,'%d.%m.%Y') FROM reisekosten WHERE id='$id' LIMIT 1");
+ $this->bis = $this->app->DB->Select("SELECT DATE_FORMAT(bis,'%d.%m.%Y') FROM reisekosten WHERE id='$id' LIMIT 1");
+ $this->von_zeit = $this->app->DB->Select("SELECT von_zeit FROM reisekosten WHERE id='$id' LIMIT 1");
+ $this->bis_zeit = $this->app->DB->Select("SELECT bis_zeit FROM reisekosten WHERE id='$id' LIMIT 1");
+ $belegnr = $this->app->DB->Select("SELECT belegnr FROM reisekosten WHERE id='$id' LIMIT 1");
+ $this->anlass = $this->app->DB->Select("SELECT anlass FROM reisekosten WHERE id='$id' LIMIT 1");
+ $this->freitext = $this->app->DB->Select("SELECT freitext FROM reisekosten WHERE id='$id' LIMIT 1");
+ $projekt = $this->app->DB->Select("SELECT projekt FROM reisekosten WHERE id='$id' LIMIT 1");
+ $mitarbeiter = $this->app->DB->Select("SELECT mitarbeiter FROM reisekosten WHERE id='$id' LIMIT 1");*/
+ $kunde= $this->app->DB->SelectArr("SELECT name,kundennummer,lieferantennummer FROM adresse WHERE id='$id' LIMIT 1");
+ $kunde = reset($kunde);
+
+ $kundennummer = $kunde['kundennummer'];
+ $this->name = $kunde['name'];
+
+ $this->projektabkuerzung = $this->app->DB->Select("SELECT abkuerzung FROM projekt WHERE id='$projekt'");
+ $this->firmenname = $this->app->erp->Firmendaten('name');
+ $this->doctypeOrig="Adresse: ".$kunde['name'];
+ $this->barcode=$belegnr;
+
+ //$ohne_briefpapier = $this->app->DB->Select("SELECT ohne_briefpapier FROM reisekosten WHERE id='$id' LIMIT 1");
+
+
+
+
+ //$artikel = $this->app->DB->SelectArr("SELECT *,DATE_FORMAT(datum,'%d.%m.%Y') as datum, CONCAT(rk.nummer,'- ',rk.beschreibung) as reisekostenart FROM reisekosten_position rp LEFT JOIN reisekostenart rk ON rk.id=rp.reisekostenart WHERE rp.reisekosten='$id' ORDER By rp.sort");
+
+ //$waehrung = $this->app->DB->Select("SELECT waehrung FROM reisekosten_position WHERE reisekosten='$id' LIMIT 1");
+
+ /* Dateiname */
+ $this->filename = date('Ymd')."_STAMMDATEN_ADRESSE_".$this->app->erp->Dateinamen($kunde['name']).".pdf";
+
+ $this->setBarcode($id);
+ }
+
+
+}
diff --git a/www/lib/dokumente/class.dokumentenvorlage.php b/www/lib/dokumente/class.dokumentenvorlage.php
index 1c14dcd3..f2a024f9 100644
--- a/www/lib/dokumente/class.dokumentenvorlage.php
+++ b/www/lib/dokumente/class.dokumentenvorlage.php
@@ -474,9 +474,11 @@ class Dokumentenvorlage extends SuperFPDF {
$this->Output($dir."/".$this->table."/".$this->id."_".$this->filename,'F');
}
- public function displayDocument() {
+ public function displayDocument($archive = true) {
$this->renderDocument();
- $this->archiveDocument();
+ if ($archive) {
+ $this->archiveDocument();
+ }
$this->Output($this->filename,'D');
exit;
}
diff --git a/www/pages/adresse.php b/www/pages/adresse.php
index ca86ff8d..82c3a957 100644
--- a/www/pages/adresse.php
+++ b/www/pages/adresse.php
@@ -780,7 +780,7 @@ class Adresse extends GenAdresse {
}
$Brief->GetAdressstammblatt($id);
- $Brief->displayDocument();
+ $Brief->displayDocument(archive: false);
$this->app->ExitXentral();
}
From 2b43efca70d3e8f6224116b47b4f528e6b110a02 Mon Sep 17 00:00:00 2001
From: OpenXE <>
Date: Tue, 11 Jun 2024 20:00:16 +0200
Subject: [PATCH 06/11] Bugfix add price when address is in several groups
---
www/lib/class.erpapi.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/www/lib/class.erpapi.php b/www/lib/class.erpapi.php
index 9ec83a60..27679ee4 100644
--- a/www/lib/class.erpapi.php
+++ b/www/lib/class.erpapi.php
@@ -38222,7 +38222,7 @@ function Firmendaten($field,$projekt="")
$sql_erweiterung = '';
if(!empty($gruppenarr))
{
- $sql_erweiterung .= ' OR v.gruppe IN ('.implode(' ', $gruppenarr).') ';
+ $sql_erweiterung .= ' OR v.gruppe IN ('.implode(', ', $gruppenarr).') ';
}
if(!$guenstigste_vk) {
$vkarr = $this->app->DB->SelectArr("SELECT * FROM verkaufspreise v WHERE v.ab_menge <= '$menge' AND
From 09aacfbb7bb6bedc52eb115913d906a5547a278d Mon Sep 17 00:00:00 2001
From: OpenXE <>
Date: Wed, 12 Jun 2024 11:24:10 +0200
Subject: [PATCH 07/11] Bugfix file upload dragndrop
---
phpwf/plugins/class.yui.php | 168 +++++++++++++++-----------
www/pages/content/datei_neudirekt.tpl | 6 +-
2 files changed, 103 insertions(+), 71 deletions(-)
diff --git a/phpwf/plugins/class.yui.php b/phpwf/plugins/class.yui.php
index a276877c..bfe50fbd 100644
--- a/phpwf/plugins/class.yui.php
+++ b/phpwf/plugins/class.yui.php
@@ -14135,24 +14135,18 @@ source: "index.php?module=ajax&action=filter&filtername=' . $filter . $extendurl
$action = $this->app->Secure->GetGET("action");
$id = $this->app->Secure->GetGET("id");
if($id)$this->app->Tpl->Set('ID',$id);
- if ($speichern != "") {
- $titel = $this->app->Secure->GetPOST("titel");
- $beschreibung = $this->app->Secure->GetPOST("beschreibung");
- $stichwort = $this->app->Secure->GetPOST("stichwort");
- $this->app->Tpl->Set('TITLE', $titel);
- $this->app->Tpl->Set('BESCHREIBUNG', $beschreibung);
-
- if ($_FILES['upload']['tmp_name'] == "") {
- $this->app->Tpl->Set('ERROR', "Bitte wählen Sie eine Datei aus und laden Sie diese herauf!
");
- $this->app->erp->EnableTab("tabs-2");
- } else {
- //$fileid = $this->app->erp->CreateDatei($_FILES['upload']['name'],$titel,$beschreibung,"",$_FILES['upload']['tmp_name'],$this->app->User->GetName());
- $this->app->erp->AddDateiVersion($datei, $this->app->User->GetName(), $_FILES['upload']['name'], "Neue Version", $_FILES['upload']['tmp_name']);
- header("Location: index.php?module=$module&action=$action&id=$id");
- exit;
+ // Get files here
+ if ($speichern != "") {
+ $retval = $this->FilesFromUploadtoDMS(null, null, $datei);
+ if ($retval !== true) {
+ $this->app->Tpl->Set('ERROR', implode(', ',$retval));
+ $this->app->erp->EnableTab("tabs-2");
+ } else {
+ header("Location: index.php?module=$module&action=$action&id=$id");
}
}
+
$this->app->Tpl->Set('STARTDISABLE', "");
$this->app->Tpl->Parse($parsetarget, "datei_neudirekt.tpl");
@@ -14229,61 +14223,18 @@ source: "index.php?module=ajax&action=filter&filtername=' . $filter . $extendurl
$id = $this->app->Secure->GetGET("id");
$sid = $this->app->Secure->GetGET("sid");
if($id)$this->app->Tpl->Set('ID', $id);
+
+ // Get files here
if ($speichern != "") {
- if($parameter == '')$parameter = $id;
- if(isset($_POST['dateiv']))
- {
- foreach($_POST['dateiv'] as $k => $v)
- {
- $name = $this->app->DB->real_escape_string($_POST['dateiname'][$k]);
- $titel = $this->app->DB->real_escape_string($_POST['dateititel'][$k]);
- $beschreibung = $this->app->DB->real_escape_string($_POST['beschreibung'][$k]);
- $stichwort = $this->app->DB->real_escape_string($_POST['dateistichwort'][$k]);
-
- //$getMime = explode('.', $name);
- //$mime = end($getMime);
-
- $data = explode(',', $v);
-
- $encodedData = str_replace(' ','+',$data[1]);
- $decodedData = base64_decode($encodedData);
-
- $this->app->Tpl->Set('TITLE', $titel);
- $this->app->Tpl->Set('BESCHREIBUNG', $beschreibung);
-
- if ($v == "" ) {
- $this->app->Tpl->Set('ERROR', "Keine Datei ausgewählt!
");
- $this->app->erp->EnableTab("tabs-2");
- } else {
- $fileid = $this->app->erp->CreateDatei($name, $titel, $beschreibung, "", $decodedData, $this->app->User->GetName());
-
- // stichwoerter hinzufuegen
- $this->app->erp->AddDateiStichwort($fileid, $stichwort, $objekt, $parameter);
- }
- }
- if($_FILES['upload']['tmp_name'] == "")
- {
- header("Location: index.php?module=$_module&action=$_action&id=$id&sid=$sid".($typ!=''?"&typ=".$typ:''));
- }
+ if($parameter == '') {
+ $parameter = $id;
}
-
-
-
- $titel = $this->app->Secure->GetPOST("titel");
- $beschreibung = $this->app->Secure->GetPOST("beschreibung");
- $stichwort = $this->app->Secure->GetPOST("stichwort");
- $this->app->Tpl->Set('TITLE', $titel);
- $this->app->Tpl->Set('BESCHREIBUNG', $beschreibung);
-
- if ($_FILES['upload']['tmp_name'] == "" && empty($_POST['dateiv'])) {
- $this->app->Tpl->Set('ERROR', "Keine Datei ausgewählt!
");
- $this->app->erp->EnableTab("tabs-2");
- } elseif($_FILES['upload']['tmp_name'] != '') {
- $fileid = $this->app->erp->CreateDatei($_FILES['upload']['name'], $titel, $beschreibung, "", $_FILES['upload']['tmp_name'], $this->app->User->GetName());
-
- // stichwoerter hinzufuegen
- $this->app->erp->AddDateiStichwort($fileid, $stichwort, $objekt, $parameter);
- header("Location: index.php?module=$_module&action=$_action&id=$id&sid=$sid".($typ!=''?"&typ=".$typ:''));
+ $retval = $this->FilesFromUploadtoDMS($objekt, $parameter);
+ if ($retval !== true) {
+ $this->app->Tpl->Set('ERROR', implode(', ',$retval));
+ $this->app->erp->EnableTab("tabs-2");
+ } else {
+ header("Location: index.php?module=$_module&action=$_action&id=$id&sid=$sid".($typ!=''?"&typ=".$typ:''));
}
}
@@ -14551,6 +14502,87 @@ source: "index.php?module=ajax&action=filter&filtername=' . $filter . $extendurl
}
}
+ /*
+ * Retrieve uploaded files and put them into DMS
+ * $datei: given file, just add a new version
+ * Return array of errors or true
+ */
+ function FilesFromUploadtoDMS($objekt, $parameter, $datei = false) {
+
+ $retval = true;
+ // Files come from drag'n'drop
+ if(isset($_POST['dateiv']))
+ {
+ foreach($_POST['dateiv'] as $k => $v)
+ {
+ $name = $this->app->DB->real_escape_string($_POST['dateiname'][$k]);
+ $titel = $this->app->DB->real_escape_string($_POST['dateititel'][$k]);
+ $beschreibung = $this->app->DB->real_escape_string($_POST['dateibeschreibung'][$k]);
+ $stichwort = $this->app->DB->real_escape_string($_POST['dateistichwort'][$k]);
+
+ $data = explode(',', $v);
+
+ $encodedData = str_replace(' ','+',$data[1]);
+ $decodedData = base64_decode($encodedData);
+
+ $this->app->Tpl->Set('TITLE', $titel);
+ $this->app->Tpl->Set('BESCHREIBUNG', $beschreibung);
+
+ if ($v == "" ) {
+ $this->app->Tpl->Set('ERROR', "Keine Datei ausgewählt!
");
+ $this->app->erp->EnableTab("tabs-2");
+ } else {
+ // Save file to disk first
+ $tempfilename = rtrim($this->app->erp->GetTMP(), '/') . "/" . $name;
+ if($handle = fopen($tempfilename, "wb")){
+ fwrite($handle, $decodedData);
+ fclose($handle);
+ // Add file to DMS
+ if ($datei) {
+ $this->app->erp->AddDateiVersion($datei, $this->app->User->GetName(), $name, "Neue Version", $tempfilename);
+ } else {
+ $fileid = $this->app->erp->CreateDatei($name, $titel, $beschreibung, "", $tempfilename, $this->app->User->GetName());
+ // stichwoerter hinzufuegen
+ $this->app->erp->AddDateiStichwort($fileid, $stichwort, $objekt, $parameter);
+ }
+ } else {
+ if ($retval === true) {
+ $retval = array();
+ }
+ $retval[] = "Datei konnte nicht gespeichert werden: ".$name."
";
+ }
+ }
+ }
+ } // drag'n'drop
+ // Single file comes from browse button
+ else {
+ $titel = $this->app->Secure->GetPOST("titel");
+ $beschreibung = $this->app->Secure->GetPOST("beschreibung");
+ $stichwort = $this->app->Secure->GetPOST("stichwort");
+ $this->app->Tpl->Set('TITLE', $titel);
+ $this->app->Tpl->Set('BESCHREIBUNG', $beschreibung);
+
+ if ($_FILES['upload']['tmp_name'] == "" && empty($_POST['dateiv'])) {
+ $this->app->erp->EnableTab("tabs-2");
+ if ($retval === true) {
+ $retval = array();
+ }
+ $retval[] = "Keine Datei ausgewählt!
";
+
+ } elseif ($_FILES['upload']['tmp_name'] != '') {
+ if ($datei) {
+ $this->app->erp->AddDateiVersion($datei, $this->app->User->GetName(), $_FILES['upload']['name'], "Neue Version", $_FILES['upload']['tmp_name']);
+ }
+ else {
+ $fileid = $this->app->erp->CreateDatei($_FILES['upload']['name'], $titel, $beschreibung, "", $_FILES['upload']['tmp_name'], $this->app->User->GetName());
+ // stichwoerter hinzufuegen
+ $this->app->erp->AddDateiStichwort($fileid, $stichwort, $objekt, $parameter);
+ }
+ }
+ }
+ return($retval);
+ }
+
function SortListAdd($parsetarget, &$ref, $menu, $sql, $sort = true) {
$module = $this->app->Secure->GetGET("module");
diff --git a/www/pages/content/datei_neudirekt.tpl b/www/pages/content/datei_neudirekt.tpl
index f7200905..3321a05d 100644
--- a/www/pages/content/datei_neudirekt.tpl
+++ b/www/pages/content/datei_neudirekt.tpl
@@ -11,7 +11,7 @@
[ERROR] |
-
+ |
{|Dateien hier einfügen|}
@@ -333,8 +333,8 @@ $(document).ready(function() {
}
}
- $('#trdatei').before(' |
Datei '+vorschau+' | '+filenameEncoded+' | Titel: | |
');
- };
+ $('#trdatei').before(' Datei '+vorschau+' | '+filenameEncoded+' | Titel: | {|Beschreibung|}: | | |
');
+ };
})(files[index]);
fileReader.readAsDataURL(file);
From 7e44bbeccfc20e98642135a00f3542a6755f6cf2 Mon Sep 17 00:00:00 2001
From: OpenXE <>
Date: Tue, 2 Jul 2024 13:20:21 +0200
Subject: [PATCH 08/11] bugfix artikeltexte
---
www/pages/artikeltexte.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/www/pages/artikeltexte.php b/www/pages/artikeltexte.php
index dea987a6..ceb89e4a 100644
--- a/www/pages/artikeltexte.php
+++ b/www/pages/artikeltexte.php
@@ -81,7 +81,7 @@ class Artikeltexte {
$where = "1";
if ($artikel) {
- // $where .= " AND a.artikel = '".$artikel."'";
+ $where .= " AND a.artikel = '".$artikel."'";
}
$count = "SELECT count(DISTINCT id) FROM artikel_texte a WHERE $where";
From 71337794ce5fe02aa3181cd402b5fd2c9e919107 Mon Sep 17 00:00:00 2001
From: OpenXE <>
Date: Mon, 8 Jul 2024 20:01:59 +0200
Subject: [PATCH 09/11] Bugfix gruppen kennziffer
---
www/pages/content/gruppen_edit.tpl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/www/pages/content/gruppen_edit.tpl b/www/pages/content/gruppen_edit.tpl
index 33b41335..f0738929 100644
--- a/www/pages/content/gruppen_edit.tpl
+++ b/www/pages/content/gruppen_edit.tpl
@@ -40,7 +40,7 @@
{|Kennziffer|}:
-
+
|
From 78dff8b5c1a6e13a90f7d8595e3e0d2d2d6c30f5 Mon Sep 17 00:00:00 2001
From: OpenXE <>
Date: Thu, 11 Jul 2024 17:16:22 +0200
Subject: [PATCH 10/11] Buchhaltung export UTF-8, UTF-8-BOM
---
www/pages/content/exportbuchhaltung_export.tpl | 10 ++++++++++
www/pages/exportbuchhaltung.php | 18 +++++++++++++++---
2 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/www/pages/content/exportbuchhaltung_export.tpl b/www/pages/content/exportbuchhaltung_export.tpl
index 9cf337f7..b73af264 100644
--- a/www/pages/content/exportbuchhaltung_export.tpl
+++ b/www/pages/content/exportbuchhaltung_export.tpl
@@ -51,6 +51,16 @@
Konto für Differenzen: |
|
+
+ Format: |
+
+
+ |
+
diff --git a/www/pages/exportbuchhaltung.php b/www/pages/exportbuchhaltung.php
index ec3f2912..b96476e1 100644
--- a/www/pages/exportbuchhaltung.php
+++ b/www/pages/exportbuchhaltung.php
@@ -80,6 +80,7 @@ class Exportbuchhaltung
$lgchecked = $this->app->Secure->GetPOST("lieferantengutschrift");
$diffignore = $this->app->Secure->GetPOST("diffignore");
$sachkonto = $this->app->Secure->GetPOST('sachkonto');
+ $format = $this->app->Secure->GetPOST('format');
$account_id = null;
if (!empty($sachkonto)) {
@@ -162,7 +163,7 @@ class Exportbuchhaltung
if ($dataok) {
$filename = "EXTF_".date('Ymd') . "_Buchungsstapel_DATEV_export.csv";
try {
- $csv = $this->DATEV_Buchuchungsstapel($rgchecked, $gschecked, $vbchecked, $lgchecked, $buchhaltung_berater, $buchhaltung_mandant, $buchhaltung_wj_beginn, $buchhaltung_sachkontenlaenge, $von, $bis, $projekt, $filename, $diffignore, $sachkonto_kennung);
+ $csv = $this->DATEV_Buchuchungsstapel($rgchecked, $gschecked, $vbchecked, $lgchecked, $buchhaltung_berater, $buchhaltung_mandant, $buchhaltung_wj_beginn, $buchhaltung_sachkontenlaenge, $von, $bis, $projekt, $filename, $diffignore, $sachkonto_kennung, $format);
header("Content-Disposition: attachment; filename=" . $filename);
header("Pragma: no-cache");
header("Expires: 0");
@@ -214,9 +215,10 @@ class Exportbuchhaltung
/*
* Create DATEV Buchhungsstapel
+ * format: "ISO-8859-1", "UTF-8", "UTF-8-BOM"
* @throws ConsistencyException with string (list of items) if consistency check fails and no sachkonto for differences is given
*/
- function DATEV_Buchuchungsstapel(bool $rechnung, bool $gutschrift, bool $verbindlichkeit, bool $lieferantengutschrift, string $berater, string $mandant, datetime $wj_beginn, int $sachkontenlaenge, datetime $von, datetime $bis, int $projekt = 0, string $filename = 'EXTF_Buchungsstapel_DATEV_export.csv', $diffignore = false, $sachkonto_differences) : string {
+ function DATEV_Buchuchungsstapel(bool $rechnung, bool $gutschrift, bool $verbindlichkeit, bool $lieferantengutschrift, string $berater, string $mandant, datetime $wj_beginn, int $sachkontenlaenge, datetime $von, datetime $bis, int $projekt = 0, string $filename = 'EXTF_Buchungsstapel_DATEV_export.csv', $diffignore = false, $sachkonto_differences, string $format = "ISO-8859-1") : string {
$datev_header_definition = array (
'1' => 'Kennzeichen',
@@ -671,7 +673,17 @@ class Exportbuchhaltung
$csv .= '"0";"S";"EUR";"0";"";"";"1234";"1370";"";"101";"";"";"";"Testbuchung";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"0";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";""'; // Testbuchung
- $csv = mb_convert_encoding($csv, "ISO-8859-1", "UTF-8");
+ switch ($format) {
+ case "UTF-8":
+ break;
+ case "UTF-8-BOM":
+ $csv = "\xef\xbb\xbf".$csv;
+ break;
+ default:
+ $csv = mb_convert_encoding($csv, "ISO-8859-1", "UTF-8");
+ break;
+ }
+
return($csv);
}
From cbd44d167a5a8dd239a9ca056e38e9822ee243be Mon Sep 17 00:00:00 2001
From: OpenXE <>
Date: Sat, 13 Jul 2024 14:46:58 +0200
Subject: [PATCH 11/11] rework paketmarke contact fields
---
www/lib/class.versanddienstleister.php | 32 ++++++++++++++----
.../versandarten/content/createshipment.tpl | 33 ++++++++++---------
www/lib/versandarten/dhl.php | 28 +++++++++++++++-
www/lib/versandarten/sendcloud.php | 33 +++++++++++++++++--
4 files changed, 99 insertions(+), 27 deletions(-)
diff --git a/www/lib/class.versanddienstleister.php b/www/lib/class.versanddienstleister.php
index c0fc16a6..921eccf6 100644
--- a/www/lib/class.versanddienstleister.php
+++ b/www/lib/class.versanddienstleister.php
@@ -68,6 +68,9 @@ abstract class Versanddienstleister
$auftragId = $this->app->DB->Select("SELECT auftragid FROM rechnung WHERE id=$rechnungId LIMIT 1");
if ($sid === 'rechnung' || $sid === 'lieferschein' || $sid === 'adresse') {
+
+ $ret['addresstype'] = 0; // 0 = firma, 1 = packstation, 2 = postfiliale, 3 = privatadresse
+
$docArr = $this->app->DB->SelectRow("SELECT * FROM `$sid` WHERE id = $id LIMIT 1");
$ret['addressId'] = $docArr['adresse'];
$ret['auftragId'] = $auftragId;
@@ -79,12 +82,28 @@ abstract class Versanddienstleister
$ret['original'] = array_filter($docArr, fn($key) => in_array($key, $addressfields), ARRAY_FILTER_USE_KEY);
- $ret['name'] = empty(trim($docArr['ansprechpartner'])) ? trim($docArr['name']) : trim($docArr['ansprechpartner']);
- $ret['name2'] = !empty(trim($docArr['ansprechpartner'])) ? trim($docArr['name']) : '';
- $ret['name3'] = join(';', array_filter([
- $docArr['abteilung'],
- $docArr['unterabteilung']
- ], fn(string $item) => !empty(trim($item))));
+ if ($docArr['typ'] == "firma") {
+ $ret['company_name'] = $docArr['name'];
+ $ret['addresstype'] = 0;
+ } else {
+ $ret['addresstype'] = 3;
+ }
+
+ $ret['contact_name'] = $docArr['ansprechpartner'];
+
+ $ret['company_division'] = join(
+ ';',
+ array_filter(
+ [
+ $docArr['abteilung'],
+ $docArr['unterabteilung']
+ ],
+ fn(string $item) => !empty(trim($item))
+ )
+ );
+
+ $ret['name'] = $docArr['name'];
+
$ret['address2'] = $docArr['adresszusatz'];
$ret['city'] = $docArr['ort'];
@@ -92,7 +111,6 @@ abstract class Versanddienstleister
$ret['country'] = $docArr['land'];
$ret['phone'] = $docArr['telefon'];
$ret['email'] = $docArr['email'];
- $ret['addresstype'] = 0;
$strasse = trim($docArr['strasse']);
$ret['streetwithnumber'] = $strasse;
diff --git a/www/lib/versandarten/content/createshipment.tpl b/www/lib/versandarten/content/createshipment.tpl
index d524c75f..db8e88da 100644
--- a/www/lib/versandarten/content/createshipment.tpl
+++ b/www/lib/versandarten/content/createshipment.tpl
@@ -18,29 +18,34 @@ SPDX-License-Identifier: LicenseRef-EGPL-3.1
{|Adresstyp|}: |
|
-
- {|Name / Zeile 1|}: |
- |
+
+ {|Firma|}: |
+ |
- {|Firmenname / Zeile 2|}: |
- |
+ {|Abteilung|}: |
+ |
+
+
+ {|Name|}: |
+ |
+
+
+ {|Ansprechpartner|}: |
+ |
{|Postnummer|}: |
|
-
- {|Firmenname / Zeile 3|}: |
- |
-
-
+
{|Strasse/Hausnummer|}: |
@@ -55,7 +60,7 @@ SPDX-License-Identifier: LicenseRef-EGPL-3.1
| {|Postfilialnummer|}: |
|
-
+
{|Adresszeile 2|}: |
|
@@ -77,10 +82,6 @@ SPDX-License-Identifier: LicenseRef-EGPL-3.1
-
- {|Ansprechpartner|}: |
- |
-
{|E-Mail|}: |
|
diff --git a/www/lib/versandarten/dhl.php b/www/lib/versandarten/dhl.php
index ad065d86..9ed5e7ee 100644
--- a/www/lib/versandarten/dhl.php
+++ b/www/lib/versandarten/dhl.php
@@ -102,7 +102,19 @@ class Versandart_dhl extends Versanddienstleister{
switch ($json->addresstype) {
case 0:
$shipment->Receiver->Address = new ReceiverNativeAddress();
- $shipment->Receiver->Address->name2 = $json->name2;
+
+ $shipment->Receiver->name1 = $json->company_name;
+ $shipment->Receiver->Address->name2 = join(
+ ';',
+ array_filter(
+ [
+ $json->contact_name,
+ $json->company_division
+ ],
+ fn(string $item) => !empty(trim($item))
+ )
+ );
+
$shipment->Receiver->Address->streetName = $json->street ?? '';
$shipment->Receiver->Address->streetNumber = $json->streetnumber;
$shipment->Receiver->Address->city = $json->city ?? '';
@@ -127,6 +139,20 @@ class Versandart_dhl extends Versanddienstleister{
$shipment->Receiver->Postfiliale->zip = $json->zip ?? '';
$shipment->Receiver->Postfiliale->Origin = Country::Create($json->country ?? 'DE', $json->state);
break;
+ case 3:
+ $shipment->Receiver->Address = new ReceiverNativeAddress();
+
+ $shipment->Receiver->name1 = $json->name;
+ $shipment->Receiver->Address->name2 = $json->contact_name;
+
+ $shipment->Receiver->Address->streetName = $json->street ?? '';
+ $shipment->Receiver->Address->streetNumber = $json->streetnumber;
+ $shipment->Receiver->Address->city = $json->city ?? '';
+ $shipment->Receiver->Address->zip = $json->zip ?? '';
+ $shipment->Receiver->Address->Origin = Country::Create($json->country ?? 'DE', $json->state);
+ if (isset($json->address2) && !empty($json->address2))
+ $shipment->Receiver->Address->addressAddition[] = $json->address2;
+ break;
}
$shipment->Receiver->Communication = new Communication();
$shipment->Receiver->Communication->email = $json->email;
diff --git a/www/lib/versandarten/sendcloud.php b/www/lib/versandarten/sendcloud.php
index cdda1cce..172a3116 100644
--- a/www/lib/versandarten/sendcloud.php
+++ b/www/lib/versandarten/sendcloud.php
@@ -82,8 +82,18 @@ class Versandart_sendcloud extends Versanddienstleister
$parcel->ShippingMethodId = $json->product;
$parcel->Name = $json->name;
switch ($json->addresstype) {
- case 0:
- $parcel->CompanyName = trim("$json->name2 $json->name3");
+ case 0:
+ $parcel->CompanyName = $json->company_name;
+ $parcel->Name = join(
+ ';',
+ array_filter(
+ [
+ $json->contact_name,
+ $json->company_division
+ ],
+ fn(string $item) => !empty(trim($item))
+ )
+ );
$parcel->Address = $json->street;
$parcel->Address2 = $json->address2;
$parcel->HouseNumber = $json->streetnumber;
@@ -98,6 +108,23 @@ class Versandart_sendcloud extends Versanddienstleister
$parcel->Address = "Postfiliale";
$parcel->HouseNumber = $json->postofficeNumber;
break;
+ case 3:
+ $parcel->Name = join(
+ ';',
+ array_filter(
+ [
+ $json->name,
+ $json->contact_name
+ ],
+ fn(string $item) => !empty(trim($item))
+ )
+ );
+
+ $parcel->Address = $json->street;
+ $parcel->Address2 = $json->address2;
+ $parcel->HouseNumber = $json->streetnumber;
+ break;
+
}
$parcel->Country = $json->country;
$parcel->PostalCode = $json->zip;
@@ -164,4 +191,4 @@ class Versandart_sendcloud extends Versanddienstleister
}
-}
\ No newline at end of file
+}