From 0ff43ab4cc5ee64577953acf90b2a3f93941b92c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Wed, 23 Jan 2019 16:17:16 +0100 Subject: [PATCH] DisplayableNamePrefs: Benutzereinstellungen --- SL/AM.pm | 30 ++++++++++++++++++++++++++ bin/mozilla/am.pl | 2 ++ templates/webpages/am/config.html | 36 +++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+) diff --git a/SL/AM.pm b/SL/AM.pm index e48f55ac3..5db3f71ca 100644 --- a/SL/AM.pm +++ b/SL/AM.pm @@ -47,6 +47,9 @@ use SL::DB::AuthUser; use SL::DB::Default; use SL::DB::Employee; use SL::DB::Chart; +use SL::DB::Customer; +use SL::DB::Part; +use SL::DB::Vendor; use SL::DB; use SL::GenericTranslations; @@ -507,6 +510,23 @@ sub save_template { return $error; } +sub displayable_name_specs_by_module { + +{ + 'SL::DB::Customer' => { + specs => SL::DB::Customer->displayable_name_specs, + prefs => SL::DB::Customer->displayable_name_prefs, + }, + 'SL::DB::Vendor' => { + specs => SL::DB::Vendor->displayable_name_specs, + prefs => SL::DB::Vendor->displayable_name_prefs, + }, + 'SL::DB::Part' => { + specs => SL::DB::Part->displayable_name_specs, + prefs => SL::DB::Part->displayable_name_prefs, + }, + }; +} + sub save_preferences { $main::lxdebug->enter_sub(); @@ -522,6 +542,16 @@ sub save_preferences { map { ($_ => $form->{$_}) } SL::DB::AuthUser::CONFIG_VARS(), }); + # Displayable name preferences + my $displayable_name_specs_by_module = displayable_name_specs_by_module(); + foreach my $specs (@{ $form->{displayable_name_specs} }) { + if (!$specs->{value} || $specs->{value} eq $displayable_name_specs_by_module->{$specs->{module}}->{prefs}->get_default()) { + $displayable_name_specs_by_module->{$specs->{module}}->{prefs}->delete($specs->{value}); + } else { + $displayable_name_specs_by_module->{$specs->{module}}->{prefs}->store_value($specs->{value}); + } + } + $main::lxdebug->leave_sub(); return 1; diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index e561b7c8b..432eb7b9d 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -659,6 +659,8 @@ sub config { $form->{enabled_quick_searchmodules} = \@{$enabled_quick_search}; $form->{default_quick_searchmodules} = \@quick_search_modules; + $form->{displayable_name_specs_by_module} = AM->displayable_name_specs_by_module(); + $myconfig{show_form_details} = 1 unless (defined($myconfig{show_form_details})); $form->{CAN_CHANGE_PASSWORD} = $main::auth->can_change_password(); $form->{todo_cfg} = { TODO->get_user_config('login' => $::myconfig{login}) }; diff --git a/templates/webpages/am/config.html b/templates/webpages/am/config.html index 3cea8184c..f64ce7da4 100644 --- a/templates/webpages/am/config.html +++ b/templates/webpages/am/config.html @@ -163,6 +163,7 @@ [% L.input_tag('form_cvars_nr_cols', MYCONFIG.form_cvars_nr_cols || 3, size = 5) %] + [% 'Quick Searches that will be shown in the header for this user' | $T8 %] @@ -179,6 +180,41 @@ + + + [% 'Displayable Name Preferences' | $T8 %] + + + [% FOREACH module=displayable_name_specs_by_module.keys.sort %] + [%- SET spec=displayable_name_specs_by_module.$module -%] + + + + + [% END %] +
[% spec.specs.title %] + + + + + + [% FOREACH option=spec.specs.options %] + + + + + [% END %] + + + + +
[% 'Option' | $T8 %][% 'Name' | $T8 %]
[% option.title %][% option.name %]
[% 'Display' | $T8 %]: + [% L.hidden_tag("displayable_name_specs[+].module", module) %] + [% L.input_tag("displayable_name_specs[].value", spec.prefs.get, size=50) %] +
+
+ + -- 2.20.1