From: Moritz Bunkus Date: Wed, 9 May 2007 07:29:14 +0000 (+0000) Subject: Beim Speichern einfach in allen Einheiten nach der ausgewählten Einheit suchen. X-Git-Tag: release-2.4.3^2~358 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=debf6f14125467bae667bebb2584745bf1a7e718;p=kivitendo-erp.git Beim Speichern einfach in allen Einheiten nach der ausgewählten Einheit suchen. --- diff --git a/SL/IR.pm b/SL/IR.pm index 81c5fe75e..8bc228b64 100644 --- a/SL/IR.pm +++ b/SL/IR.pm @@ -54,8 +54,7 @@ sub post_invoice { my $taxdiff; my $item; - my $service_units = AM->retrieve_units($myconfig,$form,"service"); - my $part_units = AM->retrieve_units($myconfig,$form,"dimension"); + my $all_units = AM->retrieve_units($myconfig, $form); if ($form->{id}) { @@ -124,21 +123,14 @@ sub post_invoice { my ($item_unit) = $sth->fetchrow_array(); $sth->finish; - if ($form->{"inventory_accno_$i"}) { - if (defined($part_units->{$item_unit}->{factor}) && $part_units->{$item_unit}->{factor} ne '' && $part_units->{$item_unit}->{factor} ne '0') { - $basefactor = $part_units->{$form->{"unit_$i"}}->{factor} / $part_units->{$item_unit}->{factor}; - } else { - $basefactor = 1; - } - $baseqty = $form->{"qty_$i"} * $basefactor; + if (defined($all_units->{$item_unit}->{factor}) + && ($all_units->{$item_unit}->{factor} ne '') + && ($all_units->{$item_unit}->{factor} * 1 != 0)) { + $basefactor = $all_units->{$form->{"unit_$i"}}->{factor} / $all_units->{$item_unit}->{factor}; } else { - if (defined($service_units->{$item_unit}->{factor}) && $service_units->{$item_unit}->{factor} ne '' && $service_units->{$item_unit}->{factor} ne '0') { - $basefactor = $service_units->{$form->{"unit_$i"}}->{factor} / $service_units->{$item_unit}->{factor}; - } else { - $basefactor = 1; - } - $baseqty = $form->{"qty_$i"} * $basefactor; + $basefactor = 1; } + $baseqty = $form->{"qty_$i"} * $basefactor; map { $form->{"${_}_$i"} =~ s/\'/\'\'/g } qw(partnumber description unit);