DeliveryOrder: stock info im dom speichern
authorSven Schöling <s.schoeling@googlemail.com>
Sun, 21 Nov 2021 23:13:36 +0000 (00:13 +0100)
committerJan Büren <jan@kivitendo.de>
Mon, 14 Feb 2022 14:02:19 +0000 (15:02 +0100)
SL/Controller/DeliveryOrder.pm
js/kivi.DeliveryOrder.js
templates/webpages/delivery_order/stock_dialog.html
templates/webpages/delivery_order/tabs/_row.html

index 42ee5d5..61e614e 100644 (file)
@@ -890,10 +890,12 @@ sub action_return_from_create_part {
 sub action_stock_in_out_dialog {
   my ($self) = @_;
 
-  my $part = SL::DB::Part->load_cached($::form->{parts_id}) or die "need parts_id";
-  my $stock = $::form->{stock};
-  my $unit = $::form->{unit};
-  my $qty = _parse_number($::form->{qty_as_number});
+  my $part    = SL::DB::Part->load_cached($::form->{parts_id}) or die "need parts_id";
+  my $stock   = $::form->{stock};
+  my $unit    = $::form->{unit};
+  my $row     = $::form->{row};
+  my $item_id = $::form->{item_id};
+  my $qty     = _parse_number($::form->{qty_as_number});
 
   my $inout = $self->type_data->transfer;
 
@@ -904,10 +906,12 @@ sub action_stock_in_out_dialog {
 
   $self->render("delivery_order/stock_dialog", { layout => 0 },
     WHCONTENTS => $self->order->delivered ? $stock_info : \@contents,
-    part  => $part,
-    do_qty => $qty,
-    do_unit => $unit,
-    delivered => $self->order->delivered,
+    part       => $part,
+    do_qty     => $qty,
+    do_unit    => $unit,
+    delivered  => $self->order->delivered,
+    row        => $row,
+    itme_id    => $item_id,
   );
 }
 
index d937a51..87fca36 100644 (file)
@@ -119,12 +119,14 @@ namespace('kivi.DeliveryOrder', function(ns) {
 
     let row = $(".data-row").val();
 
-    $.post("controller.pl", kivi.serialize({
-        action: "DeliveryOrder/pack_stock_information",
-        stock_info: data
+    $.post("controller.pl",
+      kivi.serialize({
+        action:     "DeliveryOrder/pack_stock_information",
+        stock_info: data,
+        row:        row
       }),
       (data) => {
-        $("[name=stock_info_" + row + "]").val(data);
+        $("#" + row + " .data-stock-info").val(data);
         $("#stock_in_out_dialog").dialog("close");
       }
     );
index 40fa855..f4935cf 100644 (file)
@@ -30,6 +30,7 @@
   [% L.hidden_tag("do_qty", do_qty) %]
   [% L.hidden_tag("do_unit", do_unit) %]
   [% L.hidden_tag("row", row, class="data-row") %]
+  [% L.hidden_tag("item_id", item_id) %]
 
   <p>
    <table id="stock-in-out-table">
index d6aebb9..ce9ce75 100644 (file)
@@ -16,6 +16,7 @@
       [%- END %]
       [% L.hidden_tag("orderitem_ids[+]", ID) %]
       [% L.hidden_tag("converted_from_orderitems_ids[+]", ITEM.converted_from_orderitems_id) %]
+      [% L.hidden_tag("stock_info[+]", ITEM.stock_info, class="data-stock-info") %]
       [% L.hidden_tag("order.orderitems[+].id", ITEM.id, id='item_' _ ID) %]
       [% L.hidden_tag("order.orderitems[].parts_id", ITEM.parts_id) %]
     </td>