From: Janusz Dobrowolski Date: Wed, 10 Sep 2008 21:49:10 +0000 (+0000) Subject: Fixed page update after item search. X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=18d2ad388d992ac76faab30db457360cf1b07e09;p=textcart.git Fixed page update after item search. --- diff --git a/inventory/cost_update.php b/inventory/cost_update.php index ff58f9e..769ac7d 100644 --- a/inventory/cost_update.php +++ b/inventory/cost_update.php @@ -64,7 +64,7 @@ if (isset($_POST['UpdateData'])) } } -if (isset($_POST['_stock_id_update'])) +if (list_updated('stock_id')) $Ajax->activate('cost_table'); //----------------------------------------------------------------------------------------- diff --git a/inventory/includes/item_adjustments_ui.inc b/inventory/includes/item_adjustments_ui.inc index 6d0a774..30e5610 100644 --- a/inventory/includes/item_adjustments_ui.inc +++ b/inventory/includes/item_adjustments_ui.inc @@ -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'); diff --git a/inventory/includes/stock_transfers_ui.inc b/inventory/includes/stock_transfers_ui.inc index 63d7c97..26609a1 100644 --- a/inventory/includes/stock_transfers_ui.inc +++ b/inventory/includes/stock_transfers_ui.inc @@ -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'); } diff --git a/inventory/inquiry/stock_status.php b/inventory/inquiry/stock_status.php index ae07645..2461c18 100644 --- a/inventory/inquiry/stock_status.php +++ b/inventory/inquiry/stock_status.php @@ -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'); //---------------------------------------------------------------------------------------------------- diff --git a/inventory/manage/items.php b/inventory/manage/items.php index f842065..9ce8b6f 100644 --- a/inventory/manage/items.php +++ b/inventory/manage/items.php @@ -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); diff --git a/inventory/prices.php b/inventory/prices.php index 5a3238f..3803fe0 100644 --- a/inventory/prices.php +++ b/inventory/prices.php @@ -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. diff --git a/inventory/purchasing_data.php b/inventory/purchasing_data.php index 67b670f..292055b 100644 --- a/inventory/purchasing_data.php +++ b/inventory/purchasing_data.php @@ -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'); //-------------------------------------------------------------------------------------------------- diff --git a/inventory/reorder_level.php b/inventory/reorder_level.php index 83283d5..3a68343 100644 --- a/inventory/reorder_level.php +++ b/inventory/reorder_level.php @@ -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'); diff --git a/manufacturing/includes/work_order_issue_ui.inc b/manufacturing/includes/work_order_issue_ui.inc index 9d6b9dd..8508364 100644 --- a/manufacturing/includes/work_order_issue_ui.inc +++ b/manufacturing/includes/work_order_issue_ui.inc @@ -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'); diff --git a/manufacturing/inquiry/where_used_inquiry.php b/manufacturing/inquiry/where_used_inquiry.php index e7958dc..5abcc70 100644 --- a/manufacturing/inquiry/where_used_inquiry.php +++ b/manufacturing/inquiry/where_used_inquiry.php @@ -22,7 +22,7 @@ echo "
"; 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'])) diff --git a/purchasing/includes/ui/po_ui.inc b/purchasing/includes/ui/po_ui.inc index 8edf3df..b4438da 100644 --- a/purchasing/includes/ui/po_ui.inc +++ b/purchasing/includes/ui/po_ui.inc @@ -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'); diff --git a/sales/includes/ui/sales_credit_ui.inc b/sales/includes/ui/sales_credit_ui.inc index fe1e1db..1b9db8f 100644 --- a/sales/includes/ui/sales_credit_ui.inc +++ b/sales/includes/ui/sales_credit_ui.inc @@ -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'); diff --git a/sales/includes/ui/sales_order_ui.inc b/sales/includes/ui/sales_order_ui.inc index 3b0489e..b4fcc7d 100644 --- a/sales/includes/ui/sales_order_ui.inc +++ b/sales/includes/ui/sales_order_ui.inc @@ -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');