diff --git a/upgrade/data/db_schema.json b/upgrade/data/db_schema.json index 649133a0..398095db 100644 --- a/upgrade/data/db_schema.json +++ b/upgrade/data/db_schema.json @@ -44257,6 +44257,17 @@ "Extra": "", "Privileges": "select,insert,update,references", "Comment": "" + }, + { + "Field": "rechnung_smarty_template", + "Type": "int(11)", + "Collation": null, + "Null": "NO", + "Key": "", + "Default": "0", + "Extra": "", + "Privileges": "select,insert,update,references", + "Comment": "" } ], "keys": [ @@ -80276,6 +80287,17 @@ "Extra": "", "Privileges": "select,insert,update,references", "Comment": "" + }, + { + "Field": "rechnung_smarty_template", + "Type": "int(11)", + "Collation": null, + "Null": "NO", + "Key": "", + "Default": "0", + "Extra": "", + "Privileges": "select,insert,update,references", + "Comment": "" } ], "keys": [ @@ -86184,6 +86206,17 @@ "Extra": "", "Privileges": "select,insert,update,references", "Comment": "" + }, + { + "Field": "erechnung", + "Type": "int(1)", + "Collation": null, + "Null": "YES", + "Key": "", + "Default": "0", + "Extra": "", + "Privileges": "select,insert,update,references", + "Comment": "" } ], "keys": [ diff --git a/www/pages/content/gruppen_edit.tpl b/www/pages/content/gruppen_edit.tpl index f0738929..5634aff5 100644 --- a/www/pages/content/gruppen_edit.tpl +++ b/www/pages/content/gruppen_edit.tpl @@ -68,6 +68,14 @@ + + + + {|Smarty Template für XML-Rechnung|}: + + + + diff --git a/www/pages/gruppen.php b/www/pages/gruppen.php index 41b52b5c..4cbc1c6d 100644 --- a/www/pages/gruppen.php +++ b/www/pages/gruppen.php @@ -150,6 +150,7 @@ class Gruppen { // Add checks here $input['projekt'] = $this->app->erp->ReplaceProjekt(true,$input['projekt'],true); // Parameters: Target db?, value, from form? + $input['rechnung_smarty_template'] = $this->app->erp->ReplaceSmartyTemplate(true,$input['rechnung_smarty_template'],true); $columns = "id, "; $values = "$id, "; @@ -186,7 +187,7 @@ class Gruppen { // 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"); + $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.rechnung_smarty_template, g.id FROM gruppen g"." WHERE id=$id"); foreach ($result[0] as $key => $value) { $this->app->Tpl->Set(strtoupper($key), $value); @@ -197,7 +198,7 @@ class Gruppen { } else { } - + /* * Add displayed items later * @@ -209,20 +210,21 @@ class Gruppen { $this->app->YUI->AutoComplete("artikel", "artikelnummer"); */ - - $this->app->YUI->AutoComplete("kennziffer", "gruppekennziffer"); - + + $this->app->YUI->AutoComplete("rechnung_smarty_template","smarty_template",1); + $this->app->Tpl->Set('RECHNUNG_SMARTY_TEMPLATE', $this->app->erp->ReplaceSmartyTemplate(false,$gruppen_from_db['rechnung_smarty_template'],false)); + if ($gruppen_from_db['art'] != 'preisgruppe') { - $this->app->Tpl->Set('PREISGRUPPEHIDDEN','hidden'); + $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)); @@ -239,83 +241,84 @@ class Gruppen { //$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'); - + $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'); + $input['rechnung_smarty_template'] = $this->app->Secure->GetPOST('rechnung_smarty_template'); + return $input; }