Revision d331a3d7
Von Niclas Zimmermann vor mehr als 11 Jahren hinzugefügt
SL/AM.pm | ||
---|---|---|
1063 | 1063 |
my %accnos; |
1064 | 1064 |
map { ($accnos{$_}) = split(m/--/, $form->{$_}) } qw(inventory_accno income_accno expense_accno fxgain_accno fxloss_accno ar_paid_accno); |
1065 | 1065 |
|
1066 |
$form->{curr} =~ s/ //g; |
|
1067 |
my @currencies = grep { $_ ne '' } split m/:/, $form->{curr}; |
|
1068 |
my $currency = join ':', @currencies; |
|
1069 |
|
|
1070 | 1066 |
# these defaults are database wide |
1071 | 1067 |
|
1072 | 1068 |
my $query = |
... | ... | |
1089 | 1085 |
servicenumber = ?, |
1090 | 1086 |
sdonumber = ?, |
1091 | 1087 |
pdonumber = ?, |
1092 |
curr = ?, |
|
1093 | 1088 |
businessnumber = ?, |
1094 | 1089 |
weightunit = ?, |
1095 | 1090 |
language_id = ?|; |
... | ... | |
1101 | 1096 |
$form->{customernumber}, $form->{vendornumber}, |
1102 | 1097 |
$form->{articlenumber}, $form->{servicenumber}, |
1103 | 1098 |
$form->{sdonumber}, $form->{pdonumber}, |
1104 |
$currency, |
|
1105 | 1099 |
$form->{businessnumber}, $form->{weightunit}, |
1106 | 1100 |
conv_i($form->{language_id})); |
1107 | 1101 |
do_query($form, $dbh, $query, @values); |
1108 | 1102 |
|
1103 |
$main::lxdebug->message(0, "es gibt rowcount: " . $form->{rowcount}); |
|
1104 |
|
|
1105 |
for my $i (1..$form->{rowcount}) { |
|
1106 |
if ($form->{"curr_$i"} ne $form->{"old_curr_$i"}) { |
|
1107 |
$query = qq|UPDATE currencies SET curr = '| . $form->{"curr_$i"} . qq|' WHERE curr = '| . $form->{"old_curr_$i"} . qq|'|; |
|
1108 |
do_query($form, $dbh, $query); |
|
1109 |
} |
|
1110 |
} |
|
1111 |
|
|
1112 |
if (length($form->{new_curr}) > 0) { |
|
1113 |
$query = qq|INSERT INTO currencies (curr) VALUES ('| . $form->{new_curr} . qq|')|; |
|
1114 |
do_query($form, $dbh, $query); |
|
1115 |
} |
|
1116 |
|
|
1109 | 1117 |
$dbh->commit(); |
1110 | 1118 |
|
1111 | 1119 |
$main::lxdebug->leave_sub(); |
... | ... | |
1119 | 1127 |
|
1120 | 1128 |
my $dbh = $form->get_standard_dbh($myconfig); |
1121 | 1129 |
|
1122 |
my ($currency, $businessnumber) = selectrow_query($form, $dbh, qq|SELECT curr, businessnumber FROM defaults|);
|
|
1130 |
my ($businessnumber) = selectrow_query($form, $dbh, qq|SELECT businessnumber FROM defaults|);
|
|
1123 | 1131 |
|
1124 | 1132 |
# update name |
1125 | 1133 |
my $query = qq|UPDATE employee SET name = ? WHERE login = ?|; |
... | ... | |
1127 | 1135 |
|
1128 | 1136 |
my $rc = $dbh->commit(); |
1129 | 1137 |
|
1130 |
# save first currency in myconfig |
|
1131 |
$currency =~ s/:.*//; |
|
1132 |
$form->{currency} = $currency; |
|
1133 |
|
|
1134 | 1138 |
$form->{businessnumber} = $businessnumber; |
1135 | 1139 |
|
1136 | 1140 |
$myconfig = User->new(login => $form->{login}); |
Auch abrufbar als: Unified diff
Nutzung der Tabelle currencies
Dieser Commmit passt den Code an, um die Tabelle currencies zu nutzen.