Revision fa7a37a2
Von Sven Schöling vor etwa 11 Jahren hinzugefügt
SL/Controller/Part.pm | ||
---|---|---|
6 | 6 |
use Clone qw(clone); |
7 | 7 |
use SL::DB::Part; |
8 | 8 |
use SL::Controller::Helper::GetModels; |
9 |
use SL::Controller::Helper::Filtered; |
|
10 |
use SL::Controller::Helper::Sorted; |
|
11 |
use SL::Controller::Helper::Paginated; |
|
12 |
use SL::Controller::Helper::Filtered; |
|
13 | 9 |
use SL::Locale::String qw(t8); |
14 | 10 |
use SL::JSON; |
15 | 11 |
|
16 | 12 |
use Rose::Object::MakeMethods::Generic ( |
17 |
'scalar --get_set_init' => [ qw(parts) ], |
|
13 |
'scalar --get_set_init' => [ qw(parts models) ],
|
|
18 | 14 |
); |
19 | 15 |
|
20 | 16 |
# safety |
21 | 17 |
__PACKAGE__->run_before(sub { $::auth->assert('part_service_assembly_edit') }); |
22 | 18 |
|
23 |
__PACKAGE__->make_filtered( |
|
24 |
ONLY => [ qw(part_picker_search part_picker_result ajax_autocomplete) ], |
|
25 |
LAUNDER_TO => 'filter', |
|
26 |
); |
|
27 |
__PACKAGE__->make_paginated( |
|
28 |
ONLY => [ qw(part_picker_search part_picker_result ajax_autocomplete) ], |
|
29 |
); |
|
30 |
|
|
31 |
__PACKAGE__->make_sorted( |
|
32 |
ONLY => [ qw(part_picker_search part_picker_result ajax_autocomplete) ], |
|
33 |
|
|
34 |
DEFAULT_BY => 'partnumber', |
|
35 |
DEFAULT_DIR => 1, |
|
36 |
|
|
37 |
partnumber => t8('Partnumber'), |
|
38 |
); |
|
39 |
|
|
40 | 19 |
sub action_ajax_autocomplete { |
41 | 20 |
my ($self, %params) = @_; |
42 | 21 |
|
... | ... | |
92 | 71 |
} |
93 | 72 |
|
94 | 73 |
sub init_parts { |
95 |
$_[0]->get_models(with_objects => [ qw(unit_obj) ]); |
|
74 |
$_[0]->models->get (with_objects => [ qw(unit_obj) ]); |
|
75 |
} |
|
76 |
|
|
77 |
sub init_models { |
|
78 |
my ($self) = @_; |
|
79 |
|
|
80 |
SL::Controller::Helper::GetModels->new( |
|
81 |
controller => $self, |
|
82 |
model => 'Part', |
|
83 |
sorted => { |
|
84 |
_default => { |
|
85 |
by => 'partnumber', |
|
86 |
dir => 1, |
|
87 |
}, |
|
88 |
partnumber => t8('Partnumber'), |
|
89 |
} |
|
90 |
); |
|
96 | 91 |
} |
97 | 92 |
|
98 | 93 |
1; |
Auch abrufbar als: Unified diff
PartPicker get_models