RDBO Normalisierung Part 2
[kivitendo-erp.git] / SL / Locale.pm
index 5c80083..881d592 100644 (file)
@@ -213,7 +213,7 @@ sub text {
   my $self = shift;
   my $text = shift;
 
-  if (exists $self->{texts}->{$text}) {
+  if ($self->{texts}->{$text}) {
     $text = $self->{iconv}->convert($self->{texts}->{$text});
   } else {
     $text = $self->{iconv_english}->convert($text);
@@ -240,6 +240,7 @@ sub findsub {
       $original    =~ s/_+/_/g;
 
       $translation =  lc $translation;
+      $translation =~ s/\s+/_/g;
 
       $self->{texts_reverse}->{$translation} ||= [ ];
       push @{ $self->{texts_reverse}->{$translation} }, $original;
@@ -416,6 +417,8 @@ sub format_date {
   my $dd       = shift;
   my $yy_len   = shift || 4;
 
+  ($yy, $mm, $dd) = ($yy->year, $yy->month, $yy->day) if ref $yy eq 'DateTime';
+
   $main::lxdebug->leave_sub() and return "" unless $yy && $mm && $dd;
 
   $yy = $yy % 100 if 2 == $yy_len;