<?php

$page_security = 'SA_GLACCOUNTGROUP';
$path_to_root = "../..";
include $path_to_root . "/includes/session.inc";
page(_($help_context = "GL Account Groups"));
include $path_to_root . "/gl/includes/gl_db.inc";
include $path_to_root . "/includes/ui.inc";
simple_page_mode(false);
//-----------------------------------------------------------------------------------
function can_process($selected_id)
{
    if (strlen(trim($_POST['id'])) == 0) {
        display_error(_("The account group id cannot be empty."));
        set_focus('id');
        return false;
    }
    if (strlen(trim($_POST['name'])) == 0) {
        display_error(_("The account group name cannot be empty."));
        set_focus('name');
        return false;
    }
    $type = get_account_type(trim($_POST['id']));
    if ($type && $type['id'] != $selected_id) {
        display_error(_("This account group id is already in use."));
        set_focus('id');
        return false;
    }
    //if (strcmp($_POST['id'], $_POST['parent']) == 0)
    if ($_POST['id'] === $_POST['parent']) {
        display_error(_("You cannot set an account group to be a subgroup of itself."));
Example #2
0
<?php

$page_security = 'SA_BOM';
$path_to_root = "../..";
include_once $path_to_root . "/includes/session.inc";
page(_($help_context = "Bill Of Materials"));
include_once $path_to_root . "/includes/date_functions.inc";
include_once $path_to_root . "/includes/ui.inc";
include_once $path_to_root . "/includes/data_checks.inc";
include_once $path_to_root . "/includes/manufacturing.inc";
check_db_has_bom_stock_items(_("There are no manufactured or kit items defined in the system."));
check_db_has_workcentres(_("There are no work centres defined in the system. BOMs require at least one work centre be defined."));
simple_page_mode(true);
$selected_component = $selected_id;
//--------------------------------------------------------------------------------------------------
//if (isset($_GET["NewItem"]))
//{
//	$_POST['stock_id'] = $_GET["NewItem"];
//}
if (isset($_GET['stock_id'])) {
    $_POST['stock_id'] = $_GET['stock_id'];
    $selected_parent = $_GET['stock_id'];
}
/* selected_parent could come from a post or a get */
/*if (isset($_GET["selected_parent"]))
{
	$selected_parent = $_GET["selected_parent"];
}
else if (isset($_POST["selected_parent"]))
{
	$selected_parent = $_POST["selected_parent"];
Example #3
0
/**********************************************************************
    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>.
***********************************************************************/
$page_security = 'SA_BANKACCOUNT';
$path_to_root = "../..";
include $path_to_root . "/includes/session.inc";
page(_($help_context = "Bank Accounts"));
include $path_to_root . "/includes/ui.inc";
simple_page_mode();
//-----------------------------------------------------------------------------------
if ($Mode == 'ADD_ITEM' || $Mode == 'UPDATE_ITEM') {
    //initialise no input errors assumed initially before we test
    $input_error = 0;
    //first off validate inputs sensible
    if (strlen($_POST['bank_account_name']) == 0) {
        $input_error = 1;
        display_error(_("The bank account name cannot be empty."));
        set_focus('bank_account_name');
    }
    if ($Mode == 'ADD_ITEM' && (gl_account_in_bank_accounts(get_post('account_code')) || key_in_foreign_table(get_post('account_code'), 'gl_trans', 'account'))) {
        $input_error = 1;
        display_error(_("The GL account selected is already in use. Select another GL account."));
        set_focus('account_code');
    }