X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FIS.pm;h=21bf15f74e970b23c12c588eec21b07cea2da448;hb=aacd66960ed7b1f4430c7e623e516e26cad9752d;hp=1df0eb2f9f5a320a4cc6dc243565ec65572a19a0;hpb=d51b3011755b4a7e006f433d9fe5836a22a69638;p=kivitendo-erp.git diff --git a/SL/IS.pm b/SL/IS.pm index 1df0eb2f9..21bf15f74 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -57,6 +57,7 @@ use SL::DB::Tax; use SL::DB::TaxZone; use SL::TransNumber; use SL::DB; +use SL::Presenter::Part qw(type_abbreviation classification_abbreviation); use Data::Dumper; use strict; @@ -434,7 +435,7 @@ sub invoice_details { } my $tax_rate = $taxrate * 100; push(@{ $form->{TEMPLATE_ARRAYS}->{tax_rate} }, qq|$tax_rate|); - if ($form->{"assembly_$i"}) { + if ($form->{"part_type_$i"} eq 'assembly') { $sameitem = ""; # get parts and push them onto the stack @@ -664,6 +665,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, @@ -858,9 +866,9 @@ sub _post_invoice { next if $payments_only; - if ($form->{"inventory_accno_$i"} || $form->{"assembly_$i"}) { + if ($form->{"inventory_accno_$i"} || $form->{"part_type_$i"} eq 'assembly') { - if ($form->{"assembly_$i"}) { + if ($form->{"part_type_$i"} eq 'assembly') { # record assembly item as allocated &process_assembly($dbh, $myconfig, $form, $position, $form->{"id_$i"}, $baseqty); @@ -2150,7 +2158,7 @@ sub get_customer { $ref = selectfirst_hashref_query($form, $dbh, $query, @values); delete $ref->{salesman_id} if !$ref->{salesman_id}; - delete $ref->{payment_id} if $form->{payment_id}; + delete $ref->{payment_id} if !$ref->{payment_id}; map { $form->{$_} = $ref->{$_} } keys %$ref; @@ -2346,8 +2354,8 @@ sub retrieve_item { push @{ $ref->{matches} ||= [] }, $::locale->text('EAN') . ': ' . $ref->{ean}; } - $ref->{type_and_classific} = $::request->presenter->type_abbreviation($ref->{part_type}). - $::request->presenter->classification_abbreviation($ref->{classification_id}); + $ref->{type_and_classific} = type_abbreviation($ref->{part_type}) . + classification_abbreviation($ref->{classification_id}); if (! $ref->{used_for_sale} ) { $has_wrong_pclass = PCLASS_NOTFORSALE ; next; @@ -2429,7 +2437,6 @@ sub retrieve_item { } $ref->{onhand} *= 1; - push @{ $form->{item_list} }, $ref; } $sth->finish;