From: Maxime Bourget Date: Thu, 6 Jun 2013 19:43:58 +0000 (+0100) Subject: Set default priority on db_write hook. X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=88d189f48b92fc89ae9b98362926756937c0f7ad;p=order_line_extra.git Set default priority on db_write hook. --- diff --git a/hooks.php b/hooks.php index 1773852..e51de86 100644 --- a/hooks.php +++ b/hooks.php @@ -90,6 +90,11 @@ class hooks_order_line_extra extends hooks { 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(); } diff --git a/includes/db_order_lines.inc b/includes/db_order_lines.inc index f4913bf..0719ef4 100644 --- a/includes/db_order_lines.inc +++ b/includes/db_order_lines.inc @@ -116,4 +116,11 @@ function clear_qoh_for_item($stock_id=null) { return db_query($sql, 'Error when trying to clean ".TB_PREF."denorm_qoh'); } +function update_order_detail_defaults() { + $sql = "UPDATE ".TB_PREF."sales_order_details + SET priority = now() + WHERE priority is null"; + return db_query($sql); +} + ?>