Changed voiding of Direct Invoice to automatically void 'auto' delivery and set SO...
[fa-stable.git] / admin / db / printers_db.inc
index 043268a677f842249e74d2d9e9cb64a1f8549099..43e13b4c9bbd1c016e241e35d9dc46f346538634 100644 (file)
@@ -1,16 +1,27 @@
 <?php
+/**********************************************************************
+    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>.
+***********************************************************************/
+
 function write_printer_def($id, $name, $descr, $queue, $host, $port, $timeout)
 {
        if ($id>0)
                $sql = "UPDATE ".TB_PREF."printers SET description=".db_escape($descr)
                .",name=".db_escape($name).",queue=".db_escape($queue)
-               .",host=".db_escape($host).",port='$port',timeout='$timeout' "
-               ."WHERE id=$id";
+               .",host=".db_escape($host).",port=".db_escape($port).",timeout=".db_escape($timeout)
+               ." WHERE id=".db_escape($id);
        else 
                $sql = "INSERT INTO ".TB_PREF."printers ("
                        ."name,description,queue,host,port,timeout) "
                        ."VALUES (".db_escape($name).",".db_escape($descr).","
-                       .db_escape($queue).",".db_escape($host).",'$port','$timeout')";
+                       .db_escape($queue).",".db_escape($host).",".db_escape($port).",".db_escape($timeout).")";
 
        return db_query($sql,"could not write printer definition");
 }
@@ -24,12 +35,17 @@ function get_all_printers()
 function get_printer($id)
 {
                $sql = "SELECT * FROM ".TB_PREF."printers
-                       WHERE id=$id";
+                       WHERE id=".db_escape($id);
 
                $result = db_query($sql,"could not get printer definition");
                return  db_fetch($result);
 }
 
+function delete_printer($id)
+{
+       $sql="DELETE FROM ".TB_PREF."printers WHERE id=".db_escape($id);
+       db_query($sql,"could not delete printer definition");
+}
 //============================================================================
 // printer profiles functions
 //