Addresses #241
git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@3636 248e525c-4dfb-0310-94bc-949c084e9493
This commit is contained in:
@@ -26,6 +26,9 @@ function set_file_association(p_uri in varchar2,
|
||||
PROCEDURE export_table_to_csv(p_table IN VARCHAR2,
|
||||
p_column_headers IN VARCHAR2,
|
||||
p_delimiter IN VARCHAR2 DEFAULT ',');
|
||||
|
||||
|
||||
function are_files_over_size_limit(p_enqu_id number,p_uri varchar2) return BOOLEAN;
|
||||
|
||||
end MIP_FILES;
|
||||
/
|
||||
@@ -38,59 +41,39 @@ create or replace package body MIP_FILES as
|
||||
*/
|
||||
function is_file_over_size_limit(p_uri varchar2) return boolean is
|
||||
l_file_size wwv_flow_files.doc_size%type;
|
||||
CURSOR c_get_filesize(cp_uri varchar2) is
|
||||
select doc_size
|
||||
from wwv_flow_files
|
||||
where name=cp_uri;
|
||||
begin
|
||||
IF NOT c_get_filesize%ISOPEN THEN
|
||||
OPEN c_get_filesize(p_uri);
|
||||
END IF;
|
||||
FETCH c_get_filesize
|
||||
INTO l_file_size;
|
||||
CLOSE c_get_filesize;
|
||||
if l_file_size > 3145728 then
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
end if;
|
||||
|
||||
BEGIN
|
||||
|
||||
SELECT doc_size
|
||||
INTO l_file_size
|
||||
FROM wwv_flow_files
|
||||
WHERE NAME = p_uri;
|
||||
|
||||
RETURN(l_file_size > 3 * 1024 * 1024);
|
||||
|
||||
end is_file_over_size_limit;
|
||||
/*
|
||||
FUNCTION are_files_over_size_limit
|
||||
- takes the enquiry id and an additional uri of the file to test for size
|
||||
- and returns true if all the current files and plus additional file pointed
|
||||
- by the uri are over 10 meg (10485760 bytes) in size
|
||||
%param p_uri - the uri of the file
|
||||
%param p_enqu_id - id of the enquiry to check the files for
|
||||
*/
|
||||
function are_files_over_size_limit(p_enqu_id number,p_uri varchar2) return boolean is
|
||||
l_count_size number;
|
||||
l_file_size wwv_flow_files.doc_size%type;
|
||||
CURSOR c_get_enquiry_files(cp_id number) is
|
||||
select f.*
|
||||
from documents d,DOCUMENT_ROLES dr ,wwv_flow_files f
|
||||
where dr.enqu_id = cp_id and d.id = dr.docu_id and d.uri = f.name;
|
||||
CURSOR c_get_filesize(cp_uri varchar2) is
|
||||
select doc_size
|
||||
from wwv_flow_files
|
||||
where name=cp_uri;
|
||||
|
||||
begin
|
||||
IF NOT c_get_filesize%ISOPEN THEN
|
||||
OPEN c_get_filesize(p_uri);
|
||||
END IF;
|
||||
FETCH c_get_filesize
|
||||
INTO l_file_size;
|
||||
CLOSE c_get_filesize;
|
||||
l_count_size := 0;
|
||||
FOR file_rec IN c_get_enquiry_files(p_enqu_id) LOOP
|
||||
l_count_size := l_count_size + file_rec.doc_size;
|
||||
end loop;
|
||||
if l_count_size + l_file_size > 10485760 then
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
end if;
|
||||
function are_files_over_size_limit(p_enqu_id NUMBER) return boolean is
|
||||
l_total_size number;
|
||||
BEGIN
|
||||
|
||||
SELECT SUM(doc_size)
|
||||
INTO l_total_size
|
||||
FROM documents d
|
||||
,document_roles dr
|
||||
,wwv_flow_files f
|
||||
WHERE dr.enqu_id = p_enqu_id
|
||||
AND d.id = dr.docu_id
|
||||
AND d.uri = f.NAME;
|
||||
|
||||
RETURN (nvl(l_total_size,0) > 10 * 1024 * 1024);
|
||||
|
||||
end are_files_over_size_limit;
|
||||
/*
|
||||
FUNCTION delete_file
|
||||
@@ -239,7 +222,7 @@ create or replace package body MIP_FILES as
|
||||
p_qute_id in number,
|
||||
p_enqu_id in number,
|
||||
p_drwg_code in varchar2,
|
||||
p_doro_type in varchar2) return boolean is
|
||||
p_doro_type in varchar2) return BOOLEAN is
|
||||
l_doc_id number;
|
||||
l_success boolean;
|
||||
begin
|
||||
@@ -268,7 +251,7 @@ create or replace package body MIP_FILES as
|
||||
sysdate,
|
||||
p_description,
|
||||
doev_seq.NEXTVAL);
|
||||
if (are_files_over_size_limit(p_enqu_id,p_uri) or is_file_over_size_limit(p_uri)) and p_rt_code = 'ENQUIRY SUPPORTING DOC' and not p_enqu_id is null then
|
||||
if (are_files_over_size_limit(p_enqu_id) or is_file_over_size_limit(p_uri)) and p_rt_code = 'ENQUIRY SUPPORTING DOC' and not p_enqu_id is null then
|
||||
l_success := delete_file(l_doc_id,'REMOVED SIZE','webMIP determined the file or files to be too big');
|
||||
return false;
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user