From f4776a3195b20080250530ef9ec76a085803558f Mon Sep 17 00:00:00 2001 From: Maxime Bourget Date: Sat, 15 Jun 2013 18:56:31 +0100 Subject: [PATCH] Access order detials by order_id only (find the customer) Doesn't update the customer list. --- order_lines_view.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/order_lines_view.php b/order_lines_view.php index a452972..7a74825 100644 --- a/order_lines_view.php +++ b/order_lines_view.php @@ -63,18 +63,29 @@ start_form(); start_table(TABLESTYLE_NOBORDER); start_row(); +$order_id = get_parameter('order_id'); +text_cells_ex(_('Order #'), 'order_id', 10, null, $order_id, + null, null, null, true ); if(!isset($_POST['customer_id'])) { if(isset($_GET['customer_id'])) { $customer_id = $_GET['customer_id']; $_POST['customer_id'] = $customer_id; } -else $customer_id = null; +else { + $customer_id = null; + +} } else { $customer_id = $_POST['customer_id']; } + if($order_id) { + // find the customer owing the order + $result = db_query("SELECT debtor_no FROM ".TB_PREF."sales_orders WHERE order_no = $order_id AND trans_type =".ST_SALESORDER ); + if($result && $row=db_fetch($result)) $customer_id= $row['debtor_no']; + } customer_list_cells(_("Select a customer: "), 'customer_id', $customer_id, true, true); if($customer_id != null) { @@ -89,9 +100,6 @@ if($customer_id != null) { text_cells_ex('Filter Item', 'item_like', 50, null, $item_like, null, null, null, true ); - $order_id = get_parameter('order_id'); - text_cells_ex(_('Order #'), 'order_id', 10, null, $order_id, - null, null, null, true ); } -- 2.30.2