altered code so that it takes into account document status for anti-virus and deletions
git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@3519 248e525c-4dfb-0310-94bc-949c084e9493
This commit is contained in:
@@ -6,7 +6,7 @@ create or replace package MIP_FILES is
|
||||
|
||||
-- Public function and procedure declarations
|
||||
function quote_file_exists(p_qute_id number) return boolean;
|
||||
function delete_file(p_id number) return boolean;
|
||||
function delete_file(p_id number,p_doc_status varchar2,p_reason varchar2) return boolean;
|
||||
function drawing_file_exists(p_drwg_code varchar2) return boolean;
|
||||
function update_file_association(p_uri in varchar2,
|
||||
p_description in varchar2,
|
||||
@@ -97,8 +97,10 @@ create or replace package body MIP_FILES as
|
||||
- takes the id of a file held in the documents table and deletes the associated document
|
||||
- in the documents, document_roles and wwv_flow_files tables and view
|
||||
%param p_id - the id of the file
|
||||
%param p_doc_status - the new status of the document one of "REMOVED USER", "REMOVED MALICIOUS", "REMOVED SIZE"
|
||||
%param p_reason - a description of what the reason for deleting the file is
|
||||
*/
|
||||
function delete_file(p_id number) return boolean is
|
||||
function delete_file(p_id number,p_doc_status varchar2,p_reason varchar2) return boolean is
|
||||
l_uri documents.uri%type;
|
||||
CURSOR c_get_uri(cp_id number) is
|
||||
select uri
|
||||
@@ -111,8 +113,14 @@ create or replace package body MIP_FILES as
|
||||
FETCH c_get_uri
|
||||
INTO l_uri;
|
||||
CLOSE c_get_uri;
|
||||
delete document_roles where document_roles.docu_id = p_id;
|
||||
delete documents where documents.id = p_id;
|
||||
--set up a deletion event for the document
|
||||
insert into document_events(docu_id, dost_code,event_date,description,id)
|
||||
values (p_id,
|
||||
p_doc_status,
|
||||
sysdate,
|
||||
p_reason,
|
||||
doev_seq.NEXTVAL);
|
||||
--delete the actual file from the database
|
||||
delete wwv_flow_files where wwv_flow_files.name = l_uri;
|
||||
return true;
|
||||
end delete_file;
|
||||
@@ -201,6 +209,13 @@ create or replace package body MIP_FILES as
|
||||
--set up a role for the document
|
||||
update document_roles set docu_id = l_doc_id
|
||||
where drwg_code = nvl(p_drwg_code,'') or qute_id = nvl(p_qute_id,0) or enqu_id = nvl(p_enqu_id,0);
|
||||
--set up an event for the document
|
||||
insert into document_events(docu_id, dost_code,event_date,description,id)
|
||||
values (l_doc_id,
|
||||
'AWAIT SCAN',
|
||||
sysdate,
|
||||
p_description,
|
||||
doev_seq.NEXTVAL);
|
||||
--if it works then return true
|
||||
return true;
|
||||
end update_file_association;
|
||||
@@ -226,12 +241,8 @@ create or replace package body MIP_FILES as
|
||||
p_drwg_code in varchar2,
|
||||
p_doro_type in varchar2) return boolean is
|
||||
l_doc_id number;
|
||||
|
||||
l_success boolean;
|
||||
begin
|
||||
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
|
||||
delete wwv_flow_files where wwv_flow_files.name = p_uri;
|
||||
return false;
|
||||
else
|
||||
--reference it in the documents table
|
||||
insert into documents( uri, description, id, docu_type )
|
||||
values (p_uri,
|
||||
@@ -250,6 +261,17 @@ create or replace package body MIP_FILES as
|
||||
doro_seq.NEXTVAL,
|
||||
p_doro_type,
|
||||
l_doc_id);
|
||||
--set up an event for the document
|
||||
insert into document_events(docu_id, dost_code,event_date,description,id)
|
||||
values (l_doc_id,
|
||||
'AWAIT SCAN',
|
||||
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
|
||||
l_success := delete_file(l_doc_id,'REMOVED SIZE','webMIP determined the file or files to be too big');
|
||||
return false;
|
||||
else
|
||||
--if it works then return true
|
||||
return true;
|
||||
end if;
|
||||
|
||||
Reference in New Issue
Block a user