X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fio.pl;h=86010b14f35edfb524645305980c10c34e078734;hb=b9436847a02c9f8c58383a8a3a1d64ce055ec35d;hp=7cdc751bd8513b81ce3bcb6d2272421125009be7;hpb=b92bc20759a4ef39eb106fc80fa6aaedde4df02d;p=kivitendo-erp.git diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index 7cdc751bd..86010b14f 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -142,7 +142,6 @@ sub display_row { $form->{weightunit} = $defaults->{weightunit}; my $is_purchase = (first { $_ eq $form->{type} } qw(request_quotation purchase_order purchase_delivery_order)) || ($form->{script} eq 'ir.pl'); - my $show_min_order_qty = first { $_ eq $form->{type} } qw(request_quotation purchase_order); my $is_delivery_order = $form->{type} =~ /_delivery_order$/; my $is_quotation = $form->{type} =~ /_quotation$/; my $is_invoice = $form->{type} =~ /invoice/; @@ -319,7 +318,7 @@ sub display_row { my $qty_dec = ($form->{"qty_$i"} =~ /\.(\d+)/) ? length $1 : 2; $column_data{qty} = $cgi->textfield(-name => "qty_$i", -size => 5, -class => "numeric", -value => $form->format_amount(\%myconfig, $form->{"qty_$i"}, $qty_dec)); - $column_data{qty} .= $cgi->button(-onclick => "calculate_qty_selection_window('qty_$i', 'formel_$i')", -value => $locale->text('*/')) + $column_data{qty} .= $cgi->button(-onclick => "calculate_qty_selection_dialog('qty_$i', '', 'formel_$i', '')", -value => $locale->text('*/')) . $cgi->hidden(-name => "formel_$i", -value => $form->{"formel_$i"}) if $form->{"formel_$i"}; @@ -909,6 +908,46 @@ sub validate_items { sub order { $main::lxdebug->enter_sub(); + _order(); + + if ($::instance_conf->get_feature_experimental_order) { + my $order = _make_record(); + $order->globalproject_id(undef) if !$order->globalproject_id; + $order->payment_id(undef) if !$order->payment_id; + my $row = 1; + foreach my $item (@{$order->items_sorted}) { + $item->custom_variables([]); + + $item->price_factor_id(undef) if !$item->price_factor_id; + $item->project_id(undef) if !$item->project_id; + $item->discount($item->discount/100.0); + + # autovivify all cvars that are not in the form (cvars_by_config can do it). + # workaround to pre-parse number-cvars (parse_custom_variable_values does not parse number values). + foreach my $var (@{ $item->cvars_by_config }) { + my $key = 'ic_cvar_' . $var->config->name . '_' . $row; + $var->unparsed_value($::form->{$key}); + $var->unparsed_value($::form->parse_amount(\%::myconfig, $var->{__unparsed_value})) if ($var->config->type eq 'number' && exists($var->{__unparsed_value})); + } + $item->parse_custom_variable_values; + + $row++; + } + + require SL::Controller::Order; + my $c = SL::Controller::Order->new(order => $order); + $c->action_edit(); + + $main::lxdebug->leave_sub(); + $::dispatcher->end_request; + } + + &display_form; + + $main::lxdebug->leave_sub(); +} + +sub _order { my $form = $main::form; my %myconfig = %main::myconfig; my $locale = $main::locale; @@ -982,9 +1021,6 @@ sub order { } &prepare_order; - &display_form; - - $main::lxdebug->leave_sub(); } sub quotation { @@ -1004,7 +1040,7 @@ sub quotation { if ($form->{second_run}) { $form->{print_and_post} = 0; } - delete $form->{$_} foreach (qw(id printed emailed queued)); + delete $form->{$_} foreach (qw(id printed emailed queued quonumber transaction_description)); my $buysell; if ($form->{script} eq 'ir.pl' || $form->{type} eq 'purchase_order') {