Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision be776964

Von Niclas Zimmermann vor mehr als 11 Jahren hinzugefügt

  • ID be776964b83340e69fa2f02eae59b703c0c95b88
  • Vorgänger 6d06b178
  • Nachfolger 014161b8

Nutzung der Tabelle currencies

Dieser Commmit passt den Code an, um die Tabelle currencies zu nutzen.

Unterschiede anzeigen:

SL/AM.pm
1060 1060
  my %accnos;
1061 1061
  map { ($accnos{$_}) = split(m/--/, $form->{$_}) } qw(inventory_accno income_accno expense_accno fxgain_accno fxloss_accno ar_paid_accno);
1062 1062

  
1063
  $form->{curr}  =~ s/ //g;
1064
  my @currencies =  grep { $_ ne '' } split m/:/, $form->{curr};
1065
  my $currency   =  join ':', @currencies;
1066

  
1067 1063
  # these defaults are database wide
1068 1064

  
1069 1065
  my $query =
......
1087 1083
        assemblynumber     = ?,
1088 1084
        sdonumber          = ?,
1089 1085
        pdonumber          = ?,
1090
        curr               = ?,
1091 1086
        businessnumber     = ?,
1092 1087
        weightunit         = ?,
1093 1088
        language_id        = ?|;
......
1100 1095
                $form->{articlenumber},   $form->{servicenumber},
1101 1096
                $form->{assemblynumber},
1102 1097
                $form->{sdonumber},       $form->{pdonumber},
1103
                $currency,
1104 1098
                $form->{businessnumber},  $form->{weightunit},
1105 1099
                conv_i($form->{language_id}));
1106 1100
  do_query($form, $dbh, $query, @values);
1107 1101

  
1102
  $main::lxdebug->message(0, "es gibt rowcount: " . $form->{rowcount});
1103

  
1104
  for my $i (1..$form->{rowcount}) {
1105
    if ($form->{"curr_$i"} ne $form->{"old_curr_$i"}) {
1106
      $query = qq|UPDATE currencies SET curr = '| . $form->{"curr_$i"} . qq|' WHERE curr = '| . $form->{"old_curr_$i"} . qq|'|;
1107
      do_query($form, $dbh, $query);
1108
    }
1109
  }
1110

  
1111
  if (length($form->{new_curr}) > 0) {
1112
    $query = qq|INSERT INTO currencies (curr) VALUES ('| . $form->{new_curr} . qq|')|;
1113
    do_query($form, $dbh, $query);
1114
  }
1115

  
1108 1116
  $dbh->commit();
1109 1117

  
1110 1118
  $main::lxdebug->leave_sub();
......
1118 1126

  
1119 1127
  my $dbh = $form->get_standard_dbh($myconfig);
1120 1128

  
1121
  my ($currency, $businessnumber) = selectrow_query($form, $dbh, qq|SELECT curr, businessnumber FROM defaults|);
1129
  my ($businessnumber) = selectrow_query($form, $dbh, qq|SELECT businessnumber FROM defaults|);
1122 1130

  
1123 1131
  # update name
1124 1132
  my $query = qq|UPDATE employee SET name = ? WHERE login = ?|;
......
1126 1134

  
1127 1135
  my $rc = $dbh->commit();
1128 1136

  
1129
  # save first currency in myconfig
1130
  $currency               =~ s/:.*//;
1131
  $form->{currency}       =  $currency;
1132

  
1133 1137
  $form->{businessnumber} =  $businessnumber;
1134 1138

  
1135 1139
  $myconfig = User->new(login => $form->{login});

Auch abrufbar als: Unified diff