X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/e28ec8115ffd3411bd7ffd0bfaf5dab35f807c2a..f217d072d76183bc07723dcc29503b732bd2022d:/SL/Controller/Project.pm?ds=sidebyside diff --git a/SL/Controller/Project.pm b/SL/Controller/Project.pm index 80833b0a1..351c5d35a 100644 --- a/SL/Controller/Project.pm +++ b/SL/Controller/Project.pm @@ -100,30 +100,34 @@ sub action_ajax_autocomplete { # if someone types something, and hits enter, assume he entered the full name. # if something matches, treat that as the sole match - # unfortunately get_models can't do more than one per package atm, so we do it - # the oldfashioned way. + # since we need a second get models instance with different filters for that, + # we only modify the original filter temporarily in place if ($::form->{prefer_exact}) { + local $::form->{filter}{'all::ilike'} = delete local $::form->{filter}{'all:substr:multi::ilike'}; + # active and valid filters are use as they are + + my $exact_models = SL::Controller::Helper::GetModels->new( + controller => $self, + sorted => 0, + paginated => { per_page => 2 }, + with_objects => [ 'customer', 'project_status', 'project_type' ], + ); my $exact_matches; - if (1 == scalar @{ $exact_matches = SL::DB::Manager::Project->get_all( - query => [ - valid => 1, - or => [ - description => { ilike => $::form->{filter}{'all:substr:multi::ilike'} }, - projectnumber => { ilike => $::form->{filter}{'all:substr:multi::ilike'} }, - ] - ], - limit => 2, - ) }) { - $self->projects($exact_matches); + if (1 == scalar @{ $exact_matches = $exact_models->get }) { + $self->project($exact_matches); } } $::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, @@ -244,6 +248,7 @@ sub display_form { CVar->render_inputs(variables => $params{CUSTOM_VARIABLES}) if @{ $params{CUSTOM_VARIABLES} }; + $::request->layout->use_javascript("$_.js") for qw(kivi.File ckeditor5/ckeditor ckeditor5/translations/de); $self->setup_edit_action_bar(callback => $params{callback}); $self->render('project/form', %params); @@ -299,8 +304,9 @@ sub prepare_report { my $callback = $self->models->get_callback; - my $report = SL::ReportGenerator->new(\%::myconfig, $::form); - $self->{report} = $report; + my $report = SL::ReportGenerator->new(\%::myconfig, $::form); + $report->{title} = t8('Projects'); + $self->{report} = $report; my @columns = qw(project_status customer projectnumber description active valid project_type); my @sortable = qw(projectnumber description customer project_type project_status);