Changed license type to GPLv3 in top of files
[fa-stable.git] / sales / includes / sales_ui.inc
1 <?php
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");
13
14 include_once($path_to_root . "/includes/ui.inc");
15 include_once($path_to_root . "/includes/banking.inc");
16
17 //----------------------------------------------------------------------------
18 // helper functions for script execution control
19 //
20 function processing_start()
21 {
22     processing_end();
23     $_SESSION['Processing'] = $_SERVER['PHP_SELF'];
24 }
25
26 function processing_end()
27 {
28     unset($_SESSION['Processing']);
29     if ( isset($_SESSION['Items']) ) {
30                 unset($_SESSION['Items']->line_items);
31                 unset($_SESSION['Items']);
32     }
33 }
34
35 function processing_active()
36 {
37     return (isset($_SESSION['Processing']) && $_SESSION['Processing']==$_SERVER['PHP_SELF']);
38 }
39 /*
40         Check if the cart was not destroyed during opening the edition page in
41         another browser tab.
42 */
43 function check_edit_conflicts($cartname='Items')
44 {
45         global $Ajax;
46         
47         if (isset($_POST['cart_id']) && $_POST['cart_id'] != $_SESSION[$cartname]->cart_id) {
48                 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.'));
49                 $Ajax->activate('_page_body');
50                 display_footer_exit();
51         }
52 }
53
54 ?>