From cad0103b7fa7f86a4dbe82926d2038e621bff7ef Mon Sep 17 00:00:00 2001 From: OpenXE <> Date: Mon, 9 Jan 2023 17:31:40 +0100 Subject: [PATCH] Translations for documents -> fill out table uebersetzungen --- www/lib/class.erpapi.php | 29 ++- www/pages/content/uebersetzung_edit.tpl | 90 +++++++++ www/pages/content/uebersetzung_list.tpl | 10 + www/pages/uebersetzung.php | 238 ++++++++++++++++++++++++ 4 files changed, 357 insertions(+), 10 deletions(-) create mode 100644 www/pages/content/uebersetzung_edit.tpl create mode 100644 www/pages/content/uebersetzung_list.tpl create mode 100644 www/pages/uebersetzung.php diff --git a/www/lib/class.erpapi.php b/www/lib/class.erpapi.php index b1242d0d..f1c06887 100644 --- a/www/lib/class.erpapi.php +++ b/www/lib/class.erpapi.php @@ -27451,8 +27451,13 @@ function MailSendFinal($from,$from_name,$to,$to_name,$betreff,$text,$files="",$p function BeschriftungSprache($sprache='') { - $sprache = strtolower(trim($sprache)); - $this->beschriftung_sprache='deutsch'; + + if ($sprache === '') { + $this->beschriftung_sprache='deutsch'; + } else { + $this->beschriftung_sprache=strtolower(trim($sprache)); + } + } function BeschriftungStandardwerte($field,$sprache="deutsch",$getvars=false) @@ -27644,10 +27649,10 @@ function MailSendFinal($from,$from_name,$to,$to_name,$betreff,$text,$files="",$p function getUebersetzung($field, $sprache, $id = true) { - $sprach = strtolower($sprache); + $sprache = strtolower($sprache); if(empty($this->uebersetzungId)) { - $arr = $this->app->DB->SelectArr('SELECT id, label, sprache, beschriftung + $arr = $this->app->DB->SelectArr('SELECT id, label, sprache, beschriftung, original FROM uebersetzung WHERE sprache <> "" AND label <> ""'); if(!empty($arr)) @@ -27655,7 +27660,12 @@ function MailSendFinal($from,$from_name,$to,$to_name,$betreff,$text,$files="",$p foreach($arr as $row) { $this->uebersetzungId[$row['label']][strtolower($row['sprache'])] = $row['id']; - $this->uebersetzungBeschriftung[$row['label']][strtolower($row['sprache'])] = $row['beschriftung']; + + if ($row['beschriftung'] != '') { + $this->uebersetzungBeschriftung[$row['label']][strtolower($row['sprache'])] = $row['beschriftung']; + } else { + $this->uebersetzungBeschriftung[$row['label']][strtolower($row['sprache'])] = $row['original']; + } } } } @@ -27675,13 +27685,14 @@ function MailSendFinal($from,$from_name,$to,$to_name,$betreff,$text,$files="",$p function Beschriftung($field,$sprache='') { - if($sprache!='') { + + if($sprache!='') { $this->BeschriftungSprache($sprache); } if($this->beschriftung_sprache==''){ $this->beschriftung_sprache = 'deutsch'; - } + } // wenn feld mit artikel_freifeld beginnt dann freifeld draus machen //$field = str_replace('artikel_freifeld','freifeld',$field); @@ -27715,9 +27726,7 @@ function MailSendFinal($from,$from_name,$to,$to_name,$betreff,$text,$files="",$p { return $wert; } - //1. deutsches wort als standard - $wert = $this->BeschriftungDeutschesWort($field); - return $wert; + return $field; // Not found! } diff --git a/www/pages/content/uebersetzung_edit.tpl b/www/pages/content/uebersetzung_edit.tpl new file mode 100644 index 00000000..c0d4a054 --- /dev/null +++ b/www/pages/content/uebersetzung_edit.tpl @@ -0,0 +1,90 @@ +
+ diff --git a/www/pages/content/uebersetzung_list.tpl b/www/pages/content/uebersetzung_list.tpl new file mode 100644 index 00000000..7cd3c1a3 --- /dev/null +++ b/www/pages/content/uebersetzung_list.tpl @@ -0,0 +1,10 @@ +| " . " |
' AS `open`, CONCAT('') AS `auswahl`";
+ $result = $this->app->DB->SelectArr("SELECT SQL_CALC_FOUND_ROWS u.id, $dropnbox, u.label, u.beschriftung, u.sprache, u.original, u.id FROM uebersetzung u"." WHERE id=$id");
+
+ foreach ($result[0] as $key => $value) {
+ $this->app->Tpl->Set(strtoupper($key), $value);
+ }
+
+ /*
+ * Add displayed items later
+ *
+
+ $this->app->Tpl->Add('KURZUEBERSCHRIFT2', $email);
+ $this->app->Tpl->Add('EMAIL', $email);
+ $this->app->Tpl->Add('ANGEZEIGTERNAME', $angezeigtername);
+
+ */
+
+ $sprachen = $this->app->erp->GetSprachenSelect();
+
+ foreach ($sprachen as $key => $value) {
+ $this->app->Tpl->Add('SPRACHENSELECT', "");
+ }
+
+// $this->SetInput($input);
+ $this->app->Tpl->Parse('PAGE', "uebersetzung_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['label'] = $this->app->Secure->GetPOST('label');
+ $input['beschriftung'] = $this->app->Secure->GetPOST('beschriftung');
+ $input['sprache'] = $this->app->Secure->GetPOST('sprache');
+ $input['original'] = $this->app->Secure->GetPOST('original');
+
+
+ return $input;
+ }
+
+ /*
+ * Set all fields in the page corresponding to $input
+ */
+ function SetInput($input) {
+ // $this->app->Tpl->Set('EMAIL', $input['email']);
+
+ $this->app->Tpl->Set('LABEL', $input['label']);
+ $this->app->Tpl->Set('BESCHRIFTUNG', $input['beschriftung']);
+ $this->app->Tpl->Set('SPRACHE', $input['sprache']);
+ $this->app->Tpl->Set('ORIGINAL', $input['original']);
+
+ }
+
+}