Beim Umwandeln von Angeboten/Preisanfragen in Aufträge die IDs in record_links speich...
[kivitendo-erp.git] / bin / mozilla / do.pl
index 370411d..c88f3b0 100644 (file)
@@ -648,17 +648,15 @@ sub invoice {
   check_do_access();
   $auth->assert($form->{type} eq 'purchase_delivery_order' ? 'vendor_invoice_edit' : 'invoice_edit');
 
-  $form->{close_do_ids} = $form->{id};
+  $form->{convert_from_do_ids} = $form->{id};
+  $form->{deliverydate}        = $form->{transdate};
+  $form->{transdate}           = $form->{invdate} = $form->current_date(\%myconfig);
+  $form->{duedate}             = $form->current_date(\%myconfig, $form->{invdate}, $form->{terms} * 1);
+  $form->{defaultcurrency}     = $form->get_default_currency(\%myconfig);
 
-  $form->{deliverydate} = $form->{transdate};
-  $form->{transdate}    = $form->{invdate} = $form->current_date(\%myconfig);
-  $form->{duedate}      = $form->current_date(\%myconfig, $form->{invdate}, $form->{terms} * 1);
-
-  $form->{id}     = '';
-  $form->{closed} = 0;
   $form->{rowcount}--;
 
-  $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
+  delete @{$form}{qw(id closed delivered)};
 
   if ($form->{type} eq 'purchase_delivery_order') {
     $form->{title}  = $locale->text('Add Vendor Invoice');
@@ -742,13 +740,13 @@ sub invoice_multi {
                               'back_button' => 1);
   }
 
-  $form->{close_do_ids}    = join ' ', @do_ids;
-  $form->{deliverydate}    = $form->{transdate};
-  $form->{transdate}       = $form->current_date(\%myconfig);
-  $form->{duedate}         = $form->current_date(\%myconfig, $form->{invdate}, $form->{terms} * 1);
-  $form->{type}            = "invoice";
-  $form->{closed}          = 0;
-  $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
+  $form->{convert_from_do_ids} = join ' ', @do_ids;
+  $form->{deliverydate}        = $form->{transdate};
+  $form->{transdate}           = $form->current_date(\%myconfig);
+  $form->{duedate}             = $form->current_date(\%myconfig, $form->{invdate}, $form->{terms} * 1);
+  $form->{type}                = "invoice";
+  $form->{closed}              = 0;
+  $form->{defaultcurrency}     = $form->get_default_currency(\%myconfig);
 
   my $buysell;
   if ($form->{type} eq 'purchase_delivery_order') {
@@ -1216,6 +1214,19 @@ sub transfer_out {
   $lxdebug->leave_sub();
 }
 
+sub mark_closed {
+  $lxdebug->enter_sub();
+
+  DO->close_orders('ids' => [ $form->{id} ]);
+
+  $form->{closed} = 1;
+
+  update();
+
+  $lxdebug->leave_sub();
+}
+
+
 sub yes {
   call_sub($form->{yes_nextsub});
 }