1 package SL::Controller::TopQuickSearch::OERecord;
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(models) ],
15 # nope. this is only for subclassing
16 sub auth { 'NOT ALLOWED' }
18 sub name { die 'must be overwritten' }
20 sub description_config { die 'must be overwritten' }
22 sub description_field { die 'must be overwritten' }
24 sub query_autocomplete {
27 my $objects = $self->models->get;
38 sub select_autocomplete {
39 $_[0]->redirect_to_object($::form->{id});
45 my $objects = $self->models->get;
47 return !@$objects ? ()
48 : @$objects == 1 ? $self->redirect_to_object($objects->[0]->id)
49 : $self->redirect_to_search($::form->{term});
52 sub redirect_to_search {
53 SL::Controller::Base->new->url_for(
54 controller => 'oe.pl',
62 (map {; "l_$_" => 'Y' } $_[0]->number, qw(transdate cusordnumber reqdate name employee netamount)),
66 sub redirect_to_object {
67 if ($::instance_conf->get_feature_experimental) {
68 SL::Controller::Base->new->url_for(
69 controller => 'Order',
75 SL::Controller::Base->new->url_for(
76 controller => 'oe.pl',
86 die 'must be overwritten'
90 die 'must be overwritten'
94 $_[0]->type !~ /order/
98 $_[0]->quotation ? 'quonumber' : 'ordnumber'
104 SL::Controller::Helper::GetModels->new(
110 'all:substr:multi::ilike' => $::form->{term},
118 transdate => t8('Date'),
123 with_objects => [ qw(customer vendor) ]