Release 1.11
[fa-stable.git] / gl / includes / db / gl_db_accounts.inc
index e48823f33e6ec80fad1f08958d925b9125aaea77..920facba71f574ed6e58cd61621ae8bea719261f 100644 (file)
@@ -3,6 +3,7 @@
 
 function add_gl_account($account_code, $account_name, $account_type, $account_code2, $tax_code)
 {
+       $account_name = db_escape($account_name);
        $sql = "INSERT INTO ".TB_PREF."chart_master (account_code, account_code2, account_name, account_type,
                tax_code) 
                VALUES ('$account_code', '$account_code2', '$account_name', $account_type, $tax_code)";
@@ -12,16 +13,17 @@ function add_gl_account($account_code, $account_name, $account_type, $account_co
 
 function update_gl_account($account_code, $account_name, $account_type, $account_code2, $tax_code)
 {
+       $account_name = db_escape($account_name);
     $sql = "UPDATE ".TB_PREF."chart_master SET account_name='$account_name',
                account_type=$account_type, account_code2='$account_code2',
-               tax_code=$tax_code WHERE account_code = $account_code";
+               tax_code=$tax_code WHERE account_code = '$account_code'";
 
        db_query($sql, "could not update gl account");
 }
 
 function delete_gl_account($code)
 {
-       $sql = "DELETE FROM ".TB_PREF."chart_master WHERE account_code=$code";
+       $sql = "DELETE FROM ".TB_PREF."chart_master WHERE account_code='$code'";
 
        db_query($sql, "could not delete gl account");
 }
@@ -55,7 +57,7 @@ function get_gl_accounts_all($balance=-1)
 
 function get_gl_account($code)
 {
-       $sql = "SELECT * FROM ".TB_PREF."chart_master WHERE account_code=$code";
+       $sql = "SELECT * FROM ".TB_PREF."chart_master WHERE account_code='$code'";
 
        $result = db_query($sql, "could not get gl account");
        return db_fetch($result);