my $part_info = IC->get_basic_part_info('id' => $form->{parts_id});
my $units = AM->retrieve_units(\%myconfig, $form);
- my $units_data = AM->unit_select_data($units, undef, undef, $part_info->{unit});
+ # der zweite Parameter von unit_select_data gibt den default-Namen (selected) vor
+ my $units_data = AM->unit_select_data($units, $form->{do_unit}, undef, $part_info->{unit});
$form->get_lists('warehouses' => { 'key' => 'WAREHOUSES',
'bins' => 'BINS' });
show_no_warehouses_error() if (!scalar @{ $form->{WAREHOUSES} });
my $units = AM->retrieve_units(\%myconfig, $form);
- $form->{UNITS} = AM->unit_select_data($units, $form->{unit}, 0, $form->{partunit});
+ # der zweite Parameter von unit_select_data gibt den default-Namen (selected) vor
+ $form->{UNITS} = AM->unit_select_data($units, $form->{partunit}, 0, $form->{partunit});
if (scalar @{ $form->{WAREHOUSES} }) {
$form->{warehouse_id} ||= $form->{WAREHOUSES}->[0]->{id};
<td>
<select name="unit_[% loop.count %]">
[%- FOREACH unit = UNITS %]
- <option[% IF unit.name == row.unit %] selected[% END %]>[% HTML.escape(unit.name) %]</option>
+ <option[% IF unit.selected %] selected[% END %]>[% HTML.escape(unit.name) %]</option>
[%- END %]
</select>
</td>