Revision fbf7abba
Von Bernd Bleßmann vor 4 Monaten hinzugefügt
SL/Controller/Part.pm | ||
---|---|---|
40 | 40 |
orphaned |
41 | 41 |
assortment assortment_items assembly assembly_items |
42 | 42 |
all_pricegroups all_translations all_partsgroups all_units |
43 |
all_buchungsgruppen all_payment_terms all_warehouses
|
|
43 |
all_buchungsgruppen all_payment_terms |
|
44 | 44 |
parts_classification_filter |
45 | 45 |
all_languages all_units all_price_factors |
46 | 46 |
all_businesses) ], |
47 |
'scalar' => [ qw(warehouse bin stock_amounts journal) ],
|
|
47 |
'scalar' => [ qw(stock_amounts journal) ], |
|
48 | 48 |
); |
49 | 49 |
|
50 | 50 |
# safety |
... | ... | |
666 | 666 |
$self->js->run('kivi.Part.redisplay_items', \@to_sort)->render; |
667 | 667 |
} |
668 | 668 |
|
669 |
sub action_warehouse_changed { |
|
670 |
my ($self) = @_; |
|
671 |
|
|
672 |
if ($::form->{warehouse_id} ) { |
|
673 |
$self->warehouse(SL::DB::Manager::Warehouse->find_by_or_create(id => $::form->{warehouse_id})); |
|
674 |
die unless ref($self->warehouse) eq 'SL::DB::Warehouse'; |
|
675 |
|
|
676 |
if ( $self->warehouse->id and @{$self->warehouse->bins} ) { |
|
677 |
$self->bin($self->warehouse->bins_sorted_naturally->[0]); |
|
678 |
$self->js |
|
679 |
->html('#bin', $self->build_bin_select) |
|
680 |
->focus('#part_bin_id'); |
|
681 |
return $self->js->render; |
|
682 |
} |
|
683 |
} |
|
684 |
|
|
685 |
# no warehouse was selected, empty the bin field and reset the id |
|
686 |
$self->js |
|
687 |
->val('#part_bin_id', undef) |
|
688 |
->html('#bin', ''); |
|
689 |
|
|
690 |
return $self->js->render; |
|
691 |
} |
|
692 |
|
|
693 | 669 |
sub action_ajax_autocomplete { |
694 | 670 |
my ($self, %params) = @_; |
695 | 671 |
|
... | ... | |
1201 | 1177 |
}; |
1202 | 1178 |
} |
1203 | 1179 |
|
1204 |
sub build_bin_select { |
|
1205 |
select_tag('part.bin_id', [ @{ $_[0]->warehouse->bins_sorted_naturally } ], |
|
1206 |
title_key => 'description', |
|
1207 |
default => $_[0]->bin->id, |
|
1208 |
); |
|
1209 |
} |
|
1210 |
|
|
1211 |
|
|
1212 | 1180 |
# get_set_inits for partpicker |
1213 | 1181 |
|
1214 | 1182 |
sub init_parts { |
... | ... | |
1375 | 1343 |
return \@array; |
1376 | 1344 |
} |
1377 | 1345 |
|
1378 |
sub init_all_warehouses { |
|
1379 |
my ($self) = @_; |
|
1380 |
SL::DB::Manager::Warehouse->get_all(query => [ or => [ invalid => 0, invalid => undef, id => $self->part->warehouse_id ] ]); |
|
1381 |
} |
|
1382 |
|
|
1383 | 1346 |
sub init_all_languages { |
1384 | 1347 |
SL::DB::Manager::Language->get_all_sorted; |
1385 | 1348 |
} |
js/kivi.Part.js | ||
---|---|---|
327 | 327 |
}; |
328 | 328 |
|
329 | 329 |
|
330 |
ns.reload_bin_selection = function() { |
|
331 |
$.post("controller.pl", { action: 'Part/warehouse_changed', warehouse_id: function(){ return $('#part_warehouse_id').val(); } }, kivi.eval_json_result); |
|
332 |
}; |
|
333 |
|
|
334 | 330 |
var KEY = { |
335 | 331 |
TAB: 9, |
336 | 332 |
ENTER: 13, |
... | ... | |
852 | 848 |
ns.reformat_number(event); |
853 | 849 |
}); |
854 | 850 |
|
855 |
$('#part_warehouse_id').change(kivi.Part.reload_bin_selection); |
|
856 |
|
|
857 | 851 |
ns.init(); |
858 | 852 |
}); |
859 | 853 |
}); |
templates/webpages/part/_basic_data.html | ||
---|---|---|
169 | 169 |
<th align="right" nowrap="true">[% 'Order Size' | $T8 %]</th> |
170 | 170 |
<td>[% L.input_tag("part.order_qty_as_number", SELF.part.order_qty_as_number, size=10, class="numeric") %]</td> |
171 | 171 |
</tr> |
172 |
[% IF SELF.all_warehouses.size %] |
|
173 | 172 |
<tr> |
174 |
<th align="right" nowrap="true">[% 'Default Warehouse' | $T8 %]</th> |
|
175 |
<td>[% L.select_tag('part.warehouse_id', SELF.all_warehouses, default=SELF.part.warehouse.id, title_key='description', with_empty=1) %] |
|
176 |
</td> |
|
177 |
</tr> |
|
178 |
[% END %] |
|
179 |
<tr> |
|
180 |
<th align="right" nowrap="true">[% 'Default Bin' | $T8 %]</th> |
|
173 |
<th align="right" nowrap="true">[% 'Default Warehouse / Bin' | $T8 %]</th> |
|
181 | 174 |
<td> |
182 |
<span id='bin'> |
|
183 |
[% IF SELF.part.warehouse.id %] |
|
184 |
[% L.select_tag('part.bin_id', SELF.part.warehouse.bins_sorted_naturally, default=SELF.part.bin.id, title_key='description', with_empty=0) %] |
|
185 |
[%- END %] |
|
186 |
</span> |
|
175 |
[% P.warehouse.wh_bin_select('warehouse', |
|
176 |
wh_name='part.warehouse_id', |
|
177 |
wh_default=SELF.part.warehouse.id, |
|
178 |
bin_name='part.bin_id', |
|
179 |
bin_default=SELF.part.bin.id, |
|
180 |
with_empty=1) %] |
|
187 | 181 |
</td> |
188 | 182 |
</tr> |
189 | 183 |
[%- END %] |
Auch abrufbar als: Unified diff
S:C:Part: Lagerplatz-Presenter verwenden