$form->{title} = $locale->text($form->{title});
$form->{title} = $locale->text('Assemblies') if ($is_xyz{is_assembly});
- $form->{jsscript} = 1;
-
$form->{CUSTOM_VARIABLES} = CVar->get_configs('module' => 'IC');
($form->{CUSTOM_VARIABLES_FILTER_CODE},
$form->{CUSTOM_VARIABLES_INCLUSION_CODE}) = CVar->render_search_options('variables' => $form->{CUSTOM_VARIABLES},
IC->create_links("IC", \%myconfig, \%$form);
# currencies
- map({ $form->{selectcurrency} .= "<option>$_\n" }
- split(/:/, $form->{currencies}));
+ map({ $form->{selectcurrency} .= "<option>$_\n" } $::form->get_all_currencies());
# parts and assemblies have the same links
my $item = $form->{item};
$form->get_lists('price_factors' => 'ALL_PRICE_FACTORS',
'partsgroup' => 'all_partsgroup',
- 'vendors' => 'ALL_VENDORS',);
+ 'vendors' => 'ALL_VENDORS',
+ 'warehouses' => { 'key' => 'WAREHOUSES',
+ 'bins' => 'BINS', });
+ # leerer wert für Lager und Lagerplatz korrekt einstellt
+ # ID 0 sollte in Ordnung sein, da der Zähler sowieso höher ist
+ my $no_default_bin_entry = { 'id' => '0', description => '--', 'BINS' => [ { id => '0', description => ''} ] };
+ push @ { $form->{WAREHOUSES} }, $no_default_bin_entry;
+ if (my $max = scalar @{ $form->{WAREHOUSES} }) {
+ my ($default_warehouse_id, $default_bin_id);
+ if ($form->{action} eq 'add') { # default only for new entries
+ $default_warehouse_id = $::instance_conf->get_warehouse_id;
+ $default_bin_id = $::instance_conf->get_bin_id;
+ }
+ $form->{warehouse_id} ||= $default_warehouse_id || $form->{WAREHOUSES}->[$max -1]->{id};
+ $form->{bin_id} ||= $default_bin_id || $form->{WAREHOUSES}->[$max -1]->{BINS}->[0]->{id};
+ }
IC->retrieve_buchungsgruppen(\%myconfig, $form);
flash('info', $::locale->text('This partnumber is not unique. You should change it.'));
}
- # use JavaScript Calendar or not (yes!)
- $form->{jsscript} = 1;
-
my $units = AM->retrieve_units(\%myconfig, $form);
$form->{ALL_UNITS} = [ map +{ name => $_ }, sort { $units->{$a}{sortkey} <=> $units->{$b}{sortkey} } keys %$units ];
$form->{defaults} = AM->get_defaults();
- $::request->{layout}->focus("#partnumber");
-
$form->{CUSTOM_VARIABLES} = CVar->get_custom_variables('module' => 'IC', 'trans_id' => $form->{id});
CVar->render_inputs('variables' => $form->{CUSTOM_VARIABLES}, show_disabled_message => 1)
}
my %header = (
- runningnumber => { text => $locale->text('No.'), nowrap => 1, width => '5%' },
- qty => { text => $locale->text('Qty'), nowrap => 1, width => '10%' },
- unit => { text => $locale->text('Unit'), nowrap => 1, width => '5%' },
- partnumber => { text => $locale->text('Part Number'), nowrap => 1, width => '20%' },
- description => { text => $locale->text('Part Description'), nowrap => 1, width => '50%' },
- lastcost => { text => $locale->text('Purchase Prices'), nowrap => 1, width => '50%' },
- total => { text => $locale->text('Sale Prices'), nowrap => 1, },
- bom => { text => $locale->text('BOM'), },
- partsgroup => { text => $locale->text('Group'), },
+ runningnumber => { text => $locale->text('No.'), nowrap => 1, width => '5%', align => 'left',},
+ qty => { text => $locale->text('Qty'), nowrap => 1, width => '10%', align => 'left',},
+ unit => { text => $locale->text('Unit'), nowrap => 1, width => '5%', align => 'left',},
+ partnumber => { text => $locale->text('Part Number'), nowrap => 1, width => '20%', align => 'left',},
+ description => { text => $locale->text('Part Description'), nowrap => 1, width => '50%', align => 'left',},
+ lastcost => { text => $locale->text('Purchase Prices'), nowrap => 1, width => '50%', align => 'right',},
+ total => { text => $locale->text('Sale Prices'), nowrap => 1, align => 'right',},
+ bom => { text => $locale->text('BOM'), align => 'center',},
+ partsgroup => { text => $locale->text('Group'), align => 'left',},
);
my @ROWS;
$form->error($locale->text('Description must not be empty!')) unless $form->{description};
$form->error($locale->text('Partnumber must not be set to empty!')) if $form->{id} && !$form->{partnumber};
+ # undef warehouse_id if the empty value is selected
+ if ( ($form->{warehouse_id} == 0) && ($form->{bin_id} == 0) ) {
+ undef $form->{warehouse_id};
+ undef $form->{bin_id};
+ }
# save part
if (IC->save(\%myconfig, \%$form) == 3) {
$form->error($locale->text('Partnumber not unique!'));