Order: Workflow Beistelllieferschein erstellen
authorSven Schöling <s.schoeling@googlemail.com>
Mon, 8 Nov 2021 03:24:04 +0000 (04:24 +0100)
committerJan Büren <jan@kivitendo.de>
Mon, 14 Feb 2022 14:02:19 +0000 (15:02 +0100)
SL/Controller/DeliveryOrder.pm
SL/Controller/Order.pm

index 6533425..3878e5a 100644 (file)
@@ -78,6 +78,16 @@ sub action_add {
   );
 }
 
+sub action_add_from_order {
+  my ($self) = @_;
+  # this interfers with init_order
+  $self->{converted_from_oe_id} = delete $::form->{id};
+
+  # TODO copy data and remember to link them on save
+
+  $self->action_add;
+}
+
 # edit an existing order
 sub action_edit {
   my ($self) = @_;
index b4328a1..524d904 100644 (file)
@@ -677,6 +677,16 @@ sub action_save_and_delivery_order {
   );
 }
 
+sub action_save_and_supplier_delivery_order {
+  my ($self) = @_;
+
+  $self->save_and_redirect_to(
+    controller => 'controller.pl',
+    action     => 'DeliveryOrder/add_from_order',
+    type       => 'supplier_delivery_order',
+  );
+}
+
 # save the order and redirect to the frontend subroutine for a new
 # invoice
 sub action_save_and_invoice {
@@ -2065,6 +2075,16 @@ sub setup_edit_action_bar {
           ],
           only_if   => (any { $self->type eq $_ } (sales_order_type(), purchase_order_type()))
         ],
+        action => [
+          t8('Save and Supplier Delivery Order'),
+          call      => [ 'kivi.Order.save', 'save_and_supplier_delivery_order', $::instance_conf->get_order_warn_duplicate_parts,
+                                                                       $::instance_conf->get_order_warn_no_deliverydate,
+                                                                                                                        ],
+          checks    => [ 'kivi.Order.check_save_active_periodic_invoices',
+                         @req_trans_cost_art, @req_cusordnumber,
+          ],
+          only_if   => (any { $self->type eq $_ } (sales_order_type()))
+        ],
         action => [
           t8('Save and Invoice'),
           call      => [ 'kivi.Order.save', 'save_and_invoice', $::instance_conf->get_order_warn_duplicate_parts ],