// ----------------------------------------------------------------
define ('SS_ORDERLINEX', 100<<8);
+include_once('includes/order_xtra_config.inc');
include_once('includes/db_order_lines.inc');
class hooks_order_line_extra extends hooks {
$date = array_shift($opts);
$qoh = array_shift($opts);
- $sql = "select quantity_before from ".TB_PREF."denorm_order_details_queue where id = $detail_id";
+ $sql = "SELECT quantity_before, hold_until_date
+ FROM ".TB_PREF."denorm_order_details_queue
+ NATURAL JOIN ".TB_PREF."sales_order_details
+ WHERE id = $detail_id";
$result = db_query($sql);
$quantity_before = 0;
if($row=db_fetch($result)) {
$quantity_before = $row['quantity_before'];
+ $hold_until = sql2date($row['hold_until_date']);
+ if($qoh<=$quantity_before) return array(0, 'stockmankobg');
+ if(OrderXtraConfig::early($hold_until, $date)) return array(0, 'early');
}
- return max($qoh - $quantity_before, 0);
+ return array(max($qoh - $quantity_before, 0), '');
}
function db_postwrite($cart, $trans_type) {