Back link on final edition page now properly redirects user to previous menu tab...
authorJanusz Dobrowolski <janusz@frontaccouting.eu>
Tue, 3 Jan 2012 15:06:52 +0000 (16:06 +0100)
committerJanusz Dobrowolski <janusz@frontaccouting.eu>
Tue, 3 Jan 2012 15:06:52 +0000 (16:06 +0100)
includes/main.inc
includes/page/footer.inc
includes/ui/ui_controls.inc
js/utils.js
sales/includes/sales_ui.inc

index 161911c608b512b87559d7e7ff2569b21ae8427d..8f2b3c33d56ea3912b97e3579d6b9488b45c9aa4 100644 (file)
@@ -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) 
index 68f76f35ef0c0696424b66d4cd2867f9928dee36..633a0fb7d823367e7731d1c1a5cd73045fad67c3 100644 (file)
@@ -9,7 +9,7 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
     See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
 ***********************************************************************/
-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;
 
index 2cc3b02cfdc0a1a3b01d53ea3f0defffab11637a..bbe4c7f5142f3680055589e48ecbe906daaca390 100644 (file)
@@ -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 "<td align=center><a href='$path_to_root/admin/attachments.php?vw=$id' target='blanc_'>"._("View Attachment")."</a></td>\n";
                echo "<td align=center><a href='javascript:window.print();'>"._("Print")."</a></td>\n";
-       }       
-       echo "<td align=center><a href='javascript:goBack(".($no_menu ? "1":"0").");'>".($no_menu ? _("Close") : _("Back"))."</a></td>\n";
+       }
+       echo "<td align=center><a href='javascript:goBack(".($final ? '-2' : '').");'>".($no_menu ? _("Close") : _("Back"))."</a></td>\n";
        end_row();
        end_table();
        if ($center)
index 5af7bfb4f644bab6e6e54836eb4ba38d5162d8a6..898a536211086ff3cabb62a0f873395aa4cef698 100644 (file)
@@ -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) {
index 8e2048cf21eb69d608da3b6c73d7b05c360c3b70..49232d81a8a3ca926f89ad1b3dcf1b2920a74a7a 100644 (file)
@@ -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();