ADD_TASK
HI ,
I'm using PA_PROJECT_PUB.ADD_TASK to add a new task
API returns error status E but error information as only *'PA'*
can anyone please help me what the error means
following is my code
BEGIN
PA_PROJECT_PUB.ADD_TASK(p_msg_count => x_msgcount
,p_msg_data =>x_msgdata
,p_return_status =>x_retstatus
,p_pa_project_id_out => x_projectid
,p_pa_project_number_out => x_projectNum
,p_api_version_number => 1.0
,p_commit => FND_API.G_TRUE
,p_pa_project_id =>ln_projectid
,p_pa_task_number =>rec.TASK_NUMBER
,p_task_name =>rec.TASK_NAME
,p_long_task_name =>rec.LONG_TASK_NAME
,p_task_description =>rec.TASK_DESC
,p_task_start_date =>rec.TASK_START_DATE
,p_task_completion_date =>rec.TASK_END_DATE
,p_pa_parent_task_id =>ln_taskid
,p_carrying_out_organization_id =>ln_orgid
,p_service_type_code => lc_servicetype_code
,p_task_manager_person_id=>ln_taskmgr_id
,p_billable_flag => rec.BILLABLE_FLAG
,p_chargeable_flag=>rec.CHARGABLE_FLAG
,p_actual_start_date=>rec.ACTUAL_START_DATE
,p_actual_finish_date => rec.ACTUAL_FINISH_DATE
,p_early_start_date => rec.EARLY_START_DATE
,p_early_finish_date => rec.EARLY_FINISH_DATE
,p_late_start_date => rec.LATE_START_DATE
,p_late_finish_date => rec.LATE_FINISH_DATE
,p_scheduled_start_date => rec.SCHEDULED_START_DATE
,p_scheduled_finish_date => rec.SCHEDULED_FINISH_DATE
,p_pm_product_code => 'MIGRATION'
,p_task_id =>x_taskid
FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'Return Status :'||x_retstatus||' x msg Count '||xmsgcount||' x_msg dat : '||x_msgdata);
IF x_msgcount>0 THEN
FOR j IN 1..x_msgcount LOOP
PA_INTERFACE_UTILS_PUB.get_messages(p_msg_count => x_msgcount
,p_msg_index=>j
,p_encoded => 'F'
,p_msg_data => x_msgdata
,p_data => l_data
,p_msg_index_out => l_msg_index_out);
FND_FILE.put_line(FND_FILE.OUTPUT,'Validation Error ->'||substr(l_data,1,250)||' x_msg data '||x_msgdata); --||' for project Number '||i.project_number);
--- x_retcode:=-1;
END LOOP;
END IF;
FND_FILE.PUT_LINE(FND_FILE.OUTPUT,' Exiting API program ..... ');
EXCEPTION
WHEN OTHERS THEN
FND_FILE.PUT_LINE(FND_FILE.OUTPUT,' Sql Error : '||SQLERRM);
END;
Output File
Return Status :E x msg Count 1 xmsg dat : PA
Thanks For Your Help
Thanks
Ravi
Hi hsawwan,
Sorry for the duplicate post. As I couldnt get the reply from the other category. I thought posting in general category may help me, so I posted here
Do you have any thoughts on why it is showing the error as just PA
Also,when I print x_msgdata, No other lines after that line will get printed in output file
Like the following line is not seen in output file
FND_FILE.PUT_LINE(FND_FILE.OUTPUT,' Exiting API program ..... ');
Thanks For Your Help
Thanks
Ravi
Similar Messages
-
I try to creata a Job with objects.
I use class cl_bp_combo_job and cl_bp_abap_job
data: cljob type ref to cl_bp_combo_job.
data: clsinglestep type ref to cl_bp_abap_job.
create object: cljob type cl_bp_combo_job.
cljob->set_name( i_name = 'Job1' ).
clsinglestep = cl_bp_job_factory=>make_abap_job( ).
clsinglestep->set_report( i_report = 'ZTEST' ).
cljob->add_task( new_task = clsinglestep ).
Is generated an exception for Add_task.
I found an error in class cl_tc_multifan_net_task method add_task.
Row 40 / 44
insert tasknet_wa into tasknet.
the right code i suppose is
insert tasknet_wa into table tasknet.
Do you know others class or methods to create a Job?
ThanksHi
i think it's poosible to create a job multi step:
-Method IF_BP_JOB_ENGINE~GENERATE_JOB_COUNT
- Method SET_REPORT
- Method IF_BP_JOB_ENGINE~PLAN_JOB_STEP
- Method SET_REPORT
- Method IF_BP_JOB_ENGINE~PLAN_JOB_STEP
- Method SET_REPORT
- Method IF_BP_JOB_ENGINE~PLAN_JOB_STEP
- Method IF_BP_JOB_ENGINE~RELEASE_JOB
Max -
Call to pa_project_pub.add_task
Dear Experts,
I am Trying to Add Task ..That Procedure Runing Everything Fine..
I am Trying to Assign the Attribute Value Through Add Task Program ..That Values are not Updated...
Kindly Advice Me..
Given Below The source Code
Body {
pa_project_pub.add_task (
p_api_version_number => l_api_version_number,
p_commit => l_commit,
p_init_msg_list => l_init_msg_list,
p_msg_count => l_msg_count,
p_msg_data => l_msg_data,
p_return_status => l_return_status,
p_pm_product_code => l_pm_product_code,
p_pm_project_reference => l_pm_project_reference,
p_pa_project_id => l_pa_project_id,
p_pm_task_reference => l_pm_task_reference,
p_pa_task_number => l_pa_task_number,
p_task_name => l_task_name,
p_task_description => l_task_description,
p_carrying_out_organization_id => l_carrying_out_organization_id,
P_task_manager_person_id => l_task_manager_person_id,
p_task_start_date => l_task_start_date ,--- SIXTY,
p_attribute1 => l_attribute1,
p_pa_project_id_out => l_pa_project_id_out,
p_pa_project_number_out => l_pa_project_number_out,
p_task_id => l_task_id_out);
I am Struggle in this point - p_attribute1
Thanks in Advance...
Thanks and Regards,
KumarTo update this thread, we found that the issue has appeared because the NOCOPY hint has been added to many parameters and we were using the same variable for p_pa_project_id and p_pa_project_id_out.
In 11i, where the NOCOPY hint is not used, thre is no problem.
In R12, where the NOCOPY hint is used, there is a problem due to the way the NOCOPY hint is processed. When the API is called and the same variable is used for p_pa_project_id and p_pa_project_id_out, the memory location of the variable is flushed. Since the same variable is passed, the memory location is the same. Thus, the procedure does not see the value supplied in the variable before calling the API.
The solution for us was to use 2 different variables for the IN and OUT parameters. With this change, the value provided for p_pa_project_id is not wiped out and the task is added.
This issue could present itself for any call to a function or procedure where the same variable is used as a parameter in the call, if the NOCOPY hint is used on one or more parameters that the variable is assigned to. This is not specific to EBSO, but applies to all Oracle PL/SQL. I was able to reproduce the situation on an earlier DB version using the NOCOPY hint -
Not able to access pa_project_pub.add_task API
Hi,
I am not able to execute pa_project_pub.add_task. I get "*Your current responsibility does not have access to this function*" message when i execute my custom procedure from toad. I also tried for other responsibility but i get same error.
I was able to create budget with same responsibility "Projects, Vision Operations (USA)".
BEGIN
fnd_global.APPS_INITIALIZE(1005151,20420,275,0);
DBMS_APPLICATION_INFO.SET_CLIENT_INFO (204);
--custom procedure which calls pa_project_pub.add_task api
pkg_task_upload.tasks_main;
END;
Can any one please let me know what could be the problem.
Regards,
SonaliAre you using a vision instance? Which release are you in?
If the issue is yet to be resolved after checking and compiing the invalid objects, as suggested by Hussein, then you can do the following:
- Check the responsibility ID of "Projects, Vision Operations (USA)", the one you are using. In vision instances the responsibility ID 20420 (as provided in apps_initialize) is little odd. In 11.5.10.x and R12 vision instances the responsibility ID is normally 56486. Though it can be different in your instance.
- If the responsiblity ID is correct OR you are using a different responsibility then check whether responsibility Menu is having "Open Integration Toolkit Funtions Menu" submenu (without any prompt) assigned and active (grants checkbox). Please also check within this submenu whether "Activity Management Gateway:Add Task" function is assigned and active (grants checkbox)
- For seeded Project responsibilities the submenu & underlying function is seeded, but if you using a non project responsibility for creating project/ task etc then that responsibility should have "Open Integration Toolkit Funtions Menu" submenu (without any prompt) assigned and active.
Thanks
Supro -
Implicit coercion Error while Adding Dynamic Rows To Flex DataGrid
Hi friends
I want to add interger for in next next rows while clicking tab button,one i enter all the values in one row if i press tab means next row will be editable.for making that i added the following code.i have some error shows like this
[Bindable]
private var tasks:ArrayCollection;
private static const ADD_TASK:int= "";
private function init():void
tasks = new ArrayCollection();
tasks.addItem(new Task(0.01,100000,0));
tasks.addItem({frmAmount:ADD_TASK});
private function checkEdit(e:DataGridEvent):void
// Do not allow editing of Add Task row except for
// "Click to Add" column
if(e.rowIndex == tasks.length - 1 && e.columnIndex != 0)
e.preventDefault();
private function editEnd(e:DataGridEvent):void
// Adding a new task
if(e.rowIndex == tasks.length - 1)
var txtIn:TextInput =TextInput(e.currentTarget.itemEditorInstance);
var dt:Object = e.itemRenderer.data;
// Add new task
if(parseInt(txtIn.text) != ADD_TASK)
tasks.addItemAt(new Task(parseInt(txtIn.text), 0, ""), e.rowIndex);----->Multiple markers at this line:
-1067: Implicit coercion of a value of type String to an unrelated type int.
-txtIn
// Destroy item editor
commPlanDetGrid.destroyItemEditor();
// Stop default behavior
e.preventDefault();
]]>
Please help if any suggession
Thanks in advance
B.VenkatesanVenktesan,
You are trying compare String and int..! which is not possible try to case the txtIn.text to int using parseInt(txtIn.text).
ORIGINAL:
if(txtIn.text != ADD_TASK).---->error : Comparison between a value with static type String and a possibly unrelated type int
tasks.addItemAt(new Task(txtIn.text, 0, ""), e.rowIndex);----> error:Implicit coercion of a value of type String to an unrelated type int.
EDITED:
if(parseInt(txtIn.text) != ADD_TASK).---->error : Comparison between a value with static type String and a possibly unrelated type int
tasks.addItemAt(new Task(parseInt(txtIn.text), 0, ""), e.rowIndex);----> error:Implicit coercion of a value of type String to an unrelated type int.
Thanks
Pradeep -
Error while Adding Dynamic Rows To Flex DataGrid
Hi friends
I want to add interger for in next next rows while clicking tab button,one i enter all the values in one row if i press tab means next row will be editable.for making that i added the following code.i have some error shows like this
[Bindable]
private static const ADD_TASK:int = 0;
private function editEnd(e:DataGridEvent):void
// Adding a new task
if(e.rowIndex == tasks.length - 1)
var txtIn:TextInput =TextInput(e.currentTarget.itemEditorInstance);
var dt:Object = e.itemRenderer.data;
// Add new task
if(txtIn.text != ADD_TASK).---->error : Comparison between a value with static type String and a possibly unrelated type int
tasks.addItemAt(new Task(txtIn.text, 0, ""), e.rowIndex);----> error:Implicit coercion of a value of type String to an unrelated type int.
// Destroy item editor
commPlanDetGrid.destroyItemEditor();
// Stop default behavior
e.preventDefault();
Please if any suggession welcome.
Thanks in advance.
B.venktesanVenktesan,
You are trying compare String and int..! which is not possible try to case the txtIn.text to int using parseInt(txtIn.text).
ORIGINAL:
if(txtIn.text != ADD_TASK).---->error : Comparison between a value with static type String and a possibly unrelated type int
tasks.addItemAt(new Task(txtIn.text, 0, ""), e.rowIndex);----> error:Implicit coercion of a value of type String to an unrelated type int.
EDITED:
if(parseInt(txtIn.text) != ADD_TASK).---->error : Comparison between a value with static type String and a possibly unrelated type int
tasks.addItemAt(new Task(parseInt(txtIn.text), 0, ""), e.rowIndex);----> error:Implicit coercion of a value of type String to an unrelated type int.
Thanks
Pradeep -
Implicit coercion of a value of type String to an unError while Adding Dynamic Rows To Flex DataGrid
Hi friends
I want to add interger for in next next rows while clicking tab button,one i enter all the values in one row if i press tab means next row will be editable.for making that i added the following code.i have some error shows like this
[Bindable]
private var tasks:ArrayCollection;
private static const ADD_TASK:int= "";
private function init():void
tasks = new ArrayCollection();
tasks.addItem(new Task(0.01,100000,0));
tasks.addItem({frmAmount:ADD_TASK});
private function checkEdit(e:DataGridEvent):void
// Do not allow editing of Add Task row except for
// "Click to Add" column
if(e.rowIndex == tasks.length - 1 && e.columnIndex != 0)
e.preventDefault();
private function editEnd(e:DataGridEvent):void
// Adding a new task
if(e.rowIndex == tasks.length - 1)
var txtIn:TextInput =TextInput(e.currentTarget.itemEditorInstance);
var dt:Object = e.itemRenderer.data;
// Add new task
if(parseInt(txtIn.text) != ADD_TASK)
tasks.addItemAt(new Task(parseInt(txtIn.text), 0, ""), e.rowIndex);----->Multiple markers at this line:
-1067: Implicit coercion of a value of type String to an unrelated type int.
-txtIn
// Destroy item editor
commPlanDetGrid.destroyItemEditor();
// Stop default behavior
e.preventDefault();
]]>
Please help if any suggession
Thanks in advance
B.VenkatesanThe error message indicates the problem fairly clearly. _feed_list is defined as a ComboBox in your first line of code. You are passing that as an argument in your populate(_feed_list) line of code. However, the populate function is expecting an XMLList object to be passed, not a ComboBox.
You probably really mean to be using...
populate(feed_items);
since that is the only XMLList to be found -
Hi Guys,
We have created a custom package where in we are trying to call the standard API's of Oracle projects i.e PA_PROJECT_PUB.When we are trying to call these APIs we are facing the below issue.
We have tried testing in two instances ,Initially it worked in both instances.
Using the same API's multiple times we tested the same data set in these instances.
For the first few runs it works fine.But when we go on using the same API's again and again for our testing we face now and then the below issue.
Standard API's
=========
add_task
update_project
change_structure_status
create_draft_plan
Error:
ORA-20100: File o2670336.tmp creation for FND_FILE failed.You will find more information on the cause of the error in request log. in Package PA_OPPORTUNITY_MGT_PVT Procedure modify_project_attributes ORA-20100: File o2670336.tmp creation for FND_FILE failed.
You will find more information on the cause of the error in request log. in Package PA_PROJECT_PUB Procedure update_project:ORA-0000: normal, successful completionError while publishing the task
Please let us know if anyone of has come across the same situation.
Regards,
VijayBut have issue only with validating invoice batch. I followed metalink ID's 605542.1, 167990.1,261693.1,1088553.1,749491.1, 461271.1 and few more.Was this working before? If yes, any changes have been done recently?
Please see if these docs help.
APXAPRVL: Invoice Validation Errors With MSG-00001 and REP-1419 [ID 333305.1]
Invoice Validation Errors When Others:101505:Non-Oracle Exception Rep-1419 [ID 464125.1]
Invoice Validation Fails with REP-1419 Error in Ap_approval_matched_pkg.Execute_matched_checks [ID 293425.1]
Invoice Validation Failing On Fnd_file Could Not Write To File L0202306.Tmp [ID 461520.1]
Invoice Validation (APPRVL) Errors ORA-20001 APP-SQLAP-10000 PSA_FUNDS_CONTROL_PKG.glxfck [ID 463184.1]
Validate Invoice Error With ORA-20001: APP-SQLAP-10000: AP_FUNDS_CONTROL_PKG.Calc_QV [ID 432702.1]
Invoice Validation Program Is Erroring Out [ID 382844.1]
Error On Validation Of Invoices From Previous Periods [ID 412814.1]
Thanks,
Hussein -
Error while saving dynamic row values of datagrid with record.
hi friends,
i am trying to add dynamic row in datagrid and save that value with record.i succeeded in first part while i am saving the record the error show like this.
errro:Property fromAmount not found on com.ci.view.Task and there is no default value.
how i resolve this error.
any suggession welcom
thanks in advance.
B.venkatesan
code:
package:
package com.ci.view
[Bindable]
public class Task
public function Task(frmAmount:String,toAmount:String,commissionPercentage:String)
this.frmAmount=frmAmount;
this.toAmount=toAmount;
this.commissionPercentage=commissionPercentage;
public var frmAmount:String;
public var toAmount:String;
public var commissionPercentage:String;
main mxml:
[Bindable]
private var tasks:ArrayCollection;
private static const ADD_TASK:String= "";
private function init():void
tasks = new ArrayCollection();
tasks.addItem(new Task("0","1000","0"));
tasks.addItem({frmAmount:ADD_TASK});
private function checkEdit(e:DataGridEvent):void
// Do not allow editing of Add Task row except for
// "Click to Add" column
if(e.rowIndex == tasks.length - 1 && e.columnIndex != 0)
e.preventDefault();
private function editEnd(e:DataGridEvent):void
// Adding a new task
if(e.rowIndex == tasks.length - 1)
var txtIn:TextInput =TextInput(e.currentTarget.itemEditorInstance);
var txtIn1:TextInput =TextInput(e.currentTarget.itemEditorInstance);
var txtIn2:TextInput =TextInput(e.currentTarget.itemEditorInstance);
var dt:Object = e.itemRenderer.data;
// Add new task
if((txtIn.text) != ADD_TASK)
var x:String=String(txtIn.text);
tasks.addItemAt(new Task("", "", ""), e.rowIndex);
// Destroy item editor
commPlanDetGrid.destroyItemEditor();
// Stop default behavior
e.preventDefault();Venktesan,
You are trying compare String and int..! which is not possible try to case the txtIn.text to int using parseInt(txtIn.text).
ORIGINAL:
if(txtIn.text != ADD_TASK).---->error : Comparison between a value with static type String and a possibly unrelated type int
tasks.addItemAt(new Task(txtIn.text, 0, ""), e.rowIndex);----> error:Implicit coercion of a value of type String to an unrelated type int.
EDITED:
if(parseInt(txtIn.text) != ADD_TASK).---->error : Comparison between a value with static type String and a possibly unrelated type int
tasks.addItemAt(new Task(parseInt(txtIn.text), 0, ""), e.rowIndex);----> error:Implicit coercion of a value of type String to an unrelated type int.
Thanks
Pradeep -
Dear All(s)
Whenever i try to run pa_project_assets_pub.add_project_asset API. it gives me error Project ID is Invaild. Any body can help me in this regards.
declare
v_MSG_COUNT number;
v_MSG_DATA varchar2(1000);
v_return_status varchar2(1000);
v_PA_PROJECT_ID_OUT NUMBER;
v_PA_PROJECT_NUMBER_OUT VARCHAR2(1000);
v_PA_PROJECT_ASSET_ID_OUT NUMBER;
v_PM_ASSET_REFERENCE_OUT VARCHAR2(1000);
begin
FND_GLOBAL.APPS_INITIALIZE(1013472,55653,275); User Id rep ID--APP Id
/*pa_interface_utils_pub.Set_Global_Info(p_api_version_number => 1,
p_responsibility_id => 55653,
p_user_id => 1013472,
p_resp_appl_id => 275,
p_operating_unit_id => 1448,
p_msg_count => v_msg_count,
p_msg_data => v_msg_data,
p_return_status => v_return_status
-- Call the procedure
pa_project_assets_pub.add_project_asset(p_api_version_number => '1.0',
p_commit => FND_API.G_FALSE,
p_init_msg_list => FND_API.G_FALSE,
p_msg_count => v_MSG_COUNT,
p_msg_data => v_MSG_DATA,
p_return_status => v_return_status,
p_pa_project_id_out => v_pa_project_id_out,
p_pa_project_number_out => v_pa_project_number_out,
p_pa_project_asset_id_out => v_pa_project_asset_id_out,
p_pm_asset_reference_out => v_pm_asset_reference_out,
p_pm_product_code => 'PA',--*
p_pa_asset_name => 'z2',
p_asset_number => null,--'zAsif2',
p_asset_description => 'z2',
p_pa_project_id => 1842,
p_depreciate_flag => 'Y',
p_amortize_flag => 'N',
p_project_asset_type => 'ESTIMATED',
p_estimated_asset_units => 1
dbms_output.put_line('v_return_status '||v_return_status);
dbms_output.put_line('v_msg_data '||v_msg_data);
dbms_output.put_line('v_msg_count '||v_msg_count);
dbms_output.put_line(APPS.FND_MSG_PUB.GET(p_msg_index => APPS.FND_MSG_PUB.G_LAST, p_encoded => APPS.FND_API.G_FALSE));
end;
Regards
Muhammad AsifPlease see these docs.
AMG PA_PROJECT_PUB.ADD_TASK or UPDATE_TASK Fails With Project ID is Invalid [ID 337694.1]
LINKING PROJECT WITH WORK ORDER GIVES ERROR [ID 1063407.1]
Cannot Sync Projects From Primavera P6 To Oracle Projects For Two Operating Units [ID 1282632.1]
Software Updates for Oracle Projects Rollup Patch 4 for Oracle Projects Family Pack M (11i.PJ_PF.M) [ID 423428.1]
Thanks,
Hussein -
I have Oracle9i Client 9.0.1.1.1 and Oracle ODBC Driver 9.1.0.1 installed. When I connect to the remote database with the ADODB activex object with this driver, I get different results running the ADODB.execute command on a plsql procedure depending on the version of the database I am connecting to.
If I am connecting to an Oracle9i 9.2.0.1.0 database, the plsql executes successfully. If I am connecting to an Oracle8i 8.1.7.2.0 database, the plsql fails.
Running the ODBC trace gives two different syntaxes for the different calls also.
Oracle9i 9.2.0.1.0 shows:
Processid:{3D14 714-7d8 ENTER SQLExecDirectW
HSTMT 00A54850
WCHAR * 0x024D0E50 [ 131] "{ call intp.bline_str_create.createStr(2003, 'VCO', 'W', 'C108010102', 'test', 'C.1.08.01.01.02.CC', 'OE', '062690', '', '', 'F') }"
SDWORD 131
Processid:{3D14 714-7d8 EXIT SQLExecDirectW with return code 0 (SQL_SUCCESS)
HSTMT 00A54850
WCHAR * 0x024D0E50 [ 131] "{ call intp.bline_str_create.createStr(2003, 'VCO', 'W', 'C108010102', 'test', 'C.1.08.01.01.02.CC', 'OE', '062690', '', '', 'F') }"
SDWORD 131
while Oracle8i 8.1.7.2.0 shows:
Processid:{3D14 714-7d8 ENTER SQLExecDirectW
HSTMT 00A54CD8
WCHAR * 0x024D8728 [ 114] "idaho.ifpapk_manage_task.add_task('COS', 568, 'C.1.08.01.01.02.A1', 'test', 'test', '09/30/2002', '01/01/4712', 0)"
SDWORD 114
Processid:{3D14 714-7d8 EXIT SQLExecDirectW with return code -1 (SQL_ERROR)
HSTMT 00A54CD8
WCHAR * 0x024D8728 [ 114] "idaho.ifpapk_manage_task.add_task('COS', 568, 'C.1.08.01.01.02.A1', 'test', 'test', '09/30/2002', '01/01/4712', 0)"
SDWORD 114
DIAG [37000] [Oracle][ODBC][Ora]ORA-00900: invalid SQL statement
(900)
Please help.My mistake on the ODBC Driver Verion number - Sorry. I was using the Oracle ODBC Driver version 9.0.1.0.1. We upgraded to the 9.0.1.5 Oracle ODBC driver with no success.
The Oracle 8.1.7.2 database I am connecting to in the failed instance is not willing, at this time, to upgrade. It is in their plans for the future which doesn't help me.
The syntax for the failing call to the PLSQL is:
opConn.ConnectionTimeout = 60;
opConn.CommandTimeout = 60;
opConn.Open(Session("OP_ConnectionString"),
Session("OP_User"),
Session("OP_Password"),
strQuery2 = "idaho.ifpapk_manage_task.add_task('"
+ usernameU + "', " + proj_id + ", '"
+ tt_number + "', '" + tt_name + "', '"
+ tt_description + "', '"
+ tt_start_date + "', '"
+ tt_completion_date + "', "
+ cn_parent_task_id + ")";
opConn.Execute(strQuery2);
I know the connection is getting made - I can perform a Select statement successfully.
Thanks. -
Packaged App Document Library 0.91 installs with errors in Apex 3.0
Hello All,
I get these errors when I try to install Document Library packaged application in Apex 3.0
Script name success errors total
tab.sql 137 1 137
doclib.pkb 0 1 1
sync_index.sql 1 1 2
When I try to run the app, I am prompted for user name and password. I enter the user name I’ve selected during the install process as parsing schema, and I get this error:
ORA-04063: package body "DOADMIN.DOCLIB" has errors ORA-06508: PL/SQL: could not find program unit being called: "DOADMIN.DOCLIB"
ERR-1082 Error in executing authorization scheme code.
How can I find the object that caused errors during install? Is there any installation log?
Thank you,
DanielI’ve attempted to install the document library app into completely new workspace, with new parsing user. I still get the same errors:
Errors
tab.sql
create index doclib_docs_idx2 on doclib_documents(contents) indextype is ctxsys.context
ORA-29833: indextype does not exist
doclib.pkb
create or replace package body doclib as
g_html_email_header constant varchar2(4000) := '<html lang="en-us" xmlns:htmldb="http://htmldb.oracle.com">
<head>
<style type="text/css">
*{font-size:12px;font-family:Arial, Helvetica, Geneva, sans-serif;}
body{background-color:#fff;margin:0;padding:0;font-family:Arial, Helvetica, Geneva, sans-serif;font-size:12px;}
body *{font-size:12px;}
img{border:0;margin:0;}
hr{color:#bbb;height:1px;}
br{clear:both;}
p{font-size:12px;}
a:link,a:visited{text-decoration:none;font-size:-1;color:#7f7f7f;}
a:active,a:hover{text-decoration:underline;font-size:-1;color:#ff6600;}
</style>
<title></title>
<body>';
g_html_email_footer constant varchar2(30) := '</body></html>';
function get_member_id (
p_user_name in varchar2
) return number
is
l_user_id number;
begin
for c1 in (select user_id
from doclib_members
where upper(p_user_name) = user_name ) loop
l_user_id := c1.user_id;
end loop;
return l_user_id;
end get_member_id;
function get_member_email (
p_user_name in varchar2
) return varchar2
is
l_email varchar2(255);
begin
for c1 in (select email_address
from doclib_members
where upper(p_user_name) = user_name ) loop
l_email := c1.email_address;
end loop;
return l_email;
end get_member_email;
function get_acl_id (
p_user_name in varchar2
) return number
is
l_acl_id number := 0;
begin
for c1 in (select role_id
from doclib_members
where upper(p_user_name) = user_name ) loop
l_acl_id := c1.role_id;
end loop;
return l_acl_id;
return 3;
end get_acl_id;
function get_local_name (
p_filename in varchar2
) return varchar2
is
begin
return substr(p_filename,instr(p_filename,'/')+1);
end get_local_name;
function doc_is_checkedout_by (
p_doc_id in varchar2
) return varchar2
is
begin
for c1 in (select checkedout_by
from doclib_documents
where doc_id = p_doc_id ) loop
return c1.checkedout_by;
end loop;
return null;
end doc_is_checkedout_by;
function get_doc_name (
p_doc_id in varchar2
) return varchar2
is
begin
for c1 in (select name
from doclib_documents
where doc_id = p_doc_id ) loop
return c1.name;
end loop;
return null;
end get_doc_name;
function doc_already_exists (
p_name in varchar2
) return boolean
is
begin
for c1 in (select null
from doclib_documents
where name = p_name ) loop
return true;
end loop;
return false;
end doc_already_exists;
function alert_todo_already_exists (
p_user_id in number
) return boolean
is
l_found boolean := false;
begin
for c1 in (select null
from doclib_alerts a, doclib_alerts_todo b
where a.alert_id = b.alert_id
and a.doctask_id = 0
and a.user_id = p_user_id ) loop
l_found := true;
exit;
end loop;
return l_found;
end alert_todo_already_exists;
function parse_search_string(
p_search_str in varchar2 ) return varchar2
is
l_temp_value varchar2(1000);
l_temp_value2 varchar2(1000);
l_return_value varchar2(1000) := NULL;
l_start_token number := 1;
l_in_token boolean := FALSE;
l_quotes number;
l_phrases dbms_sql.varchar2s;
n number;
begin
if nvl(length(p_search_str),0) = 0 then
return NULL;
end if;
l_quotes := length(p_search_str) - length(replace(p_search_str,'"', ''));
if ( l_quotes > 0 and mod(l_quotes,2) = 0 ) then
l_temp_value2 := lower(p_search_str);
for i in 1 .. l_quotes/2 loop
n := instr( l_temp_value2, '"' );
l_temp_value := l_temp_value || substr( l_temp_value2, 1, n-1 );
l_temp_value2 := substr( l_temp_value2, n+1 );
n := instr( l_temp_value2, '"' );
l_phrases(i) := substr( l_temp_value2, 1, n-1 );
l_temp_value2 := substr( l_temp_value2, n+1 );
end loop;
l_temp_value := l_temp_value || l_temp_value2;
else
l_temp_value := lower(p_search_str);
end if;
l_temp_value := trim(replace( l_temp_value, ':', ' '));
l_temp_value := trim(replace( l_temp_value, ';', ' '));
l_temp_value := trim(replace( l_temp_value, '"', ' '));
l_temp_value := trim(replace( l_temp_value, ':'',', ' '));
l_temp_value := trim(replace( l_temp_value, '(', ' '));
l_temp_value := trim(replace( l_temp_value, ')', ' '));
l_temp_value := trim(replace( l_temp_value, '!', ' '));
l_temp_value := trim(replace( l_temp_value, '&', ' '));
l_temp_value := trim(replace( l_temp_value, '+', ' '));
l_temp_value := trim(replace( l_temp_value, '-', ' '));
l_temp_value := trim(replace( l_temp_value, ',', ' '));
l_temp_value := trim(replace( l_temp_value, '\', ' '));
l_temp_value := trim(replace( l_temp_value, ' and ', ' ' ));
l_temp_value := trim(replace( l_temp_value, ' or ', ' ' ));
if length(l_temp_value) > 0 then
l_in_token := TRUE;
end if;
for i in 1..nvl(length(l_temp_value),0) loop
if substr(l_temp_value,i,1) = ' ' then
if l_in_token = TRUE then
l_return_value := l_return_value || '{' || substr(l_temp_value,l_start_token, i-l_start_token) || '}' || ' and ';
l_in_token := FALSE;
end if;
elsif l_in_token = FALSE then
l_in_token := TRUE;
l_start_token := i;
end if;
end loop;
if l_in_token = TRUE then
l_return_value := l_return_value || '{' || substr(l_temp_value,l_start_token) || '} and ';
end if;
for i in 1 .. nvl(l_phrases.count,0) loop
l_return_value := l_return_value || ' {' || l_phrases(i) || '} and ';
end loop;
return trim( substr( l_return_value, 1, length(l_return_value)-4 ) );
end parse_search_string;
function doc_has_revisions (
p_doc_id in varchar2
) return number
is
l_revisions number := 0;
begin
for c1 in (select count(*) cnt
from doclib_documents
where deleted_as_of = to_date('22-04-2004','DD-MM-YYYY')
and revision_of = p_doc_id ) loop
l_revisions := c1.cnt;
end loop;
return l_revisions;
end doc_has_revisions;
function get_checkout_list (
p_user_name in varchar2
) return varchar2
is
l_chkout_lst varchar2(32000);
begin
for c1 in (select '<li>'||name||'</li>' name
from doclib_documents
where deleted_as_of = to_date('22-04-2004','DD-MM-YYYY')
and revision_of = 0
and checkedout_by = p_user_name ) loop
l_chkout_lst := l_chkout_lst || c1.name;
end loop;
if l_chkout_lst is null then
l_chkout_lst := 'None.';
else
l_chkout_lst := '<ul>'||l_chkout_lst||'</ul>';
end if;
return l_chkout_lst;
end get_checkout_list;
procedure return_xml (
p_doc_id in number,
p_action in varchar2,
p_message in varchar2,
p_chkout_lst in varchar2,
p_result in varchar2,
p_user_name in varchar2
is
begin
owa_util.mime_header('text/xml', FALSE );
htp.p('Cache-Control: no-cache');
htp.p('Pragma: no-cache');
owa_util.http_header_close;
htp.p('<div class="return" id="'||p_doc_id||'" action="'||p_action||'" result="'||p_result||'">');
htp.p('<div class="message" id="primary">'||p_message||'</div>');
htp.p('<div class="message" id="chkoutlst">'||p_chkout_lst||'</div>');
htp.p('<div id="checkoutby">'||p_user_name||'</div>');
htp.p('<div id="modifiedby">'||p_user_name||'</div>');
htp.p('</div>');
end;
procedure add_document (
p_doc_id in varchar2 default null,
p_name in varchar2 default null,
p_filename in varchar2,
p_user_name in varchar2,
p_description in varchar2,
p_attr1 in varchar2,
p_attr2 in varchar2,
p_attr3 in varchar2
is
l_content blob;
l_mime_type varchar2(48);
l_name varchar2(255);
begin
if get_acl_id(p_user_name) < 2 then
raise_application_error(-20001,'You are not authorized to add documents.');
end if;
if p_name is null then
l_name := get_local_name(p_filename);
for c1 in (select doc_id, name
from doclib_documents
where revision_of = 0
and name = l_name ) loop
--document already exists, so update it
update_document(c1.doc_id, c1.name, p_filename, p_user_name, p_description, p_attr1, p_attr2, p_attr3);
goto end_add;
end loop;
else
l_name := p_name;
end if;
for c1 in (select mime_type, blob_content
from apex_application_files
where name = p_filename ) loop
l_content := c1.blob_content;
l_mime_type := c1.mime_type;
end loop;
insert
into doclib_documents (doc_id, name, description, mime_type, contents, attr1, attr2, attr3)
values (p_doc_id, l_name, p_description, l_mime_type, l_content, p_attr1, p_attr2, p_attr3);
delete
from apex_application_files
where name = p_filename;
if p_name is null then
do_alerts('D',0,null);
end if;
commit;
<<end_add>>
null;
exception when others then
raise_application_error(-20001, 'Exception encountered adding document: '||sqlerrm);
end add_document;
procedure add_member (
p_user_name in varchar2,
p_member in varchar2,
p_email in varchar2,
p_acl_id in varchar2
is
begin
if get_acl_id(p_user_name) < 3 then
raise_application_error(-20001,'You are not authorized to add members.');
end if;
insert
into doclib_members (user_name, email_address, role_id)
values (p_member, p_email, p_acl_id);
commit;
exception when dup_val_on_index then
raise_application_error(-20001,'The user is already a member of this workspace.');
when others then
raise_application_error(-20001,'Exception encountered adding member: '||sqlerrm);
end add_member;
procedure add_task (
p_user_name in varchar2,
p_assigned_to in varchar2,
p_name in varchar2,
p_description in varchar2,
p_start_date in varchar2,
p_end_date in varchar2,
p_priority in varchar2,
p_status in varchar2,
p_pct_complete in varchar2,
p_doc_id in varchar2
is
l_start_date date;
l_due_date date;
begin
if get_acl_id(p_user_name) < 2 then
raise_application_error(-20001,'You are not authorized to add tasks.');
end if;
l_start_date := to_date(p_start_date,'DD-MM-YYYY HH24:MI');
l_due_date := to_date(p_end_date, 'DD-MM-YYYY HH24:MI');
insert
into doclib_tasks (assigned_to, name, description, start_date, due_date, priority_id, status_id, pct_complete, doc_id)
values (p_assigned_to, p_name, p_description, l_start_date, l_due_date, p_priority, p_status, p_pct_complete, p_doc_id);
do_alerts('T',0,null);
commit;
exception when others then
raise_application_error(-20001,'Exception encountered adding task: '||sqlerrm);
end add_task;
procedure add_link (
p_user_name in varchar2,
p_name in varchar2,
p_url in varchar2
is
begin
if get_acl_id(p_user_name) < 2 then
raise_application_error(-20001,'You are not authorized to add links.');
end if;
insert
into doclib_links (name, url)
values (p_name, p_url);
commit;
exception when others then
raise_application_error(-20001,'Exception encountered adding link: '||sqlerrm);
end add_link;
procedure add_announcement (
p_user_name in varchar2,
p_title in varchar2,
p_description in varchar2,
p_expire_date in varchar2
is
l_expire_date date;
begin
if get_acl_id(p_user_name) < 2 then
raise_application_error(-20001,'You are not authorized to add announcements.');
end if;
l_expire_date := to_date(p_expire_date,'DD-MM-YYYY HH24:MI');
insert
into doclib_announcements (title, description, expire_date)
values (p_title, p_description, l_expire_date);
commit;
exception when others then
raise_application_error(-20001,'Exception encountered adding announcement: '||sqlerrm);
end add_announcement;
procedure add_alert (
p_user_name in varchar2,
p_alert_type in varchar2,
p_alert_interval in varchar2,
p_doctask_id in varchar2
is
l_user_id number;
begin
l_user_id := get_member_id(p_user_name);
insert
into doclib_alerts (user_id, alert_type, alert_interval, doctask_id)
values (l_user_id, p_alert_type, p_alert_interval, p_doctask_id);
commit;
exception when others then
raise_application_error(-20001,'Exception adding alert: '||sqlerrm);
end add_alert;
procedure delete_alert (
p_alert_id in varchar2
is
begin
delete
from doclib_alerts
where alert_id = p_alert_id;
commit;
end delete_alert;
procedure do_alerts (
p_alert_type in varchar2,
p_doctask_id in number,
p_newdoc_id in number default null
is
l_subject varchar2(2000);
l_url varchar2(4000);
l_body clob;
l_body_html clob;
begin
l_body := ' ';
if p_alert_type = 'D' then
--Do document alerts on specific document
if p_doctask_id != 0 then
for c1 in (select c.email_address, c.user_id, b.name, a.alert_interval, a.alert_id
from doclib_alerts a, doclib_documents b, doclib_members c
where a.alert_type = p_alert_type
and a.doctask_id = b.doc_id
and a.user_id = c.user_id
and a.doctask_id = p_doctask_id ) loop
l_subject := 'Document '||c1.name||' has been updated.';
l_url := v('BASE_URL')||'/f?p='||v('APP_ID')||':2:::::P2_DOC_ID:'||p_newdoc_id;
l_body_html := g_html_email_header||'<p />'||l_subject||'<p />Click to view.'||
g_html_email_footer;
if c1.alert_interval = 'I' then
apex_mail.send(
p_to => c1.email_address,
p_from => c1.email_address,
p_body => l_body,
p_body_html => l_body_html,
p_subj => l_subject );
else --it is a daily alert, insert into todos
if not alert_todo_already_exists(c1.user_id) then --make sure non-specific daily alert isn't already recorded
insert
into doclib_alerts_todo (alert_id, alert_url)
values (c1.alert_id, l_url);
end if;
end if;
end loop;
update doclib_alerts
set doctask_id = p_newdoc_id
where alert_type = 'D'
and doctask_id = p_doctask_id;
end if;
--Do document alerts on generic documents
for c1 in (select c.email_address, c.user_id, a.alert_id, a.alert_interval
from doclib_alerts a, doclib_members c
where a.alert_type = p_alert_type
and a.doctask_id = 0
and a.user_id = c.user_id ) loop
l_subject := 'A document has been added or updated in the document workspace.';
l_url := v('BASE_URL')||'/f?p='||v('APP_ID')||':1';
l_body_html := g_html_email_header||'<p />'||l_subject||'<p />Click to view.'||
g_html_email_footer;
if c1.alert_interval = 'I' then
apex_mail.send(
p_to => c1.email_address,
p_from => c1.email_address,
p_body => l_body,
p_body_html => l_body_html,
p_subj => l_subject );
else --it is a daily alert, insert into todos
if not alert_todo_already_exists(c1.user_id) then --make sure non-specific daily alert isn't already recorded
insert
into doclib_alerts_todo (alert_id, alert_url)
values (c1.alert_id, l_url);
end if;
end if;
end loop;
else
if p_doctask_id != 0 then
--Do task alerts on specific tasks
for c1 in (select c.email_address, c.user_id, b.name, a.alert_interval, a.alert_id
from doclib_alerts a, doclib_tasks b, doclib_members c
where a.alert_type = p_alert_type
and a.doctask_id = b.task_id
and a.user_id = c.user_id
and a.doctask_id = p_doctask_id ) loop
l_subject := 'Task '||c1.name||' has been updated.';
l_url := v('BASE_URL')||'/f?p='||v('APP_ID')||':75:::::P75_TASK_ID:'||p_doctask_id;
l_body_html := g_html_email_header||'<p />'||l_subject||'<p />Click to view.'||
g_html_email_footer;
if c1.alert_interval = 'I' then
apex_mail.send(
p_to => c1.email_address,
p_from => c1.email_address,
p_body => l_body,
p_body_html => l_body_html,
p_subj => l_subject );
else --it is a daily alert, insert into todos
if not alert_todo_already_exists(c1.user_id) then --make sure non-specific daily alert isn't already recorded
insert
into doclib_alerts_todo (alert_id, alert_url)
values (c1.alert_id, l_url);
end if;
end if;
end loop;
end if;
--Do task alerts on generic tasks
for c1 in (select c.email_address, c.user_id, a.alert_id, a.alert_interval
from doclib_alerts a, doclib_members c
where a.alert_type = p_alert_type
and a.doctask_id = 0
and a.user_id = c.user_id ) loop
l_subject := 'A task has been added or updated in the document workspace.';
l_url := v('BASE_URL')||'/f?p='||v('APP_ID')||':1';
l_body_html := g_html_email_header||'<p />'||l_subject||'<p />Click to view.'||
g_html_email_footer;
if c1.alert_interval = 'I' then
apex_mail.send(
p_to => c1.email_address,
p_from => c1.email_address,
p_body => l_body,
p_body_html => l_body_html,
p_subj => l_subject );
else --it is a daily alert, insert into todos
if not alert_todo_already_exists(c1.user_id) then --make sure non-specific daily alert isn't already recorded
insert
into doclib_alerts_todo (alert_id, alert_url)
values (c1.alert_id, l_url);
end if;
end if;
end loop;
end if;
end do_alerts;
procedure do_alert_todos
is
l_subject varchar2(2000);
l_body clob;
l_body_html clob;
begin
wwv_flow_api.set_security_group_id;
l_body := ' ';
l_subject := 'Documents or tasks have been updated.';
for c1 in (select distinct(c.email_address), b.user_id
from doclib_members c, doclib_alerts b, doclib_alerts_todo a
where a.alert_id = b.alert_id
and b.user_id = c.user_id ) loop
l_body_html := g_html_email_header||'<p />The following documents or tasks have been added or updated.';
for c2 in (select b.alert_url
from doclib_alerts a, doclib_alerts_todo b
where a.alert_id = b.alert_id
and a.user_id = c1.user_id ) loop
l_body_html := l_body_html || '<p />'||c2.alert_url||'';
end loop;
l_body_html := l_body_html ||g_html_email_footer;
apex_mail.send(
p_to => c1.email_address,
p_from => c1.email_address,
p_body => l_body,
p_body_html => l_body_html,
p_subj => l_subject );
end loop;
delete from doclib_alerts_todo;
commit;
end do_alert_todos;
procedure update_document (
p_doc_id in varchar2,
p_name in varchar2,
p_filename in varchar2,
p_user_name in varchar2,
p_description in varchar2,
p_attr1 in varchar2,
p_attr2 in varchar2,
p_attr3 in varchar2
is
l_doc_id number;
l_checked_out_by varchar2(255);
l_mime_type varchar2(48);
l_cnt number;
l_num_over number;
begin
if get_acl_id(p_user_name) < 2 then
raise_application_error(-20001,'You are not authorized to update documents.');
end if;
l_checked_out_by := doc_is_checkedout_by(p_doc_id);
--this can be optimistic locking mechanism
if l_checked_out_by is not null and upper(l_checked_out_by) != upper(p_user_name) then
raise_application_error(-20001,'This document is locked by '||l_checked_out_by);
end if;
for c1 in (select mime_type
from apex_application_files
where name = p_filename ) loop
l_mime_type := c1.mime_type;
end loop;
for c1 in (select mime_type
from doclib_documents
where doc_id = p_doc_id ) loop
if l_mime_type != c1.mime_type then
delete
from apex_application_files
where name = p_filename;
raise_application_error(-20001,'The document type to be checked in does not match the document type of the original document.');
end if;
end loop;
if l_checked_out_by is not null then
checkin(p_doc_id, p_user_name);
end if;
l_doc_id := doclib_nextval;
add_document(l_doc_id, p_name, p_filename, p_user_name, p_description, p_attr1, p_attr2, p_attr3);
update doclib_documents
set revision_of = l_doc_id
where doc_id = p_doc_id;
l_cnt := 1;
for c1 in (select count(*) cnt
from doclib_documents
where revision_of != 0
and deleted_as_of = to_date('22-04-2004','DD-MM-YYYY') -- don't count logically deleted docs
and name = p_name ) loop
l_cnt := l_cnt + c1.cnt;
end loop;
--check whether we have hit max revisions as defined in workspace setting
if v('DOC_WORKSPACE_VERSIONS') != '0' and l_cnt > to_number(v('DOC_WORKSPACE_VERSIONS')) then
l_num_over := l_cnt - to_number(v('DOC_WORKSPACE_VERSIONS'));
for c2 in (select doc_id
from (select doc_id
from doclib_documents
where name = p_name
order by version_no)
where rownum <= l_num_over ) loop
delete
from doclib_documents
where doc_id = c2.doc_id;
end loop;
end if;
update doclib_documents
set revision_of = l_doc_id
where (revision_of != 0 or deleted_as_of != to_date('22-04-2004','DD-MM-YYYY'))
and name = p_name;
--preserve lock
if l_checked_out_by is not null then
update doclib_documents
set checkedout_by = l_checked_out_by
where doc_id = l_doc_id;
end if;
--do alerts
do_alerts('D',p_doc_id, l_doc_id);
--update tasks
update doclib_tasks
set doc_id = l_doc_id
where doc_id = p_doc_id;
commit;
exception when others then
raise_application_error(-20001,'Exception encountered updating document: '||sqlerrm);
end update_document;
procedure update_doc_attributes (
p_doc_id in varchar2,
p_user_name in varchar2,
p_description in varchar2,
p_attr1 in varchar2,
p_attr2 in varchar2,
p_attr3 in varchar2
is
begin
if get_acl_id(p_user_name) < 2 then
raise_application_error(-20001,'You are not authorized to update document attributes.');
end if;
update doclib_documents
set description = p_description,
attr1 = p_attr1,
attr2 = p_attr2,
attr3 = p_attr3
where doc_id = p_doc_id;
commit;
exception when others then
raise_application_error(-20001,'Exception encountered updating document attributes: '||sqlerrm);
end update_doc_attributes;
procedure checkout (
p_doc_id in varchar2,
p_user_name in varchar2
is
l_chkout_lst varchar2(32000);
begin
if get_acl_id(p_user_name) < 2 then
--raise_application_error(-20001,'You are not authorized to checkout documents.');
return_xml(p_doc_id,'CHECKOUT','You are not authorized to lock documents.',null,'FAILED',p_user_name);
return;
end if;
--This can be the optimistic locking scheme
if doc_is_checkedout_by(p_doc_id) is not null then
--raise_application_error(-20001,'This document is already checked out.');
return_xml(p_doc_id,'CHECKOUT','This document is already locked.',null,'FAILED',p_user_name);
return;
end if;
update doclib_documents
set checkedout_by = p_user_name
where doc_id = p_doc_id;
commit;
l_chkout_lst := get_checkout_list(p_user_name);
return_xml(p_doc_id,'CHECKOUT','Document successfully locked.',l_chkout_lst,'SUCCESS',p_user_name);
exception when others then
--raise_application_error(-20001,'Expection encountered checking out document: '||sqlerrm);
return_xml(p_doc_id,'CHECKOUT','Expection encountered checking out document: '||sqlerrm,null,'FAILED',p_user_name);
end checkout;
procedure checkin (
p_doc_id in varchar2,
p_user_name in varchar2
is
begin
if doc_is_checkedout_by(p_doc_id) is null then
raise_application_error(-20001,'This document is not locked.');
end if;
update doclib_documents
set checkedout_by = null
where doc_id = p_doc_id;
commit;
exception when others then
raise_application_error(-20001,'Exception encountered checking in document: '||sqlerrm);
end checkin;
procedure uncheckout (
p_doc_id in varchar2,
p_user_name in varchar2
is
l_checkedout_by varchar2(255);
l_chkout_lst varchar2(32000);
begin
l_checkedout_by := doc_is_checkedout_by(p_doc_id);
if l_checkedout_by is null then
--raise_application_error(-20001,'This document is not checked out.');
return_xml(p_doc_id,'UNCHECKOUT','This document is not locked.',null,'FAILED',p_user_name);
return;
end if;
--This can be optimistic locking scheme
if upper(l_checkedout_by) != upper(p_user_name) and get_acl_id(p_user_name) < 3 then
--raise_application_error(-20001,'You are not authorized to uncheckout this document.');
return_xml(p_doc_id,'UNCHECKOUT','You are not authorized to unlock this document.',null,'FAILED',p_user_name);
return;
end if;
update doclib_documents
set checkedout_by = null
where doc_id = p_doc_id;
commit;
l_chkout_lst := get_checkout_list(p_user_name);
return_xml(p_doc_id,'UNCHECKOUT','Unlock was successfull',l_chkout_lst,'SUCCESS',p_user_name);
exception when others then
--raise_application_error(-20001,'Exception encountered unchecking out document: '||sqlerrm);
return_xml(p_doc_id,'UNCHECKOUT','Exception encountered unlocking document: '||sqlerrm,null,'FAILED',p_user_name);
end uncheckout;
procedure update_member (
p_user_name in varchar2,
p_member_id in varchar2,
p_email in varchar2,
p_acl_id in varchar2,
p_retrieved in varchar2
is
l_retrieved date;
begin
l_retrieved := to_date(p_retrieved,'DD-MM-YYYY HH24:MI:SS');
if get_acl_id(p_user_name) < 3 then
raise_application_error(-20001,'You are not authorized to update members.');
end if;
--optimistic locking
for c1 in (select null
from doclib_members
where user_id = p_member_id
and updated_on > l_retrieved ) loop
raise_application_error(-20001,'The member has been updated since you retrieved the data. Refresh and try again.');
end loop;
update doclib_members
set email_address = p_email,
role_id = p_acl_id
where user_id = p_member_id;
commit;
exception when others then
raise_application_error(-20001,'Exception encountered updating member: '||sqlerrm);
end update_member;
procedure update_member_email (
p_user_name in varchar2,
p_email in varchar2,
p_retrieved in varchar2
is
l_user_id number;
l_retrieved date;
begin
l_user_id := get_member_id(p_user_name);
l_retrieved := to_date(p_retrieved,'DD-MM-YYYY HH24:MI:SS');
--optimistic locking
for c1 in (select null
from doclib_members
where user_id = l_user_id
and updated_on > l_retrieved ) loop
raise_application_error(-20001,'Remarkably, your email address changed since you retrieved the data. Refresh and try again.');
end loop;
update doclib_members
set email_address = p_email
where user_id = l_user_id;
commit;
exception when others then
raise_application_error(-20001,'Exception encountered updating email: '||sqlerrm);
end update_member_email;
procedure update_task (
p_task_id in varchar2,
p_title in varchar2,
p_user_name in varchar2,
p_assigned in varchar2,
p_priority in varchar2,
p_status in varchar2,
p_pct_complete in varchar2,
p_description in varchar2,
p_start_date in varchar2,
p_due_date in varchar2,
p_doc_id in varchar2,
p_retrieved in varchar2
is
l_start_date date;
l_due_date date;
l_retrieved date;
begin
if get_acl_id(p_user_name) < 2 then
raise_application_error(-20001,'You are not authorized to update tasks.');
end if;
l_retrieved := to_date(p_retrieved,'DD-MM-YYYY HH24:MI:SS');
l_start_date := to_date(p_start_date,'DD-MM-YYYY HH24:MI');
l_due_date := to_date(p_due_date, 'DD-MM-YYYY HH24:MI');
--optimistic locking
for c1 in (select null
from doclib_tasks
where task_id = p_task_id
and updated_on > l_retrieved ) loop
raise_application_error(-20001,'This task has been updated since you retrieved the data. Refresh and try again.');
end loop;
update doclib_tasks
set assigned_to = p_assigned,
priority_id = p_priority,
status_id = p_status,
pct_complete = p_pct_complete,
name = p_title,
description = p_description,
start_date = l_start_date,
due_date = l_due_date,
doc_id = p_doc_id
where task_id = p_task_id;
do_alerts('T',p_task_id,null);
commit;
exception when others then
raise_application_error(-20001,'Exception encountered updating task: '||sqlerrm);
end update_task;
procedure update_link (
p_link_id in varchar2,
p_user_name in varchar2,
p_name in varchar2,
p_url in varchar2,
p_retrieved in varchar2
is
l_retrieved date;
begin
if get_acl_id(p_user_name) < 2 then
raise_application_error(-20001,'You are not authorized to update links.');
end if;
l_retrieved := to_date(p_retrieved,'DD-MM-YYYY HH24:MI:SS');
--optimistic locking
for c1 in (select null
from doclib_links
where link_id = p_link_id
and updated_on > l_retrieved ) loop
raise_application_error(-20001,'This link has been updated since you retrieved the data. Refresh and try again.');
end loop;
update doclib_links
set name = p_name,
url = p_url
where link_id = p_link_id;
commit;
exception when others then
raise_application_error(-20001,'Exception encountered updating link: '||sqlerrm);
end update_link;
procedure update_announcement (
p_an_id in varchar2,
p_user_name in varchar2,
p_title in varchar2,
p_description in varchar2,
p_expire_date in varchar2,
p_retrieved in varchar2
is
l_expire_date date;
l_retrieved date;
begin
if get_acl_id(p_user_name) < 2 then
raise_application_error(-20001,'You are not authorized to update announcements.');
end if;
l_retrieved := to_date(p_retrieved,'DD-MM-YYYY HH24:MI:SS');
l_expire_date := to_date(p_expire_date,'DD-MM-YYYY HH24:MI');
--optimistic locking
for c1 in (select null
from doclib_announcements
where an_id = p_an_id
and updated_on > l_retrieved ) loop
raise_application_error(-20001,'This task has been updated since you retrieved the data. Refresh and try again.');
end loop;
update doclib_announcements
set title = p_title,
description = p_description,
expire_date = l_expire_date
where an_id = p_an_id;
commit;
exception when others then
raise_application_error(-20001,'Exception encountered updating announcement: '||sqlerrm);
end update_announcement;
procedure delete_document (
p_doc_id in varchar2,
p_user_name in varchar2,
p_delete_all in varchar2 default null
is
l_date date := sysdate;
l_checkedout_by varchar2(255);
l_chkout_lst varchar2(32000);
begin
if get_acl_id(p_user_name) < 2 then
--raise_application_error(-20001,'You are not authorized to delete documents.');
return_xml(p_doc_id,'DELETE','You are not authorized to delete documents.',null,'FAILED',p_user_name);
return;
end if;
l_checkedout_by := doc_is_checkedout_by(p_doc_id);
if l_checkedout_by is not null and upper(l_checkedout_by) != upper(p_user_name) then
--raise_application_error(-20001,'This document is currently checked out by '||l_checkedout_by);
return_xml(p_doc_id,'DELETE','This document is currently locked by '||l_checkedout_by,null,'FAILED',p_user_name);
return;
end if;
if p_delete_all = 'Y' then
update doclib_documents
set deleted_as_of = l_date
where doc_id = p_doc_id
or revision_of = p_doc_id;
else
update doclib_documents
set deleted_as_of = l_date
where doc_id = p_doc_id;
end if;
commit;
l_chkout_lst := get_checkout_list(p_user_name);
return_xml(p_doc_id,'DELETE','Document successfully deleted.',l_chkout_lst,'SUCCESS',p_user_name);
exception when others then
--raise_application_error(-20001,'Exception encountered deleting document: '||sqlerrm);
return_xml(p_doc_id,'DELETE','Exception encountered deleting document: '||sqlerrm,null,'FAILED',p_user_name);
end delete_document;
procedure really_delete_document (
p_user_name in varchar2,
p_doc_id in varchar2
is
begin
if get_acl_id(p_user_name) < 3 then
raise_application_error(-20001,'You are not authorized to really delete documents.');
end if;
delete
from doclib_documents
where doc_id = p_doc_id;
commit;
exception when others then
raise_application_error(-20001,'Exception encountered deleting document: '||sqlerrm);
end really_delete_document;
procedure delete_member (
p_user_name in varchar2,
p_user_id in varchar2
is
begin
if get_acl_id(p_user_name) < 3 then
raise_application_error(-20001,'You are not authorized to delete members.');
end if;
delete
from doclib_members
where user_id = p_user_id;
commit;
exception when others then
raise_application_error(-20001,'Exception encountered deleting member: '||sqlerrm);
end delete_member;
procedure delete_task (
p_user_name in varchar2,
p_task_id in varchar2
is
begin
if get_acl_id(p_user_name) < 2 then
raise_application_error(-20001,'You are not authorized to delete tasks.');
end if;
delete
from doclib_tasks
where task_id = p_task_id;
commit;
exception when others then
raise_application_error(-20001,'Exception encountered deleting task: '||sqlerrm);
end delete_task;
procedure delete_announcement (
p_user_name in varchar2,
p_an_id in varchar2
is
begin
if get_acl_id(p_user_name) < 2 then
raise_application_error(-20001,'You are not authorized to delete announcements.');
end if;
delete
from doclib_announcements
where an_id = p_an_id;
commit;
exception when others then
raise_application_error(-20001,'Exception encountered deleting announcement: '||sqlerrm);
end delete_announcement;
procedure delete_link (
p_user_name in varchar2,
p_link_id in varchar2
is
begin
if get_acl_id(p_user_name) < 2 then
raise_application_error(-20001,'You are not authorized to delete links.');
end if;
delete
from doclib_links
where link_id = p_link_id;
commit;
exception when others then
raise_application_error(-20001,'Exception encountered deleting link: '||sqlerrm);
end delete_link;
procedure make_doc_current (
p_user_name in varchar2,
p_name in varchar2,
p_doc_id in varchar2
is
l_name varchar2(255);
l_checkedout_by varchar2(255);
l_curr_doc_id number;
begin
if get_acl_id(p_user_name) < 2 then
raise_application_error(-20001,'You are not authorized to make this document current.');
end if;
l_checkedout_by := doc_is_checkedout_by(p_doc_id);
if l_checkedout_by is not null and upper(l_checkedout_by) != upper(p_user_name) then
raise_application_error(-20001,'This document is currently locked by '||l_checkedout_by);
end if;
for c1 in (select doc_id
from doclib_documents
where deleted_as_of = to_date('22-04-2004','DD-MM-YYYY')
and revision_of = 0
and name = p_name ) loop
l_curr_doc_id := c1.doc_id;
exit; -- this should only get one row, but just in case
end loop;
l_checkedout_by := doc_is_checkedout_by(l_curr_doc_id);
if l_checkedout_by is not null and upper(l_checkedout_by) != upper(p_user_name) then
raise_application_error(-20001,'This document is currently locked by '||l_checkedout_by);
end if;
update doclib_documents
set revision_of = p_doc_id,
checkedout_by = null --Revisions can't be locked
where name = p_name
and doc_id != p_doc_id;
update doclib_documents
set revision_of = 0,
checkedout_by = l_checkedout_by --In case original document was locked by p_user_name
where doc_id = p_doc_id;
--do alerts
do_alerts('D',l_curr_doc_id, p_doc_id);
commit;
exception when others then
raise_application_error(-20001,'Exception encountered making document current: '||sqlerrm);
end make_doc_current;
procedure undelete_document (
p_user_name in varchar2,
p_doc_id in varchar2
is
begin
if get_acl_id(p_user_name) < 3 then
raise_application_error(-20001,'You are not authorized to undelete a document.');
end if;
update doclib_documents
set deleted_as_of = to_date('22-04-2004','DD-MM-YYYY')
where doc_id = p_doc_id;
commit;
exception when others then
raise_application_error(-20001,'Exception encountered undeleting document: '||sqlerrm);
end undelete_document;
procedure send_invitation (
p_user_name in varchar2,
p_url in varchar2,
p_email in varchar2,
p_acl_id in varchar2,
p_subject in varchar2,
p_body in varchar2
is
l_body clob;
l_role_name varchar2(30);
l_from varchar2(255);
begin
for c1 in (select name
from doclib_roles
where role_id = p_acl_id ) loop
l_role_name := c1.name;
end loop;
for c1 in (select email_address
from doclib_members
where user_name = p_user_name ) loop
l_from := c1.email_address;
end loop;
l_body := g_html_email_header||chr(13)||'<p />'||p_body||chr(13);
l_body := l_body ||chr(13)||'<p />'||p_user_name||' has granted you access to '||p_url||'.';
l_body := l_body ||chr(13)||' Click the link to view the site. You have been granted access to the workspace with ';
l_body := l_body ||chr(13)||'the role of: '||l_role_name||'.'||g_html_email_footer;
apex_mail.send(
p_to => p_email,
p_from => l_from,
p_body => to_clob(' '),
p_body_html => l_body,
p_subj => p_subject );
end send_invitation;
procedure delete_document_multi (
p_doc_ids in varchar2,
p_user_name in varchar2
is
l_date date := sysdate;
l_checkedout_by varchar2(255);
l_chkout_lst varchar2(32000);
l_vc_arr2 apex_application_global.vc_arr2;
l_doc_id number;
l_curr_doc_id number;
begin
if get_acl_id(p_user_name) < 2 then
--raise_application_error(-20001,'You are not authorized to delete documents.');
return_xml(p_doc_ids,'DELETE_MULTI','You are not authorized to delete documents.',null,'FAILED',p_user_name);
return;
end if;
l_vc_arr2 := apex_util.string_to_table(p_doc_ids,',');
for c1 in (select revision_of
from doclib_documents
where doc_id = l_vc_arr2(1) ) loop
l_curr_doc_id := c1.revision_of;
end loop;
for z in 1..l_vc_arr2.count loop
l_checkedout_by := doc_is_checkedout_by(l_vc_arr2(z));
if l_checkedout_by is not null and upper(l_checkedout_by) != upper(p_user_name) then
--raise_application_error(-20001,'This document is currently checked out by '||l_checkedout_by);
return_xml(l_vc_arr2(z),'DELETE_MULTI','This document is currently locked by '||l_checkedout_by,null,'FAILED',p_user_name);
return;
end if;
update doclib_documents
set deleted_as_of = l_date
where doc_id = l_vc_arr2(z);
end loop;
commit;
l_chkout_lst := get_checkout_list(p_user_name);
return_xml(l_curr_doc_id,'DELETE_MULTI','Documents successfully deleted',l_chkout_lst,'SUCCESS',p_user_name);
exception when others then
--raise_application_error(-20001,'Exception encountered deleting document: '||sqlerrm);
return_xml(p_doc_ids,'DELETE_MULTI','Exception encountered deleting documents '||sqlerrm,null,'FAILED',p_user_name);
end delete_document_multi;
procedure rollback_document (
p_doc_id in varchar2,
p_user_name in varchar2
is
l_date date := sysdate;
l_checkedout_by varchar2(255);
l_chkout_lst varchar2(32000);
begin
if get_acl_id(p_user_name) < 2 then
return_xml(p_doc_id,'ROLLBACK','You are not authorized to rollback documents.',null,'FAILED',p_user_name);
return;
end if;
l_checkedout_by := doc_is_checkedout_by(p_doc_id);
--can be used as optimistic locking
if l_checkedout_by is not null and upper(l_checkedout_by) != upper(p_user_name) then
return_xml(p_doc_id,'ROLLBACK','This document is currently locked by '||l_checkedout_by,null,'FAILED',p_user_name);
return;
end if;
update doclib_documents
set deleted_as_of = l_date
where doc_id = p_doc_id;
for c1 in (select doc_id, name
from doclib_documents
where deleted_as_of = to_date('22-04-2004','DD-MM-YYYY')
and revision_of = p_doc_id
and version_no = (select max(version_no)
from doclib_documents
where deleted_as_of = to_date('22-04-2004','DD-MM-YYYY')
and revision_of = p_doc_id) ) loop
doclib.make_doc_current(
p_user_name => p_user_name,
p_name => c1.name,
p_doc_id => c1.doc_id );
apex_util.set_session_state('DOC_ID',c1.doc_id);
end loop;
commit;
l_chkout_lst := get_checkout_list(p_user_name);
return_xml(p_doc_id,'ROLLBACK','Document successfully rolled back',l_chkout_lst,'SUCCESS',p_user_name);
exception when others then
return_xml(p_doc_id,'ROLLBACK','Exception encountered rolling back document: '||sqlerrm,null,'FAILED',p_user_name);
end rollback_document;
/* Begin CBackstrom procedures and functions */
PROCEDURE return_all_docs(p_doc_type IN VARCHAR2) IS
l_checkedout_by VARCHAR2(4000);
l_attr1 VARCHAR2(4000);
l_attr2 VARCHAR2(4000);
l_attr3 VARCHAR2(4000);
BEGIN
l_checkedout_by := v('P9_MEMBERS');
l_attr1 := v('P9_ATTR1');
l_attr2 := v('P9_ATTR2');
l_attr3 := v('P9_ATTR3');
IF(p_doc_type = 'XML') THEN
owa_util.mime_header('text/xml', FALSE);
htp.p('Cache-Control: no-cache');
htp.p('Pragma: no-cache');
owa_util.http_header_close;
END IF;
htp.p('<div id="filelist">');
--htp.p('<div style="width:150px;"></div>');
IF v('P9_DESC') IS NOT NULL THEN
FOR c1 IN
(SELECT score(1) sc,
name,
doc_id,
checkedout_by,
'<img src="' || decode(mime_type, 'application/vnd.oasis.opendocument.text', '' || v('APP_IMAGES') || 'icodt.GIF', 'application/vnd.ms-excel', '' || v('APP_IMAGES') || 'ICXLS.GIF', 'application/msword', '' || v('APP_IMAGES') || 'ICDOC.GIF', 'application/pdf', '' || v('APP_IMAGES') || 'icpdf.GIF', 'application/vnd.ms-powerpoint', '' || v('APP_IMAGES') || 'ICPPT.GIF', 'application/vnd.oasis.opendocument.spreadsheet', '' || v('APP_IMAGES') || 'iccalc.GIF', 'application/vnd.oasis.opendocument.presentation', '' || v('APP_IMAGES') || 'icodp.GIF', 'text/plain', '' || v('APP_IMAGES') || 'ICTXT.GIF', 'application/x-zip-compressed', '' || v('APP_IMAGES') || 'ICZIP.GIF', '' || v('APP_IMAGES') || 'ICGEN.GIF') || '" width="16" height="16" border="0" />' img
FROM doclib_documents
WHERE deleted_as_of = to_date('22-04-2004', 'DD-MM-YYYY')
AND revision_of = 0
AND(checkedout_by = l_checkedout_by OR l_checkedout_by = '0')
AND(attr1 = l_attr1 OR l_attr1 = '0')
AND(attr2 = l_attr2 OR l_attr2 = '0')
AND(attr3 = l_attr3 OR l_attr3 = '0')
AND contains(contents, doclib.parse_search_string(v('P9_DESC')), 1) > 0
ORDER BY sc DESC)
LOOP
IF c1.checkedout_by IS NULL THEN
htp.p('<a href="javascript:void(0) onclick="GetDoc(this,''' || c1.doc_id || ''')" id="' || c1.doc_id || '">' || c1.img || ' (' || c1.sc || ') '|| c1.name || '</a>');
ELSIF c1.checkedout_by = apex_application.g_user THEN
htp.p('<a href="javascript:void(0) onclick="GetDoc(this,''' || c1.doc_id || ''')" id="' || c1.doc_id || '" class="checkedoutme">' || c1.img || ' (' || c1.sc || ') ' || c1.name || '(' || c1.sc || ')</a>');
ELSE
htp.p('<a href="javascript:void(0) onclick="GetDoc(this,''' || c1.doc_id || ''')" id="' || c1.doc_id || '" class="checkedout">' || c1.img || ' (' || c1.sc || ') '|| c1.name || '(' || c1.sc || ')</a>');
END IF;
END LOOP;
ELSE
FOR c1 IN
(SELECT name,
doc_id,
checkedout_by,
'<img src="' ||decode(mime_type,'application/vnd.oasis.opendocument.text', ''|| v('APP_IMAGES')||
'icodt.GIF','application/vnd.ms-excel',''||v('APP_IMAGES')||'ICXLS.GIF','application/msword',''||
v('APP_IMAGES')||'ICDOC.GIF','application/pdf',''||v('APP_IMAGES')||'icpdf.GIF','application/vnd.ms-powerpoint',''||
v('APP_IMAGES')||'ICPPT.GIF','application/vnd.oasis.opendocument.spreadsheet',''||v('APP_IMAGES')||
'iccalc.GIF','application/vnd.oasis.opendocument.presentation',''||v('APP_IMAGES')||'icodp.GIF','text/plain',''||
v('APP_IMAGES')||'ICTXT.GIF','application/x-zip-compressed',''||v('APP_IMAGES')||'ICZIP.GIF',''||v('APP_IMAGES')||
'ICGEN.GIF')||'" width="16" height="16" border="0" />' img
FROM doclib_documents
WHERE deleted_as_of = to_date('22-04-2004', 'DD-MM-YYYY')
AND revision_of = 0
AND(checkedout_by = l_checkedout_by OR l_checkedout_by = '0')
AND(attr1 = l_attr1 OR l_attr1 = '0')
AND(attr2 = l_attr2 OR l_attr2 = '0')
AND(attr3 = l_attr3 OR l_attr3 = '0')
order by name, updated_on desc)
LOOP
IF c1.checkedout_by IS NULL THEN
htp.p('<a href="javascript:void(0) onclick="GetDoc(this,''' || c1.doc_id || ''')" id="' || c1.doc_id || '">' || c1.img || ' ' || c1.name || '</a>');
ELSIF c1.checkedout_by = apex_application.g_user THEN
htp.p('<a href="javascript:void(0) onclick="GetDoc(this,''' || c1.doc_id || ''')" id="' || c1.doc_id || '" class="checkedoutme">' || c1.img || ' ' || c1.name || '</a>');
ELSE
htp.p('<a href="javascript:void(0) onclick="GetDoc(this,''' || c1.doc_id || ''')" id="' || c1.doc_id || '" class="checkedout">' || c1.img || ' ' || c1.name || '</a>');
END if;
END LOOP;
END IF;
htp.p('</div>');
END;
PROCEDURE doc_versions(p_doc_id IN VARCHAR2) IS
l_checkedout_by VARCHAR2(4000);
l_doc_name VARCHAR2(4000);
BEGIN
htp.p('<table id="doc_versions" cellpadding="0" border="0" cellspacing="0">');
htp.p('<tr>');
htp.p('<th><input type="checkbox" onclick="html_CheckAll(''doc_versions'',this.checked)" /></th>');
htp.p('<th>Version</th>');
htp.p('<th>Created</th>');
htp.p('<th>Created By</th>');
htp.p('</tr>');
FOR c2 IN
(SELECT doc_id,
decode(revision_of,0,' ',apex_item.checkbox(1,doc_id)) a,
name,
version_no,
created_on,
created_by
FROM doclib_documents
WHERE deleted_as_of = to_date('22-04-2004', 'DD-MM-YYYY')
AND(doc_id = p_doc_id OR revision_of = p_doc_id)
ORDER BY version_no DESC)
LOOP
htp.p('<tr>');
htp.p('<td>' || c2.a || '</td>');
htp.p('<td><a id="filehref" href="apex_util.count_click?p_url=' || v('OWNER') || '.get_doc?p=' || c2.doc_id || '&p_cat=DOCS&p_id=' || c2.doc_id || '&p_user=' || v('APP_USER') || '&p_workspace=' || apex_custom_auth.get_security_group_id || '">' || c2.version_no || '</a></td>');
htp.p('<td>' || to_char(c2.created_on, 'MM/DD/YYYY HH:MI AM') || '</td>');
htp.p('<td>' || c2.created_by || '</td>');
htp.p('</tr>');
END LOOP;
htp.p('</table>');
END;
FUNCTION doc_is_updated_by(p_doc_id IN VARCHAR2) RETURN VARCHAR2 IS
BEGIN
FOR c1 IN
(SELECT updated_by
FROM doclib_documents
WHERE doc_id = p_doc_id)
LOOP
RETURN c1.updated_by;
END LOOP;
RETURN NULL;
END doc_is_updated_by;
FUNCTION doc_updated_date(p_doc_id IN VARCHAR2) RETURN VARCHAR2 IS
BEGIN
FOR c1 IN
(SELECT to_char(updated_on, 'MM/DD/YYYY HH:MI AM') updated_on
FROM doclib_documents
WHERE doc_id = p_doc_id)
LOOP
RETURN c1.updated_on;
END LOOP;
RETURN NULL;
END doc_updated_date;
FUNCTION doc_created_date(p_doc_id IN VARCHAR2) RETURN VARCHAR2 IS
BEGIN
FOR c1 IN
(SELECT to_char(created_on, 'MM/DD/YYYY HH:MI AM') created
FROM doclib_documents
WHERE doc_id = p_doc_id)
LOOP
RETURN c1.created;
END LOOP;
RETURN NULL;
END doc_created_date;
FUNCTION doc_linked_image(p_doc_id IN VARCHAR2) RETURN VARCHAR2 IS l_image_link VARCHAR2(4000);
l_image_prefix VARCHAR2(4000);
BEGIN
l_image_link := '<a id="filehref" href="apex_util.count_click?p_url=' || v('OWNER') || '.get_doc?p=' || p_doc_id || '&p_cat=DOCS&p_id=' || p_doc_id || '&p_user=' || v('APP_USER') || '&p_workspace=' || apex_custom_auth.get_security_group_id || '">';
l_image_prefix := v('APP_IMAGES');
FOR c1 IN
(SELECT mime_type,
l_image_link || '<img src="' || decode(mime_type, 'application/vnd.oasis.opendocument.text', l_image_prefix || 'icodt.GIF', 'application/vnd.ms-excel', l_image_prefix || 'ICXLS.GIF', 'application/msword', l_image_prefix || 'ICDOC.GIF', 'application/pdf', l_image_prefix || 'icpdf.GIF', 'application/vnd.ms-powerpoint', l_image_prefix || 'ICPPT.GIF', 'application/vnd.oasis.opendocument.spreadsheet', l_image_prefix || 'iccalc.GIF', 'application/vnd.oasis.opendocument.presentation', l_image_prefix || 'icodp.GIF', 'text/plain', l_image_prefix || 'ICTXT.GIF', 'application/x-zip-compressed', l_image_prefix || 'ICZIP.GIF', l_image_prefix || 'ICGEN.GIF') || '" width="16" height="16" border="0" /></a>' image
FROM doclib_documents
WHERE doc_id = p_doc_id)
LOOP
RETURN c1.image;
END LOOP;
RETURN NULL;
END doc_linked_image;
FUNCTION doc_file_type(p_doc_id IN VARCHAR2) RETURN VARCHAR2 IS l_file_type VARCHAR2(4000);
BEGIN
FOR c1 IN
(SELECT mime_type
FROM doclib_documents
WHERE doc_id = p_doc_id)
LOOP
RETURN c1.mime_type;
END LOOP;
RETURN NULL;
END doc_file_type;
PROCEDURE doc_attribute_tab(p_doc_id IN VARCHAR2, p_user_name IN VARCHAR2) IS
BEGIN
for c1 in (select attr1, attr2, attr3, description
from doclib_documents
where doc_id = p_doc_id ) loop
htp.p('<table id="doc_attribute" cellpadding="0" cellspacing="0" border="0">');
htp.p('<tr><th>'||v('DOC_WORKSPACE_LBL1')||'</th><td>'||APEX_ITEM.SELECT_LIST_FROM_LOV(1,c1.attr1,'ATTR1',null,'NO',null,null,'ATTR1')||'</td></tr>');
htp.p('<tr><th>'||v('DOC_WORKSPACE_LBL2')||'</th><td>'||APEX_ITEM.SELECT_LIST_FROM_LOV(2,c1.attr2,'ATTR2',null,'NO',null,null,'ATTR2')||'</td></tr>');
htp.p('<tr><th>'||v('DOC_WORKSPACE_LBL3')||'</th><td>'||APEX_ITEM.SELECT_LIST_FROM_LOV(3,c1.attr3,'ATTR3',null,'NO',null,null,'ATTR3')||'</td></tr>');
htp.p('<tr><td colspan="2"><b>Description</b>
<textarea id="desc">' || c1.description || '</textarea></td></tr>');
htp.p('<tr><td colspan="2"><input type="button" onclick="doc_attribute_update()" value="Update Attributes" /></td></tr>');
htp.p('</table>');
end loop;
END;
PROCEDURE doc_detail(p_doc_id IN VARCHAR2, p_user_name IN VARCHAR2) IS
l_checkedout_by VARCHAR2(4000);
l_updated_by VARCHAR2(4000);
l_created_date VARCHAR2(4000);
l_updated_date VARCHAR2(4000);
l_mime_type VARCHAR2(4000);
l_doc_name VARCHAR2(4000);
l_acl_id VARCHAR2(4000);
BEGIN
l_checkedout_by := doclib.doc_is_checkedout_by(p_doc_id);
l_doc_name := doclib.get_doc_name(p_doc_id);
l_acl_id := doclib.get_acl_id(p_user_name);
l_updated_by := doc_is_updated_by(p_doc_id);
l_mime_type := doc_file_type(p_doc_id);
l_updated_date := doc_updated_date(p_doc_id);
l_created_date := doc_created_date(p_doc_id);
apex_util.set_session_state('DOC_ID', p_doc_id);
apex_util.set_session_state('DOC_NAME', l_doc_name);
htp.p('<div id="doc_detail">');
htp.p('<div id="doc_header">');
htp.p('<div id="doc_name"><a href="apex_util.count_click?p_url=' || v('OWNER') || '.get_doc?p=' || p_doc_id || '&p_cat=DOCS&p_id=' || p_doc_id || '&p_user=' || v('APP_USER') || '&p_workspace=' || apex_custom_auth.get_security_group_id || ">' || l_doc_name || '</a></div>');
htp.p('<table><tr><td valign="top">');
htp.p('<table>');
htp.p('<tr><th>View :</th><td>' || doc_linked_image(p_doc_id) || '</td></tr>');
htp.p('<tr><th>Locked By :</th><td id="checkedoutby">' || l_checkedout_by || '</td></tr>');
htp.p('<tr><th>Modified By :</th><td id="modifiedby">' || l_updated_by || '</td></tr>');
htp.p('</table>');
htp.p('</td><td width="100">
<td><td valign="top">');
htp.p('<table>');
htp.p('<tr><th>Updated Date :</th><td id="updateddate">' || l_updated_date || '</td></tr>');
htp.p('<tr><th>Created Date :</th><td id="createddate">' || l_created_date || '</td></tr>');
htp.p('<tr><th>Send Link :</th><td id="sendlink"><a href="mailto:' || doclib.get_member_email(p_user_name) || '?subject=' || l_doc_name || '&body=' || v('BASE_URL') || '/f?p=' || v('APP_ID') || ':2:::::P2_DOC_ID:' || p_doc_id || ">Click Here</a></td></tr>');
htp.p('</table>');
htp.p('</td></tr></table>');
htp.p('</div>');
htp.p('<div id="doc_actions">Actions : ');
IF l_acl_id > 1 THEN
IF l_checkedout_by IS NULL THEN
htp.p('<a href="javascript:doc_Action(this,''' || p_doc_id || ''',''CHECKOUT'') id="checkout_button">Lock</a>');
ELSIF l_checkedout_by = p_user_name OR l_acl_id > 2 THEN
htp.p('<a href="javascript:doc_Action(this,''' || p_doc_id || ''',''UNCHECKOUT'') id="checkout_button">Unlock</a>');
END IF;
IF l_checkedout_by IS NULL OR l_checkedout_by = p_user_name THEN
htp.p('Add Version');
htp.p('Delete');
END IF;
-- htp.p('<a href="f?p=&APP_ID.:5:&SESSION.::::P5_NAME,P5_DOC_ID:' || l_doc_name || ',' || p_doc_id || ' id="versions_button">Versions</a>');
END IF;
htp.p('<a href="apex_util.count_click?p_url=' || v('OWNER') || '.get_doc?p=' || p_doc_id || '&p_cat=DOCS&p_id=' || p_doc_id || '&p_user=' || p_user_name || '&p_workspace=' || apex_custom_auth.get_security_group_id || ">View</a>');
htp.p('<a href="f?p=' || v('APP_ID') || ':95:' || v('SESSION') || '::::P95_ALERT_TYPE,P95_ALERT_INTERVAL,P95_DOC_ID:D,,' || v('DOC_ID') || ">Alert Me</a>');
htp.p('</div>');
htp.p('<div id="action_message"></div>');
htp.p('<div id="doc_tabs">');
htp.p('<div id="doc_tabsbuttons">Versions<a id="tab3" href="javascript:void(0)" onclick="doc_Comments_Tab(''tab3'')">Comments</a>');
if doclib.GET_ACL_ID(v('APP_USER')) > 1 then
htp.p('Attributes');
end if;
htp.p('</div>');
htp.p('<div id="doc_tabsbody">');
htp.p('<div id="tab1_content">');
doc_versions(p_doc_id);
IF (l_checkedout_by IS NULL OR l_checkedout_by = p_user_name) and get_acl_id(v('APP_USER')) > 1 THEN
htp.p('<hr /><input type="button" value="Delete All Versions" onclick="doc_Action(this,''' || p_doc_id || ''',''DELETE'')" />');
if doc_has_revisions(p_doc_id) > 0 then
htp.p('<input type="button" value="Delete Checked Versions" onclick="doc_Action(this,''' || p_doc_id || ''',''DELETE_CHECKED'')" />');
htp.p('<input type="button" value="Delete Current Version (Rollback Version)" onclick="doc_Action(this,''' || p_doc_id || ''',''ROLLBACK'')" />');
end if;
END IF;
htp.p('</div>');
htp.p('<div id="tab2_content" style="display:none;">');
doc_attribute_tab(p_doc_id, p_user_name);
htp.p('</div>');
htp.p('<div id="tab3_content" style="display:none;"><div id="doc_comments">
</div></div>');
htp.p('</div>');
htp.p('</div>');
htp.p('</div>');
END;
PROCEDURE doc_comments(p_doc_id IN VARCHAR2) IS
BEGIN
htp.p('<div>');
htp.p('<table id="doc_versions" cellpadding="0" border="0" cellspacing="0">');
htp.p('<tr><th>Member</th><th>Date</th><th>Comment</th></tr>');
FOR c2 IN
(SELECT description,
created_by,
created_on
FROM doclib_documents
WHERE(doc_id = p_doc_id OR revision_of = p_doc_id)
AND(description IS NOT NULL OR description != '')
AND deleted_as_of = to_date('22-04-2004','DD-MM-YYYY')
ORDER BY created_on DESC)
LOOP
htp.p('<tr>' || '<td>' || c2.created_by || '</td><td>' || to_char(c2.created_on, 'MM/DD/YYYY HH:MI AM') || '</td><td>' || c2.description || '</td></tr>');
END LOOP;
htp.p('</table>');
htp.p('</div>');
END;
/* End CBackstrom procedures and functions */
end doclib;
Error at line 1230: PL/SQL: SQL Statement ignored
sync_index.sql
declare
l_job_id binary_integer;
begin
for c1 in (select job
from user_jobs
where what = 'ctx_ddl.sync_index(''doclib_docs_idx2'', ''2M'');' ) loop
dbms_job.remove(c1.job);
end loop;
dbms_job.submit(
job => l_job_id,
what => 'ctx_ddl.sync_index(''doclib_docs_idx2'', ''2M'');',
next_date => sysdate + 15/1440,
interval => 'sysdate + 15/1440');
end;
ORA-06550: line 1, column 93:
PLS-00201: identifier 'CTX_DDL.SYNC_INDEX' must be declared
ORA-06550: line 1, column 93:
PL/SQL: Statement ignored
I would appreciate any suggestions.
Thank you for your time.
DanielD -
Hi,
I wanted to know if there is an API to insert project tasks through pl/sql or we can do it through base tables directly. My requirement assumes inserting task for an existing project.
Through my research, I came to find the api as pa_project_pub.add_task. But still looking into load/create a task.
Edited by: Nel Marcus on Oct 3, 2011 3:48 PMHi
The API you have found - ADD_TASK is used to add new tasks to existing project.
Dina -
which api I can use to create task in already created project I am using this api PA_PROJECT_PUB.ADD_TASK to create task in already create prject before
I use the following query and query run successfully but not task add in project please guide me
the out put of query is given below
anonymous block completed
Set Global status ->S
Return Status =
in procedure task_id is a output parameter but it did not prin (Return Status = )
declare
L_API_VERSION_NUMBER number := 1.0;
L_COMMIT varchar2(1) := 'F';
L_INIT_MSG_LIST varchar2(1) := 'F';
L_MSG_COUNT number;
L_MSG_DATA varchar2(2000);
L_RETURN_STATUS varchar2(1);
L_PM_PRODUCT_CODE varchar2(10);
L_PM_TASK_REFERENCE varchar2(25);
L_PA_TASK_NUMBER varchar2(100);
L_TASK_NAME varchar2(240);
L_PM_PARENT_TASK_REFERENCE varchar2(25);
L_TASK_DESCRIPTION varchar2(2000);
L_PA_PROJECT_ID number;
L_PM_PROJECT_REFERENCE varchar2(1000);
L_MSG_INDEX_OUT number;
L_DATA varchar2(2000);
API_ERROR EXCEPTION;
L_PA_PROJECT_ID_OUT number;
L_PA_PROJECT_NUMBER_OUT varchar(1000);
L_TASK_ID number;
begin
--Fnd_global.apps_initialize(user_id,resp_id, resp_appl_id);
FND_GLOBAL.APPS_INITIALIZE(1509,22593,275);
L_PM_TASK_REFERENCE := '1';
L_PA_TASK_NUMBER := '1';
L_TASK_NAME := 'Construction';
L_PM_PARENT_TASK_REFERENCE :='';
L_TASK_DESCRIPTION :='Plant function';
L_PA_PROJECT_ID :=5001;
l_PM_PROJECT_REFERENCE:='';
-------calling global parameters---
pa_interface_utils_pub.set_global_info
p_api_version_number =>1.0,
p_responsibility_id =>22593,
p_user_id =>1509,
p_msg_count =>l_msg_count,
p_msg_data =>l_msg_data,
P_RETURN_STATUS =>L_RETURN_STATUS
DBMS_OUTPUT.PUT_LINE ('Set Global status ->' || L_RETURN_STATUS);
l_pm_product_code := '';
PA_PROJECT_PUB.ADD_TASK
(P_API_VERSION_NUMBER=>L_API_VERSION_NUMBER,
P_COMMIT => L_COMMIT,
P_INIT_MSG_LIST => L_INIT_MSG_LIST,
P_MSG_COUNT =>L_MSG_COUNT,
P_MSG_DATA => L_MSG_DATA,
P_RETURN_STATUS => L_RETURN_STATUS,
P_PM_PRODUCT_CODE => L_PM_PRODUCT_CODE,
P_PM_PROJECT_REFERENCE =>L_PM_PROJECT_REFERENCE,
P_PA_PROJECT_ID =>l_PA_PROJECT_ID,
P_PM_TASK_REFERENCE =>L_PM_TASK_REFERENCE,
P_PA_TASK_NUMBER =>L_PA_TASK_NUMBER,
P_TASK_NAME =>L_TASK_NAME,
P_TASK_DESCRIPTION =>l_task_description,
P_PM_PARENT_TASK_REFERENCE =>L_PM_PARENT_TASK_REFERENCE,
P_PA_PROJECT_ID_OUT =>L_PA_PROJECT_ID_OUT,
P_PA_PROJECT_NUMBER_OUT =>L_PA_PROJECT_NUMBER_OUT,
P_TASK_ID =>l_TASK_ID
dbms_output.put_line('Return Status = ' ||l_TASK_ID);
EXCEPTION WHEN api_error THEN
dbms_output.put_line('An error occured duing project creation');
if (L_MSG_COUNT > 0 ) then
for I in 1..L_MSG_COUNT
LOOP
apps.PA_INTERFACE_UTILS_PUB.get_messages(
p_msg_count => l_msg_count,
p_encoded => 'F',
p_msg_data => l_msg_data,
p_data => l_data,
p_msg_index_out => l_msg_index_out);
dbms_output.put_line('Error message l_data ->'||l_data);
dbms_output.put_line('Error message l_msg_data ->'||l_msg_data);
END LOOP;
end if;
WHEN OTHERS THEN
dbms_output.put_line('An error occured duing conversion, SQLCODE ->'|| SQLERRM);
IF (l_msg_count >=1 ) THEN
FOR i IN 1..l_msg_count LOOP
PA_INTERFACE_UTILS_PUB.get_messages(
p_msg_count => l_msg_count,
p_encoded => 'F',
p_msg_data => l_msg_data,
p_data => l_data,
p_msg_index_out => l_msg_index_out);
dbms_output.put_line('Error message ->'||l_data);
end LOOP;
end if;
end;
and what is the differnce between procedure for task
PA_PROJECT_PUB.ADD_TASK and PA_PROJECT_PUB.LOAD_TASKPA_PROJECT_PUB.ADD_TASK
-
Pa_projects doesnt return any data
HI,
I'm using API PA_PROJECT_PUB.ADD_TASK to insert tasks data to PA_TASKS table
The API returns me ' Invalid Project ' error message
On exploring the procedure code I found that it is querying pa_projects table
Also when I used the following in my toad
begin
fnd_client_info.set_org_context('204');
end;
select * from pa_projects -- it doesnt return any rows
However the following query returns rows
select * from pa_projects_all where org_id=204
Can any one please help me how to populate pa_projects table or what data will be there in pa_projects
Thanks for your help
Regards
RaviHi Sandeep,
I followed the instructions mentioned , but I still get no rows returned
Any more Suggestions ?
Thanks
Ravi
Maybe you are looking for
-
H430: Windows 8.1 is not recognizing SD card slot
I have Lenovo H430 and is working great for me.... yet i have a problem after upgraded windows from8 to 8.1 the SD card slot is not recognizable can't be found in device manager and when i try to add the device it is not found, so what i do is run th
-
Audio not working / Video flashes to black every ~5 seconds
Hi. For some reason, when we turn on our TV as of late, every channel is having this issue where upon turning on, the video will flash to black every 5 seconds or so, and there is no audio. The only thing that solves the problem is unplugging and rep
-
when i bought Nokia N8,i thought i can play almost every video file format in it....but now i can't.... is there any way to play all types of video file in it??
-
Having problems downloading Photoshop - Lightroom downloaded just fine.
I purchased the Creative plan, which says it includes Photoshop CC and Lightroom 5. From the creative cloud desktop platform, I successfully downloaded Lightroom, but when I go to download Photoshop, it just sits at 0%. When I go to Adobe's website,
-
Can not install solaris 10 on dell Desktop
Hi All, This is my first post. I am new to sun solaris. I am trying to install Solaris 10 (using DVD). while installation it came up with folllwing error. NO Disk found. check to make sure disks are cabled and powered up.on the same disk, windows VIS