Tabellenzeilen richtig einfaerben.
[kivitendo-erp.git] / SL / Form.pm
index 0d32e2d..3b683f4 100644 (file)
@@ -1210,7 +1210,7 @@ sub get_shipto {
 
 
     my $query = qq|SELECT s.* FROM shipto s
-                  WHERE s.id = $self->{shipto_id}|;
+                  WHERE s.shipto_id = $self->{shipto_id}|;
     my $sth = $dbh->prepare($query);
     $sth->execute || $self->dberror($query);
     $ref = $sth->fetchrow_hashref(NAME_lc);
@@ -1237,7 +1237,6 @@ sub add_shipto {
     }
     $self->{"shipto$item"} =~ s/\'/\'\'/g;
   }
-
   if ($shipto) {
     if ($self->{shipto_id}) {
       my $query = qq| UPDATE shipto set
@@ -1252,7 +1251,7 @@ sub add_shipto {
                       shiptophone = '$self->{shiptophone}',
                       shiptofax = '$self->{shiptofax}',
                       shiptoemail = '$self->{shiptoemail}'
-                      WHERE id = $self->{shipto_id}|;
+                      WHERE shipto_id = $self->{shipto_id}|;
       $dbh->do($query) || $self->dberror($query);
     } else {
       my $query =
@@ -1564,18 +1563,6 @@ sub language_payment {
   }
   $sth->finish;
 
-  # get adr
-  $query = qq|SELECT id, adr_description, adr_code
-              FROM adr|;
-  $sth = $dbh->prepare($query);
-  $sth->execute || $form->dberror($query);
-
-
-  $self->{ADR} = [];
-  while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
-    push @{ $self->{ADR} }, $ref;
-  }
-  $sth->finish;
   $dbh->disconnect;
   $main::lxdebug->leave_sub();
 }
@@ -2313,10 +2300,14 @@ sub new {
   my ($type, $country, $NLS_file) = @_;
   my $self = {};
 
-  %self = ();
   if ($country && -d "locale/$country") {
+    local *IN;
     $self->{countrycode} = $country;
-    eval { require "locale/$country/$NLS_file"; };
+    if (open(IN, "locale/$country/$NLS_file")) {
+      my $code = join("", <IN>);
+      eval($code);
+      close(IN);
+    }
   }
 
   $self->{NLS_file} = $NLS_file;
@@ -2336,7 +2327,7 @@ sub new {
 sub text {
   my ($self, $text) = @_;
 
-  return (exists $self{texts}{$text}) ? $self{texts}{$text} : $text;
+  return (exists $self->{texts}{$text}) ? $self->{texts}{$text} : $text;
 }
 
 sub findsub {
@@ -2344,8 +2335,8 @@ sub findsub {
 
   my ($self, $text) = @_;
 
-  if (exists $self{subs}{$text}) {
-    $text = $self{subs}{$text};
+  if (exists $self->{subs}{$text}) {
+    $text = $self->{subs}{$text};
   } else {
     if ($self->{countrycode} && $self->{NLS_file}) {
       Form->error(