Revision a4d74009
Von Niclas Zimmermann vor mehr als 11 Jahren hinzugefügt
SL/CP.pm | ||
---|---|---|
149 | 149 |
my $arap = $form->{arap} eq "ar" ? "ar" : "ap"; |
150 | 150 |
|
151 | 151 |
my $query = |
152 |
qq|SELECT a.id, a.invnumber, a.transdate, a.amount, a.paid, cu.curr | . |
|
152 |
qq|SELECT a.id, a.invnumber, a.transdate, a.amount, a.paid, cu.name AS curr | .
|
|
153 | 153 |
qq|FROM $arap a | . |
154 |
qq|LEFT JOIN currencies cu ON (cu.id=a.curr)| . |
|
155 |
qq|WHERE (a.${vc}_id = ?) AND cu.curr = ? AND NOT (a.amount = a.paid)| .
|
|
154 |
qq|LEFT JOIN currencies cu ON (cu.id=a.currency_id)| .
|
|
155 |
qq|WHERE (a.${vc}_id = ?) AND cu.name = ? AND NOT (a.amount = a.paid)| .
|
|
156 | 156 |
qq|ORDER BY a.id|; |
157 | 157 |
my $sth = prepare_execute_query($form, $dbh, $query, |
158 | 158 |
conv_i($form->{"${vc}_id"}), |
... | ... | |
174 | 174 |
SELECT COUNT(*) |
175 | 175 |
FROM $arap |
176 | 176 |
WHERE (${vc}_id = ?) |
177 |
AND ((SELECT cu.curr FROM currencies cu WHERE cu.id=${arap}.curr) <> ?)
|
|
177 |
AND ((SELECT cu.name FROM currencies cu WHERE cu.id=${arap}.currency_id) <> ?)
|
|
178 | 178 |
AND (amount <> paid) |
179 | 179 |
SQL |
180 | 180 |
($form->{openinvoices_other_currencies}) = selectfirst_array_query($form, $dbh, $query, conv_i($form->{"${vc}_id"}), "$form->{currency}"); |
... | ... | |
250 | 250 |
qq|SELECT $buysell | . |
251 | 251 |
qq|FROM exchangerate e | . |
252 | 252 |
qq|JOIN ${arap} a ON (a.transdate = e.transdate) | . |
253 |
qq|WHERE (e.curr = (SELECT id FROM currencies WHERE curr = ?)) AND (a.id = ?)|;
|
|
253 |
qq|WHERE (e.currency_id = (SELECT id FROM currencies WHERE name = ?)) AND (a.id = ?)|;
|
|
254 | 254 |
my ($exchangerate) = |
255 | 255 |
selectrow_query($form, $dbh, $query, |
256 | 256 |
$form->{currency}, $form->{"id_$i"}); |
Auch abrufbar als: Unified diff
Verbesserungen in Upgrade-Scripten
In den Scripten currencies.pl rm_whitespaces wurden einige Ver-
besserungen durchgeführt:
1. Umbenennung von Spalten curr in currency_id in allen Tabellen
außer currencies.
2. Umbenennung von Spalte curr in name in Tabelle currencies.
3. Update in rm_whitespaces wird jetzt in einer Schleife erledigt
anstatt für jede Tabelle eigenen Code zu schreiben.
4. Tabelle currencies hat jetzt id als Primärschlüssel und nicht
mehr curr.
Die oben aufgeführten Änderungen führen natürlich auch zu notwendigen
Änderungen im Programm, welche dieses Commit ebenfalls enthält.