From 187c4ee192da9281f42800e6ac8ae08f23d9a9d6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Wed, 5 May 2021 10:56:20 +0200 Subject: [PATCH] Artikel-BDVs unter Basisdaten anzeigen, falls konfiguriert MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Die benutzerdefinierten Variablen für Artikel können konfigurierbar im Tab Basisdaten angezeigt werden --- SL/Controller/Part.pm | 8 ++++++-- SL/DB/MetaSetup/CustomVariableConfig.pm | 1 + doc/changelog | 2 ++ .../custom_variables_add_edit_position.sql | 6 ++++++ templates/webpages/custom_variable_config/form.html | 8 ++++++++ templates/webpages/part/_basic_data.html | 12 ++++++++++++ 6 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 sql/Pg-upgrade2/custom_variables_add_edit_position.sql diff --git a/SL/Controller/Part.pm b/SL/Controller/Part.pm index cfc94eea1..0b476ea81 100644 --- a/SL/Controller/Part.pm +++ b/SL/Controller/Part.pm @@ -12,6 +12,7 @@ use SL::Controller::Helper::GetModels; use SL::Locale::String qw(t8); use SL::JSON; use List::Util qw(sum); +use List::UtilsBy qw(extract_by); use SL::Helper::Flash; use Data::Dumper; use DateTime; @@ -230,8 +231,11 @@ sub render_form { $params{CUSTOM_VARIABLES} = CVar->get_custom_variables(module => 'IC', trans_id => $self->part->id); - CVar->render_inputs('variables' => $params{CUSTOM_VARIABLES}, show_disabled_message => 1, partsgroup_id => $self->part->partsgroup_id) - if (scalar @{ $params{CUSTOM_VARIABLES} }); + if (scalar @{ $params{CUSTOM_VARIABLES} }) { + CVar->render_inputs('variables' => $params{CUSTOM_VARIABLES}, show_disabled_message => 1, partsgroup_id => $self->part->partsgroup_id); + $params{CUSTOM_VARIABLES_FIRST_TAB} = []; + @{ $params{CUSTOM_VARIABLES_FIRST_TAB} } = extract_by { $_->{first_tab} == 1 } @{ $params{CUSTOM_VARIABLES} }; + } my %title_hash = ( part => t8('Edit Part'), assembly => t8('Edit Assembly'), diff --git a/SL/DB/MetaSetup/CustomVariableConfig.pm b/SL/DB/MetaSetup/CustomVariableConfig.pm index af6d69084..684d22917 100644 --- a/SL/DB/MetaSetup/CustomVariableConfig.pm +++ b/SL/DB/MetaSetup/CustomVariableConfig.pm @@ -11,6 +11,7 @@ __PACKAGE__->meta->table('custom_variable_configs'); __PACKAGE__->meta->columns( default_value => { type => 'text' }, description => { type => 'text', not_null => 1 }, + first_tab => { type => 'boolean', default => 'false', not_null => 1 }, flags => { type => 'text' }, id => { type => 'integer', not_null => 1, sequence => 'custom_variable_configs_id' }, includeable => { type => 'boolean', not_null => 1 }, diff --git a/doc/changelog b/doc/changelog index 3d0e621c5..8b4a5988c 100644 --- a/doc/changelog +++ b/doc/changelog @@ -32,6 +32,8 @@ Mittelgroße neue Features: Kleinere neue Features und Detailverbesserungen: + - Die benutzerdefinierten Variablen für Artikel können konfigurierbar im Tab Basisdaten + angezeigt werden (ohne extra Klick auf einen weiteren Tab) - Der Lagerbestandsbericht wurde um die Anzeige von benutzerdefinierten Variablen aus dem Bereich Artikel erweitert - Im Lagerjournal ist standardmäßig die Berichtsanzeige um Dokument angehakt. diff --git a/sql/Pg-upgrade2/custom_variables_add_edit_position.sql b/sql/Pg-upgrade2/custom_variables_add_edit_position.sql new file mode 100644 index 000000000..efb420d17 --- /dev/null +++ b/sql/Pg-upgrade2/custom_variables_add_edit_position.sql @@ -0,0 +1,6 @@ +-- @tag: custom_variables_add_edit_position +-- @description: Erweiterung custom_variables +-- @depends: release_3_5_6_1 custom_variables + +ALTER TABLE custom_variable_configs ADD COLUMN first_tab BOOLEAN NOT NULL DEFAULT FALSE; + diff --git a/templates/webpages/custom_variable_config/form.html b/templates/webpages/custom_variable_config/form.html index a33d9dfb1..a03bcd26e 100644 --- a/templates/webpages/custom_variable_config/form.html +++ b/templates/webpages/custom_variable_config/form.html @@ -97,6 +97,14 @@ labeldx => LxERP.t8("Partsgroups where variables are shown")) %] + + [% 'Display in basic data tab' | $T8 %] + + [% L.radio_button_tag('config.first_tab', value='1', id='config.first_tab', label=LxERP.t8('Yes'), checked=(SELF.config.first_tab ? 1 : '')) %] + [% L.radio_button_tag('config.first_tab', value='0', id='config.first_tab', label=LxERP.t8('No'), checked=(SELF.config.first_tab ? '' : 1)) %] + + +

diff --git a/templates/webpages/part/_basic_data.html b/templates/webpages/part/_basic_data.html index 90d5eeceb..47cd8f3e8 100644 --- a/templates/webpages/part/_basic_data.html +++ b/templates/webpages/part/_basic_data.html @@ -75,6 +75,18 @@ + [% IF CUSTOM_VARIABLES_FIRST_TAB %] + [% 'Unchecked custom variables will not appear in orders and invoices.' | $T8 %] + [%- FOREACH var = CUSTOM_VARIABLES_FIRST_TAB %] + + [% var.VALID_BOX %] + [%- IF !var.partsgroup_filtered %] + [% HTML.escape(var.description) %] + [%- END %] + + [% var.HTML_CODE %] + [%- END %] + [% END %] -- 2.20.1