X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDO.pm;h=14a499a7cbbe21b596d6f21bc33d7b183a37dcb6;hb=df91c9fde8209d66dab26e657a2b1a4a105b5ee7;hp=4fbe8020a1adf96bf561e633674ff50cfc13cdb9;hpb=ed14204df3eb35e33247c5f5b0fec0298a141ef2;p=kivitendo-erp.git diff --git a/SL/DO.pm b/SL/DO.pm index 4fbe8020a..14a499a7c 100644 --- a/SL/DO.pm +++ b/SL/DO.pm @@ -293,6 +293,13 @@ sub save { do_statement($form, $h_item_id, $q_item_id); my ($item_id) = $h_item_id->fetchrow_array(); + # Get pricegroup_id and save it. Unfortunately the interface + # also uses ID "0" for signalling that none is selected, but "0" + # must not be stored in the database. Therefore we cannot simply + # use conv_i(). + my $pricegroup_id = $form->{"pricegroup_id_$i"} * 1; + $pricegroup_id = undef if !$pricegroup_id; + # save detail record in delivery_order_items table @values = (conv_i($item_id), conv_i($form->{id}), conv_i($form->{"id_$i"}), $form->{"description_$i"}, $form->{"longdescription_$i"}, @@ -305,7 +312,7 @@ sub save { $form->{"lastcost_$i"}, conv_i($form->{"price_factor_id_$i"}), conv_i($form->{"price_factor_id_$i"}), conv_i($form->{"marge_price_factor_$i"}), - conv_i($form->{"pricegroup_id_$i"})); + $pricegroup_id); do_statement($form, $h_item, $q_item, @values); my $stock_info = DO->unpack_stock_information('packed' => $form->{"stock_${in_out}_$i"}); @@ -867,13 +874,13 @@ sub order_details { while (my $ref = $h_pg->fetchrow_hashref("NAME_lc")) { if ($form->{groupitems} && $ref->{partsgroup} ne $sameitem) { - map({ push(@{ $form->{$_} }, "") } grep({ $_ ne "description" } @arrays)); + map({ push(@{ $form->{TEMPLATE_ARRAYS}->{$_} }, "") } grep({ $_ ne "description" } @arrays)); $sameitem = ($ref->{partsgroup}) ? $ref->{partsgroup} : "--"; - push(@{ $form->{description} }, $sameitem); + push(@{ $form->{TEMPLATE_ARRAYS}->{description} }, $sameitem); } - push(@{ $form->{description} }, $form->format_amount($myconfig, $ref->{qty} * $form->{"qty_$i"}) . qq|, $ref->{partnumber}, $ref->{description}|); + push(@{ $form->{TEMPLATE_ARRAYS}->{"description"} }, $form->format_amount($myconfig, $ref->{qty} * $form->{"qty_$i"}) . qq| -- $ref->{partnumber}, $ref->{description}|); - map({ push(@{ $form->{$_} }, "") } grep({ $_ ne "description" } @arrays)); + map({ push(@{ $form->{TEMPLATE_ARRAYS}->{$_} }, "") } grep({ $_ ne "description" } @arrays)); } }