Revision 6798d5bb
Von Jan Büren vor etwa 1 Jahr hinzugefügt
SL/Controller/Inventory.pm | ||
---|---|---|
722 | 722 |
my ($self) = @_; |
723 | 723 |
|
724 | 724 |
$self->warehouse($self->warehouses->[0]) if !$self->warehouse || !$self->warehouse->id; |
725 |
$self->bin ($self->warehouse->bins->[0]) if !$self->bin || !$self->bin->id; |
|
725 |
$self->bin ($self->warehouse->bins_sorted_naturally->[0]) if !$self->bin || !$self->bin->id;
|
|
726 | 726 |
# foreach my $warehouse ( $self->warehouses ) { |
727 | 727 |
# $warehouse->{BINS} = []; |
728 | 728 |
# foreach my $bin ( $self->bins ) { |
... | ... | |
768 | 768 |
} |
769 | 769 |
|
770 | 770 |
sub build_bin_select { |
771 |
select_tag('bin_id', [ $_[0]->warehouse->bins ], |
|
771 |
select_tag('bin_id', [ $_[0]->warehouse->bins_sorted_naturally ],
|
|
772 | 772 |
title_key => 'description', |
773 | 773 |
default => $_[0]->bin->id, |
774 | 774 |
); |
SL/Controller/Part.pm | ||
---|---|---|
674 | 674 |
die unless ref($self->warehouse) eq 'SL::DB::Warehouse'; |
675 | 675 |
|
676 | 676 |
if ( $self->warehouse->id and @{$self->warehouse->bins} ) { |
677 |
$self->bin($self->warehouse->bins_sorted->[0]); |
|
677 |
$self->bin($self->warehouse->bins_sorted_naturally->[0]);
|
|
678 | 678 |
$self->js |
679 | 679 |
->html('#bin', $self->build_bin_select) |
680 | 680 |
->focus('#part_bin_id'); |
... | ... | |
1202 | 1202 |
} |
1203 | 1203 |
|
1204 | 1204 |
sub build_bin_select { |
1205 |
select_tag('part.bin_id', [ @{ $_[0]->warehouse->bins_sorted } ], |
|
1205 |
select_tag('part.bin_id', [ @{ $_[0]->warehouse->bins_sorted_naturally } ],
|
|
1206 | 1206 |
title_key => 'description', |
1207 | 1207 |
default => $_[0]->bin->id, |
1208 | 1208 |
); |
SL/DB/Warehouse.pm | ||
---|---|---|
2 | 2 |
|
3 | 3 |
use strict; |
4 | 4 |
|
5 |
use Sort::Naturally; |
|
6 |
|
|
5 | 7 |
use SL::DB::MetaSetup::Warehouse; |
6 | 8 |
use SL::DB::Manager::Warehouse; |
7 | 9 |
use SL::DB::Helper::ActsAsList; |
... | ... | |
19 | 21 |
sub bins_sorted { |
20 | 22 |
return [ sort { $a->id <=> $b->id } @{ shift()->bins || [] } ]; |
21 | 23 |
} |
24 |
sub bins_sorted_naturally { |
|
25 |
return [ sort { ncmp ($a->description, $b->description) } @{ shift()->bins || [] } ]; |
|
26 |
} |
|
22 | 27 |
|
23 | 28 |
sub first_bin { |
24 | 29 |
return shift()->bins_sorted->[0]; |
templates/design40_webpages/inventory/warehouse_selection_stock.html | ||
---|---|---|
24 | 24 |
<td class="wi-wide below"> |
25 | 25 |
[% L.select_tag('warehouse_id', SELF.warehouses, default=SELF.warehouse.id, title_key='description', class='wi-wide') %] |
26 | 26 |
[% IF SELF.warehouse.id %] |
27 |
[% L.select_tag('bin_id', SELF.warehouse.bins, default=SELF.bin.id, title_key='description', class='wi-wide below') %] |
|
27 |
[% L.select_tag('bin_id', SELF.warehouse.bins_sorted_naturally, default=SELF.bin.id, title_key='description', class='wi-wide below') %]
|
|
28 | 28 |
[% ELSE %] |
29 | 29 |
<span id="bin_id" class="data wi-wide"></span> |
30 | 30 |
[% END %] |
templates/webpages/inventory/warehouse_selection_stock.html | ||
---|---|---|
20 | 20 |
<th align="right" nowrap>[% 'Destination warehouse' | $T8 %]</th> |
21 | 21 |
<td>[% L.select_tag('warehouse_id', SELF.warehouses, default=SELF.warehouse.id, title_key='description') %] |
22 | 22 |
[% IF SELF.warehouse.id %] |
23 |
[% L.select_tag('bin_id', SELF.warehouse.bins, default=SELF.bin.id, title_key='description') %] |
|
23 |
[% L.select_tag('bin_id', SELF.warehouse.bins_sorted_naturally, default=SELF.bin.id, title_key='description') %]
|
|
24 | 24 |
[%- ELSE %] |
25 | 25 |
<span id='bin_id'></span> |
26 | 26 |
[% 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