2 /**********************************************************************
3 Copyright (C) FrontAccounting, LLC.
4 Released under the terms of the GNU General Public License, GPL,
5 as published by the Free Software Foundation, either version 3
6 of the License, or (at your option) any later version.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
11 ***********************************************************************/
12 include_once($path_to_root . "/includes/date_functions.inc");
14 include_once($path_to_root . "/includes/ui.inc");
15 include_once($path_to_root . "/includes/banking.inc");
17 //----------------------------------------------------------------------------
18 // helper functions for script execution control
20 function processing_start()
22 page_processing(false);
24 $_SESSION['Processing'] = $_SERVER['PHP_SELF'];
27 function processing_end()
29 page_processing(true);
30 unset($_SESSION['Processing']);
31 if ( isset($_SESSION['Items']) ) {
32 unset($_SESSION['Items']->line_items);
33 unset($_SESSION['Items']);
37 function processing_active()
39 return (isset($_SESSION['Processing']) && $_SESSION['Processing']==$_SERVER['PHP_SELF']);
42 Check if the cart was not destroyed during opening the edition page in
45 function check_edit_conflicts($cart_id, $cartname='Items')
47 global $Ajax, $SysPrefs;
49 if ((!isset($SysPrefs->no_check_edit_conflicts) || $SysPrefs->no_check_edit_conflicts==0) && $cart_id && isset($_SESSION[$cartname]) && $cart_id != $_SESSION[$cartname]->cart_id) {
50 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.'));
51 $Ajax->activate('_page_body');
52 display_footer_exit();