X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDO.pm;h=0d2a5ec21efd109041730f63e45623888a5406e3;hb=5fab9350eab8c95b77b5f02faa547c9118d45233;hp=f391963235d72faa09a4a640b763aaed8fe194be;hpb=3a94f4d2dd9a835d4a7007e1b999ea00b3c4e1cd;p=kivitendo-erp.git diff --git a/SL/DO.pm b/SL/DO.pm index f39196323..0d2a5ec21 100644 --- a/SL/DO.pm +++ b/SL/DO.pm @@ -408,7 +408,7 @@ sub mark_orders_if_delivered { 'to_table' => 'delivery_orders', 'to_id' => $params{do_id}); - my ($oe_id) = $links[0]->{from_id} if (scalar @links); + my $oe_id = @links ? $links[0]->{from_id} : undef; return $main::lxdebug->leave_sub() if (!$oe_id); @@ -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,11 +883,14 @@ 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}; } } - map { push @{ $form->{TEMPLATE_ARRAYS}->{"ic_cvar_$_->{name}"} }, $form->{"ic_cvar_$_->{name}_$i"} } @{ $ic_cvar_configs }; + push @{ $form->{TEMPLATE_ARRAYS}->{"ic_cvar_$_->{name}"} }, + CVar->format_to_template(CVar->parse($form->{"ic_cvar_$_->{name}_$i"}, $_), $_) + for @{ $ic_cvar_configs }; } $h_pg->finish(); @@ -1096,7 +1099,7 @@ sub get_shipped_qty { my $all_units = AM->retrieve_all_units(); foreach my $entry (@{ $entries }) { - $entry->{qty} *= $all_units->{$entry->{unit}}->{factor} / $all_units->{$entry->{partunit}}->{factor}; + $entry->{qty} *= AM->convert_unit($entry->{unit}, $entry->{partunit}, $all_units); if (!$ship{$entry->{parts_id}}) { $ship{$entry->{parts_id}} = $entry;