+/*
+ Check if the cart was not destroyed during opening the edition page in
+ another browser tab.
+*/
+function check_edit_conflicts($cartname='Items')
+{
+ global $Ajax;
+
+ if (isset($_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();
+ }
+}