Fixed GET continuation after timeot and logout page access without authorization.
[fa-stable.git] / gl / manage / gl_accounts.php
index c78becaa1605fd725238840aeddb6cec4bcd915e..4699c5498a941be26d07a7a61e1f74565ae90b8d 100644 (file)
@@ -9,8 +9,8 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
     See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
 ***********************************************************************/
-$page_security = 10;
-$path_to_root="../..";
+$page_security = 'SA_GLACCOUNT';
+$path_to_root = "../..";
 include($path_to_root . "/includes/session.inc");
 
 page(_("Chart of Accounts"));
@@ -187,6 +187,17 @@ function can_delete($selected_account)
                return false;
        }                                                                       
        
+       $sql= "SELECT COUNT(*) FROM ".TB_PREF."quick_entry_lines WHERE 
+               dest_id='$selected_account' AND UPPER(LEFT(action, 1)) <> 'T'";
+       $result = db_query($sql,"Couldn't test for existing suppliers GL codes");
+
+       $myrow = db_fetch_row($result);
+       if ($myrow[0] > 0) 
+       {
+               display_error(_("Cannot delete this account because it is used by one or more Quick Entry Lines."));
+               return false;
+       }                                                                       
+
        return true;
 }