commit 8010b559b6a609a95a34d81bd98b47c1312d3061
Author: Tamino Steinert <tamino.steinert@tamino.st>
Date:   Mon Dec 6 19:22:16 2021 +0100

    Reclamation: don't need shipped_qty

diff --git a/SL/Controller/Reclamation.pm b/SL/Controller/Reclamation.pm
index 8c8443635..185241673 100644
--- a/SL/Controller/Reclamation.pm
+++ b/SL/Controller/Reclamation.pm
@@ -27,7 +27,6 @@ use SL::DB::Translation;
 
 use SL::Helper::CreatePDF qw(:all);
 use SL::Helper::PrintOptions;
-use SL::Helper::ShippedQty;
 use SL::Helper::UserPreferences::PositionsScrollbar;
 use SL::Helper::UserPreferences::UpdatePositions;
 
@@ -900,7 +899,6 @@ sub action_reorder_items {
     reason       => sub { $_[0]->reason eq undef ? "" : $_[0]->reason->name },
     reason_description_ext => sub { $_[0]->reason_description_ext },
     reason_description_int => sub { $_[0]->reason_description_int },
-    shipped_qty  => sub { $_[0]->shipped_qty },
     qty          => sub { $_[0]->qty },
     sellprice    => sub { $_[0]->sellprice },
     discount     => sub { $_[0]->discount },
@@ -909,15 +907,6 @@ sub action_reorder_items {
 
   $self->get_item_cvpartnumber($_) for @{$self->reclamation->items_sorted};
 
-  if ($::form->{order_by} eq 'shipped_qty') {
-    # Calculate shipped qtys here to prevent calling calculate for every item
-    # via the items method. Do not use write_to_objects to prevent
-    # reclamation->delivered to be set, because this should be the value from
-    # db, which can be set manually or is set when linked delivery orders are
-    # saved.
-    SL::Helper::ShippedQty->new->calculate($self->reclamation)->write_to(\@{$self->reclamation->items});
-  }
-
   my $method = $sort_keys{$::form->{order_by}};
   my @to_sort = map { { old_pos => $_->position, order_by => $method->($_) } } @{ $self->reclamation->items_sorted };
   if ($::form->{sort_dir}) {
@@ -1892,12 +1881,6 @@ sub pre_render {
     $item->active_discount_source($price_source->discount_from_source($item->active_discount_source));
   }
 
-  # Calculate shipped qtys here to prevent calling calculate for every item via
-  # the items method. Do not use write_to_objects to prevent
-  # reclamation->delivered to be set, because this should be the value from db,
-  # which can be set manually or is set when linked delivery orders are saved.
-  SL::Helper::ShippedQty->new->calculate($self->reclamation)->write_to(\@{$self->reclamation->items});
-
   if ($self->reclamation->record_number && $::instance_conf->get_webdav) {
     my $webdav = SL::Webdav->new(
       type     => $self->type,
@@ -2631,9 +2614,15 @@ the bottom.
 
 =item *
 
+<<<<<<< HEAD
 Ordering item rows with drag and drop is possible. Sorting item rows is possible
 (by partnumber, description, reason, reason_description_int,
 reason_description_ext, qty, sellprice and discount for now).
+=======
+Ordering item rows with drag and drop is possible. Sorting item rows is
+possible (by partnumber, description, reason, qty, sellprice
+and discount for now).
+>>>>>>> 66ac9fa6c7 (Reclamation: don't need shipped_qty)
 
 =item *
 
diff --git a/SL/DB/ReclamationItem.pm b/SL/DB/ReclamationItem.pm
index 01f7e6d79..cbdc4c1e0 100644
--- a/SL/DB/ReclamationItem.pm
+++ b/SL/DB/ReclamationItem.pm
@@ -21,22 +21,11 @@ use SL::DB::Helper::CustomVariables (
     }
   },
 );
-use SL::Helper::ShippedQty;
 
 __PACKAGE__->meta->initialize;
 
 __PACKAGE__->configure_acts_as_list(group_by => [qw(reclamation_id)]);
 
-sub shipped_qty {
-  my ($self, %params) = @_;
-
-  my $force = delete $params{force};
-
-  SL::Helper::ShippedQty->new(%params)->calculate($self)->write_to_objects if $force || !defined $self->{shipped_qty};
-
-  $self->{shipped_qty};
-}
-
 sub is_linked_to_record {
   my ($self) = @_;
 
@@ -131,7 +120,6 @@ sub customervendor {
   return $self->reclamation->customervendor;
 }
 
-sub delivered_qty { goto &shipped_qty }
 sub record { goto &reclamation }
 sub record_id { goto &reclamation_id }
 sub trans_id { goto &reclamation_id }
@@ -149,31 +137,6 @@ SL::DB::ReclamationItems: Rose model for reclamationitems
 
 =head1 FUNCTIONS
 
-=over 4
-
-=item C<shipped_qty PARAMS>
-
-Calculates the shipped qty for this reclamationitem (measured in the current unit)
-and returns it.
-
-Note that the shipped qty is expected not to change within the request and is
-cached in C<shipped_qty> once calculated. If C<< force => 1 >> is passed, the
-existibng cache is ignored.
-
-Given parameters will be passed to L<SL::Helper::ShippedQty>, so you can force
-the shipped/delivered distinction like this:
-
-  $_->shipped_qty(require_stock_out => 0);
-
-Note however that calculating shipped_qty on individual Reclamationitems is generally
-a bad idea. See L<SL::Helper::ShippedQty> for way to compute these all at once.
-
-=item C<delivered_qty>
-
-Alias for L</shipped_qty>.
-
-=back
-
 =head1 AUTHORS
 
 G. Richardson E<lt>grichardson@kivitendo-premium.deE<gt>
diff --git a/templates/webpages/reclamation/tabs/basic_data.html b/templates/webpages/reclamation/tabs/basic_data.html
index e74156e1b..db6cc5d48 100644
--- a/templates/webpages/reclamation/tabs/basic_data.html
+++ b/templates/webpages/reclamation/tabs/basic_data.html
@@ -226,7 +226,6 @@
                 <th id="reason_header_id"   class="listheading" nowrap width="100"><a href='#' onClick='javascript:kivi.Reclamation.reorder_items("reason")'>[%- 'Reason' | $T8 %]</a></th>
                 <th id="reason_description_ext_header_id"  class="listheading" nowrap ><a href='#' onClick='javascript:kivi.Reclamation.reorder_items("reason_description_ext")'>[%- 'Reason Description Extern' | $T8 %]</a></th>
                 <th id="reason_description_int_header_id"  class="listheading" nowrap ><a href='#' onClick='javascript:kivi.Reclamation.reorder_items("reason_description_int")'>[%- 'Reason Description Intern' | $T8 %]</a></th>
-                <th id="shipped_qty_header_id"  class="listheading" nowrap width="5" ><a href='#' onClick='javascript:kivi.Reclamation.reorder_items("shipped_qty")'>[%- 'Delivered'   | $T8 %]</a></th>
                 <th id="qty_header_id"          class="listheading" nowrap width="5" ><a href='#' onClick='javascript:kivi.Reclamation.reorder_items("qty")'>        [%- 'Qty'         | $T8 %]</a></th>
                 <th class="listheading" nowrap width="5" >[%- 'Price Factor' | $T8 %] </th>
                 <th class="listheading" nowrap width="5" >[%- 'Unit'         | $T8 %] </th>
diff --git a/templates/webpages/reclamation/tabs/basic_data/_row.html b/templates/webpages/reclamation/tabs/basic_data/_row.html
index a9213a754..72cf2bed0 100644
--- a/templates/webpages/reclamation/tabs/basic_data/_row.html
+++ b/templates/webpages/reclamation/tabs/basic_data/_row.html
@@ -83,9 +83,6 @@
                      size='40',
                      style='width: 150px') %]
     </td>
-    <td nowrap>
-      [%- L.div_tag(LxERP.format_amount(ITEM.shipped_qty, 2, 0) _ ' ' _ ITEM.unit, name="shipped_qty", class="numeric") %]
-    </td>
     <td nowrap>
       [%- L.input_tag("reclamation.reclamation_items[].qty_as_number",
                       ITEM.qty_as_number,
