From 95fd152649f9383cee8680762daf3430e8250bd6 Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Mon, 9 Nov 2015 12:04:08 +0100 Subject: [PATCH] Fixed tabbed dialogs. Removed redundant 'popup' variables. --- inventory/cost_update.php | 12 +++++------- inventory/includes/db/items_purchases_db.inc | 2 +- inventory/inquiry/stock_movements.php | 8 +++----- inventory/inquiry/stock_status.php | 2 +- inventory/manage/items.php | 19 ++++++++----------- inventory/prices.php | 12 +++++------- inventory/purchasing_data.php | 11 ++++------- inventory/reorder_level.php | 12 ++++-------- purchasing/manage/suppliers.php | 5 +++-- sales/inquiry/customer_inquiry.php | 2 +- sales/manage/customers.php | 13 ++++++------- 11 files changed, 41 insertions(+), 57 deletions(-) diff --git a/inventory/cost_update.php b/inventory/cost_update.php index efd99593..11ab6fc3 100644 --- a/inventory/cost_update.php +++ b/inventory/cost_update.php @@ -10,10 +10,11 @@ See the License here . ***********************************************************************/ $page_security = 'SA_STANDARDCOST'; -if (!@$_GET['popup']) - $path_to_root = ".."; -else + +if (@$_GET['page_level'] == 1) $path_to_root = "../.."; +else + $path_to_root = ".."; include_once($path_to_root . "/includes/session.inc"); include_once($path_to_root . "/includes/date_functions.inc"); @@ -21,6 +22,7 @@ include_once($path_to_root . "/includes/ui.inc"); include_once($path_to_root . "/includes/banking.inc"); include_once($path_to_root . "/includes/data_checks.inc"); include_once($path_to_root . "/inventory/includes/inventory_db.inc"); +include_once($path_to_root . "/includes/ui/items_cart.inc"); $js = ""; if ($SysPrefs->use_popup_windows) @@ -112,10 +114,6 @@ $_POST['overhead_cost'] = price_decimal_format($myrow["overhead_cost"], $dec3); amount_row(_("Standard Material Cost Per Unit"), "material_cost", null, "class='tableheader2'", null, $dec1); -if ($page_nested) -{ - hidden('popup', @$_GET['popup']); -} if ($myrow["mb_flag"]=='M') { amount_row(_("Standard Labour Cost Per Unit"), "labour_cost", null, "class='tableheader2'", null, $dec2); diff --git a/inventory/includes/db/items_purchases_db.inc b/inventory/includes/db/items_purchases_db.inc index 33f765a8..eecd9123 100644 --- a/inventory/includes/db/items_purchases_db.inc +++ b/inventory/includes/db/items_purchases_db.inc @@ -57,7 +57,7 @@ function get_item_purchasing_data($selected_id, $stock_id) $sql = "SELECT pdata.*, supplier.supp_name FROM ".TB_PREF."purch_data pdata INNER JOIN ".TB_PREF."suppliers supplier ON pdata.supplier_id=supplier.supplier_id - WHERE pata.supplier_id=".db_escape($selected_id)." + WHERE pdata.supplier_id=".db_escape($selected_id)." AND pdata.stock_id=".db_escape($stock_id); $result = db_query($sql, "The supplier purchasing details for the selected supplier and item could not be retrieved"); diff --git a/inventory/inquiry/stock_movements.php b/inventory/inquiry/stock_movements.php index 363f4dc9..a0783eab 100644 --- a/inventory/inquiry/stock_movements.php +++ b/inventory/inquiry/stock_movements.php @@ -23,7 +23,7 @@ if ($SysPrefs->use_popup_windows) $js .= get_js_open_window(800, 500); if (user_use_date_picker()) $js .= get_js_date_picker(); -page(_($help_context = "Inventory Item Movement"), @$_GET['popup'], false, "", $js); +page(_($help_context = "Inventory Item Movement"), isset($_GET['stock_id']), false, "", $js); //------------------------------------------------------------------------------------------------ check_db_has_stock_items(_("There are no items defined in the system.")); @@ -38,8 +38,7 @@ if (isset($_GET['stock_id'])) $_POST['stock_id'] = $_GET['stock_id']; } -if (!@$_GET['popup']) - start_form(); +start_form(); if (!isset($_POST['stock_id'])) $_POST['stock_id'] = get_global_stock_item(); @@ -62,8 +61,7 @@ date_cells(_("To:"), 'BeforeDate'); submit_cells('ShowMoves',_("Show Movements"),'',_('Refresh Inquiry'), 'default'); end_row(); end_table(); -if (!@$_GET['popup']) - end_form(); +end_form(); set_global_stock_item($_POST['stock_id']); diff --git a/inventory/inquiry/stock_status.php b/inventory/inquiry/stock_status.php index f4093075..6c0c0ba9 100644 --- a/inventory/inquiry/stock_status.php +++ b/inventory/inquiry/stock_status.php @@ -13,7 +13,7 @@ $page_security = 'SA_ITEMSSTATVIEW'; $path_to_root = "../.."; include_once($path_to_root . "/includes/session.inc"); -page(_($help_context = "Inventory Item Status"), @$_GET['popup']); +page(_($help_context = "Inventory Item Status"), isset($_GET['stock_id'])); if (isset($_GET['stock_id'])) $_POST['stock_id'] = $_GET['stock_id']; diff --git a/inventory/manage/items.php b/inventory/manage/items.php index 3725aca9..fc7f1a7a 100644 --- a/inventory/manage/items.php +++ b/inventory/manage/items.php @@ -19,7 +19,7 @@ if ($SysPrefs->use_popup_windows) if (user_use_date_picker()) $js .= get_js_date_picker(); -page(_($help_context = "Items"), @$_REQUEST['popup'], false, "", $js); +page(_($help_context = "Items"), false, false, "", $js); include_once($path_to_root . "/includes/date_functions.inc"); include_once($path_to_root . "/includes/ui.inc"); @@ -265,7 +265,7 @@ if (isset($_POST['delete']) && strlen($_POST['delete']) > 1) function item_settings(&$stock_id, $new_item) { - global $SysPrefs, $path_to_root; + global $SysPrefs, $path_to_root, $page_nested; start_outer_table(TABLESTYLE2); @@ -428,7 +428,7 @@ function item_settings(&$stock_id, $new_item) else { submit_center_first('addupdate', _("Update Item"), '', - @$_REQUEST['popup'] ? true : 'default'); + $page_nested ? true : 'default'); submit_return('select', get_post('stock_id'), _("Select this items and return to document entry."), 'default'); submit('clone', _("Clone This Item"), true, '', true); @@ -487,17 +487,17 @@ tabbed_content_start('tabs', array( break; case 'sales_pricing': $_GET['stock_id'] = $stock_id; - $_GET['popup'] = 1; + $_GET['page_level'] = 1; include_once($path_to_root."/inventory/prices.php"); break; case 'purchase_pricing': $_GET['stock_id'] = $stock_id; - $_GET['popup'] = 1; + $_GET['page_level'] = 1; include_once($path_to_root."/inventory/purchasing_data.php"); break; case 'standard_cost': $_GET['stock_id'] = $stock_id; - $_GET['popup'] = 1; + $_GET['page_level'] = 1; include_once($path_to_root."/inventory/cost_update.php"); break; case 'reorder_level': @@ -505,18 +505,16 @@ tabbed_content_start('tabs', array( { break; } + $_GET['page_level'] = 1; $_GET['stock_id'] = $stock_id; - $_GET['popup'] = 1; include_once($path_to_root."/inventory/reorder_level.php"); break; case 'movement': $_GET['stock_id'] = $stock_id; - $_GET['popup'] = 1; include_once($path_to_root."/inventory/inquiry/stock_movements.php"); break; case 'status': $_GET['stock_id'] = $stock_id; - $_GET['popup'] = 1; include_once($path_to_root."/inventory/inquiry/stock_status.php"); break; }; @@ -525,9 +523,8 @@ tabbed_content_end(); div_end(); -hidden('popup', @$_REQUEST['popup']); end_form(); //------------------------------------------------------------------------------------ -end_page(@$_REQUEST['popup']); +end_page(); diff --git a/inventory/prices.php b/inventory/prices.php index c537752e..a464e62e 100644 --- a/inventory/prices.php +++ b/inventory/prices.php @@ -10,10 +10,11 @@ See the License here . ***********************************************************************/ $page_security = 'SA_SALESPRICE'; -if (!@$_GET['popup']) - $path_to_root = ".."; -else + +if (@$_GET['page_level'] == 1) $path_to_root = "../.."; +else + $path_to_root = ".."; include_once($path_to_root . "/includes/session.inc"); include_once($path_to_root . "/sales/includes/sales_db.inc"); @@ -182,10 +183,7 @@ if ($Mode == 'Edit') } hidden('selected_id', $selected_id); -if ($page_nested) -{ - hidden('popup', @$_GET['popup']); -} + div_start('price_details'); start_table(TABLESTYLE2); diff --git a/inventory/purchasing_data.php b/inventory/purchasing_data.php index d0302261..8c36581d 100644 --- a/inventory/purchasing_data.php +++ b/inventory/purchasing_data.php @@ -10,10 +10,11 @@ See the License here . ***********************************************************************/ $page_security = 'SA_PURCHASEPRICING'; -if (!@$_GET['popup']) - $path_to_root = ".."; -else + +if (@$_GET['page_level'] == 1) $path_to_root = "../.."; +else + $path_to_root = ".."; include_once($path_to_root . "/includes/session.inc"); include_once($path_to_root . "/includes/date_functions.inc"); @@ -193,10 +194,6 @@ if ($Mode =='Edit') br(); hidden('selected_id', $selected_id); -if ($page_nested) -{ - hidden('popup', @$_GET['popup']); -} start_table(TABLESTYLE2); diff --git a/inventory/reorder_level.php b/inventory/reorder_level.php index 8eca2ef1..cc0d6979 100644 --- a/inventory/reorder_level.php +++ b/inventory/reorder_level.php @@ -10,10 +10,11 @@ See the License here . ***********************************************************************/ $page_security = 'SA_REORDER'; -if (!@$_GET['popup']) - $path_to_root = ".."; -else + +if (@$_GET['page_level'] == 1) $path_to_root = "../.."; +else + $path_to_root = ".."; include_once($path_to_root . "/includes/session.inc"); include_once($path_to_root . "/includes/date_functions.inc"); @@ -72,11 +73,6 @@ $k=0; //row colour counter $result = get_loc_details($_POST['stock_id']); -if ($page_nested) -{ - hidden('popup', @$_GET['popup']); -} - while ($myrow = db_fetch($result)) { diff --git a/purchasing/manage/suppliers.php b/purchasing/manage/suppliers.php index 4613de18..d17950c4 100644 --- a/purchasing/manage/suppliers.php +++ b/purchasing/manage/suppliers.php @@ -35,7 +35,8 @@ $supplier_id = get_post('supplier_id'); //-------------------------------------------------------------------------------------------- function supplier_settings(&$supplier_id) { - + global $page_nested; + start_outer_table(TABLESTYLE2); table_section(1); @@ -169,7 +170,7 @@ function supplier_settings(&$supplier_id) if ($supplier_id) { submit_center_first('submit', _("Update Supplier"), - _('Update supplier data'), @$_REQUEST['popup'] ? true : 'default'); + _('Update supplier data'), $page_nested ? true : 'default'); submit_return('select', get_post('supplier_id'), _("Select this supplier and return to document entry.")); submit_center_last('delete', _("Delete Supplier"), _('Delete supplier data if have been never used'), true); diff --git a/sales/inquiry/customer_inquiry.php b/sales/inquiry/customer_inquiry.php index b90eacec..720edc35 100644 --- a/sales/inquiry/customer_inquiry.php +++ b/sales/inquiry/customer_inquiry.php @@ -41,7 +41,7 @@ start_table(TABLESTYLE_NOBORDER); start_row(); if (!$page_nested) - customer_list_cells(_("Select a customer: "), 'customer_id', null, true, false, false, !@$_GET['popup']); + customer_list_cells(_("Select a customer: "), 'customer_id', null, true, false, false, true); date_cells(_("From:"), 'TransAfterDate', '', null, -user_transaction_days()); date_cells(_("To:"), 'TransToDate', '', null); diff --git a/sales/manage/customers.php b/sales/manage/customers.php index e7e21e89..953d7762 100644 --- a/sales/manage/customers.php +++ b/sales/manage/customers.php @@ -20,7 +20,7 @@ if ($SysPrefs->use_popup_windows) if (user_use_date_picker()) $js .= get_js_date_picker(); -page(_($help_context = "Customers"), @$_REQUEST['popup'], false, "", $js); +page(_($help_context = "Customers"), false, false, "", $js); include_once($path_to_root . "/includes/date_functions.inc"); include_once($path_to_root . "/includes/banking.inc"); @@ -187,7 +187,7 @@ if (isset($_POST['delete'])) function customer_settings($selected_id) { - global $SysPrefs, $path_to_root; + global $SysPrefs, $path_to_root, $page_nested; if (!$selected_id) { @@ -284,8 +284,8 @@ function customer_settings($selected_id) start_row(); echo ''._('Customer branches').':'; hyperlink_params_td($path_to_root . "/sales/manage/customer_branches.php", - ''. (@$_REQUEST['popup'] ? _("Select or &Add") : _("&Add or Edit ")).'', - "debtor_no=".$selected_id.(@$_REQUEST['popup'] ? '&popup=1':'')); + ''. ($page_nested ? _("Select or &Add") : _("&Add or Edit ")).'', + "debtor_no=".$selected_id.($page_nested ? '&popup=1':'')); end_row(); } @@ -308,7 +308,7 @@ function customer_settings($selected_id) else { submit_center_first('submit', _("Update Customer"), - _('Update customer data'), @$_REQUEST['popup'] ? true : 'default'); + _('Update customer data'), $page_nested ? true : 'default'); submit_return('select', $selected_id, _("Select this customer and return to document entry.")); submit_center_last('delete', _("Delete Customer"), _('Delete customer data if have been never used'), true); @@ -374,7 +374,6 @@ tabbed_content_start('tabs', array( br(); tabbed_content_end(); -hidden('popup', @$_REQUEST['popup']); end_form(); -end_page(@$_REQUEST['popup']); +end_page(); -- 2.30.2