From b5290bacccd3388d097dc01a2c6a2762b9ee4e57 Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Tue, 3 Jan 2012 16:06:52 +0100 Subject: [PATCH] Back link on final edition page now properly redirects user to previous menu tab, improved sales document edition control. --- includes/main.inc | 8 ++++---- includes/page/footer.inc | 2 +- includes/ui/ui_controls.inc | 6 +++--- js/utils.js | 6 +++--- sales/includes/sales_ui.inc | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/includes/main.inc b/includes/main.inc index 161911c6..8f2b3c33 100644 --- a/includes/main.inc +++ b/includes/main.inc @@ -46,16 +46,16 @@ function page($title, $no_menu=false, $is_index=false, $onload="", $js="", $scri } } -function end_page($no_menu=false, $is_index=false, $hide_back_link=false, $type_no=0, $trans_no=0) +function end_page($no_menu=false, $is_index=false, $final_screen=false, $type_no=0, $trans_no=0) { global $path_to_root; - if (!$is_index && !$hide_back_link && function_exists('hyperlink_back')) - hyperlink_back(true, $no_menu, $type_no, $trans_no); + if (!$is_index && function_exists('hyperlink_back')) + hyperlink_back(true, $no_menu, $type_no, $trans_no, $final_screen); div_end(); // end of _page_body section include($path_to_root . "/includes/page/footer.inc"); - page_footer($no_menu, $is_index, $hide_back_link); + page_footer($no_menu, $is_index); } function cache_js_file($fpath, $text) diff --git a/includes/page/footer.inc b/includes/page/footer.inc index 68f76f35..633a0fb7 100644 --- a/includes/page/footer.inc +++ b/includes/page/footer.inc @@ -9,7 +9,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License here . ***********************************************************************/ -function page_footer($no_menu=false, $is_index=false, $hide_back_link=false) +function page_footer($no_menu=false, $is_index=false) { global $path_to_root, $js_lib, $Validate, $Editors, $Ajax, $sql_queries; diff --git a/includes/ui/ui_controls.inc b/includes/ui/ui_controls.inc index 2cc3b02c..bbe4c7f5 100644 --- a/includes/ui/ui_controls.inc +++ b/includes/ui/ui_controls.inc @@ -166,7 +166,7 @@ function access_string($label, $clean=false) return $clean ? $label : array($label, $access); } -function hyperlink_back($center=true, $no_menu=true, $type_no=0, $trans_no=0) +function hyperlink_back($center=true, $no_menu=true, $type_no=0, $trans_no=0, $final=false) { global $path_to_root; @@ -186,8 +186,8 @@ function hyperlink_back($center=true, $no_menu=true, $type_no=0, $trans_no=0) if ($id != 0) echo ""._("View Attachment")."\n"; echo ""._("Print")."\n"; - } - echo "".($no_menu ? _("Close") : _("Back"))."\n"; + } + echo "".($no_menu ? _("Close") : _("Back"))."\n"; end_row(); end_table(); if ($center) diff --git a/js/utils.js b/js/utils.js index 5af7bfb4..898a5362 100644 --- a/js/utils.js +++ b/js/utils.js @@ -251,11 +251,11 @@ function get_amount(doc, label) { return isNaN(val) ? 0 : val; } -function goBack(no_menu) { - if (no_menu) +function goBack(deep) { + if (window.opener) window.close(); else - window.history.go(-1); + window.history.go(deep || -1); } function setFocus(name, byId) { diff --git a/sales/includes/sales_ui.inc b/sales/includes/sales_ui.inc index 8e2048cf..49232d81 100644 --- a/sales/includes/sales_ui.inc +++ b/sales/includes/sales_ui.inc @@ -45,8 +45,8 @@ function processing_active() function check_edit_conflicts($cartname='Items') { global $Ajax; - - if (isset($_POST['cart_id']) && $_POST['cart_id'] != $_SESSION[$cartname]->cart_id) { + + if (get_post('cart_id') && $_POST['cart_id'] != $_SESSION[$cartname]->cart_id) { display_error(_('This edit session has been abandoned by opening sales document in another browser tab. You cannot edit more than one sales document at once.')); $Ajax->activate('_page_body'); display_footer_exit(); -- 2.30.2