sub action_warehouse_changed {
my ($self) = @_;
- $self->warehouse(SL::DB::Manager::Warehouse->find_by_or_create(id => $::form->{warehouse_id}));
- die unless ref($self->warehouse) eq 'SL::DB::Warehouse';
-
- if ( $self->warehouse->id and @{$self->warehouse->bins} ) {
- $self->bin($self->warehouse->bins->[0]);
- $self->js
- ->html('#bin', $self->build_bin_select)
- ->focus('#part_bin_id');
- } else {
- # no warehouse was selected, empty the bin field and reset the id
- $self->js
- ->val('#part_bin_id', undef)
- ->html('#bin', '');
- };
+ if ($::form->{warehouse_id} ) {
+ $self->warehouse(SL::DB::Manager::Warehouse->find_by_or_create(id => $::form->{warehouse_id}));
+ die unless ref($self->warehouse) eq 'SL::DB::Warehouse';
+
+ if ( $self->warehouse->id and @{$self->warehouse->bins} ) {
+ $self->bin($self->warehouse->bins->[0]);
+ $self->js
+ ->html('#bin', $self->build_bin_select)
+ ->focus('#part_bin_id');
+ return $self->js->render;
+ }
+ }
+
+ # no warehouse was selected, empty the bin field and reset the id
+ $self->js
+ ->val('#part_bin_id', undef)
+ ->html('#bin', '');
return $self->js->render;
}
query => [
obsolete => 0,
SL::DB::Manager::Part->type_filter($::form->{filter}{part_type}),
+ SL::DB::Manager::PartClassification->classification_filter($::form->{filter}{classification_id}),
or => [
description => { ilike => $::form->{filter}{'all:substr:multi::ilike'} },
partnumber => { ilike => $::form->{filter}{'all:substr:multi::ilike'} },
partnumber => t8('Partnumber'),
description => t8('Description'),
},
- with_objects => [ qw(unit_obj) ],
+ with_objects => [ qw(unit_obj classification) ],
);
}
}
sub init_all_partsgroups {
- SL::DB::Manager::PartsGroup->get_all_sorted;
+ my ($self) = @_;
+ SL::DB::Manager::PartsGroup->get_all_sorted(query => [ or => [ id => $self->part->partsgroup_id, obsolete => 0 ] ]);
}
sub init_all_buchungsgruppen {
}
sub init_all_payment_terms {
- SL::DB::Manager::PaymentTerm->get_all_sorted;
+ my ($self) = @_;
+ SL::DB::Manager::PaymentTerm->get_all_sorted(query => [ or => [ id => $self->part->payment_id, obsolete => 0 ] ]);
}
sub init_all_price_factors {
SL::Controller::Helper::GetModels->new(
controller => $_[0],
model => 'Part',
- with_objects => [ qw(unit_obj partsgroup) ],
+ with_objects => [ qw(unit_obj partsgroup classification) ],
disable_plugin => 'paginated',
source => $::form->{multi_items},
sorted => {