From: Joe Hunt Date: Fri, 1 Feb 2013 16:12:48 +0000 (+0100) Subject: When updating costs and no quantity on hand we got a db error (in newer mysql releases). X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=e3d8b9578c9a7102b66094b7c0999dc2333d4d65;p=textcart.git When updating costs and no quantity on hand we got a db error (in newer mysql releases). --- diff --git a/inventory/includes/db/items_trans_db.inc b/inventory/includes/db/items_trans_db.inc index 0a17b66..a7591dd 100644 --- a/inventory/includes/db/items_trans_db.inc +++ b/inventory/includes/db/items_trans_db.inc @@ -67,7 +67,8 @@ function stock_cost_update($stock_id, $material_cost, $labour_cost, $overhead_co } } - add_audit_trail(ST_COSTUPDATE, $update_no, $date_); + if ($update_no != -1) + add_audit_trail(ST_COSTUPDATE, $update_no, $date_); commit_transaction(); return $update_no;