From: Bernd Bleßmann Date: Fri, 14 Jun 2019 13:50:19 +0000 (+0200) Subject: Lagerberichte nach Waren-CVars filtern können … X-Git-Tag: kivitendo-mebil_0.1-0~10^2~2^2~370 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=5d2ede536e3a31f17b0a8afa9cc0ce8627a34b2f;p=kivitendo-erp.git Lagerberichte nach Waren-CVars filtern können … … nur Waren-CVars aus den Stammdaten - nicht aus Überlagerung aus Belegen Übernahme aus Kundenprojekt --- diff --git a/SL/WH.pm b/SL/WH.pm index c2e562b5c..f0f5ef202 100644 --- a/SL/WH.pm +++ b/SL/WH.pm @@ -306,6 +306,18 @@ sub get_warehouse_journal { my $where_clause = @filter_ary ? join(" AND ", @filter_ary) . " AND " : ''; + my ($cvar_where, @cvar_values) = CVar->build_filter_query( + module => 'IC', + trans_id_field => 'p.id', + filter => $form, + sub_module => undef, + ); + + if ($cvar_where) { + $where_clause .= qq| ($cvar_where) AND |; + push @filter_vars, @cvar_values; + } + $select_tokens{'trans'} = { "parts_id" => "i1.parts_id", "qty" => "ABS(SUM(i1.qty))", @@ -642,6 +654,18 @@ sub get_warehouse_report { ( grep( { !/qty/ and !/^l_cvar/ and /^l_/ and $form->{$_} eq 'Y' } keys %$form), qw(l_parts_id l_qty l_partunit) ); + my ($cvar_where, @cvar_values) = CVar->build_filter_query( + module => 'IC', + trans_id_field => 'p.id', + filter => $form, + sub_module => undef, + ); + + if ($cvar_where) { + $where_clause .= qq| AND ($cvar_where)|; + push @filter_vars, @cvar_values; + } + my $query = qq|SELECT * FROM ( SELECT $select_clause FROM inventory i diff --git a/bin/mozilla/wh.pl b/bin/mozilla/wh.pl index 4012fa2fd..3f0a5b615 100644 --- a/bin/mozilla/wh.pl +++ b/bin/mozilla/wh.pl @@ -575,7 +575,7 @@ sub journal { show_no_warehouses_error() if (!scalar @{ $form->{WAREHOUSES} }); my $cvar_configs = CVar->get_configs('module' => 'IC'); - (undef, + ($form->{CUSTOM_VARIABLES_FILTER_CODE}, $form->{CUSTOM_VARIABLES_INCLUSION_CODE}) = CVar->render_search_options('variables' => $cvar_configs, 'include_prefix' => 'l_', 'include_value' => 'Y'); @@ -649,11 +649,16 @@ sub generate_journal { my $cvar_configs = CVar->get_configs('module' => 'IC'); my @includeable_custom_variables = grep { $_->{includeable} } @{ $cvar_configs }; + my @searchable_custom_variables = grep { $_->{searchable} } @{ $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); + push @hidden_variables, map({'cvar_'. $_->{name}} @searchable_custom_variables); + push @hidden_variables, map({'cvar_'. $_->{name} .'_from'} grep({$_->{type} eq 'date'} @searchable_custom_variables)); + push @hidden_variables, map({'cvar_'. $_->{name} .'_to'} grep({$_->{type} eq 'date'} @searchable_custom_variables)); + push @hidden_variables, map({'cvar_'. $_->{name} .'_qtyop'} grep({$_->{type} eq 'number'} @searchable_custom_variables)); my %column_defs = ( 'ids' => { raw_header_data => checkbox_tag("", id => "check_all", checkall => "[data-checkall=1]") }, @@ -811,7 +816,7 @@ sub report { show_no_warehouses_error() if (!scalar @{ $form->{WAREHOUSES} }); my $cvar_configs = CVar->get_configs('module' => 'IC'); - (undef, + ($form->{CUSTOM_VARIABLES_FILTER_CODE}, $form->{CUSTOM_VARIABLES_INCLUSION_CODE}) = CVar->render_search_options('variables' => $cvar_configs, 'include_prefix' => 'l_', 'include_value' => 'Y'); @@ -915,12 +920,17 @@ sub generate_report { my $cvar_configs = CVar->get_configs('module' => 'IC'); my @includeable_custom_variables = grep { $_->{includeable} } @{ $cvar_configs }; + my @searchable_custom_variables = grep { $_->{searchable} } @{ $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 partstypes_id description chargenumber bestbefore qty_op qty qty_unit partunit l_warehousedescription l_bindescription); push @hidden_variables, qw(include_empty_bins subtotal include_invalid_warehouses date); push @hidden_variables, qw(classification_id stock_value_basis allrows); + push @hidden_variables, map({'cvar_'. $_->{name}} @searchable_custom_variables); + push @hidden_variables, map({'cvar_'. $_->{name} .'_from'} grep({$_->{type} eq 'date'} @searchable_custom_variables)); + push @hidden_variables, map({'cvar_'. $_->{name} .'_to'} grep({$_->{type} eq 'date'} @searchable_custom_variables)); + push @hidden_variables, map({'cvar_'. $_->{name} .'_qtyop'} grep({$_->{type} eq 'number'} @searchable_custom_variables)); my %column_defs = ( 'warehousedescription' => { 'text' => $locale->text('Warehouse'), }, diff --git a/templates/webpages/wh/journal_filter.html b/templates/webpages/wh/journal_filter.html index 0c6f7d472..694e1fd16 100644 --- a/templates/webpages/wh/journal_filter.html +++ b/templates/webpages/wh/journal_filter.html @@ -142,6 +142,7 @@ [% L.date_tag('todate') %] + [% CUSTOM_VARIABLES_FILTER_CODE %] diff --git a/templates/webpages/wh/report_filter.html b/templates/webpages/wh/report_filter.html index a4c1c7223..3aff1b4a3 100644 --- a/templates/webpages/wh/report_filter.html +++ b/templates/webpages/wh/report_filter.html @@ -162,6 +162,7 @@ [% L.input_number_tag("per_page", 20, size=4) %] + [% CUSTOM_VARIABLES_FILTER_CODE %]