예제 #1
0
    }
    if (strlen(trim($_POST['name'])) == 0) {
        display_error(_("The account class name cannot be empty."));
        set_focus('name');
        return false;
    }
    if (isset($use_oldstyle_convert) && $use_oldstyle_convert == 1) {
        $_POST['Balance'] = check_value('Balance');
    }
    return true;
}
//-----------------------------------------------------------------------------------
if ($Mode == 'ADD_ITEM' || $Mode == 'UPDATE_ITEM') {
    if (can_process()) {
        if ($selected_id != "") {
            if (update_account_class($selected_id, $_POST['name'], $_POST['ctype'])) {
                display_notification(_('Selected account class settings has been updated'));
            }
        } else {
            if (add_account_class($_POST['id'], $_POST['name'], $_POST['ctype'])) {
                display_notification(_('New account class has been added'));
                $Mode = 'RESET';
            }
        }
    }
}
//-----------------------------------------------------------------------------------
function can_delete($selected_id)
{
    if ($selected_id == "") {
        return false;
예제 #2
0
}
//-----------------------------------------------------------------------------------
function can_process()
{
    if (strlen($_POST['name']) == 0) {
        display_error(tr("The account class name cannot be empty."));
        set_focus('name');
        return false;
    }
    return true;
}
//-----------------------------------------------------------------------------------
if (isset($_POST['ADD_ITEM']) || isset($_POST['UPDATE_ITEM'])) {
    if (can_process()) {
        if ($selected_id != -1) {
            update_account_class($selected_id, $_POST['name'], $_POST['Balance']);
        } else {
            add_account_class($_POST['id'], $_POST['name'], $_POST['Balance']);
        }
        meta_forward($_SERVER['PHP_SELF']);
    }
}
//-----------------------------------------------------------------------------------
function can_delete($selected_id)
{
    if ($selected_id == -1) {
        return false;
    }
    $sql = "SELECT COUNT(*) FROM chart_types\n\t\tWHERE class_id={$selected_id}";
    $result = db_query($sql, "could not query chart master");
    $myrow = db_fetch_row($result);