X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/kivitendo-erp.git/blobdiff_plain/a1070c2d94abd46d8bba45c2a57609e59f2582a9..713a6d703c0b2806f6a1f8fafa6bc9b6554c4087:/SL/IS.pm diff --git a/SL/IS.pm b/SL/IS.pm index a24468652..367c8615f 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -37,6 +37,7 @@ package IS; use List::Util qw(max); use SL::AM; +use SL::CVar; use SL::Common; use SL::DBUtils; use SL::MoreCommon; @@ -463,6 +464,12 @@ sub customer_details { map { $form->{"dv_$_"} = $ref->{$_} } keys %$ref; } + + my $custom_variables = CVar->get_custom_variables('dbh' => $dbh, + 'module' => 'CT', + 'trans_id' => $form->{customer_id}); + map { $form->{"vc_cvar_$_->{name}"} = $_->{value} } @{ $custom_variables }; + $dbh->disconnect; $main::lxdebug->leave_sub(); @@ -1513,6 +1520,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 +1538,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);