X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fic.pl;h=3434861c128366af5604344e5d3912f3a54f21c5;hb=8bde65163db8c36ffa5e83bed7ee68ab859c106d;hp=17d589f56e3660f0c00754875fd90236763dbcc2;hpb=d331a3d77f0b24a301412799d2e9cc5fa1bf27ba;p=kivitendo-erp.git diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl index 17d589f56..3434861c1 100644 --- a/bin/mozilla/ic.pl +++ b/bin/mozilla/ic.pl @@ -106,8 +106,6 @@ sub search { $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}, @@ -1585,7 +1583,22 @@ sub form_header { $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); @@ -1595,16 +1608,11 @@ sub form_header { 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) @@ -1674,15 +1682,15 @@ sub assembly_row { } 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; @@ -1760,12 +1768,14 @@ sub update { # parse pricegroups. and no, don't rely on check_form for this... map { $form->{"price_$_"} = $form->parse_amount(\%myconfig, $form->{"price_$_"}) } 1 .. $form->{price_rows}; + $form->{sellprice} = $form->parse_amount(\%myconfig, $form->{sellprice}); # same for makemodel lastcosts # but parse_amount not necessary for assembly component lastcosts unless ($form->{item} eq "assembly") { map { $form->{"lastcost_$_"} = $form->parse_amount(\%myconfig, $form->{"lastcost_$_"}) } 1 .. $form->{"makemodel_rows"}; }; + $form->{listprice} = $form->parse_amount(\%myconfig, $form->{listprice}); if ($form->{item} eq "assembly") { my $i = $form->{assembly_rows}; @@ -1844,6 +1854,11 @@ sub save { $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!'));