diff --git a/application/Address/AddressController.php b/application/Address/AddressController.php index 05df3e272..c601d725e 100644 --- a/application/Address/AddressController.php +++ b/application/Address/AddressController.php @@ -284,6 +284,7 @@ class AddressController extends mfBaseController { } + $country_code_errors = []; $export_addresses = []; foreach($addresses as $fibu_num => $address) { @@ -300,7 +301,28 @@ class AddressController extends mfBaseController { $a["street"] = $address->street; $a["zip"] = $address->zip; $a["city"] = $address->city; - $a["countrycode"] = ($address->country) ? __($address->country, "cc") : "AT"; + if(strlen($address->country) == 2) { + $a["countrycode"] = trim($address->country); + } else { + $a["countrycode"] = "AT"; + + if(trim($address->country)) { + $acountry = strtolower(trim($address->country)); + $cc = __($acountry, "cc"); + + $this->log->debug("is $cc == cc.$acountry"); + $this->log->debug("last translation failed: ".(__last_translation_failed() ? "true" : "false")); + + if(__last_translation_failed()) { + //if($cc == "cc.".$acountry) { + $a["countrycode"] = "AT"; + // email to buchhaltung + $country_code_errors[$fibu_num] = $address; + } else { + $a["countrycode"] = $cc; + } + } + } $a["phone"] = ""; if($address->mobile) $a["phone"] = $address->mobile; if($address->phone) $a["phone"] = $address->phone; @@ -347,6 +369,19 @@ class AddressController extends mfBaseController { $export_addresses[] = $a; } + if(count($country_code_errors)) { + $msg = "Hallo,\r\n\r\ndas in thetool eingetragene Land von folgenden Kunden/Lieferanten konnte nicht in einen ISO-Code übersetzt werden:\r\n\r\n"; + foreach($country_code_errors as $fibu_num => $address) { + $msg .= "$fibu_num (".$address->getCompanyOrName()."): ".$address->country."\r\n"; + } + + $email = new Emailnotification(); + $email->setFrom(TT_OUTGOING_EMAIL, "thetool"); + $email->setTo(TT_FIBU_EMAIL_TO); + $email->setSubject("[BMD-Export] Fehlerhaftes Land"); + $email->setBody($msg); + $email->send(); + } diff --git a/lang/de.php b/lang/de.php index feef57f38..9c5e67579 100644 --- a/lang/de.php +++ b/lang/de.php @@ -32,7 +32,7 @@ $l['connected-b'] = "Rohr im Haus"; $l['created-t'] = "Erstellt"; $l['planned-t'] = "Faserplan vorhanden"; $l['assigned-t'] = "Bauauftrag zugeteilt"; -$l['passed-t'] = "Fasern im Gebäude"; +$l['passed-t'] = "Fasern im Gebaeude"; $l['connected-t'] = "Passiv erschlossen"; $l['active-t'] = "Internetprodukt aktiv"; @@ -57,10 +57,12 @@ $l['contract.relocation'] = "Umzug"; $l['contract.productchange'] = "Produktwechsel"; -$l['cc.österreich'] = "AT"; +$l['cc.oesterreich'] = "AT"; +$l['cc.oestereich'] = "AT"; $l['cc.osterreich'] = "AT"; $l['cc.oesterreich'] = "AT"; $l['cc.austria'] = "AT"; +$l['cc.at'] = "AT"; $l["cc.bulgarien"] = "BG"; $l["cc.bulgaria"] = "BG"; $l["cc.schweiz"] = "CH"; @@ -74,6 +76,11 @@ $l["cc.czech republic"] = "CZ"; $l["cc.Česká republika"] = "CZ"; $l["cc.deutschland"] = "DE"; $l["cc.germany"] = "DE"; +$l["cc.frankreich"] = "FR"; +$l["cc.france"] = "FR"; +$l["cc.francaise"] = "FR"; +$l["cc.République française"] = "FR"; +$l["cc.Republique francaise"] = "FR"; $l["cc.großbritannien"] = "GB"; $l["cc.grossbritannien"] = "GB"; $l["cc.britain"] = "GB"; @@ -81,8 +88,9 @@ $l["cc.great britain"] = "GB"; $l["cc.uk"] = "GB"; $l["cc.united kingdom"] = "GB"; $l["cc.United Kingdom of Great Britain and Northern Ireland"] = "GB"; -$l["cc.Vereinigtes Königreich"] = "GB"; -$l["cc.Vereinigtes Königreich Großbritannien und Nordirland"] = "GB"; +$l["cc.Vereinigtes Koenigreich"] = "GB"; +$l["cc.Vereinigtes Koenigreich Großbritannien und Nordirland"] = "GB"; +$l["cc.Vereinigtes Koenigreich Grossbritannien und Nordirland"] = "GB"; $l["cc.ungarn"] = "HU"; $l["cc.hungary"] = "HU"; $l["cc.irland"] = "IE"; @@ -96,6 +104,13 @@ $l["cc.nippon"] = "JP"; $l["cc.nihon"] = "JP"; $l["cc.日本"] = "JP"; $l["cc.日本国"] = "JP"; +$l["cc.luxemburg"] = "LU"; +$l["cc.großherzogtum luxemburg"] = "LU"; +$l["cc.grossherzogtum luxemburg"] = "LU"; +$l["cc.luxembourg"] = "LU"; +$l["cc.grand duchy of luxembourg"] = "LU"; +$l["cc.groussherzogtum lëtzebuerg"] = "LU"; +$l["cc.groussherzogtum letzebuerg"] = "LU"; $l["cc.niederlande"] = "NL"; $l["cc.netherlands"] = "NL"; $l["cc.nederland"] = "NL"; @@ -103,7 +118,7 @@ $l["cc.holland"] = "NL"; $l["cc.polen"] = "PL"; $l["cc.poland"] = "PL"; $l["cc.polska"] = "PL"; -$l["cc.rumänien"] = "RO"; +$l["cc.rumaenien"] = "RO"; $l["cc.rumaenien"] = "RO"; $l["cc.romania"] = "RO"; $l["cc.slowenien"] = "SL"; @@ -112,6 +127,16 @@ $l["cc.slowakei"] = "SK"; $l["cc.slovakia"] = "SK"; $l["cc.slowakische republik"] = "SK"; $l["cc.Slovak Republic"] = "SK"; - +$l["cc.Vereinigte Staaten"] = "US"; +$l["cc.Vereinigte Staaten von Amerika"] = "US"; +$l["cc.usa - vereinigte staaten"] = "US"; +$l["cc.Amerika"] = "US"; +$l["cc.US"] = "US"; +$l["cc.USA"] = "US"; +$l["cc.U.S.A."] = "US"; +$l["cc.America"] = "US"; +$l["cc.United States"] = "US"; +$l["cc.United States of America"] = "US"; +$l["cc.mm"] = "CW"; $lang['de'] = $l; \ No newline at end of file diff --git a/lib/mvcfronk/mfLayout/mfLayout.php b/lib/mvcfronk/mfLayout/mfLayout.php index 31416a252..e854a12d4 100644 --- a/lib/mvcfronk/mfLayout/mfLayout.php +++ b/lib/mvcfronk/mfLayout/mfLayout.php @@ -261,7 +261,7 @@ function mfLayoutInclude($filename, $folder = "") { global $mfLayoutPackage; if($folder) { - $folder = $fodler."/"; + $folder = $folder."/"; } $inc_path = VIEWDIR . "/" . LAYOUT_DEFAULTPACKAGE . "/" . $folder . $filename; @@ -279,10 +279,14 @@ if(!isset($lang)) { $lang = []; } +$last_translation_failed = false; + function __($_string, $prefix = null) { global $lang; + global $last_translation_failed; + $last_translation_failed = false; - $string = str_replace(["Ä","Ö","Ü"],["ä","ö","ü"] , strtolower($_string)); + $string = str_replace(["Ä","Ö","Ü","ß","ä","ö","ü","ss"], ["ae","oe","ue"], strtolower($_string)); if(!$lang) { @@ -297,6 +301,11 @@ function __($_string, $prefix = null) { if (array_key_exists($string, $lang['de'])) { return $lang['de'][$string]; } + $last_translation_failed = true; return $string; } +function __last_translation_failed() { + global $last_translation_failed; + return $last_translation_failed; +} \ No newline at end of file