X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fio.pl;h=6826833d758dcb2be26d683a471c732cd52cc8fc;hb=25d67207329617a104fab716c301895cf0ae116d;hp=d8f53dbc8354b1713776247ca04ed4795ac147fa;hpb=09479f022ab9e0815ceee55923ae46df51afbd42;p=kivitendo-erp.git diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index d8f53dbc8..6826833d7 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -888,10 +888,22 @@ sub order { $form->{old_employee_id} = $form->{employee_id}; $form->{old_salesman_id} = $form->{salesman_id}; - # link doc invoice -> quotation (single id no multi mode) - $form->{convert_from_ar_ids} = delete $form->{id}; - delete $form->{$_} foreach (qw(printed emailed queued)); + + # When creating a new sales order from a saved sales invoice, reset id, + # ordnumber, transdate and deliverydate as we are creating a new order. This + # workflow is probably mainly used as a template mechanism for creating new + # orders from existing invoices, so we probably don't want to link the items. + # Is this order function called anywhere else? + # The worksflows in oe already call sales_order and purchase_order in oe, not + # this general function which now only seems to be called from saved sales + # invoices + # Why is ordnumber set to invnumber above, does this ever make sense? + + if ( $form->{script} eq 'is.pl' && $form->{type} eq 'invoice' ) { + delete $form->{$_} foreach (qw(ordnumber id transdate deliverydate)); + }; + my $buysell; if ($form->{script} eq 'ir.pl' || $form->{type} eq 'request_quotation') { $form->{title} = $locale->text('Add Purchase Order'); @@ -954,9 +966,6 @@ sub quotation { if ($form->{type} =~ /(sales|purchase)_order/) { $form->{"converted_from_orderitems_id_$_"} = delete $form->{"orderitems_id_$_"} for 1 .. $form->{"rowcount"}; } - # link doc order -> quotation (single id no multi mode) - $form->{convert_from_oe_ids} = delete $form->{id}; - if ($form->{second_run}) { $form->{print_and_post} = 0; } @@ -1958,6 +1967,7 @@ sub _make_record_item { } sub _make_record { + Form::disconnect_standard_dbh; my $class = { sales_order => 'Order', purchase_order => 'Order',