From 0b0690657989cd259e5966faaac7cacbfa89cee2 Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Mon, 9 Jun 2008 22:42:47 +0000 Subject: [PATCH] Some more fixes related to ajax combos behaviour and usage --- CHANGELOG.txt | 13 ++++++++ includes/ui/ui_lists.inc | 33 +++----------------- inventory/cost_update.php | 5 ++- inventory/includes/item_adjustments_ui.inc | 2 +- inventory/inquiry/stock_status.php | 5 ++- inventory/prices.php | 6 ++-- inventory/purchasing_data.php | 6 ++-- inventory/reorder_level.php | 5 ++- manufacturing/inquiry/where_used_inquiry.php | 5 +++ manufacturing/manage/bom_edit.php | 5 ++- purchasing/includes/ui/po_ui.inc | 2 +- 11 files changed, 49 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 26653fd1..2c32127d 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -20,6 +20,19 @@ Legend: $ -> Affected files ---------------------------------------Release Candidate 1------------------------------- +10-Jun-2008 Janusz Dobrowolski +# Some more fixes related to ajax combos usage +$ /includes/ui/ui_lists.inc + /inventory/cost_update.php + /inventory/prices.php + /inventory/purchasing_data.php + /inventory/reorder_level.php + /inventory/includes/item_adjustments_ui.inc + /inventory/inquiry/stock_status.php + /manufacturing/inquiry/where_used_inquiry.php + /manufacturing/manage/bom_edit.php + /purchasing/includes/ui/po_ui.inc + 09-Jun-2008 Janusz Dobrowolski # Some additional fixes related to last big committment $ /gl/gl_journal.php diff --git a/includes/ui/ui_lists.inc b/includes/ui/ui_lists.inc index 4b2294e3..102227c4 100644 --- a/includes/ui/ui_lists.inc +++ b/includes/ui/ui_lists.inc @@ -74,7 +74,7 @@ $opts = array( // default options : _('Enter description fragment to search or * for all')) :''; if ($selected_id == null) { - $selected_id = get_post($name); + $selected_id = get_post($name, null); } $txt = get_post($search_box); $rel = ''; @@ -131,54 +131,31 @@ $opts = array( // default options $descr = $opts['format']==null ? $contact_row[1] : call_user_func($opts['format'], $contact_row); $sel = ''; - if (isset($_POST[$search_submit])) { - if (($by_id ? $value : $contact_row[1]) === $txt) - $selected_id = $value; - } - // if no initial selection - set the first item - if ($selected_id === "") { - $selected_id = $value; - } - if ($selected_id == $value) { + if ($selected_id === $value) { $sel = 'selected'; $found = $value; - $_POST[$name] = $selected_id; } - if ($first_opt == false) { + if ($first_id === false) { $first_id = $value; $first_opt = $descr; - continue; } $selector .= "\n"; } db_free_result($result); } - if ($first_id !== false) { - // add first option - selected also if no match for selected_id was found - // and no special option defined - $sel = $spec_option===false || $found === $first_id ? 'selected' : ''; - $selector = "\n" - . $selector; - } // Prepend special option. if ($spec_option !== false) { // if special option used - add it $first_id = $spec_id; $first_opt = $spec_option; - if (isset($_POST[$search_submit])) { - if ($txt == '') - $selected_id = $spec_id; - } $sel = $found===false ? 'selected' : ''; $selector = "\n" . $selector; - $first_id = $spec_id; } if ($found === false) { $_POST[$name] = $first_id; } - if ($by_id) { $txt = $_POST[$name]; if ($search_box) @@ -203,7 +180,7 @@ $opts = array( // default options } // ------ make combo ---------- -$edit_entry = ''; + $edit_entry = ''; if ($search_box != false) { $edit_entry = "activate('cost_table'); //----------------------------------------------------------------------------------------- start_form(false, true); @@ -87,7 +89,7 @@ $result = db_query($sql); check_db_error("The cost details for the item could not be retrieved", $sql); $myrow = db_fetch($result); - +div_start('cost_table'); hidden("OldMaterialCost", $myrow["material_cost"]); hidden("OldLabourCost", $myrow["labour_cost"]); hidden("OldOverheadCost", $myrow["overhead_cost"]); @@ -113,6 +115,7 @@ else } end_table(1); +div_end(); submit_center('UpdateData', _("Update")); end_form(); diff --git a/inventory/includes/item_adjustments_ui.inc b/inventory/includes/item_adjustments_ui.inc index 28f38f0a..39c728a4 100644 --- a/inventory/includes/item_adjustments_ui.inc +++ b/inventory/includes/item_adjustments_ui.inc @@ -139,7 +139,7 @@ function adjustment_edit_item_controls(&$order, $stock_id=null) else { echo ""; - stock_costable_items_list('stock_id', $_POST['stock_id'], false, true); + stock_costable_items_list('stock_id', null, false, true); echo ""; $item_info = get_item_edit_info($_POST['stock_id']); diff --git a/inventory/inquiry/stock_status.php b/inventory/inquiry/stock_status.php index acaa0c0f..c0509a73 100644 --- a/inventory/inquiry/stock_status.php +++ b/inventory/inquiry/stock_status.php @@ -18,6 +18,8 @@ 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'])) + $Ajax->activate('status_tbl'); //---------------------------------------------------------------------------------------------------- check_db_has_stock_items(_("There are no items defined in the system.")); @@ -46,6 +48,7 @@ if (is_service($mb_flag)) $loc_details = get_loc_details($_POST['stock_id']); +div_start('status_tbl'); start_table($table_style); if ($kitset_or_service == true) @@ -132,7 +135,7 @@ while ($myrow = db_fetch($loc_details)) } end_table(); - +div_end(); end_form(); end_page(); diff --git a/inventory/prices.php b/inventory/prices.php index 81b2e2c7..7a8e53e1 100644 --- a/inventory/prices.php +++ b/inventory/prices.php @@ -108,13 +108,15 @@ if (isset($_GET['delete'])) echo _("The selected price has been deleted."); } - +if (isset($_POST['_stock_id_update'])) + $Ajax->activate('price_table'); //--------------------------------------------------------------------------------------------------- $mb_flag = get_mb_flag($_POST['stock_id']); $prices_list = get_prices($_POST['stock_id']); +div_start('price_table'); start_table("$table_style width=30%"); $th = array(_("Currency"), _("Sales Type"), _("Price"), "", ""); @@ -135,7 +137,7 @@ while ($myrow = db_fetch($prices_list)) } end_table(); - +div_end(); //------------------------------------------------------------------------------------------------ if (db_num_rows($prices_list) == 0) diff --git a/inventory/purchasing_data.php b/inventory/purchasing_data.php index 0fd952dc..8a1b4c0f 100644 --- a/inventory/purchasing_data.php +++ b/inventory/purchasing_data.php @@ -106,7 +106,8 @@ if (isset($_GET['Delete'])) display_note(_("The purchasing data item has been sucessfully deleted.")); unset ($supplier_id); } - +if (isset($_POST['_stock_id_update'])) + $Ajax->activate('price_table'); //-------------------------------------------------------------------------------------------------- start_form(false, true); @@ -137,7 +138,7 @@ else WHERE stock_id = '" . $_POST['stock_id'] . "'"; $result = db_query($sql, "The supplier purchasing details for the selected part could not be retrieved"); - + div_start('price_table'); if (db_num_rows($result) == 0) { display_note(_("There is no purchasing data set up for the part selected")); @@ -176,6 +177,7 @@ else end_table(); } + div_end(); } //------------------------------------------------------------------------------------------------ diff --git a/inventory/reorder_level.php b/inventory/reorder_level.php index a39d094e..dfe6f2dc 100644 --- a/inventory/reorder_level.php +++ b/inventory/reorder_level.php @@ -21,6 +21,8 @@ if (isset($_GET['stock_id'])) $_POST['stock_id'] = $_GET['stock_id']; } +if (isset($_POST['_stock_id_update'])) + $Ajax->activate('reorders'); //------------------------------------------------------------------------------------ start_form(false, true); @@ -37,6 +39,7 @@ stock_item_heading($_POST['stock_id']); set_global_stock_item($_POST['stock_id']); +div_start('reorders'); start_table("$table_style width=30%"); $th = array(_("Location"), _("Quantity On Hand"), _("Re-Order Level")); @@ -77,7 +80,7 @@ while ($myrow = db_fetch($result)) } end_table(1); - +div_end(); submit_center('UpdateData', _("Update")); end_form(); diff --git a/manufacturing/inquiry/where_used_inquiry.php b/manufacturing/inquiry/where_used_inquiry.php index 0bbacaca..ca58c439 100644 --- a/manufacturing/inquiry/where_used_inquiry.php +++ b/manufacturing/inquiry/where_used_inquiry.php @@ -22,6 +22,9 @@ echo "
"; set_global_stock_item($_POST['stock_id']); +if (isset($_POST['_stock_id_update'])) + $Ajax->activate('usage_table'); + if (isset($_POST['stock_id'])) { $sql = "SELECT ".TB_PREF."bom.*,".TB_PREF."stock_master.description,".TB_PREF."workcentres.name As WorkCentreName, ".TB_PREF."locations.location_name @@ -32,6 +35,7 @@ if (isset($_POST['stock_id'])) $result = db_query($sql,"No parent items were returned"); + div_start('usage_table'); if (db_num_rows($result) == 0) { display_note(_("The selected item is not used in any BOMs.")); @@ -69,6 +73,7 @@ if (isset($_POST['stock_id'])) end_table(); } + div_end(); } end_form(); diff --git a/manufacturing/manage/bom_edit.php b/manufacturing/manage/bom_edit.php index a10606b1..2df31409 100644 --- a/manufacturing/manage/bom_edit.php +++ b/manufacturing/manage/bom_edit.php @@ -86,7 +86,7 @@ function display_bom_items($selected_parent) global $table_style; $result = get_bom($selected_parent); - +div_start('bom'); start_table("$table_style width=60%"); $th = array(_("Code"), _("Description"), _("Location"), _("Work Centre"), _("Quantity"), _("Units"),'',''); @@ -110,6 +110,7 @@ function display_bom_items($selected_parent) } //END WHILE LIST LOOP end_table(); +div_end(); } //-------------------------------------------------------------------------------------------------- @@ -204,6 +205,8 @@ echo ""; end_form(); +if (isset($_POST['_stock_id_update'])) + $Ajax->activate('bom'); //-------------------------------------------------------------------------------------------------- if (isset($_POST['stock_id'])) diff --git a/purchasing/includes/ui/po_ui.inc b/purchasing/includes/ui/po_ui.inc index d76073bd..0104d2f3 100644 --- a/purchasing/includes/ui/po_ui.inc +++ b/purchasing/includes/ui/po_ui.inc @@ -54,7 +54,7 @@ function display_po_header(&$order) if (!isset($_POST['supplier_id']) && (get_global_supplier() != reserved_words::get_all())) $_POST['supplier_id'] = get_global_supplier(); - supplier_list_row(_("Supplier:"), 'supplier_id', $_POST['supplier_id'], false, true); + supplier_list_row(_("Supplier:"), 'supplier_id', null, false, true); if ($order->supplier_id != $_POST['supplier_id']) { -- 2.30.2