X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=inline;f=SL%2FIS.pm;h=7ff850039eea8e1a4aa282c4a09ca1e1cf380688;hb=98056ff901abcbbbcf3f0499c3149056628631e8;hp=bbf53e31ac3b203a5aaf3149b7e70c00bb6b38ad;hpb=0a64ac3db8c430756ab6260399816714e44ec16d;p=kivitendo-erp.git diff --git a/SL/IS.pm b/SL/IS.pm index bbf53e31a..7ff850039 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -664,6 +664,13 @@ sub customer_details { 'trans_id' => $form->{customer_id}); map { $form->{"vc_cvar_$_->{name}"} = $_->{value} } @{ $custom_variables }; + if ($form->{cp_id}) { + $custom_variables = CVar->get_custom_variables(dbh => $dbh, + module => 'Contacts', + trans_id => $form->{cp_id}); + $form->{"cp_cvar_$_->{name}"} = $_->{value} for @{ $custom_variables }; + } + $form->{cp_greeting} = GenericTranslations->get('dbh' => $dbh, 'translation_type' => 'greetings::' . ($form->{cp_gender} eq 'f' ? 'female' : 'male'), 'language_id' => $language_id, @@ -2130,6 +2137,11 @@ sub get_customer { my $payment_id; # get customer + my $where = ''; + if ($cid) { + $where .= 'AND c.id = ?'; + push @values, $cid; + } $query = qq|SELECT c.id AS customer_id, c.name AS customer, c.discount as customer_discount, c.creditlimit, @@ -2141,8 +2153,7 @@ sub get_customer { FROM customer c LEFT JOIN business b ON (b.id = c.business_id) LEFT JOIN currencies cu ON (c.currency_id=cu.id) - WHERE c.id = ?|; - push @values, $cid; + WHERE 1 = 1 $where|; $ref = selectfirst_hashref_query($form, $dbh, $query, @values); delete $ref->{salesman_id} if !$ref->{salesman_id};