Revision 3a8e5bda
Von Martin Helmling martin.helmling@octosoft.eu vor fast 8 Jahren hinzugefügt
SL/Controller/Part.pm | ||
---|---|---|
457 | 457 |
sub action_warehouse_changed { |
458 | 458 |
my ($self) = @_; |
459 | 459 |
|
460 |
$self->warehouse(SL::DB::Manager::Warehouse->find_by_or_create(id => $::form->{warehouse_id})); |
|
461 |
die unless ref($self->warehouse) eq 'SL::DB::Warehouse'; |
|
462 |
|
|
463 |
if ( $self->warehouse->id and @{$self->warehouse->bins} ) { |
|
464 |
$self->bin($self->warehouse->bins->[0]); |
|
465 |
$self->js |
|
466 |
->html('#bin', $self->build_bin_select) |
|
467 |
->focus('#part_bin_id'); |
|
468 |
} else { |
|
469 |
# no warehouse was selected, empty the bin field and reset the id |
|
470 |
$self->js |
|
471 |
->val('#part_bin_id', undef) |
|
472 |
->html('#bin', ''); |
|
473 |
}; |
|
460 |
if ($::form->{warehouse_id} ) { |
|
461 |
$self->warehouse(SL::DB::Manager::Warehouse->find_by_or_create(id => $::form->{warehouse_id})); |
|
462 |
die unless ref($self->warehouse) eq 'SL::DB::Warehouse'; |
|
463 |
|
|
464 |
if ( $self->warehouse->id and @{$self->warehouse->bins} ) { |
|
465 |
$self->bin($self->warehouse->bins->[0]); |
|
466 |
$self->js |
|
467 |
->html('#bin', $self->build_bin_select) |
|
468 |
->focus('#part_bin_id'); |
|
469 |
return $self->js->render; |
|
470 |
} |
|
471 |
} |
|
472 |
|
|
473 |
# no warehouse was selected, empty the bin field and reset the id |
|
474 |
$self->js |
|
475 |
->val('#part_bin_id', undef) |
|
476 |
->html('#bin', ''); |
|
474 | 477 |
|
475 | 478 |
return $self->js->render; |
476 | 479 |
} |
Auch abrufbar als: Unified diff
Abfangen von leerer warehouse_id bevor Objekt gesucht wird
Will man kein Default Lager einstellen kommt es zu einem Rose Fehler.
Nun wird verfahren wie wenn Lager nicht gefunden wird.