From ea6ec9c1f72a4d30387aec5e771eb38dfdb7fb2a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Tue, 31 Aug 2021 08:56:57 +0200 Subject: [PATCH] =?utf8?q?CVars=20f=C3=BCr=20Lagerbestand:=20Funktion=20zu?= =?utf8?q?m=20Rendern=20aus=20SL/CVar=20nehmen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/WH.pm | 6 +++--- bin/mozilla/wh.pl | 9 +++++---- templates/webpages/wh/report_filter.html | 14 +++----------- 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/SL/WH.pm b/SL/WH.pm index 69874ceeb..2c11f8435 100644 --- a/SL/WH.pm +++ b/SL/WH.pm @@ -627,11 +627,11 @@ sub get_warehouse_report { $form->{l_part_type} = 'Y'; my $select_clause = join ', ', map { +/^l_/; "$select_tokens{$'} AS $'" } - ( grep( { !/qty/ and /^l_/ and $form->{$_} eq 'Y' } keys %$form), + ( grep( { !/qty/ and !/^l_cvar/ and /^l_/ and $form->{$_} eq 'Y' } keys %$form), qw(l_parts_id l_qty l_partunit) ); my $group_clause = join ", ", map { +/^l_/; "$'" } - ( grep( { !/qty/ and /^l_/ and $form->{$_} eq 'Y' } keys %$form), + ( grep( { !/qty/ and !/^l_cvar/ and /^l_/ and $form->{$_} eq 'Y' } keys %$form), qw(l_parts_id l_partunit) ); my %join_tokens = ( @@ -639,7 +639,7 @@ sub get_warehouse_report { ); my $joins = join ' ', grep { $_ } map { +/^l_/; $join_tokens{"$'"} } - ( grep( { !/qty/ and /^l_/ and $form->{$_} eq 'Y' } keys %$form), + ( grep( { !/qty/ and !/^l_cvar/ and /^l_/ and $form->{$_} eq 'Y' } keys %$form), qw(l_parts_id l_qty l_partunit) ); my $query = diff --git a/bin/mozilla/wh.pl b/bin/mozilla/wh.pl index 3aff194e9..8f55b015f 100644 --- a/bin/mozilla/wh.pl +++ b/bin/mozilla/wh.pl @@ -790,8 +790,11 @@ sub report { show_no_warehouses_error() if (!scalar @{ $form->{WAREHOUSES} }); - my $CVAR_CONFIGS = SL::DB::Manager::CustomVariableConfig->get_all_sorted(where => [ module => 'IC' ]); - my $INCLUDABLE_CVAR_CONFIGS = [ grep { $_->includeable } @{ $CVAR_CONFIGS } ]; + 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'); $form->{title} = $locale->text("Report about warehouse contents"); @@ -801,8 +804,6 @@ sub report { print $form->parse_html_template("wh/report_filter", { "WAREHOUSES" => $form->{WAREHOUSES}, "UNITS" => AM->unit_select_data(AM->retrieve_units(\%myconfig, $form)), - # "CVAR_CONFIGS" => $CVAR_CONFIGS, # nyi searchable cvars - "INCLUDABLE_CVAR_CONFIGS" => $INCLUDABLE_CVAR_CONFIGS, }); $main::lxdebug->leave_sub(); diff --git a/templates/webpages/wh/report_filter.html b/templates/webpages/wh/report_filter.html index c1dea3f6a..a4c1c7223 100644 --- a/templates/webpages/wh/report_filter.html +++ b/templates/webpages/wh/report_filter.html @@ -215,17 +215,9 @@ - [% IF INCLUDABLE_CVAR_CONFIGS %] -
- [% FOREACH cvar_cfg = INCLUDABLE_CVAR_CONFIGS %] - - - [% name__ = cvar_cfg.name; - L.checkbox_tag("l_cvar_" _ name__, value="1", checked=(cvar_cfg.included_by_default ? 1 : ''), label=cvar_cfg.description) %] - - - [% END %] - [% END %] + + + [% CUSTOM_VARIABLES_INCLUSION_CODE %]
-- 2.20.1