Merging version 2.1 RC to main trunk.
[fa-stable.git] / sales / includes / sales_ui.inc
index 64045bb155e78faddc5b1d1c2604bc30a5549cf7..7e7f7afd195aeffd4e0b5e0729443a00295cfe0d 100644 (file)
@@ -1,5 +1,14 @@
 <?php
-
+/**********************************************************************
+    Copyright (C) FrontAccounting, LLC.
+       Released under the terms of the GNU General Public License, GPL, 
+       as published by the Free Software Foundation, either version 3 
+       of the License, or (at your option) any later version.
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+    See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
+***********************************************************************/
 include_once($path_to_root . "/includes/date_functions.inc");
 
 include_once($path_to_root . "/includes/ui.inc");
@@ -27,5 +36,19 @@ function processing_active()
 {
     return (isset($_SESSION['Processing']) && $_SESSION['Processing']==$_SERVER['PHP_SELF']);
 }
+/*
+       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();
+       }
+}
 
 ?>
\ No newline at end of file