1 package SL::Controller::TopQuickSearch::Article;
4 use parent qw(Rose::Object);
6 use SL::Locale::String qw(t8);
8 use SL::Controller::Helper::GetModels;
9 use SL::Controller::Base;
11 use Rose::Object::MakeMethods::Generic (
12 'scalar --get_set_init' => [ qw(parts models part) ],
15 sub auth { 'part_service_assembly_edit' }
17 sub name { 'article' }
19 sub description_config { t8('Articles') }
21 sub description_field { t8('Articles') }
23 sub query_autocomplete {
26 my $objects = $self->models->get;
30 value => $_->displayable_name,
31 label => $_->displayable_name,
37 sub select_autocomplete {
38 redirect_to_part($::form->{id});
44 my $objects = $self->models->get;
46 return !@$objects ? ()
47 : @$objects == 1 ? redirect_to_part($objects->[0]->id)
48 : redirect_to_search($::form->{term});
51 sub redirect_to_search {
52 SL::Controller::Base->new->url_for(
53 controller => 'ic.pl',
54 action => 'generate_report',
55 searchitems => 'assembly',
60 sub redirect_to_part {
61 SL::Controller::Base->new->url_for(
62 controller => 'ic.pl',
75 SL::Controller::Helper::GetModels->new(
81 'all:substr:multi::ilike' => $::form->{term},
89 partnumber => t8('Partnumber'),