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