From 88d189f48b92fc89ae9b98362926756937c0f7ad Mon Sep 17 00:00:00 2001 From: Maxime Bourget Date: Thu, 6 Jun 2013 20:43:58 +0100 Subject: [PATCH] Set default priority on db_write hook. --- hooks.php | 5 +++++ includes/db_order_lines.inc | 7 +++++++ 2 files changed, 12 insertions(+) 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); +} + ?> -- 2.30.2