Revision ba6a1366
Von Niclas Zimmermann vor mehr als 11 Jahren hinzugefügt
SL/AM.pm | ||
---|---|---|
1103 | 1103 |
|
1104 | 1104 |
for my $i (1..$form->{rowcount}) { |
1105 | 1105 |
if ($form->{"curr_$i"} ne $form->{"old_curr_$i"}) { |
1106 |
$query = qq|UPDATE currencies SET name = '| . $form->{"curr_$i"} . qq|' WHERE name = '| . $form->{"old_curr_$i"} . qq|'|;
|
|
1107 |
do_query($form, $dbh, $query); |
|
1106 |
$query = qq|UPDATE currencies SET name = ? WHERE name = ?|;
|
|
1107 |
do_query($form, $dbh, $query, $form->{"curr_$i"}, $form->{"old_curr_$i"});
|
|
1108 | 1108 |
} |
1109 | 1109 |
} |
1110 | 1110 |
|
1111 | 1111 |
if (length($form->{new_curr}) > 0) { |
1112 |
$query = qq|INSERT INTO currencies (name) VALUES ('| . $form->{new_curr} . qq|')|;
|
|
1113 |
do_query($form, $dbh, $query); |
|
1112 |
$query = qq|INSERT INTO currencies (name) VALUES (?)|;
|
|
1113 |
do_query($form, $dbh, $query, $form->{new_curr});
|
|
1114 | 1114 |
} |
1115 | 1115 |
|
1116 | 1116 |
$dbh->commit(); |
... | ... | |
1292 | 1292 |
$sth->finish; |
1293 | 1293 |
|
1294 | 1294 |
#Get currencies: |
1295 |
$query = qq|SELECT name AS curr FROM currencies ORDER BY id|; |
|
1296 |
|
|
1297 |
$form->{CURRENCIES} = []; |
|
1298 |
|
|
1299 |
$sth = prepare_execute_query($form, $dbh, $query); |
|
1300 |
$sth->execute || $form->dberror($query); |
|
1301 |
while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { |
|
1302 |
push @{ $form->{ CURRENCIES } } , $ref; |
|
1303 |
} |
|
1304 |
$sth->finish; |
|
1295 |
$query = qq|SELECT name AS curr FROM currencies ORDER BY id|; |
|
1296 |
$form->{CURRENCIES} = selectall_hashref_query($form, $dbh, $query); |
|
1305 | 1297 |
|
1306 | 1298 |
#Which of them is the default currency? |
1307 | 1299 |
$query = qq|SELECT name AS defaultcurrency FROM currencies WHERE id = (SELECT currency_id FROM defaults LIMIT 1);|; |
1308 |
$sth = $dbh->prepare($query); |
|
1309 |
$sth->execute || $form->dberror($query); |
|
1310 |
|
|
1311 |
$form->{defaultcurrency} = ($sth->fetchrow_hashref("NAME_lc"))->{defaultcurrency}; |
|
1312 |
|
|
1313 |
$sth->finish; |
|
1300 |
($form->{defaultcurrency}) = selectrow_query($form, $dbh, $query); |
|
1314 | 1301 |
|
1315 | 1302 |
$dbh->disconnect; |
1316 | 1303 |
|
Auch abrufbar als: Unified diff
Verbesserung Lesbarkeit von Code
Dieser Commit verbessert noch an Stellen, die Währungen betreffen,
die Lesbarkeit des Codes.