X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FLocale.pm;h=d6ac18157239733e8d08b135b4340e9b79ee4c6c;hb=c9e93ded8a5ca6f8a9212c5e64a99616889b5aac;hp=0b535d74036ca6e52646bffa0996ea517bff3560;hpb=eb0c10b0a09da8ff4590c3043a9fa6dd10775ee4;p=kivitendo-erp.git diff --git a/SL/Locale.pm b/SL/Locale.pm index 0b535d740..d6ac18157 100644 --- a/SL/Locale.pm +++ b/SL/Locale.pm @@ -42,6 +42,8 @@ use SL::LXDebug; use SL::Common; use SL::Inifile; +use strict; + sub new { $main::lxdebug->enter_sub(); @@ -66,9 +68,12 @@ sub _init { my $country = shift; my $NLS_file = shift; + $self->{charset} = Common::DEFAULT_CHARSET; + $self->{countrycode} = $country; + $self->{NLS_file} = $NLS_file; + if ($country && -d "locale/$country") { local *IN; - $self->{countrycode} = $country; if (open(IN, "<", "locale/$country/$NLS_file")) { my $code = join("", ); eval($code); @@ -80,23 +85,18 @@ sub _init { close IN; chomp $self->{charset}; - - } else { - $self->{charset} = Common::DEFAULT_CHARSET; } + } - my $db_charset = $main::dbcharset || Common::DEFAULT_CHARSET; - - $self->{iconv} = Text::Iconv->new($self->{charset}, $db_charset); - $self->{iconv_reverse} = Text::Iconv->new($db_charset, $self->{charset}); - $self->{iconv_english} = Text::Iconv->new('ASCII', $db_charset); - $self->{iconv_iso8859} = Text::Iconv->new('ISO-8859-15', $db_charset); - $self->{iconv_to_iso8859} = Text::Iconv->new($db_charset, 'ISO-8859-15'); + my $db_charset = $main::dbcharset || Common::DEFAULT_CHARSET; - $self->_read_special_chars_file($country); - } + $self->{iconv} = Text::Iconv->new($self->{charset}, $db_charset); + $self->{iconv_reverse} = Text::Iconv->new($db_charset, $self->{charset}); + $self->{iconv_english} = Text::Iconv->new('ASCII', $db_charset); + $self->{iconv_iso8859} = Text::Iconv->new('ISO-8859-15', $db_charset); + $self->{iconv_to_iso8859} = Text::Iconv->new($db_charset, 'ISO-8859-15'); - $self->{NLS_file} = $NLS_file; + $self->_read_special_chars_file($country); push @{ $self->{LONG_MONTH} }, ("January", "February", "March", "April", @@ -215,7 +215,7 @@ sub findsub { if (exists $self->{subs}{$text_rev}) { $text = $self->{subs}{$text_rev}; } elsif ($self->{countrycode} && $self->{NLS_file}) { - Form->error("$text not defined in locale/$self->{countrycode}/$self->{NLS_file}"); + $main::form->error("$text not defined in locale/$self->{countrycode}/$self->{NLS_file}"); } $main::lxdebug->leave_sub(); @@ -231,6 +231,8 @@ sub date { my $longdate = ""; my $longmonth = ($longformat) ? 'LONG_MONTH' : 'SHORT_MONTH'; + my ($spc, $yy, $mm, $dd); + if ($date) { # get separator @@ -304,6 +306,7 @@ sub parse_date { $main::lxdebug->enter_sub(); my ($self, $myconfig, $date, $longformat) = @_; + my ($spc, $yy, $mm, $dd); unless ($date) { $main::lxdebug->leave_sub();