X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=SL%2FIS.pm;h=8ecddffde5082fbea0bfc486668ddc0d3e12f8d3;hb=baba1fe94140984bd580ad34df31e8524c822c99;hp=a244686525c630c9f13b6cf4756254c62718ddca;hpb=a1070c2d94abd46d8bba45c2a57609e59f2582a9;p=kivitendo-erp.git diff --git a/SL/IS.pm b/SL/IS.pm index a24468652..8ecddffde 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -1513,6 +1513,12 @@ sub get_customer { } my $cid = conv_i($form->{customer_id}); + my $payment_id; + + if ($form->{payment_id}) { + $payment_id = "(pt.id = ?) OR"; + push @values, conv_i($form->{payment_id}); + } # get customer $query = @@ -1525,7 +1531,7 @@ sub get_customer { b.discount AS tradediscount, b.description AS business FROM customer c LEFT JOIN business b ON (b.id = c.business_id) - LEFT JOIN payment_terms pt ON (($form->{payment_id} = pt.id) OR (c.payment_id = pt.id)) + LEFT JOIN payment_terms pt ON ($payment_id (c.payment_id = pt.id)) WHERE c.id = ?|; push @values, $cid; $ref = selectfirst_hashref_query($form, $dbh, $query, @values);