X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FCP.pm;h=f6c8c1a8ebec0e76c72b05ce6a205af59e72cd58;hb=cc042e07ef78786b758b22cee75509815e59ba5b;hp=64fd988c5de903d445fddb449e6539c8667085c2;hpb=c09536f461b4933a1813b2af5e17eb6214f7bf38;p=kivitendo-erp.git diff --git a/SL/CP.pm b/SL/CP.pm index 64fd988c5..f6c8c1a8e 100644 --- a/SL/CP.pm +++ b/SL/CP.pm @@ -160,16 +160,14 @@ sub get_openinvoices { my $buysell = $form->{vc} eq 'customer' ? "buy" : "sell"; my $arap = $form->{arap} eq "ar" ? "ar" : "ap"; - my $curr_null = $form->{curreny} ? '' : ' OR a.curr IS NULL'; # fix: after sql-injection fix, curr is inserted as NULL, before that as '' - my $query = qq|SELECT a.id, a.invnumber, a.transdate, a.amount, a.paid, a.curr | . qq|FROM $arap a | . - qq|WHERE (a.${vc}_id = ?) AND (a.curr = ? $curr_null) AND NOT (a.amount = paid)| . + qq|WHERE (a.${vc}_id = ?) AND (COALESCE(a.curr, '') = ?) AND NOT (a.amount = a.paid)| . qq|ORDER BY a.id|; my $sth = prepare_execute_query($form, $dbh, $query, conv_i($form->{"${vc}_id"}), - $form->{currency}); + "$form->{currency}"); $form->{PR} = []; while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { @@ -182,6 +180,16 @@ sub get_openinvoices { } $sth->finish; + + $query = < ?) + AND (amount <> paid) +SQL + ($form->{openinvoices_other_currencies}) = selectfirst_array_query($form, $dbh, $query, conv_i($form->{"${vc}_id"}), "$form->{currency}"); + $dbh->disconnect; $main::lxdebug->leave_sub(); @@ -358,14 +366,11 @@ sub process_payment { } } - # record a AR/AP with a payment - if ($form->round_amount($paymentamount, 2) > 0) { - $form->{invnumber} = ""; - OP::overpayment("", $myconfig, $form, $dbh, $paymentamount, $ml, 1); - } - my $rc; if ($form->round_amount($paymentamount, 2) < 0) { + # Hier werden negativen Zahlungseingänge abgefangen + # Besser: in Oberfläche schon prüfen + # Zahlungsein- und ausgänge sind immer positiv $dbh->rollback; $rc = 0; }