]> wagnertech.de Git - kivitendo-erp.git/blobdiff - SL/IR.pm
is_sales methode für Order
[kivitendo-erp.git] / SL / IR.pm
index 7f4389ffa0f5124166db3246bb9e0c0da3882877..edf55f16a978361715f8ac839a6783558e0003b2 100644 (file)
--- a/SL/IR.pm
+++ b/SL/IR.pm
@@ -207,9 +207,9 @@ sub post_invoice {
 
       next if $payments_only;
 
-      # update parts table
+      # update parts table by setting lastcost to current price, don't allow negative values by using abs
       $query = qq|UPDATE parts SET lastcost = ? WHERE id = ?|;
-      @values = ($form->{"sellprice_$i"}, conv_i($form->{"id_$i"}));
+      @values = (abs($form->{"sellprice_$i"}), conv_i($form->{"id_$i"}));
       do_query($form, $dbh, $query, @values);
 
       # check if we sold the item already and