RETROTEC-AG/OpenXE#17 Locale des GUI-Users ermitteln
Sprache in den Usereinstellungen speichern
This commit is contained in:
parent
a18a139e64
commit
c258166bcb
|
|
@ -75,7 +75,7 @@ class FiskalyTransferService
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* @return Transaction
|
* @return Transaction
|
||||||
*
|
*
|
||||||
* @depracated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public function createTransactionFromSingleJournal(
|
public function createTransactionFromSingleJournal(
|
||||||
int $cashierId,
|
int $cashierId,
|
||||||
|
|
@ -270,7 +270,7 @@ class FiskalyTransferService
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* @return Transaction
|
* @return Transaction
|
||||||
*
|
*
|
||||||
* @depracated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public function transferPosSession($posSession): Transaction
|
public function transferPosSession($posSession): Transaction
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -475,8 +475,11 @@ class User
|
||||||
return $this->cache[$cacheKey]['name'];
|
return $this->cache[$cacheKey]['name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
|
* @deprecated Eine Liste der verfügbaren Sprachen sollte IMHO zentral im Übersetzer generiert werden.
|
||||||
*/
|
*/
|
||||||
public function GetSprachen()
|
public function GetSprachen()
|
||||||
{
|
{
|
||||||
|
|
@ -506,14 +509,19 @@ class User
|
||||||
return $defaultLanguages;
|
return $defaultLanguages;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function GetSprache()
|
|
||||||
{
|
|
||||||
$sprachen = $this->GetSprachen();
|
|
||||||
|
|
||||||
return reset($sprachen);
|
|
||||||
|
/**
|
||||||
|
* Die vom User gewählte Sprache zurückgeben.
|
||||||
|
* Null, falls die Sprache nicht erkannt wird.
|
||||||
|
*
|
||||||
|
* @return string|null
|
||||||
|
*/
|
||||||
|
public function GetSprache(): string|null
|
||||||
|
{
|
||||||
|
return \Xentral\Components\I18n\Bootstrap::findLanguage(
|
||||||
|
strval($this->GetField('sprachebevorzugen'))
|
||||||
|
)[Xentral\Components\I18n\Iso639\Key::DEFAULT];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -12131,14 +12131,14 @@ function SendPaypalFromAuftrag($auftrag, $test = false)
|
||||||
$this->app->Tpl->Add($target, $html);
|
$this->app->Tpl->Add($target, $html);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**@deprected**/
|
/**@deprecated**/
|
||||||
function HelpIcon()
|
function HelpIcon()
|
||||||
{
|
{
|
||||||
$module = $this->app->Secure->GetGET("module");
|
$module = $this->app->Secure->GetGET("module");
|
||||||
$action = $this->app->Secure->GetGET("action");
|
$action = $this->app->Secure->GetGET("action");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**@deprected**/
|
/**@deprecated**/
|
||||||
function PrinterIcon()
|
function PrinterIcon()
|
||||||
{
|
{
|
||||||
// $this->app->Tpl->Add('TABSPRINT'," <a style=\"color:white;font-size:9pt\" href=\"#\" onclick=\"wawisionPrint();\"><img src=\"./themes/new/images/icons_druck.png\" height=\"18\"></a>");
|
// $this->app->Tpl->Add('TABSPRINT'," <a style=\"color:white;font-size:9pt\" href=\"#\" onclick=\"wawisionPrint();\"><img src=\"./themes/new/images/icons_druck.png\" height=\"18\"></a>");
|
||||||
|
|
@ -13856,7 +13856,7 @@ function SendPaypalFromAuftrag($auftrag, $test = false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**@depreacated */
|
/**@deprecated */
|
||||||
function CheckSamePage()
|
function CheckSamePage()
|
||||||
{
|
{
|
||||||
$id = $this->app->Secure->GetGET("id");
|
$id = $this->app->Secure->GetGET("id");
|
||||||
|
|
@ -13868,7 +13868,7 @@ function SendPaypalFromAuftrag($auftrag, $test = false)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @depreacated
|
* @deprecated
|
||||||
* @refactor Artikel Modul
|
* @refactor Artikel Modul
|
||||||
*/
|
*/
|
||||||
function SeitenSperrAuswahl($ueberschrift,$meldung)
|
function SeitenSperrAuswahl($ueberschrift,$meldung)
|
||||||
|
|
@ -13911,7 +13911,7 @@ $( this ).dialog( "close" );
|
||||||
');
|
');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**@depreacated */
|
/**@deprecated */
|
||||||
function SeitenSperrInfo($meldung)
|
function SeitenSperrInfo($meldung)
|
||||||
{
|
{
|
||||||
$this->app->Tpl->Set('SPERRMELDUNG', '$("a#inline").fancybox({
|
$this->app->Tpl->Set('SPERRMELDUNG', '$("a#inline").fancybox({
|
||||||
|
|
@ -27759,7 +27759,7 @@ function Firmendaten($field,$projekt="")
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @depracated */
|
/** @deprecated */
|
||||||
function GetPrioTicketSelect($prio)
|
function GetPrioTicketSelect($prio)
|
||||||
{
|
{
|
||||||
$prios = array('4'=>'niedrig','3'=>'normal','2'=>'hoch');
|
$prios = array('4'=>'niedrig','3'=>'normal','2'=>'hoch');
|
||||||
|
|
|
||||||
|
|
@ -2636,9 +2636,15 @@ class Firmendaten {
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Liefert einen Array aus Strings zurück. Immer mindestens 'deutsch' enthalten
|
* Liefert einen Array aus Strings zurück. Immer mindestens 'deutsch' enthalten.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
|
* @todo Sollte eventuell zusammengelegt oder in den Übersetzer verschoben werden.
|
||||||
|
* @see \Firmendaten::getLanguages()
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
private function getLanguages(){
|
private function getLanguages(){
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2820,6 +2820,18 @@ $this->app->Tpl->Add('TODOFORUSER',"<tr><td width=\"90%\">".$tmp[$i]['aufgabe'].
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Diese Funktion holt die Sprache von den Firmendaten, falls keine Sprache in $fromPost übergeben wurde.
|
||||||
|
* Sie wurde nur verwendet, um eine Vorgabe im sprachebevorzugen-SELECT beim Benutzer zu erzeugen.
|
||||||
|
* Das wird jetzt anders gelöst.
|
||||||
|
*
|
||||||
|
* @param $fromPost
|
||||||
|
*
|
||||||
|
* @return array|mixed|string|null
|
||||||
|
* @deprecated Nicht mehr benötigt
|
||||||
|
*/
|
||||||
private function getCurrentDefaultLanguage($fromPost){
|
private function getCurrentDefaultLanguage($fromPost){
|
||||||
|
|
||||||
if(empty($fromPost)){
|
if(empty($fromPost)){
|
||||||
|
|
@ -2832,28 +2844,42 @@ $this->app->Tpl->Add('TODOFORUSER',"<tr><td width=\"90%\">".$tmp[$i]['aufgabe'].
|
||||||
return $fromPost;
|
return $fromPost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Liefert einen String aus HTML-Optionen zurück
|
* Liefert einen String aus HTML-Select-Optionen zurück für die Sprachauswahl beim Benutzer.
|
||||||
* @param string $fromPost
|
*
|
||||||
|
* @param string|null $userPreferredLanguage Gewählte Sprache von den Usereinstellungen
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function languageSelectOptions($fromPost=''){
|
private function languageSelectOptions(string|null $userPreferredLanguage='') {
|
||||||
|
$select=\Xentral\Components\I18n\Bootstrap::findLanguage(strval($userPreferredLanguage))[Xentral\Components\I18n\Iso639\Key::DEFAULT];
|
||||||
$select = $this->getCurrentDefaultLanguage($fromPost);
|
if(empty($select)) {
|
||||||
|
/** @var \Xentral\Components\I18n\Localization $localization */
|
||||||
$out = "";
|
$localization=$this->app->Container->get('Localization');
|
||||||
$sprachen = $this->getLanguages();
|
$select=$localization->getLanguage();
|
||||||
|
}
|
||||||
foreach($sprachen as $sprache) {
|
$out = '';
|
||||||
$selected = (($select==$sprache) ? 'selected' : '');
|
foreach ($this->getLanguages() as $sprache) {
|
||||||
$out .= "<option value=\"$sprache\" $selected>$sprache</option>";
|
if($language=\Xentral\Components\I18n\Bootstrap::findLanguage($sprache)) {
|
||||||
|
$selected = (($select == $language[Xentral\Components\I18n\Iso639\Key::DEFAULT]) ? ' selected="selected"' : '');
|
||||||
|
$out .= "<option value=\"{$language[Xentral\Components\I18n\Iso639\Key::DEFAULT]}\"{$selected}>{$language[Xentral\Components\I18n\Iso639\Key::NAME_deu]}</option>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $out;
|
return $out;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Liefert einen Array aus Strings zurück. Immer mindestens 'deutsch' enthalten
|
* Liefert einen Array aus Strings zurück. Immer mindestens 'deutsch' enthalten.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
|
* @todo Sollte eventuell zusammengelegt oder in den Übersetzer verschoben werden.
|
||||||
|
* @see \Firmendaten::getLanguages()
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
private function getLanguages(){
|
private function getLanguages(){
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue