From: Janusz Dobrowolski Date: Tue, 3 Jan 2012 15:06:52 +0000 (+0100) Subject: Back link on final edition page now properly redirects user to previous menu tab... X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=f4c44ab25716b65353ff59696761ea0f8f203128;p=textcart.git Back link on final edition page now properly redirects user to previous menu tab, improved sales document edition control. --- diff --git a/includes/main.inc b/includes/main.inc index 161911c..8f2b3c3 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 68f76f3..633a0fb 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 2cc3b02..bbe4c7f 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 5af7bfb..898a536 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 8e2048c..49232d8 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();