From: Bernd Bleßmann Date: Tue, 31 Aug 2021 06:56:57 +0000 (+0200) Subject: CVars für Lagerbestand: Funktion zum Rendern aus SL/CVar nehmen X-Git-Tag: kivitendo-mebil_0.1-0~10^2~2^2~373 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=ea6ec9c1f72a4d30387aec5e771eb38dfdb7fb2a;p=kivitendo-erp.git CVars für Lagerbestand: Funktion zum Rendern aus SL/CVar nehmen --- 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 %]