X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/kivitendo-erp.git/blobdiff_plain/05f8844cf548de3fc962b4935d679053d5edd030..38bb9635fde8c2821c23da931bcb6acba8e4b8be:/SL/Controller/Project.pm?ds=sidebyside diff --git a/SL/Controller/Project.pm b/SL/Controller/Project.pm index 90e2d6e6d..72f9bd4b2 100644 --- a/SL/Controller/Project.pm +++ b/SL/Controller/Project.pm @@ -90,7 +90,7 @@ sub action_destroy { flash_later('error', $::locale->text('The project is in use and cannot be deleted.')); } - $self->redirect_to(action => 'search'); + $self->redirect_to(action => 'list'); } sub action_ajax_autocomplete { @@ -100,21 +100,21 @@ 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); } } @@ -138,6 +138,14 @@ sub action_test_page { $_[0]->render('project/test_page'); } +sub action_project_picker_search { + $_[0]->render('project/project_picker_search', { layout => 0 }); +} + +sub action_project_picker_result { + $_[0]->render('project/_project_picker_result', { layout => 0 }); +} + # # filters #