Better wrapping on comments in documents.
[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         page_processing(false);
23     processing_end();
24     $_SESSION['Processing'] = $_SERVER['PHP_SELF'];
25 }
26
27 function processing_end()
28 {
29         page_processing(true);
30     unset($_SESSION['Processing']);
31     if ( isset($_SESSION['Items']) ) {
32                 unset($_SESSION['Items']->line_items);
33                 unset($_SESSION['Items']);
34     }
35 }
36
37 function processing_active()
38 {
39     return (isset($_SESSION['Processing']) && $_SESSION['Processing']==$_SERVER['PHP_SELF']);
40 }
41 /*
42         Check if the cart was not destroyed during opening the edition page in
43         another browser tab.
44 */
45 function check_edit_conflicts($cart_id, $cartname='Items')
46 {
47         global $Ajax, $SysPrefs;
48
49         if ((!isset($SysPrefs->no_check_edit_conflicts) || $SysPrefs->no_check_edit_conflicts==0) && $cart_id && $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();
53         }
54 }
55