Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision f7027139

Von Sven Schöling vor mehr als 8 Jahren hinzugefügt

  • ID f7027139b5a2403424817a929743c162a0880f6a
  • Vorgänger 709aea6d
  • Nachfolger 3160b088

TopQuickSearch: typisierte Suche gefixt

Unterschiede anzeigen:

SL/Controller/TopQuickSearch/Article.pm
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',
all => $_[0],
controller => 'ic.pl',
action => 'generate_report',
all => $term,
(searchitems => $self->type) x!!$self->type,
);
}
sub redirect_to_part {
my ($self, $term) = @_;
SL::Controller::Base->new->url_for(
controller => 'ic.pl',
action => 'edit',
id => $_[0],
id => $term,
);
}
......
model => 'Part',
source => {
filter => {
($self->type),
(type => $self->type) x!!$self->type,
'all:substr:multi::ilike' => $::form->{term},
},
},
SL/Controller/TopQuickSearch/Assembly.pm
sub description_field { t8('Assemblies') }
sub type { type => 'assembly' }
sub type { 'assembly' }
1;
SL/Controller/TopQuickSearch/Part.pm
sub description_field { t8('Parts') }
sub type { type => 'part' }
sub type { 'part' }
1;
SL/Controller/TopQuickSearch/Service.pm
sub description_field { t8('Services') }
sub type { type => 'service' }
sub type { 'service' }
1;

Auch abrufbar als: Unified diff