Added Quick Entries in GL Journal Entry and changed some needed fixes.
[fa-stable.git] / gl / includes / db / gl_db_bank_accounts.inc
index 620b1bc3553cb84c7ed5ffd35337a720b7e1afa2..2bb39707cce6b3de985b47603cacb4d2175fd44a 100644 (file)
@@ -119,16 +119,38 @@ function delete_quick_entry_line($selected_id)
 }
 //---------------------------------------------------------------------------------------------
 
-function get_quick_entries($deposit=null, $bank_only=null)
+
+function has_quick_entries($deposit=-1, $bank_only=-1)
+{
+       $where = false;
+       $sql = "SELECT id FROM ".TB_PREF."quick_entries";
+       if ($deposit != -1)
+       {
+               $sql .= " WHERE deposit=$deposit";
+               $where = true;
+       }               
+       if ($bank_only != -1)
+       {
+               if ($where)
+                       $sql .= " AND bank_only=$bank_only";
+               else    
+                       $sql .= " WHERE bank_only=$bank_only";
+       }               
+
+       $result = db_query($sql, "could not retreive quick entries");
+       return db_num_rows($result) > 0;
+}
+
+function get_quick_entries($deposit=-1, $bank_only=-1)
 {
        $where = false;
        $sql = "SELECT * FROM ".TB_PREF."quick_entries";
-       if ($deposit != null)
+       if ($deposit != -1)
        {
                $sql .= " WHERE deposit=$deposit";
                $where = true;
        }               
-       if ($bank_only != null)
+       if ($bank_only != -1)
        {
                if ($where)
                        $sql .= " AND bank_only=$bank_only";