added function to test if a quotation document/file exists

git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@3446 248e525c-4dfb-0310-94bc-949c084e9493
This commit is contained in:
PriestJ
2008-02-01 17:33:52 +00:00
parent ade5b1b425
commit 92d4ebcb67

View File

@@ -5,6 +5,7 @@ create or replace package MIP_FILES is
-- Purpose : Handle files for the webMIP system
-- Public function and procedure declarations
function quote_file_exists(p_qute_id number) return boolean;
function delete_file(p_id number) return boolean;
function drawing_file_exists(p_drwg_code varchar2) return boolean;
function update_file_association(p_uri in varchar2,
@@ -53,6 +54,33 @@ create or replace package body MIP_FILES as
delete wwv_flow_files where wwv_flow_files.name = l_uri;
return true;
end delete_file;
/*
FUNCTION quote_file_exists
- takes the quote id and searches for associated file in APEX Application
- Files, returns true if the file exists or false if it does not exist
%param p_qute_id - the quote id
*/
function quote_file_exists(p_qute_id number) return boolean is
l_file_exists number;
CURSOR c_file_exists(cp_qute_id number) IS
select 1
from wwv_flow_files
where name=(select d.uri
from documents d, document_roles dr
where dr.qute_id = cp_qute_id and d.id = dr.docu_id);
begin
IF NOT c_file_exists%ISOPEN THEN
OPEN c_file_exists(p_qute_id);
END IF;
FETCH c_file_exists
INTO l_file_exists;
CLOSE c_file_exists;
if l_file_exists is not null and l_file_exists>0 then
return true;
else
return false;
end if;
end quote_file_exists;
/*
FUNCTION drawing_file_exists
- takes the drawing code and searches for associated file in APEX Application