Zeilenumbrueche entfernt und einmal locales.pl
[kivitendo-erp.git] / SL / Form.pm
index a77c302..fe9d2b8 100644 (file)
@@ -197,7 +197,7 @@ sub quote {
   my ($self, $str) = @_;
 
   if ($str && !ref($str)) {
-    $str =~ s/"/"/g;
+    $str =~ s/\"/"/g;
   }
 
   $str;
@@ -208,7 +208,7 @@ sub unquote {
   my ($self, $str) = @_;
 
   if ($str && !ref($str)) {
-    $str =~ s/"/"/g;
+    $str =~ s/"/\"/g;
   }
 
   $str;
@@ -415,26 +415,33 @@ sub parse_html_template {
   $main::lxdebug->enter_sub();
 
   my ($self, $file, $additional_params) = @_;
+  my $language;
 
-  if (-f "templates/webpages/${file}_" . $main::myconfig{"countrycode"} .
-      ".html") {
-    if ((-f ".developper") &&
+  if (!defined($main::myconfig) || !defined($main::myconfig{"countrycode"})) {
+    $language = $main::language;
+  } else {
+    $language = $main::myconfig{"countrycode"};
+  }
+
+  if (-f "templates/webpages/${file}_${language}.html") {
+    if ((-f ".developer") &&
         (-f "templates/webpages/${file}_master.html") &&
         ((stat("templates/webpages/${file}_master.html"))[9] >
-         (stat("templates/webpages/${file}_" . $main::myconfig{"countrycode"} .
-               ".html"))[9])) {
+         (stat("templates/webpages/${file}_${language}.html"))[9])) {
       my $info = "Developper information: templates/webpages/${file}_master.html is newer than the localized version.\n" .
-        "Please re-run 'locales.pl' in 'locale/" . $main::myconfig{"countrycode"} . "'.";
+        "Please re-run 'locales.pl' in 'locale/${language}'.";
       print(qq|<pre>$info</pre>|);
       die($info);
     }
 
-    $file = "templates/webpages/${file}_" . $main::myconfig{"countrycode"} .
-      ".html";
+    $file = "templates/webpages/${file}_${language}.html";
   } elsif (-f "templates/webpages/${file}.html") {
     $file = "templates/webpages/${file}.html";
   } else {
-    $self->error("Web page template '${file}' not found.");
+    my $info = "Web page template '${file}' not found.\n" .
+      "Please re-run 'locales.pl' in 'locale/${language}'.";
+    print(qq|<pre>$info</pre>|);
+    die($info);
   }
 
   my $template = HTML::Template->new("filename" => $file,
@@ -685,7 +692,7 @@ sub parse_amount {
   }
 
   if ($myconfig->{numberformat} eq "1'000.00") {
-    $amount =~ s/'//g;
+    $amount =~ s/\'//g;
   }
 
   $amount =~ s/,//g;