X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FController%2FPart.pm;h=23b4eff1ee0d204332ae2d5be832ea419897feaf;hb=3a8e5bda9aeca9faf1a5278bc14324104d4db5c8;hp=6b40493f415126423796b3123a6deba09ccf0f95;hpb=f2cee1250cf2604954dbc8fac64f0d1643393ecd;p=kivitendo-erp.git diff --git a/SL/Controller/Part.pm b/SL/Controller/Part.pm index 6b40493f4..23b4eff1e 100644 --- a/SL/Controller/Part.pm +++ b/SL/Controller/Part.pm @@ -457,20 +457,23 @@ sub action_reorder_items { 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; }