Added 'View Attachments' if any in all popup view windows
[fa-stable.git] / admin / db / attachments_db.inc
index 6934071f4756b46c30cbfad958f0ef497da8bcfc..499080a28c16c2c11a25cd62bc9276b9247e3517 100644 (file)
@@ -67,5 +67,16 @@ function get_attachment($id)
        return db_fetch($result);
 }
 
+function has_attachment($type, $id)
+{
+       $sql = "SELECT DISTINCT * FROM ".TB_PREF."attachments WHERE type_no=".db_escape($type)." AND trans_no=".db_escape($id);
+       $result = db_query($sql, "Could not retrieve attachments");
+       $myrow = db_fetch($result);
+       if ($myrow === false)
+               return 0;
+       else
+               return $myrow['id'];
+}
+
 
 ?>
\ No newline at end of file