コード例 #1
0
ファイル: gl_accounts.php プロジェクト: M-Shahbaz/FA
 } elseif (!$accounts_alpha && !preg_match("/^[0-9.]+\$/", $_POST['account_code'])) {
     $input_error = 1;
     display_error(_("The account code must be numeric."));
     set_focus('account_code');
 }
 if ($input_error != 1) {
     if ($accounts_alpha == 2) {
         $_POST['account_code'] = strtoupper($_POST['account_code']);
     }
     if (!isset($_POST['account_tags'])) {
         $_POST['account_tags'] = array();
     }
     if ($selected_account) {
         if (get_post('inactive') == 1 && is_bank_account($_POST['account_code'])) {
             display_error(_("The account belongs to a bank account and cannot be inactivated."));
         } elseif (update_gl_account($_POST['account_code'], $_POST['account_name'], $_POST['account_type'], $_POST['account_code2'])) {
             update_record_status($_POST['account_code'], $_POST['inactive'], 'chart_master', 'account_code');
             update_tag_associations(TAG_ACCOUNT, $_POST['account_code'], $_POST['account_tags']);
             $Ajax->activate('account_code');
             // in case of status change
             display_notification(_("Account data has been updated."));
         }
     } else {
         if (add_gl_account($_POST['account_code'], $_POST['account_name'], $_POST['account_type'], $_POST['account_code2'])) {
             add_tag_associations($_POST['account_code'], $_POST['account_tags']);
             display_notification(_("New account has been added."));
             $selected_account = $_POST['AccountList'] = $_POST['account_code'];
         } else {
             display_error(_("Account not added, possible duplicate Account Code."));
         }
     }
コード例 #2
0
ファイル: gl_accounts.php プロジェクト: ravenii/guardocs
        set_focus('account_code');
    } elseif (strlen($_POST['account_name']) == 0) {
        $input_error = 1;
        display_error(tr("The account name cannot be empty."));
        set_focus('account_name');
    } elseif (!$accounts_alpha && !is_numeric($_POST['account_code'])) {
        $input_error = 1;
        display_error(tr("The account code must be numeric."));
        set_focus('account_code');
    }
    if ($input_error != 1) {
        if ($accounts_alpha == 2) {
            $_POST['account_code'] = strtoupper($_POST['account_code']);
        }
        if ($selected_account) {
            update_gl_account($_POST['account_code'], $_POST['account_name'], $_POST['account_type'], $_POST['account_code2'], $_POST['tax_code']);
        } else {
            add_gl_account($_POST['account_code'], $_POST['account_name'], $_POST['account_type'], $_POST['account_code2'], $_POST['tax_code']);
        }
        meta_forward($_SERVER['PHP_SELF']);
    }
}
//-------------------------------------------------------------------------------------
function can_delete($selected_account)
{
    if ($selected_account == "") {
        return false;
    }
    $sql = "SELECT COUNT(*) FROM gl_trans WHERE account='{$selected_account}'";
    $result = db_query($sql, "Couldn't test for existing transactions");
    $myrow = db_fetch_row($result);