Cleanup: removed all closing tags in php files.
[fa-stable.git] / sales / includes / db / credit_status_db.inc
index 040fb324a33b789582b28cb635ac2c89dc3adbab..b011b301966dbfb3e10bd7884d4e3e96bbae485d 100644 (file)
@@ -1,18 +1,18 @@
 <?php
 /**********************************************************************
     Copyright (C) FrontAccounting, LLC.
-       Released under the terms of the GNU Affero General Public License,
-       AGPL, as published by the Free Software Foundation, either version 
-       of the License, or (at your option) any later version.
+       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/agpl-3.0.html>.
+    See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
 ***********************************************************************/
 function add_credit_status($description, $disallow_invoicing)
 {
        $sql = "INSERT INTO ".TB_PREF."credit_status (reason_description, dissallow_invoices) 
-               VALUES (".db_escape($description).",$disallow_invoicing)";
+               VALUES (".db_escape($description).",".db_escape($disallow_invoicing).")";
                
        db_query($sql, "could not add credit status");          
 }
@@ -20,21 +20,22 @@ function add_credit_status($description, $disallow_invoicing)
 function update_credit_status($status_id, $description, $disallow_invoicing)
 {
        $sql = "UPDATE ".TB_PREF."credit_status SET reason_description=".db_escape($description).",
-               dissallow_invoices=$disallow_invoicing WHERE id=$status_id";
+               dissallow_invoices=".db_escape($disallow_invoicing)." WHERE id=".db_escape($status_id);
        
        db_query($sql, "could not update credit status");                       
 }
 
-function get_all_credit_status()
+function get_all_credit_status($all=false)
 {
        $sql = "SELECT * FROM ".TB_PREF."credit_status";
-       
+       if (!$all) $sql .= " WHERE !inactive";
+
        return db_query($sql, "could not get all credit status");
 } 
 
 function get_credit_status($status_id)
 {
-       $sql = "SELECT * FROM ".TB_PREF."credit_status WHERE id=$status_id";
+       $sql = "SELECT * FROM ".TB_PREF."credit_status WHERE id=".db_escape($status_id);
        
        $result = db_query($sql, "could not get credit status");
        
@@ -43,9 +44,8 @@ function get_credit_status($status_id)
 
 function delete_credit_status($status_id)
 {
-       $sql="DELETE FROM ".TB_PREF."credit_status WHERE id=$status_id";
+       $sql="DELETE FROM ".TB_PREF."credit_status WHERE id=".db_escape($status_id);
                
        db_query($sql, "could not delete credit status");       
 }
 
-?>
\ No newline at end of file