From: Werner Hahn Date: Tue, 25 Sep 2018 12:07:07 +0000 (+0200) Subject: TopQuickSearch: UserPreferences kleinere Syntaxverbesserungen X-Git-Tag: release-3.5.4~269 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=1edebcf0aed748b75fa68e46aad70dbeeadfdd85;p=kivitendo-erp.git TopQuickSearch: UserPreferences kleinere Syntaxverbesserungen --- diff --git a/SL/Controller/TopQuickSearch.pm b/SL/Controller/TopQuickSearch.pm index f44ff6f49..4c65ba27d 100644 --- a/SL/Controller/TopQuickSearch.pm +++ b/SL/Controller/TopQuickSearch.pm @@ -70,19 +70,15 @@ sub enabled_modules { namespace => 'TopQuickSearch', ); - my %enabled_names; + my @quick_search_modules; if (my $prefs_val = $user_prefs->get('quick_search_modules')) { - my @quick_search_modules = split ',', $prefs_val; - - %enabled_names = map { - $_ => 1 - } @quick_search_modules ; + @quick_search_modules = split ',', $prefs_val; } else { - %enabled_names = map { - $_ => 1 - } @{ $::instance_conf->get_quick_search_modules }; + @quick_search_modules = @{ $::instance_conf->get_quick_search_modules }; } + my %enabled_names = map { $_ => 1 } @quick_search_modules; + grep { $enabled_names{$_->name} } $_[0]->available_modules diff --git a/SL/Form.pm b/SL/Form.pm index 0c21ae2e6..0ecb2219d 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -434,7 +434,6 @@ sub header { jquery jquery-ui jquery.cookie jquery.checkall jquery.download jquery/jquery.form jquery/fixes client_js jquery/jquery.tooltipster.min - jquery.multiselect2side common part_selection ), "jquery/ui/i18n/jquery.ui.datepicker-$::myconfig{countrycode}"); diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index 83d1bd58a..e561b7c8b 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -656,13 +656,14 @@ sub config { } my $enabled_quick_search = [ SL::Controller::TopQuickSearch->new->available_modules ]; - $form->{ENABLED_QUICK_SEARCHMODULES} = \@{$enabled_quick_search}; - $form->{DEFAULT_QUICK_SEARCHMODULES} = \@quick_search_modules; + $form->{enabled_quick_searchmodules} = \@{$enabled_quick_search}; + $form->{default_quick_searchmodules} = \@quick_search_modules; $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}) }; + $::request->{layout}->use_javascript("jquery.multiselect2side.js"); $form->{title} = $locale->text('Edit Preferences for #1', $::myconfig{login}); setup_am_config_action_bar(); @@ -686,12 +687,11 @@ sub save_preferences { TODO->save_user_config('login' => $::myconfig{login}, %{ $form->{todo_cfg} || { } }); - my $user_prefs = SL::Helper::UserPreferences->new( - namespace => 'TopQuickSearch', - ); - my $quick_search_modules = join ',', @{$form->{quick_search_modules}}; - $user_prefs->store('quick_search_modules', $quick_search_modules); - + if ($form->{quick_search_modules}) { + my $user_prefs = SL::Helper::UserPreferences->new( namespace => 'TopQuickSearch',); + my $quick_search_modules = join ',', @{$form->{quick_search_modules}}; + $user_prefs->store('quick_search_modules', $quick_search_modules); + } if (AM->save_preferences($form)) { if ($::auth->can_change_password() && defined $form->{new_password} diff --git a/templates/webpages/am/config.html b/templates/webpages/am/config.html index 038639abe..3cea8184c 100644 --- a/templates/webpages/am/config.html +++ b/templates/webpages/am/config.html @@ -2,7 +2,7 @@ [%- USE LxERP %] [%- USE HTML %] [%- USE L %] -[% USE Dumper %] +

[% title %]

@@ -168,15 +168,14 @@
[% L.select_tag("quick_search_modules[]", - ENABLED_QUICK_SEARCHMODULES, + enabled_quick_searchmodules, value_key = "name", title_key = "description_config", id = "quick_searches", multiple = 1, with_empty = 1 - size = ENABLED_QUICK_SEARCHMODULES.size, - default = DEFAULT_QUICK_SEARCHMODULES) %] - [% # L.multiselect2side("quick_searches", labelsx=LxERP.t8("All modules"), labeldx=LxERP.t8("Enabled modules")) %] + size = enabled_quick_searchmodules.size, + default = default_quick_searchmodules) %]