From: Bernd Bleßmann Date: Fri, 7 May 2021 10:34:36 +0000 (+0200) Subject: Projekt-Picker: Stil der Beschreibung angeben können X-Git-Tag: kivitendo-mebil_0.1-0~9^2~245 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=40df01939f53719f4f7c167ed2bf7fa67c509291;p=kivitendo-erp.git Projekt-Picker: Stil der Beschreibung angeben können dem Picker kann mit "description_style" mitgegeben werden, wie die Ergebnisse angezeigt werden. Mögliche Werte: "both", "number", "description" und "full" (in SL::DB::Project->full_description) definiert). --- diff --git a/SL/Controller/Project.pm b/SL/Controller/Project.pm index ba460c597..94862e11b 100644 --- a/SL/Controller/Project.pm +++ b/SL/Controller/Project.pm @@ -120,10 +120,14 @@ sub action_ajax_autocomplete { $::form->{sort_by} = 'customer_and_description'; + my $description_style = ($::form->{description_style} =~ m{both|number|description|full}) + ? $::form->{description_style} + : 'full'; + my @hashes = map { +{ - value => $_->full_description(style => 'full'), - label => $_->full_description(style => 'full'), + value => $_->full_description(style => $description_style), + label => $_->full_description(style => $description_style), id => $_->id, projectnumber => $_->projectnumber, description => $_->description, diff --git a/SL/Presenter/Project.pm b/SL/Presenter/Project.pm index af40c30cf..8aecdfe49 100644 --- a/SL/Presenter/Project.pm +++ b/SL/Presenter/Project.pm @@ -39,7 +39,7 @@ sub project_picker { push @classes, 'project_autocomplete'; - my %data_params = map { $_ => delete $params{$_} } grep { defined $params{$_} } qw(customer_id active valid); + my %data_params = map { $_ => delete $params{$_} } grep { defined $params{$_} } qw(customer_id active valid description_style); my $ret = input_tag($name, (ref $value && $value->can('id') ? $value->id : ''), class => "@classes", type => 'hidden', id => $id, diff --git a/js/autocomplete_project.js b/js/autocomplete_project.js index aba682153..6a566c444 100644 --- a/js/autocomplete_project.js +++ b/js/autocomplete_project.js @@ -93,6 +93,9 @@ namespace('kivi', function(k){ data['filter.valid'] = 'valid'; // default } + if (o.description_style) + data['description_style'] = o.description_style; + return data; } diff --git a/templates/webpages/project/test_page.html b/templates/webpages/project/test_page.html index 95c3c833f..258048274 100644 --- a/templates/webpages/project/test_page.html +++ b/templates/webpages/project/test_page.html @@ -46,6 +46,28 @@ [% P.project.picker('project12_id', '', active='both', valid='both',style='width: 300px') %] all (active, inactive, valid, invalid)
+
+[% P.project.picker('project13_id', '', style='width: 300px') %] description style full (default) +
+ +
+[% P.project.picker('project14_id', '', description_style='full', style='width: 300px') %] description style full (explicit) +
+ +
+[% P.project.picker('project15_id', '', description_style='both', style='width: 300px') %] description style both +
+ +
+[% P.project.picker('project16_id', '', description_style='number', style='width: 300px') %] description style number +
+ +
+[% P.project.picker('project17_id', '', description_style='description', style='width: 300px') %] description style description +
+ +
+ Runtime test:
'