Merge branch 'master' into dev
[kivitendo-erp.git] / SL / WH.pm
index eb37626..28e836e 100644 (file)
--- a/SL/WH.pm
+++ b/SL/WH.pm
@@ -111,8 +111,7 @@ sub transfer {
       );
 
       if ($unit) {
-        $qty *= $unit->factor           || 1;
-        $qty /= $part->unit_obj->factor || 1 if $part->unit;
+        $qty = $unit->convert_to($qty, $part->unit_obj);
       }
 
       $params{chargenumber} ||= '';
@@ -626,6 +625,9 @@ sub get_warehouse_report {
     push @filter_ary, "i.itime <= ?";
     push @filter_vars, $filter{date};
   }
+  if (!$filter{include_invalid_warehouses}){
+    push @filter_ary,  "NOT (w.invalid)";
+  }
 
   # prepare qty comparison for later filtering
   my ($f_qty_op, $f_qty, $f_qty_base_unit);
@@ -1020,6 +1022,8 @@ An expiration date. Note that this is not by default used by C<warehouse_report>
 
 =head1 BUGS
 
+None yet.
+
 =head1 AUTHOR
 
 =cut