use Rose::Object::MakeMethods::Generic (
scalar => [ qw(db_args flat_filter) ],
- 'scalar --get_set_init' => [ qw(models all_edit_right vc use_linked_items all_employees all_businesses) ],
+ 'scalar --get_set_init' => [ qw(models all_edit_right vc use_linked_items all_employees all_businesses all_departments) ],
);
__PACKAGE__->run_before(sub { $::auth->assert('delivery_plan'); });
sub make_filter_summary {
my ($self) = @_;
my $vc = $self->vc;
- my ($business, $employee);
+ my ($business, $employee, $department);
my $filter = $::form->{filter} || {};
my @filter_strings;
$business = SL::DB::Business->new(id => $filter->{order}{customer}{"business_id"})->load->description if $filter->{order}{customer}{"business_id"};
$employee = SL::DB::Employee->new(id => $filter->{order}{employee_id})->load->name if $filter->{order}{employee_id};
+ $department = SL::DB::Department->new(id => $filter->{order}{department_id})->load->description if $filter->{order}{department_id};
my @filters = (
[ $filter->{order}{"ordnumber:substr::ilike"}, $::locale->text('Number') ],
[ $filter->{order}{customer}{"name:substr::ilike"}, $::locale->text('Customer') ],
[ $filter->{order}{customer}{"customernumber:substr::ilike"}, $::locale->text('Customer Number') ],
[ $business, $::locale->text('Customer type') ],
+ [ $department, $::locale->text('Department') ],
[ $employee, $::locale->text('Employee') ],
);
sub init_all_businesses {
return SL::DB::Manager::Business->get_all_sorted;
}
+sub init_all_departments {
+ return SL::DB::Manager::Department->get_all_sorted;
+}
sub link_to {
my ($self, $object, %params) = @_;
style => 'width: 200px') %]
</td>
</tr>
+ [%- IF SELF.all_departments.size %]
+ <tr>
+ <th align="right">[% 'Department' | $T8 %]</th>
+ <td>
+ [% L.select_tag('filter.order.department_id', SELF.all_departments, default=filter.order.department_id, title_key='description', with_empty=1, style='width:200px') %]
+ </td>
+ </tr>
+ [%- END %]
<tr>
<th align="right">[% 'Type' | $T8 %]</th>
<td>