Revision 6798d5bb
Von Jan Büren vor mehr als 1 Jahr hinzugefügt
SL/Controller/Inventory.pm | ||
---|---|---|
my ($self) = @_;
|
||
|
||
$self->warehouse($self->warehouses->[0]) if !$self->warehouse || !$self->warehouse->id;
|
||
$self->bin ($self->warehouse->bins->[0]) if !$self->bin || !$self->bin->id;
|
||
$self->bin ($self->warehouse->bins_sorted_naturally->[0]) if !$self->bin || !$self->bin->id;
|
||
# foreach my $warehouse ( $self->warehouses ) {
|
||
# $warehouse->{BINS} = [];
|
||
# foreach my $bin ( $self->bins ) {
|
||
... | ... | |
}
|
||
|
||
sub build_bin_select {
|
||
select_tag('bin_id', [ $_[0]->warehouse->bins ],
|
||
select_tag('bin_id', [ $_[0]->warehouse->bins_sorted_naturally ],
|
||
title_key => 'description',
|
||
default => $_[0]->bin->id,
|
||
);
|
SL/Controller/Part.pm | ||
---|---|---|
die unless ref($self->warehouse) eq 'SL::DB::Warehouse';
|
||
|
||
if ( $self->warehouse->id and @{$self->warehouse->bins} ) {
|
||
$self->bin($self->warehouse->bins_sorted->[0]);
|
||
$self->bin($self->warehouse->bins_sorted_naturally->[0]);
|
||
$self->js
|
||
->html('#bin', $self->build_bin_select)
|
||
->focus('#part_bin_id');
|
||
... | ... | |
}
|
||
|
||
sub build_bin_select {
|
||
select_tag('part.bin_id', [ @{ $_[0]->warehouse->bins_sorted } ],
|
||
select_tag('part.bin_id', [ @{ $_[0]->warehouse->bins_sorted_naturally } ],
|
||
title_key => 'description',
|
||
default => $_[0]->bin->id,
|
||
);
|
SL/DB/Warehouse.pm | ||
---|---|---|
|
||
use strict;
|
||
|
||
use Sort::Naturally;
|
||
|
||
use SL::DB::MetaSetup::Warehouse;
|
||
use SL::DB::Manager::Warehouse;
|
||
use SL::DB::Helper::ActsAsList;
|
||
... | ... | |
sub bins_sorted {
|
||
return [ sort { $a->id <=> $b->id } @{ shift()->bins || [] } ];
|
||
}
|
||
sub bins_sorted_naturally {
|
||
return [ sort { ncmp ($a->description, $b->description) } @{ shift()->bins || [] } ];
|
||
}
|
||
|
||
sub first_bin {
|
||
return shift()->bins_sorted->[0];
|
templates/design40_webpages/inventory/warehouse_selection_stock.html | ||
---|---|---|
<td class="wi-wide below">
|
||
[% L.select_tag('warehouse_id', SELF.warehouses, default=SELF.warehouse.id, title_key='description', class='wi-wide') %]
|
||
[% IF SELF.warehouse.id %]
|
||
[% L.select_tag('bin_id', SELF.warehouse.bins, default=SELF.bin.id, title_key='description', class='wi-wide below') %]
|
||
[% L.select_tag('bin_id', SELF.warehouse.bins_sorted_naturally, default=SELF.bin.id, title_key='description', class='wi-wide below') %]
|
||
[% ELSE %]
|
||
<span id="bin_id" class="data wi-wide"></span>
|
||
[% END %]
|
templates/webpages/inventory/warehouse_selection_stock.html | ||
---|---|---|
<th align="right" nowrap>[% 'Destination warehouse' | $T8 %]</th>
|
||
<td>[% L.select_tag('warehouse_id', SELF.warehouses, default=SELF.warehouse.id, title_key='description') %]
|
||
[% IF SELF.warehouse.id %]
|
||
[% L.select_tag('bin_id', SELF.warehouse.bins, default=SELF.bin.id, title_key='description') %]
|
||
[% L.select_tag('bin_id', SELF.warehouse.bins_sorted_naturally, default=SELF.bin.id, title_key='description') %]
|
||
[%- ELSE %]
|
||
<span id='bin_id'></span>
|
||
[% END %]
|
Auch abrufbar als: Unified diff
Lagerplätze natürlich nach Beschreibung in Listen sortieren
Für alle Lagerfunktionen und für den Standardlagerplatz der Waren