Zeilenumbrueche entfernt und einmal locales.pl
[kivitendo-erp.git] / SL / Form.pm
index 90f4120..fe9d2b8 100644 (file)
@@ -143,7 +143,6 @@ sub new {
   $self->{action} =~ s/( |-|,|#)/_/g;
 
   $self->{version}   = "2.2.0";
-  $self->{dbversion} = "2.2.0";
 
   $main::lxdebug->leave_sub();
 
@@ -198,7 +197,7 @@ sub quote {
   my ($self, $str) = @_;
 
   if ($str && !ref($str)) {
-    $str =~ s/"/"/g;
+    $str =~ s/\"/"/g;
   }
 
   $str;
@@ -209,7 +208,7 @@ sub unquote {
   my ($self, $str) = @_;
 
   if ($str && !ref($str)) {
-    $str =~ s/"/"/g;
+    $str =~ s/"/\"/g;
   }
 
   $str;
@@ -416,15 +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") {
-    $file = "templates/webpages/${file}_" . $main::myconfig{"countrycode"} .
-      ".html";
+  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}_${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/${language}'.";
+      print(qq|<pre>$info</pre>|);
+      die($info);
+    }
+
+    $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,
@@ -675,7 +692,7 @@ sub parse_amount {
   }
 
   if ($myconfig->{numberformat} eq "1'000.00") {
-    $amount =~ s/'//g;
+    $amount =~ s/\'//g;
   }
 
   $amount =~ s/,//g;