Revision 26456e6e
Von Moritz Bunkus vor mehr als 14 Jahren hinzugefügt
SL/CP.pm | ||
---|---|---|
160 | 160 |
my $buysell = $form->{vc} eq 'customer' ? "buy" : "sell"; |
161 | 161 |
my $arap = $form->{arap} eq "ar" ? "ar" : "ap"; |
162 | 162 |
|
163 |
my $curr_null = $form->{curreny} ? '' : ' OR a.curr IS NULL'; # fix: after sql-injection fix, curr is inserted as NULL, before that as '' |
|
164 |
|
|
165 | 163 |
my $query = |
166 | 164 |
qq|SELECT a.id, a.invnumber, a.transdate, a.amount, a.paid, a.curr | . |
167 | 165 |
qq|FROM $arap a | . |
168 |
qq|WHERE (a.${vc}_id = ?) AND (a.curr = ? $curr_null) AND NOT (a.amount = paid)| .
|
|
166 |
qq|WHERE (a.${vc}_id = ?) AND (COALESCE(a.curr, '') = ?) AND NOT (a.amount = a.paid)| .
|
|
169 | 167 |
qq|ORDER BY a.id|; |
170 | 168 |
my $sth = prepare_execute_query($form, $dbh, $query, |
171 | 169 |
conv_i($form->{"${vc}_id"}), |
172 |
$form->{currency});
|
|
170 |
"$form->{currency}");
|
|
173 | 171 |
|
174 | 172 |
$form->{PR} = []; |
175 | 173 |
while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { |
... | ... | |
182 | 180 |
} |
183 | 181 |
|
184 | 182 |
$sth->finish; |
183 |
|
|
184 |
$query = <<SQL; |
|
185 |
SELECT COUNT(*) |
|
186 |
FROM $arap |
|
187 |
WHERE (${vc}_id = ?) |
|
188 |
AND (COALESCE(curr, '') <> ?) |
|
189 |
AND (amount <> paid) |
|
190 |
SQL |
|
191 |
($form->{openinvoices_other_currencies}) = selectfirst_array_query($form, $dbh, $query, conv_i($form->{"${vc}_id"}), "$form->{currency}"); |
|
192 |
|
|
185 | 193 |
$dbh->disconnect; |
186 | 194 |
|
187 | 195 |
$main::lxdebug->leave_sub(); |
... | ... | |
363 | 371 |
# Hier werden negativen Zahlungseingänge abgefangen |
364 | 372 |
# Besser: in Oberfläche schon prüfen |
365 | 373 |
# Zahlungsein- und ausgänge sind immer positiv |
366 |
$dbh->rollback;
|
|
374 |
$dbh->rollback; |
|
367 | 375 |
$rc = 0; |
368 | 376 |
} |
369 | 377 |
if ($form->round_amount($paymentamount, 2) == 0) { |
Auch abrufbar als: Unified diff
Bei Zahlungseingang/-ausgang Meldung anzeigen, wenn offene Rechnungen in anderen Währungen vorhanden sind
Fix für Bug 1050.