Fixed payments reallocation for prepayment orders; blocked edition for open prepaymen...
[fa-stable.git] / sales / inquiry / sales_orders_view.php
index f5977aa791bb0bb9444ad87ffcb92c50cd67c760..f275bc7055c2957c14781c143f64188631ef6cf6 100644 (file)
@@ -71,7 +71,7 @@ else
 }
 
 $js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
        $js .= get_js_open_window(900, 600);
 if (user_use_date_picker())
        $js .= get_js_date_picker();
@@ -106,6 +106,9 @@ function edit_link($row)
 {
        global $page_nested;
 
+       if (is_prepaid_order_open($row['order_no']))
+               return '';
+
        return $page_nested ? '' : trans_editor_link($row['trans_type'], $row['order_no']);
 }
 
@@ -149,7 +152,8 @@ function order_link($row)
 function tmpl_checkbox($row)
 {
        global $trans_type, $page_nested;
-       if ($trans_type == ST_SALESQUOTE)
+
+       if ($trans_type == ST_SALESQUOTE || !check_sales_order_type($row['order_no']))
                return '';
 
        if ($page_nested)
@@ -195,8 +199,8 @@ if (get_post('_OrderNumber_changed') || get_post('_OrderReference_changed')) //
        $disable = get_post('OrderNumber') !== '' || get_post('OrderReference') !== '';
 
        if ($show_dates) {
-                       $Ajax->addDisable(true, 'OrdersAfterDate', $disable);
-                       $Ajax->addDisable(true, 'OrdersToDate', $disable);
+               $Ajax->addDisable(true, 'OrdersAfterDate', $disable);
+               $Ajax->addDisable(true, 'OrdersToDate', $disable);
        }
 
        $Ajax->activate('orders_tbl');
@@ -210,7 +214,7 @@ ref_cells(_("#:"), 'OrderNumber', '',null, '', true);
 ref_cells(_("Ref"), 'OrderReference', '',null, '', true);
 if ($show_dates)
 {
-       date_cells(_("from:"), 'OrdersAfterDate', '', null, -$_SESSION["wa_current_user"]->prefs->transaction_days());
+       date_cells(_("from:"), 'OrdersAfterDate', '', null, -user_transaction_days());
        date_cells(_("to:"), 'OrdersToDate', '', null, 1);
 }
 locations_list_cells(_("Location:"), 'StockLocation', null, true, true);
@@ -272,7 +276,6 @@ else
                _("Currency") => array('align'=>'center')
        );
 if ($_POST['order_view_mode'] == 'OutstandingOnly') {
-       //array_substitute($cols, 3, 1, _("Cust Order Ref"));
        array_append($cols, array(
                array('insert'=>true, 'fun'=>'dispatch_link'),
                array('insert'=>true, 'fun'=>'edit_link')));