}
function db_postwrite($cart, $trans_type) {
- if(!is_a($cart, "Cart") ) return;
+ if(is_a($cart, "Cart")) {
// It's a cart. Find all the stock_id and update the cache table
foreach($cart->line_items as $line_no => $item) {
update_queue_quantity_for_item($stock_id);
update_qoh_for_item($stock_id);
}
+ }
// update null fields of new entered orders.
//
- $types = array(ST_SALESORDER);
+ $types = array(ST_SALESORDER, 'order_xtra');
if(in_array($trans_type, $types)) update_order_detail_defaults();
}
if(!isset($_POST['Split']) || $_POST['Split'] != 'Split') return;
$splitter = new Splitter($_POST);
begin_transaction();
+ $cart = null;
+ hook_db_prewrite($cart, 'order_xtra');
if($splitter->splitAll()) display_warning("Items have been split.");
+ hook_db_postwrite($cart, 'order_xtra');
commit_transaction();
}