When updating costs and no quantity on hand we got a db error (in newer mysql releases).
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Fri, 1 Feb 2013 16:12:48 +0000 (17:12 +0100)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Fri, 1 Feb 2013 16:12:48 +0000 (17:12 +0100)
inventory/includes/db/items_trans_db.inc

index 0a17b66eeec9b1aaed12ed89c1cea03bfbee68fc..a7591dd3d30f66ebc4a7b4bd3857f1cc3319dfda 100644 (file)
@@ -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;