+
+ function db_postwrite($cart, $trans_type) {
+ if(!is_a($cart, "Cart") ) return;
+
+ // It's a cart. Find all the stock_id and update the cache table
+ foreach($cart->line_items as $line_no => $item) {
+ $stock_id = $item->stock_id;
+ update_queue_quantity_for_item($stock_id);
+ update_qoh_for_item($stock_id);
+ }
+
+ // update null fields of new entered orders.
+ //
+ $types = array(ST_SALESORDER);
+ if(in_array($trans_type, $types)) update_order_detail_defaults();
+
+ }
+
+
+ function db_prevoid($cart, $trans_type) {
+ // Simple version, rebuild everything
+ $types = array(ST_CUSTCREDIT, ST_CUSTDELIVERY, ST_INVADJUST, ST_PURCHORDER, ST_WORKORDER, ST_MANUISSUE,
+ ST_SALESORDER, ST_SALESQUOTE, ST_MANURECEIVE);
+ if(in_array($trans_type, $types)) {
+ update_queue_quantities();
+ update_qoh_for_item();
+ }
+ }