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
44 44
  my $objects = $self->models->get;
45 45

  
46 46
  return !@$objects     ? ()
47
       : @$objects == 1 ? redirect_to_part($objects->[0]->id)
48
       :                  redirect_to_search($::form->{term});
47
       : @$objects == 1 ? $self->redirect_to_part($objects->[0]->id)
48
       :                  $self->redirect_to_search($::form->{term});
49 49
}
50 50

  
51 51
sub redirect_to_search {
52
  my ($self, $term) = @_;
53

  
52 54
  SL::Controller::Base->new->url_for(
53
    controller  => 'ic.pl',
54
    action      => 'generate_report',
55
    all         => $_[0],
55
    controller   => 'ic.pl',
56
    action       => 'generate_report',
57
    all          => $term,
58
    (searchitems => $self->type) x!!$self->type,
56 59
  );
57 60
}
58 61

  
59 62
sub redirect_to_part {
63
  my ($self, $term) = @_;
64

  
60 65
  SL::Controller::Base->new->url_for(
61 66
    controller => 'ic.pl',
62 67
    action     => 'edit',
63
    id         => $_[0],
68
    id         => $term,
64 69
  );
65 70
}
66 71

  
......
76 81
    model      => 'Part',
77 82
    source     => {
78 83
      filter => {
79
        ($self->type),
84
        (type => $self->type) x!!$self->type,
80 85
        'all:substr:multi::ilike' => $::form->{term},
81 86
      },
82 87
    },
SL/Controller/TopQuickSearch/Assembly.pm
11 11

  
12 12
sub description_field { t8('Assemblies') }
13 13

  
14
sub type { type => 'assembly' }
14
sub type { 'assembly' }
15 15

  
16 16
1;
SL/Controller/TopQuickSearch/Part.pm
11 11

  
12 12
sub description_field { t8('Parts') }
13 13

  
14
sub type { type => 'part' }
14
sub type { 'part' }
15 15

  
16 16
1;
SL/Controller/TopQuickSearch/Service.pm
11 11

  
12 12
sub description_field { t8('Services') }
13 13

  
14
sub type { type => 'service' }
14
sub type { 'service' }
15 15

  
16 16
1;

Auch abrufbar als: Unified diff