From 341a12fe82f59bd59e583e5ebae480d08ad7f306 Mon Sep 17 00:00:00 2001 From: Maxime Bourget Date: Thu, 6 Jun 2013 22:00:55 +0100 Subject: [PATCH] Ignore tags --- .gitignore | 1 + includes/db_order_lines.inc | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6e92f57 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +tags diff --git a/includes/db_order_lines.inc b/includes/db_order_lines.inc index ffb30e4..a0675f4 100644 --- a/includes/db_order_lines.inc +++ b/includes/db_order_lines.inc @@ -117,15 +117,27 @@ function clear_qoh_for_item($stock_id=null) { } function update_order_detail_defaults() { + // Set priority to current time. $sql = "UPDATE ".TB_PREF."sales_order_details SET priority = now() WHERE priority is null"; db_query($sql); + // Set hold_until_date to delivery_date $sql = "UPDATE ".TB_PREF."sales_order_details NATURAL JOIN 0_sales_orders SET hold_until_date = delivery_date WHERE hold_until_date is null"; db_query($sql); + + // Set expiry date to 6 weeks + delivery date + // or 2 weeks + required date. Stuff with an + // explicit required date should expire quickly the + // required date has been missed. + $sql = "UPDATE ".TB_PREF."sales_order_details + SET expiry_date = if(required_date is null, hold_until_date + INTERVAL 6 WEEK, + required_date + INTERVAL 2 WEEK) + WHERE expiry_date is null"; + db_query($sql); } ?> -- 2.30.2