Revision 58e12eca
Von Sven Schöling vor mehr als 11 Jahren hinzugefügt
SL/Controller/Part.pm | ||
---|---|---|
44 | 44 |
|
45 | 45 |
# if someone types something, and hits enter, assume he entered the full name. |
46 | 46 |
# if something matches, treat that as sole match |
47 |
# unfortunately get_models can't do more than one per package atm, so we d it |
|
48 |
# the oldfashioned way. |
|
47 | 49 |
if ($::form->{prefer_exact}) { |
48 |
# TODO! |
|
50 |
my $exact_matches; |
|
51 |
if (1 == scalar @{ $exact_matches = SL::DB::Manager::Part->get_all( |
|
52 |
query => [ |
|
53 |
obsolete => 0, |
|
54 |
SL::DB::Manager::Part->type_filter($::form->{filter}{type}), |
|
55 |
or => [ |
|
56 |
description => { ilike => $::form->{filter}{'all:substr::ilike'} }, |
|
57 |
partnumber => { ilike => $::form->{filter}{'all:substr::ilike'} }, |
|
58 |
] |
|
59 |
], |
|
60 |
limit => 2, |
|
61 |
) }) { |
|
62 |
$self->parts($exact_matches); |
|
63 |
} |
|
49 | 64 |
} |
50 | 65 |
|
51 | 66 |
my @hashes = map { |
... | ... | |
57 | 72 |
description => $_->description, |
58 | 73 |
type => $_->type, |
59 | 74 |
} |
60 |
} @{ $self->parts }; |
|
75 |
} @{ $self->parts }; # neato: if exact match triggers we don't even need the init_parts
|
|
61 | 76 |
|
62 | 77 |
$self->render(\ SL::JSON::to_json(\@hashes), { layout => 0, type => 'json', process => 0 }); |
63 | 78 |
} |
SL/Presenter/Part.pm | ||
---|---|---|
49 | 49 |
|
50 | 50 |
C<VALUE> can be an id or C<Rose::DB:Object> instance. |
51 | 51 |
|
52 |
If C<PARAMS> contains C<type> only parts of this type will be used for autocompletion. |
|
52 |
If C<PARAMS> contains C<type> only parts of this type will be used for |
|
53 |
autocompletion. Currently only one type may be specified. |
|
53 | 54 |
|
54 | 55 |
Obsolete parts will by default not displayed for selection. However they are |
55 |
accepted as default values and can persist during updates. |
|
56 |
accepted as default values and can persist during updates. As with other |
|
57 |
selectors though, they are not selecatble once overridden. |
|
58 |
|
|
59 |
|
|
56 | 60 |
|
57 | 61 |
=back |
58 | 62 |
|
Auch abrufbar als: Unified diff
exact match funktion wieder hergestellt nach dem letzten commit