Revision 267374ef
Von Thomas Heck vor mehr als 11 Jahren hinzugefügt
SL/Controller/Customer.pm | ||
---|---|---|
1 |
package SL::Controller::Customer; |
|
2 |
|
|
3 |
use strict; |
|
4 |
use parent qw(SL::Controller::Base); |
|
5 |
|
|
6 |
use SL::DB::Customer; |
|
7 |
|
|
8 |
# safety |
|
9 |
__PACKAGE__->run_before(sub { $::auth->assert('customer_vendor_edit') }); |
|
10 |
|
|
11 |
sub action_ajax_autocomplete { |
|
12 |
my ($self, %params) = @_; |
|
13 |
|
|
14 |
my $limit = $::form->{limit} || 20; |
|
15 |
my $type = $::form->{type} || {}; |
|
16 |
my $query = { ilike => "%$::form->{term}%" }; |
|
17 |
my @filter; |
|
18 |
push @filter, ($::form->{column}) |
|
19 |
? ($::form->{column} => $query) |
|
20 |
: (or => [ customernumber => $query, name => $query ]); |
|
21 |
|
|
22 |
$self->{customers} = SL::DB::Manager::Customer->get_all(query => [ @filter ], limit => $limit); |
|
23 |
$self->{value} = $::form->{column} || 'name'; |
|
24 |
|
|
25 |
$self->render('ct/ajax_autocomplete2', { layout => 0, type => 'json' }); |
|
26 |
} |
Auch abrufbar als: Unified diff
SL::Controller::Customer entfernt