From: Thomas Heck Date: Mon, 6 Jan 2014 16:44:08 +0000 (+0100) Subject: Einheiten beim Fertigen beachten X-Git-Tag: release-3.1.0beta1~22^2~49 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=be6eabfc4b62af1a8173e5cbcaff0b7f0d9b6db4;p=kivitendo-erp.git Einheiten beim Fertigen beachten fixt #2232 --- diff --git a/SL/WH.pm b/SL/WH.pm index 3087dfff4..7e4d5194b 100644 --- a/SL/WH.pm +++ b/SL/WH.pm @@ -38,6 +38,9 @@ use SL::AM; use SL::DBUtils; use SL::Form; +use SL::DB::Unit; +use SL::DB::Assembly; + use warnings; use strict; @@ -158,6 +161,17 @@ sub transfer_assembly { my %params = @_; Common::check_params(\%params, qw(assembly_id dst_warehouse_id login qty unit dst_bin_id chargenumber bestbefore comment)); + + my $unit = SL::DB::Manager::Unit->find_by(name => $params{unit}); + if ($unit) { + my $assembly = SL::DB::Manager::Assembly->get_all( + query => [ id => $params{assembly_id} ], + with_objects => ['part'], + limit => 1, + )->[0]; + $params{qty} = $unit->convert_to($params{qty}, $assembly->part->unit_obj); + } + # my $maxcreate=WH->check_assembly_max_create(assembly_id =>$params{'assembly_id'}, dbh => $my_dbh); my $myconfig = \%main::myconfig;