Fixed page update after item search.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Wed, 10 Sep 2008 21:49:10 +0000 (21:49 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Wed, 10 Sep 2008 21:49:10 +0000 (21:49 +0000)
13 files changed:
inventory/cost_update.php
inventory/includes/item_adjustments_ui.inc
inventory/includes/stock_transfers_ui.inc
inventory/inquiry/stock_status.php
inventory/manage/items.php
inventory/prices.php
inventory/purchasing_data.php
inventory/reorder_level.php
manufacturing/includes/work_order_issue_ui.inc
manufacturing/inquiry/where_used_inquiry.php
purchasing/includes/ui/po_ui.inc
sales/includes/ui/sales_credit_ui.inc
sales/includes/ui/sales_order_ui.inc

index ff58f9eb8900ed0bbcca3c7c0293893a2f449e6a..769ac7d679eb8b4cb8f252a1790c88033ceb9d75 100644 (file)
@@ -64,7 +64,7 @@ if (isset($_POST['UpdateData']))
        }
 }
 
-if (isset($_POST['_stock_id_update']))
+if (list_updated('stock_id')) 
        $Ajax->activate('cost_table');
 //-----------------------------------------------------------------------------------------
 
index 6d0a7740e866c506c23db675639af4edf363e555..30e56103bb6407b0d30f98ee37da48644a62e8b7 100644 (file)
@@ -131,7 +131,7 @@ function adjustment_edit_item_controls(&$order, $line_no=-1)
        else
        {
        stock_costable_items_list_cells(null, 'stock_id', null, false, true);
-               if(isset($_POST['_stock_id_update'])) {
+               if (list_updated('stock_id')) {
                            $Ajax->activate('units');
                            $Ajax->activate('qty');
                            $Ajax->activate('std_cost');
index 63d7c970d8148b79e6b3dd9edc0a880933baa973..26609a1bf7b32ca3125cb09e84b996280a9b305a 100644 (file)
@@ -116,7 +116,7 @@ function transfer_edit_item_controls(&$order, $line_no=-1)
        else
        {
        stock_costable_items_list_cells(null, 'stock_id', null, false, true);
-               if(isset($_POST['_stock_id_update'])) {
+               if (list_updated('stock_id')) {
                            $Ajax->activate('units');
                            $Ajax->activate('qty');
                }
index ae0764567c14fbde263f5cf1f7caa619755d4cbf..2461c18899fde8069f34213860c7febcb1132c5c 100644 (file)
@@ -18,7 +18,7 @@ include_once($path_to_root . "/includes/data_checks.inc");
 
 include_once($path_to_root . "/inventory/includes/inventory_db.inc");
 
-if (isset($_POST['_stock_id_update']))
+if (list_updated('stock_id')) 
        $Ajax->activate('status_tbl');
 //----------------------------------------------------------------------------------------------------
 
index f842065b56c9ef187212461663be27ebf5383e6c..9ce8b6f80dd9aad891026f181609a0e991e70f98 100644 (file)
@@ -13,7 +13,7 @@ include_once($path_to_root . "/includes/data_checks.inc");
 include_once($path_to_root . "/inventory/includes/inventory_db.inc");
 
 $user_comp = user_company();
-$new_item = (!isset($_POST['stock_id']) || $_POST['stock_id'] == "")
+$new_item = get_post('stock_id')==''
 //------------------------------------------------------------------------------------
 
 if (isset($_GET['stock_id']))
@@ -25,14 +25,8 @@ else if (isset($_POST['stock_id']))
        $stock_id = strtoupper($_POST['stock_id']);
 }
 
-if(get_post('_stock_id_update')) {
-       $_POST['NewStockID'] = $_POST['stock_id'];
-       if ($new_item) {
-         clear_data();
-         set_focus('NewStockID');
-       } else {
-         set_focus('description');
-       }
+if (list_updated('stock_id')) {
+       $_POST['NewStockID'] = get_post('stock_id');
        $Ajax->activate('details');
        $Ajax->activate('controls');
 //     unset($_POST['New']);
@@ -89,7 +83,7 @@ check_db_has_item_tax_types(_("There are no item tax types defined in the system
 
 function clear_data()
 {
-       global $new_item;
+//     global $new_item;
        
        unset($_POST['long_description']);
        unset($_POST['description']);
@@ -100,7 +94,7 @@ function clear_data()
        unset($_POST['NewStockID']);
        unset($_POST['dimension_id']);
        unset($_POST['dimension2_id']);
-       $new_item = true;
+//     $new_item = true;
 }
 
 //------------------------------------------------------------------------------------
@@ -146,7 +140,6 @@ if (isset($_POST['addupdate']))
                                $_POST['dimension_id'], $_POST['dimension2_id']);
 
                        display_notification(_("Item has been updated."));
-                       set_focus('stock_id');
                } 
                else 
                { //it is a NEW part
@@ -160,9 +153,9 @@ if (isset($_POST['addupdate']))
 
                display_notification(_("A new item has been added."));
                $_POST['stock_id'] = $_POST['NewStockID'];
-               $new_item = false;
-               set_focus('stock_id');
+//             $new_item = false;
                }
+               set_focus('stock_id');
                $Ajax->activate('_page_body');
        }
 }
@@ -223,7 +216,7 @@ if (isset($_POST['delete']) && strlen($_POST['delete']) > 1)
                if (file_exists($filename))
                        unlink($filename);
                display_notification(_("Selected item has been deleted."));
-               $new_item = true;
+//             $new_item = true;
                $_POST['stock_id'] = '';
                clear_data();
                set_focus('stock_id');
@@ -242,7 +235,7 @@ if (db_has_stock_items())
        start_row();
     stock_items_list_cells(_("Select an item:"), 'stock_id', null,
          _('New item'), true);
-//    submit_cells('SelectStockItem', _("Edit Item"));
+       $new_item = get_post('stock_id')==''; 
        end_row();
        end_table();
 }
@@ -262,6 +255,7 @@ if ($new_item)
 
 /*If the page was called without $_POST['NewStockID'] passed to page then assume a new item is to be entered show a form with a part Code field other wise the form showing the fields with the existing entries against the part will show for editing with only a hidden stock_id field. New is set to flag that the page may have called itself and still be entering a new part, in which case the page needs to know not to go looking up details for an existing part*/
 
+    clear_data();
        text_row(_("Item Code:"), 'NewStockID', null, 21, 20);
 
        $company_record = get_company_prefs();
@@ -284,9 +278,8 @@ if ($new_item)
 } 
 else 
 { // Must be modifying an existing item
+               $_POST['NewStockID'] = $_POST['stock_id'];
 
-       if (!$new_item) 
-       {
                $myrow = get_item($_POST['NewStockID']);
 
                $_POST['long_description'] = $myrow["long_description"];
@@ -306,7 +299,7 @@ else
        
                label_row(_("Item Code:"),$_POST['NewStockID']);
                hidden('NewStockID', $_POST['NewStockID']);
-       }
+               set_focus('description');
 }
 
 text_row(_("Name:"), 'description', null, 52, 50);
index 5a3238ff3ef5d34af064a4993db25dcd9d09c1db..3803fe07d7b2bfda45ce9784005da57d21e44586 100644 (file)
@@ -102,12 +102,11 @@ if ($Mode == 'RESET')
        $selected_id = -1;
 }
 
-if (isset($_POST['_stock_id_update'])) {
+if (list_updated('stock_id')) {
        $Ajax->activate('price_table');
        $Ajax->activate('price_details');
 }
-if (isset($_POST['_stock_id_update']) || isset($_POST['_sales_type_id_update'])
-        || isset($_POST['_curr_abrev_update']) ) {
+if (list_updated('stock_id')) || isset($_POST['_curr_abrev_update']) ) {
        // after change of stock, currency or salestype selector
        // display default calculated price for new settings. 
        // If we have this price already in db it is overwritten later.
index 67b670ffd6a89c742da8a5c37a352aa45992be57..292055bea90bcf929e95caa6daea4bb7e3b1ad06 100644 (file)
@@ -92,7 +92,7 @@ if (isset($_POST['_selected_id_update']) )
        $Ajax->activate('_page_body');
 }
 
-if (isset($_POST['_stock_id_update']))
+if (list_updated('stock_id')) 
        $Ajax->activate('price_table');
 //--------------------------------------------------------------------------------------------------
 
index 83283d5b536d012e36863ba8c5213b8586f2e02b..3a6834370dad9b76a51e17606a2cbd629c870aed 100644 (file)
@@ -19,7 +19,7 @@ check_db_has_costable_items(_("There are no inventory items defined in the syste
 if (isset($_GET['stock_id']))
        $_POST['stock_id'] = $_GET['stock_id'];
 
-if (isset($_POST['_stock_id_update']))
+if (list_updated('stock_id')) 
 {
        $Ajax->activate('show_heading');
        $Ajax->activate('reorders');
index 9d6b9dd2a51fff494e49d896eaafd992b4cd55a8..8508364eb62f12674d5484ccaf9460d42e3378fe 100644 (file)
@@ -94,7 +94,7 @@ function issue_edit_item_controls(&$order, $line_no=-1)
 
                stock_component_items_list_cells(null, 'stock_id', 
                        $wo_details["stock_id"], null, false, true);
-               if(isset($_POST['_stock_id_update'])) {
+               if (list_updated('stock_id')) {
                            $Ajax->activate('units');
                            $Ajax->activate('qty');
                            $Ajax->activate('std_cost');
index e7958dca6ec1bb2ce0e889d355fb3f01a7ec8e20..5abcc70e00c325aaf51d6caef61daaa58c10f5cc 100644 (file)
@@ -22,7 +22,7 @@ echo "<hr></center>";
 
 set_global_stock_item($_POST['stock_id']);
 
-if (isset($_POST['_stock_id_update']))
+if (list_updated('stock_id')) 
        $Ajax->activate('usage_table');
 
 if (isset($_POST['stock_id']))
index 8edf3dfeb2ba3d523d92fe9d9c87a88c7bb48faa..b4438da608d7f066c1ee9797521bb9d6f75645d9 100644 (file)
@@ -297,7 +297,7 @@ function po_item_controls(&$order, $stock_id=null)
                hidden('line_no', ($_SESSION['PO']->lines_on_order + 1));
 
                stock_purchasable_items_list_cells(null, 'stock_id', null, false, true);
-               if(isset($_POST['_stock_id_update'])) {
+               if (list_updated('stock_id')) {
                            $Ajax->activate('price');
                            $Ajax->activate('units');
                            $Ajax->activate('qty');
index fe1e1dbe3d30d434d4d2cccee568a2f6b9ef3c24..1b9db8f10659fbeef88cfd5464118d138fcbdbe9 100644 (file)
@@ -241,7 +241,7 @@ function credit_edit_item_controls(&$order, $rowcounter, $line_no=-1)
        else
        {
                stock_items_list_cells(null,'stock_id', null, false, true);
-               if(isset($_POST['_stock_id_update'])) {
+               if (list_updated('stock_id')) {
                            $Ajax->activate('price');
                            $Ajax->activate('qty');
                            $Ajax->activate('units');
index 3b0489e352e8000db7a3b8a48be480d78602c117..b4fcc7d4d4b8b67b6f605c37ca3691c076f078f9 100644 (file)
@@ -335,7 +335,7 @@ function sales_order_item_controls(&$order, &$rowcounter, $line_no=-1)
        else
        {
                stock_items_list_cells(null,'stock_id', null, false, true);
-               if(isset($_POST['_stock_id_update'])) {
+               if (list_updated('stock_id')) {
                            $Ajax->activate('price');
                            $Ajax->activate('units');
                            $Ajax->activate('qty');