From: Bernd Bleßmann Date: Mon, 26 Nov 2018 16:08:04 +0000 (+0100) Subject: Waren-CVars für Lagerbuchungsbericht X-Git-Tag: kivitendo-mebil_0.1-0~10^2~2^2~371 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=3193bd4a57817d4ad38397f3cf4c84647cf16051;p=kivitendo-erp.git Waren-CVars für Lagerbuchungsbericht Übernahme aus Kundenprojekt --- diff --git a/SL/WH.pm b/SL/WH.pm index 2c11f8435..c2e562b5c 100644 --- a/SL/WH.pm +++ b/SL/WH.pm @@ -355,11 +355,11 @@ sub get_warehouse_journal { # take all the requested ones from the first hash and overwrite them from the out/in hashes if present. for my $i ('trans', 'out', 'in') { $select{$i} = join ', ', map { +/^l_/; ($select_tokens{$i}{"$'"} || $select_tokens{'trans'}{"$'"}) . " AS r_$'" } - ( grep( { !/qty$/ and /^l_/ and $form->{$_} eq 'Y' } keys %$form), qw(l_parts_id l_qty l_partunit l_shippingdate) ); + ( grep( { !/qty$/ and !/^l_cvar/ and /^l_/ and $form->{$_} eq 'Y' } keys %$form), qw(l_parts_id l_qty l_partunit l_shippingdate) ); } my $group_clause = join ", ", map { +/^l_/; "r_$'" } - ( grep( { !/qty$/ and /^l_/ and $form->{$_} eq 'Y' } keys %$form), qw(l_parts_id l_partunit l_shippingdate l_itime) ); + ( grep( { !/qty$/ and !/^l_cvar/ and /^l_/ and $form->{$_} eq 'Y' } keys %$form), qw(l_parts_id l_partunit l_shippingdate l_itime) ); $where_clause = defined($where_clause) ? $where_clause : ''; diff --git a/bin/mozilla/wh.pl b/bin/mozilla/wh.pl index 5b39e2496..4012fa2fd 100644 --- a/bin/mozilla/wh.pl +++ b/bin/mozilla/wh.pl @@ -574,6 +574,12 @@ sub journal { show_no_warehouses_error() if (!scalar @{ $form->{WAREHOUSES} }); + my $cvar_configs = CVar->get_configs('module' => 'IC'); + (undef, + $form->{CUSTOM_VARIABLES_INCLUSION_CODE}) = CVar->render_search_options('variables' => $cvar_configs, + 'include_prefix' => 'l_', + 'include_value' => 'Y'); + setup_wh_journal_action_bar(); $form->header(); @@ -641,6 +647,10 @@ sub generate_journal { my $report = SL::ReportGenerator->new(\%myconfig, $form); + my $cvar_configs = CVar->get_configs('module' => 'IC'); + my @includeable_custom_variables = grep { $_->{includeable} } @{ $cvar_configs }; + push @columns, map { "cvar_$_->{name}" } @includeable_custom_variables; + my @hidden_variables = map { "l_${_}" } @columns; push @hidden_variables, qw(warehouse_id bin_id partnumber description chargenumber bestbefore qty_op qty qty_unit unit partunit fromdate todate transtype_ids comment projectnumber); push @hidden_variables, qw(classification_id); @@ -669,6 +679,9 @@ sub generate_journal { 'oe_id' => { 'text' => $locale->text('Document'), }, ); + my %column_defs_cvars = map { +"cvar_$_->{name}" => { 'text' => $_->{description} } } @includeable_custom_variables; + %column_defs = (%column_defs, %column_defs_cvars); + if ($form->{transtype_ids} && 'ARRAY' eq ref $form->{transtype_ids}) { for (my $i = 0; $i < scalar(@{ $form->{transtype_ids} }); $i++) { delete $form->{transtype_ids}[$i] if $form->{transtype_ids}[$i] eq ''; @@ -679,7 +692,7 @@ sub generate_journal { my $href = build_std_url('action=generate_journal', grep { $form->{$_} } @hidden_variables); $href .= "&maxrows=".$form->{maxrows}; - map { $column_defs{$_}->{link} = $href ."&page=".$page. "&sort=${_}&order=" . Q($_ eq $form->{sort} ? 1 - $form->{order} : $form->{order}) } @columns; + map { $column_defs{$_}->{link} = $href ."&page=".$page. "&sort=${_}&order=" . Q($_ eq $form->{sort} ? 1 - $form->{order} : $form->{order}) } grep {!/^cvar/} @columns; my %column_alignment = map { $_ => 'right' } qw(qty); @@ -704,6 +717,13 @@ sub generate_journal { my $all_units = AM->retrieve_units(\%myconfig, $form); + CVar->add_custom_variables_to_report('module' => 'IC', + 'trans_id_field' => 'parts_id', + 'configs' => $cvar_configs, + 'column_defs' => \%column_defs, + 'data' => \@contents); + + my %doc_types = ( 'sales_quotation' => { script => 'oe', title => $locale->text('Sales quotation') }, 'sales_order' => { script => 'oe', title => $locale->text('Sales Order') }, 'request_quotation' => { script => 'oe', title => $locale->text('Request quotation') }, diff --git a/templates/webpages/wh/journal_filter.html b/templates/webpages/wh/journal_filter.html index def92cd2c..0c6f7d472 100644 --- a/templates/webpages/wh/journal_filter.html +++ b/templates/webpages/wh/journal_filter.html @@ -200,6 +200,9 @@ + + [% CUSTOM_VARIABLES_INCLUSION_CODE %] +