Filter order details by order.
authorMaxime Bourget <bmx007@gmail.com>
Sat, 15 Jun 2013 16:26:20 +0000 (17:26 +0100)
committerMaxime Bourget <bmx007@gmail.com>
Sat, 15 Jun 2013 16:26:20 +0000 (17:26 +0100)
haxe/ItemScheduler.hx
hincludes/lib/ItemScheduler.class.php
includes/order_lines.inc
order_lines_view.php

index 3122a9d14418efa74e94b81dfcf92bd66ea73349..7b988f2a8b9329ebd8269f34380f7039633e6a02 100644 (file)
@@ -241,8 +241,11 @@ class ItemScheduler {
                if(expiry_date != null && (now.getTime() > expiry_date.getTime())) classes.push('expired');
 
                var cells : Array <Dynamic> = [
-                       order.order_id 
-                       , '<a href="/modules/order_line_extra/order_lines_view.php?customer_id='+Std.string(order.debtor_no)+'">'+order.deliver_to+'</a>'
+                       '<a href="/modules/order_line_extra/order_lines_view.php?customer_id='+Std.string(order.debtor_no)+
+                                               '&order_id='+order.order_id
+                                               +'">'+order.order_id+'</a>'
+                       , '<a href="/modules/order_line_extra/order_lines_view.php?customer_id='+Std.string(order.debtor_no)
+                                               +'">'+order.deliver_to+'</a>'
                        , order.quantity // '<input type="text" name="'+row_id+'[quantity]" value="'+order.quantity+'">'
                        ,before
                        ,left
index 9e7ae69e549fd9d003f457a195dc91aefef3d96a..530224eded2b6a7b693da6cdf979fe3ffa50c973 100644 (file)
@@ -204,7 +204,7 @@ class ItemScheduler {
                if($expiry_date !== null && $now->getTime() > $expiry_date->getTime()) {
                        $classes->push("expired");
                }
-               $cells = new _hx_array(array($order->order_id, "<a href=\"/modules/order_line_extra/order_lines_view.php?customer_id=" . Std::string($order->debtor_no) . "\">" . Std::string($order->deliver_to) . "</a>", $order->quantity, $before, $left, $order->from_stk_loc, $order->hold_until_date, $order->required_date, $order->comment, $this->quantity_box($row_id, $order, $left)));
+               $cells = new _hx_array(array("<a href=\"/modules/order_line_extra/order_lines_view.php?customer_id=" . Std::string($order->debtor_no) . "&order_id=" . Std::string($order->order_id) . "\">" . Std::string($order->order_id) . "</a>", "<a href=\"/modules/order_line_extra/order_lines_view.php?customer_id=" . Std::string($order->debtor_no) . "\">" . Std::string($order->deliver_to) . "</a>", $order->quantity, $before, $left, $order->from_stk_loc, $order->hold_until_date, $order->required_date, $order->comment, $this->quantity_box($row_id, $order, $left)));
                $attributes->push("class=\"" . $classes->join(" ") . "\"");
                $this->printRow($cells, $attributes);
        }
index 96c0a27bcb71d8b63a4fda1048b5a8f67afcbc64..a3367ea340b7732b1f4d464e5e7e699eacd739e7 100644 (file)
@@ -235,7 +235,7 @@ function pick_checkbox($row)
        . hidden('pick['.$id.']', $value, false);
 }
 
-function get_order_details_extra($customer_id, $location, $item_like) {
+function get_order_details_extra($customer_id, $location, $item_like, $order_id) {
        $select = "sod.id
        , so.order_no
        , stk_code
@@ -270,6 +270,10 @@ function get_order_details_extra($customer_id, $location, $item_like) {
                                $where .= " AND stk_code LIKE '$item_like'";
        }
 
+       if($order_id) {
+               $where .= " AND so.order_no = $order_id";
+       }
+
        return array('select' => $select, 'from' => $from, 'where' => $where);
 }
 
index c72f043a5a1c2408e314e321e84abf739c78aba7..a452972c19533453eef6c19745093ff169f14019 100644 (file)
@@ -27,6 +27,18 @@ add_access_extensions();
 
 $_SESSION['page_title'] = _($help_context = "Edit lines extra parameters");
 
+function get_parameter($param) {
+       $value = null;
+       if(!isset($_POST[$param])) {
+               if(isset($_GET[$param])) {
+                       $value = $_GET[$param];
+                       $_POST[$param] = $value;
+               }
+       }
+       else $value = $_POST[$param];
+       return $value;
+}
+
 // Process POST
 filter_data($_POST);
 update_extra_order_details();
@@ -76,6 +88,10 @@ if($customer_id != null) {
        else $item_like = $_POST['item_like'];
        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 );
 }
 
 
@@ -93,7 +109,7 @@ end_table(1);
 //
 if($customer_id) {
        // Display all item for one customer
-       $sql = get_order_details_extra($customer_id, 'DEF', $item_like);
+       $sql = get_order_details_extra($customer_id, 'DEF', $item_like, $order_id);
        $cols = array(
                'detail_id' => 'skip'
                ,       _("Order #") => array('fun'=>'view_link', 'ord' => '')