X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FController%2FTopQuickSearch%2FArticle.pm;h=e689bbe81db14512c111130e96d283012909e9ce;hb=6309c61710215e3755cc8e096ae1f2801e2f6962;hp=83ccedf00eee2c7b219e24fbfcfb6f3ee8c8a1e0;hpb=2bccc0a27d0c6917ab219aeb60efcbc9ae043205;p=kivitendo-erp.git diff --git a/SL/Controller/TopQuickSearch/Article.pm b/SL/Controller/TopQuickSearch/Article.pm index 83ccedf00..e689bbe81 100644 --- a/SL/Controller/TopQuickSearch/Article.pm +++ b/SL/Controller/TopQuickSearch/Article.pm @@ -16,9 +16,9 @@ sub auth { 'part_service_assembly_edit' } sub name { 'article' } -sub description_config { t8('Article') } +sub description_config { t8('Articles') } -sub description_field { t8('Article') } +sub description_field { t8('Articles') } sub query_autocomplete { my ($self) = @_; @@ -35,7 +35,8 @@ sub query_autocomplete { } sub select_autocomplete { - redirect_to_part($::form->{id}); + my ($self) = @_; + $self->redirect_to_part($::form->{id}); } sub do_search { @@ -44,28 +45,32 @@ sub do_search { my $objects = $self->models->get; return !@$objects ? () - : @$objects == 1 ? redirect_to_part($objects->[0]->id) - : redirect_to_search($::form->{term}); + : @$objects == 1 ? $self->redirect_to_part($objects->[0]->id) + : $self->redirect_to_search($::form->{term}); } sub redirect_to_search { + my ($self, $term) = @_; + SL::Controller::Base->new->url_for( - controller => 'ic.pl', - action => 'generate_report', - searchitems => 'assembly', - all => $_[0], + controller => 'ic.pl', + action => 'generate_report', + all => $term, + (searchitems => $self->part_type) x!!$self->part_type, ); } sub redirect_to_part { + my ($self, $term) = @_; + SL::Controller::Base->new->url_for( - controller => 'ic.pl', - action => 'edit', - id => $_[0], + controller => 'controller.pl', + action => 'Part/edit', + 'part.id' => $term, ); } -sub type { +sub part_type { () } @@ -77,7 +82,8 @@ sub init_models { model => 'Part', source => { filter => { - ($self->type), + (part_type => $self->part_type) x!!$self->part_type, + or => [ obsolete => undef, obsolete => 0 ], 'all:substr:multi::ilike' => $::form->{term}, }, },