Merge branch 'master' of vc.linet-services.de:public/lx-office-erp
[kivitendo-erp.git] / SL / DO.pm
index 9099ba6..f6c56b6 100644 (file)
--- a/SL/DO.pm
+++ b/SL/DO.pm
@@ -663,7 +663,7 @@ sub retrieve {
   # stuff different from the whole will not be overwritten, but saved with a suffix.
   $query =
     qq|SELECT doi.id AS delivery_order_items_id,
-         p.partnumber, p.assembly, doi.description, doi.qty,
+         p.partnumber, p.assembly, p.listprice, doi.description, doi.qty,
          doi.sellprice, doi.parts_id AS id, doi.unit, doi.discount, p.bin, p.notes AS partnotes,
          doi.reqdate, doi.project_id, doi.serialnumber, doi.lastcost,
          doi.ordnumber, doi.transdate, doi.cusordnumber, doi.longdescription,
@@ -831,6 +831,7 @@ sub order_details {
     push @{ $form->{TEMPLATE_ARRAYS}{description} },     $form->{"description_$i"};
     push @{ $form->{TEMPLATE_ARRAYS}{longdescription} }, $form->{"longdescription_$i"};
     push @{ $form->{TEMPLATE_ARRAYS}{qty} },             $form->format_amount($myconfig, $form->{"qty_$i"});
+    push @{ $form->{TEMPLATE_ARRAYS}{qty_nofmt} },       $form->{"qty_$i"};
     push @{ $form->{TEMPLATE_ARRAYS}{unit} },            $form->{"unit_$i"};
     push @{ $form->{TEMPLATE_ARRAYS}{partnotes} },       $form->{"partnotes_$i"};
     push @{ $form->{TEMPLATE_ARRAYS}{serialnumber} },    $form->{"serialnumber_$i"};
@@ -859,7 +860,6 @@ sub order_details {
           $sameitem = ($ref->{partsgroup}) ? $ref->{partsgroup} : "--";
           push(@{ $form->{description} }, $sameitem);
         }
-
         push(@{ $form->{description} }, $form->format_amount($myconfig, $ref->{qty} * $form->{"qty_$i"}) . qq|, $ref->{partnumber}, $ref->{description}|);
 
         map({ push(@{ $form->{$_} }, "") } grep({ $_ ne "description" } @arrays));
@@ -883,6 +883,7 @@ sub order_details {
         push @{ $form->{TEMPLATE_ARRAYS}{si_chargenumber}[$position-1] },  $si->{chargenumber};
         push @{ $form->{TEMPLATE_ARRAYS}{si_bestbefore}[$position-1] },    $si->{bestbefore};
         push @{ $form->{TEMPLATE_ARRAYS}{si_qty}[$position-1] },           $form->format_amount($myconfig, $si->{qty} * 1);
+        push @{ $form->{TEMPLATE_ARRAYS}{si_qty_nofmt}[$position-1] },     $si->{qty} * 1;
         push @{ $form->{TEMPLATE_ARRAYS}{si_unit}[$position-1] },          $si->{unit};
       }
     }
@@ -939,7 +940,7 @@ sub unpack_stock_information {
 }
 
 sub get_item_availability {
-  $main::lxdebug->enter_sub();
+  $::lxdebug->enter_sub;
 
   my $self     = shift;
   my %params   = @_;
@@ -947,8 +948,6 @@ sub get_item_availability {
   Common::check_params(\%params, qw(parts_id));
 
   my @parts_ids = 'ARRAY' eq ref $params{parts_id} ? @{ $params{parts_id} } : ($params{parts_id});
-  my $form      = $main::form;
-  my $myconfig  = \%main::myconfig;
 
   my $query     =
     qq|SELECT i.warehouse_id, i.bin_id, i.chargenumber, i.bestbefore, SUM(qty) AS qty, i.parts_id,
@@ -962,9 +961,9 @@ sub get_item_availability {
        HAVING SUM(qty) > 0
        ORDER BY LOWER(w.description), LOWER(b.description), LOWER(i.chargenumber), i.bestbefore
 |;
-  my $contents = selectall_hashref_query($form, $form->get_standard_dbh($myconfig), $query, @parts_ids);
+  my $contents = selectall_hashref_query($::form, $::form->get_standard_dbh, $query, @parts_ids);
 
-  $main::lxdebug->leave_sub();
+  $::lxdebug->leave_sub;
 
   return @{ $contents };
 }