90: --
91: procedure clear_source is
92: l_proc varchar2(72) := g_package||'clear_source';
93: begin
94: hr_utility.set_location('Entering:'|| l_proc, 10);
95: g_source := null;
96: g_error_expected := false;
97: hr_utility.set_location(' Leaving:'|| l_proc, 20);
98: end clear_source;
93: begin
94: hr_utility.set_location('Entering:'|| l_proc, 10);
95: g_source := null;
96: g_error_expected := false;
97: hr_utility.set_location(' Leaving:'|| l_proc, 20);
98: end clear_source;
99: --
100: -- ----------------------------------------------------------------------------
101: -- |------------------------------< add_to_source >---------------------------|
129: (p_text in varchar2
130: ) is
131: l_proc varchar2(72) := g_package||'add_to_source';
132: begin
133: hr_utility.set_location('Entering:'|| l_proc, 10);
134: g_source := g_source || p_text;
135: hr_utility.set_location(' Leaving:'||l_proc, 20);
136: exception
137: when Plsql_Value_Error then
131: l_proc varchar2(72) := g_package||'add_to_source';
132: begin
133: hr_utility.set_location('Entering:'|| l_proc, 10);
134: g_source := g_source || p_text;
135: hr_utility.set_location(' Leaving:'||l_proc, 20);
136: exception
137: when Plsql_Value_Error then
138: -- Trap attempts to create more than 32K of package body source code.
139: --
142: -- in size. If so, reduce the number of procedures which need to be
143: -- called for this API module. The module will not execute until this
144: -- problem is resolved.
145: --
146: hr_utility.set_message(800, 'HR_51940_AHC_PACK_TOO_LARGE');
147: hr_utility.raise_error;
148: end add_to_source;
149: --
150: -- ----------------------------------------------------------------------------
143: -- called for this API module. The module will not execute until this
144: -- problem is resolved.
145: --
146: hr_utility.set_message(800, 'HR_51940_AHC_PACK_TOO_LARGE');
147: hr_utility.raise_error;
148: end add_to_source;
149: --
150: -- ----------------------------------------------------------------------------
151: -- |-----------------------------< error_expected >---------------------------|
177: procedure error_expected
178: is
179: l_proc varchar2(72) := g_package||'error_expected';
180: begin
181: hr_utility.set_location('Entering:'|| l_proc, 10);
182: g_error_expected := true;
183: hr_utility.set_location(' Leaving:'||l_proc, 20);
184: end error_expected;
185: --
179: l_proc varchar2(72) := g_package||'error_expected';
180: begin
181: hr_utility.set_location('Entering:'|| l_proc, 10);
182: g_error_expected := true;
183: hr_utility.set_location(' Leaving:'||l_proc, 20);
184: end error_expected;
185: --
186: -- ----------------------------------------------------------------------------
187: -- |----------------------------< execute_source >----------------------------|
217: l_execute integer; -- Value returned by
218: -- dbms_sql.execute
219: l_proc varchar2(72) := g_package||'execute_source';
220: begin
221: hr_utility.set_location('Entering:'|| l_proc, 10);
222: --
223: -- The whole of the new package body code has now been built,
224: -- use dynamic SQL to execute the create or replace package statement
225: --
226: l_dynamic_cursor := dbms_sql.open_cursor;
227: dbms_sql.parse(l_dynamic_cursor, g_source, dbms_sql.v7);
228: l_execute := dbms_sql.execute(l_dynamic_cursor);
229: dbms_sql.close_cursor(l_dynamic_cursor);
230: hr_utility.set_location(' Leaving:'|| l_proc, 20);
231: exception
232: --
233: -- In case of an unexpected error close the dynamic cursor
234: -- if it was successfully opened.
318: -- found in the hook parameter list.
319: l_para_valid boolean; -- Indicates if parameter is valid.
320: l_proc varchar2(72) := g_package||'chk_param_in_hook_proc_call';
321: begin
322: hr_utility.set_location('Entering:'|| l_proc, 10);
323: --
324: -- Assume the parameter is valid until an error is found
325: --
326: l_para_valid := true;
331: --
332: if p_call_parameter_overload <> p_previous_overload then
333: -- Error: A call package procedure cannot have any PL/SQL overloaded
334: -- versions. Code to carry out this hook call has not been created.
335: hr_utility.set_message(800, 'HR_51941_AHC_CALL_NO_OVER');
336: hr_utility.set_location(l_proc, 20);
337: l_para_valid := false;
338: --
339: -- Check the argument name has been set. If it is not set the entry
332: if p_call_parameter_overload <> p_previous_overload then
333: -- Error: A call package procedure cannot have any PL/SQL overloaded
334: -- versions. Code to carry out this hook call has not been created.
335: hr_utility.set_message(800, 'HR_51941_AHC_CALL_NO_OVER');
336: hr_utility.set_location(l_proc, 20);
337: l_para_valid := false;
338: --
339: -- Check the argument name has been set. If it is not set the entry
340: -- returned from hr_general.describe_procedure is for a function
342: --
343: elsif p_call_parameter_name is null then
344: -- Error: A package function cannot be called. Only package procedures
345: -- can be called. Code to carry out this hook call has not been created.
346: hr_utility.set_message(800, 'HR_51942_AHC_NO_FUNCTIONS');
347: hr_utility.set_location(l_proc, 30);
348: l_para_valid := false;
349: else
350: --
343: elsif p_call_parameter_name is null then
344: -- Error: A package function cannot be called. Only package procedures
345: -- can be called. Code to carry out this hook call has not been created.
346: hr_utility.set_message(800, 'HR_51942_AHC_NO_FUNCTIONS');
347: hr_utility.set_location(l_proc, 30);
348: l_para_valid := false;
349: else
350: --
351: l_para_found := false;
349: else
350: --
351: l_para_found := false;
352: l_loop := 0;
353: hr_utility.set_location(l_proc, 40);
354: --
355: -- Keep searching through the parameter names table until the parameter
356: -- name is found or the end of the list has been reached.
357: --
360: if p_hook_parameter_names(l_loop) = p_call_parameter_name then
361: l_para_found := true;
362: end if;
363: end loop; -- end of while loop
364: hr_utility.set_location(l_proc, 50);
365: --
366: -- If the parameter has been found carry out further parameter checks
367: --
368: if l_para_found then
373: if p_hook_parameter_datatypes(l_loop) <> p_call_parameter_datatype then
374: -- Error: The *PARAMETER parameter to the call procedure must
375: -- have the same datatype as the value available at the hook.
376: -- Code to carry out this hook call has not been created.
377: hr_utility.set_message(800, 'HR_51943_AHC_CALL_PARA_D_TYPE');
378: hr_utility.set_message_token('PARAMETER', p_call_parameter_name);
379: hr_utility.set_location(l_proc, 60);
380: l_para_valid := false;
381: --
374: -- Error: The *PARAMETER parameter to the call procedure must
375: -- have the same datatype as the value available at the hook.
376: -- Code to carry out this hook call has not been created.
377: hr_utility.set_message(800, 'HR_51943_AHC_CALL_PARA_D_TYPE');
378: hr_utility.set_message_token('PARAMETER', p_call_parameter_name);
379: hr_utility.set_location(l_proc, 60);
380: l_para_valid := false;
381: --
382: -- Check that the parameter to the call
375: -- have the same datatype as the value available at the hook.
376: -- Code to carry out this hook call has not been created.
377: hr_utility.set_message(800, 'HR_51943_AHC_CALL_PARA_D_TYPE');
378: hr_utility.set_message_token('PARAMETER', p_call_parameter_name);
379: hr_utility.set_location(l_proc, 60);
380: l_para_valid := false;
381: --
382: -- Check that the parameter to the call
383: -- package procedure is of type IN
385: elsif p_call_parameter_in_out <> 0 then
386: -- Error: At least one OUT or IN/OUT parameter has been specified
387: -- on the call procedure. You can only use IN parameters. Code to
388: -- carry out this hook call has not been created.
389: hr_utility.set_message(800, 'HR_51944_AHC_CALL_ONLY_IN_PARA');
390: hr_utility.set_location(l_proc, 70);
391: l_para_valid := false;
392: end if;
393: else
386: -- Error: At least one OUT or IN/OUT parameter has been specified
387: -- on the call procedure. You can only use IN parameters. Code to
388: -- carry out this hook call has not been created.
389: hr_utility.set_message(800, 'HR_51944_AHC_CALL_ONLY_IN_PARA');
390: hr_utility.set_location(l_proc, 70);
391: l_para_valid := false;
392: end if;
393: else
394: --
397: --
398: -- Error: There is a parameter to the call procedure which is not
399: -- available at this hook. Check your call procedure parameters.
400: -- Code to carry out this hook call has not been created.
401: hr_utility.set_message(800, 'HR_51945_AHC_CALL_NO_PARA');
402: hr_utility.set_location(l_proc, 80);
403: l_para_valid := false;
404: end if;
405: end if;
398: -- Error: There is a parameter to the call procedure which is not
399: -- available at this hook. Check your call procedure parameters.
400: -- Code to carry out this hook call has not been created.
401: hr_utility.set_message(800, 'HR_51945_AHC_CALL_NO_PARA');
402: hr_utility.set_location(l_proc, 80);
403: l_para_valid := false;
404: end if;
405: end if;
406: --
405: end if;
406: --
407: -- Return the parameter status
408: --
409: hr_utility.set_location(' Leaving:'||l_proc, 90);
410: return l_para_valid;
411: end chk_param_in_hook_proc_call;
412: --
413: -- ----------------------------------------------------------------------------
504: -- found in the hook parameter list.
505: l_para_valid boolean; -- Indicates if parameter is valid.
506: l_proc varchar2(72) := g_package||'chk_param_in_hook_leg_func';
507: begin
508: hr_utility.set_location('Entering:'|| l_proc, 10);
509: --
510: -- Assume the parameter is valid until an error is found
511: --
512: l_para_valid := true;
518: if p_call_parameter_overload <> p_previous_overload then
519: -- Error: A legislation package function cannot have any PL/SQL
520: -- overloaded versions. This API module will not execute until this
521: -- problem has been resolved.
522: hr_utility.set_message(800, 'HR_51946_AHK_LEG_NO_OVER');
523: hr_utility.set_location(l_proc, 20);
524: l_para_valid := false;
525: else
526: --
519: -- Error: A legislation package function cannot have any PL/SQL
520: -- overloaded versions. This API module will not execute until this
521: -- problem has been resolved.
522: hr_utility.set_message(800, 'HR_51946_AHK_LEG_NO_OVER');
523: hr_utility.set_location(l_proc, 20);
524: l_para_valid := false;
525: else
526: --
527: l_find_parameter_name := p_call_parameter_name;
526: --
527: l_find_parameter_name := p_call_parameter_name;
528: l_para_found := false;
529: l_loop := 0;
530: hr_utility.set_location(l_proc, 30);
531: --
532: -- Keep searching through the parameter names table until the parameter
533: -- name is found or the end of the list has been reached.
534: --
537: if p_hook_parameter_names(l_loop) = l_find_parameter_name then
538: l_para_found := true;
539: end if;
540: end loop; -- end of while loop
541: hr_utility.set_location(l_proc, 40);
542: --
543: -- If the parameter was not found attempt to search through the list
544: -- again. Except this time looking for the parameter with _O on the
545: -- end. There is no need to handle the case where the parameter name
548: -- HR_51949_AHK_LEG_NO_PARA error will be correctly raised later in
549: -- this procedure.
550: --
551: if not l_para_found then
552: hr_utility.set_location(l_proc, 50);
553: l_find_parameter_name := p_call_parameter_name || '_O';
554: l_loop := 0;
555: while (not l_para_found) and (l_loop < p_number_of_parameters) loop
556: l_loop := l_loop + 1;
558: l_para_found := true;
559: end if;
560: end loop; -- end of while loop
561: end if;
562: hr_utility.set_location(l_proc, 60);
563: --
564: -- If the parameter has been found carry out further parameter checks
565: --
566: if l_para_found then
571: if p_hook_parameter_datatypes(l_loop) <> p_call_parameter_datatype then
572: -- Error: The *PARAMETER parameter to the legislation function must
573: -- have the same datatype as the value available at the hook. This
574: -- API module will not execute until this problem has been resolved.
575: hr_utility.set_message(800, 'HR_51947_AHK_LEG_PARA_D_TYPE');
576: hr_utility.set_message_token('PARAMETER', p_call_parameter_name);
577: hr_utility.set_location(l_proc, 70);
578: l_para_valid := false;
579: --
572: -- Error: The *PARAMETER parameter to the legislation function must
573: -- have the same datatype as the value available at the hook. This
574: -- API module will not execute until this problem has been resolved.
575: hr_utility.set_message(800, 'HR_51947_AHK_LEG_PARA_D_TYPE');
576: hr_utility.set_message_token('PARAMETER', p_call_parameter_name);
577: hr_utility.set_location(l_proc, 70);
578: l_para_valid := false;
579: --
580: -- Check that the parameter to the call package function is
573: -- have the same datatype as the value available at the hook. This
574: -- API module will not execute until this problem has been resolved.
575: hr_utility.set_message(800, 'HR_51947_AHK_LEG_PARA_D_TYPE');
576: hr_utility.set_message_token('PARAMETER', p_call_parameter_name);
577: hr_utility.set_location(l_proc, 70);
578: l_para_valid := false;
579: --
580: -- Check that the parameter to the call package function is
581: -- of type IN
583: elsif p_call_parameter_in_out <> 0 then
584: -- Error: All the parameters to the legislation function must be
585: -- IN parameters. OUT or IN/OUT parameters are not allowed. This
586: -- API module will not execute until this problem has been resolved.
587: hr_utility.set_message(800, 'HR_51948_AHK_LEG_ONLY_IN_PARA');
588: hr_utility.set_location(l_proc, 80);
589: l_para_valid := false;
590: end if;
591: else
584: -- Error: All the parameters to the legislation function must be
585: -- IN parameters. OUT or IN/OUT parameters are not allowed. This
586: -- API module will not execute until this problem has been resolved.
587: hr_utility.set_message(800, 'HR_51948_AHK_LEG_ONLY_IN_PARA');
588: hr_utility.set_location(l_proc, 80);
589: l_para_valid := false;
590: end if;
591: else
592: --
595: --
596: -- Error: There is a parameter to the legislation function which
597: -- is not available at this hook. This API module will not execute
598: -- until this problem has been resolved.
599: hr_utility.set_message(800, 'HR_51949_AHK_LEG_NO_PARA');
600: hr_utility.set_location(l_proc, 90);
601: l_para_valid := false;
602: end if;
603: end if;
596: -- Error: There is a parameter to the legislation function which
597: -- is not available at this hook. This API module will not execute
598: -- until this problem has been resolved.
599: hr_utility.set_message(800, 'HR_51949_AHK_LEG_NO_PARA');
600: hr_utility.set_location(l_proc, 90);
601: l_para_valid := false;
602: end if;
603: end if;
604: hr_utility.set_location(l_proc, 100);
600: hr_utility.set_location(l_proc, 90);
601: l_para_valid := false;
602: end if;
603: end if;
604: hr_utility.set_location(l_proc, 100);
605: --
606: -- Pass out the parameter status values
607: --
608: if l_para_valid then
610: else
611: p_hook_parameter_name := null;
612: end if;
613: p_parameter_valid := l_para_valid;
614: hr_utility.set_location(' Leaving:'||l_proc, 110);
615: end chk_param_in_hook_leg_func;
616: --
617: -- ----------------------------------------------------------------------------
618: -- |--------------------------< make_procedure_call >-------------------------|
706: -- HR_API_HOOK_CALLS table.
707: l_call_code varchar2(32767) := null;
708: l_proc varchar2(72) := g_package||'make_procedure_call';
709: begin
710: hr_utility.set_location('Entering:'|| l_proc, 10);
711: --
712: -- Call an RDMS procedure to obtain the list of parameters to the call
713: -- package procedure. A separate begin ... end block has been specified so
714: -- that errors raised by hr_general.describe_procedure can be trapped and
735: exception
736: when Package_Not_Exists then
737: -- Error: The call_package does not exist in the database. Code to
738: -- carry out this hook call has not been created.
739: hr_utility.set_message(800, 'HR_51950_AHC_CALL_PKG_NO_EXIST');
740: l_describe_error := true;
741: hr_utility.set_location(l_proc, 20);
742: when Proc_Not_In_Package then
743: -- Error: The call_procedure does not exist in the call_package.
737: -- Error: The call_package does not exist in the database. Code to
738: -- carry out this hook call has not been created.
739: hr_utility.set_message(800, 'HR_51950_AHC_CALL_PKG_NO_EXIST');
740: l_describe_error := true;
741: hr_utility.set_location(l_proc, 20);
742: when Proc_Not_In_Package then
743: -- Error: The call_procedure does not exist in the call_package.
744: -- Code to carry out this hook call has not been created.
745: hr_utility.set_message(800, 'HR_51951_AHC_CALL_PRO_NO_EXIST');
741: hr_utility.set_location(l_proc, 20);
742: when Proc_Not_In_Package then
743: -- Error: The call_procedure does not exist in the call_package.
744: -- Code to carry out this hook call has not been created.
745: hr_utility.set_message(800, 'HR_51951_AHC_CALL_PRO_NO_EXIST');
746: l_describe_error := true;
747: hr_utility.set_location(l_proc, 30);
748: when Remote_Object then
749: -- Error: Remote objects cannot be called from API User Hooks.
743: -- Error: The call_procedure does not exist in the call_package.
744: -- Code to carry out this hook call has not been created.
745: hr_utility.set_message(800, 'HR_51951_AHC_CALL_PRO_NO_EXIST');
746: l_describe_error := true;
747: hr_utility.set_location(l_proc, 30);
748: when Remote_Object then
749: -- Error: Remote objects cannot be called from API User Hooks.
750: -- Code to carry out this hook call has not been created.
751: hr_utility.set_message(800, 'HR_51952_AHC_CALL_REMOTE_OBJ');
747: hr_utility.set_location(l_proc, 30);
748: when Remote_Object then
749: -- Error: Remote objects cannot be called from API User Hooks.
750: -- Code to carry out this hook call has not been created.
751: hr_utility.set_message(800, 'HR_51952_AHC_CALL_REMOTE_OBJ');
752: l_describe_error := true;
753: hr_utility.set_location(l_proc, 40);
754: when Invalid_Package then
755: -- Error: The call_package code in the database is invalid.
749: -- Error: Remote objects cannot be called from API User Hooks.
750: -- Code to carry out this hook call has not been created.
751: hr_utility.set_message(800, 'HR_51952_AHC_CALL_REMOTE_OBJ');
752: l_describe_error := true;
753: hr_utility.set_location(l_proc, 40);
754: when Invalid_Package then
755: -- Error: The call_package code in the database is invalid.
756: -- Code to carry out this hook call has not been created.
757: hr_utility.set_message(800, 'HR_51953_AHC_CALL_PKG_INVALID');
753: hr_utility.set_location(l_proc, 40);
754: when Invalid_Package then
755: -- Error: The call_package code in the database is invalid.
756: -- Code to carry out this hook call has not been created.
757: hr_utility.set_message(800, 'HR_51953_AHC_CALL_PKG_INVALID');
758: l_describe_error := true;
759: hr_utility.set_location(l_proc, 50);
760: when Invalid_Object_Name then
761: -- Error: An error has occurred while attempting to parse the name of
755: -- Error: The call_package code in the database is invalid.
756: -- Code to carry out this hook call has not been created.
757: hr_utility.set_message(800, 'HR_51953_AHC_CALL_PKG_INVALID');
758: l_describe_error := true;
759: hr_utility.set_location(l_proc, 50);
760: when Invalid_Object_Name then
761: -- Error: An error has occurred while attempting to parse the name of
762: -- the call package and call procedure. Check the package and procedure
763: -- names. Code to carry out this hook call has not been created.
760: when Invalid_Object_Name then
761: -- Error: An error has occurred while attempting to parse the name of
762: -- the call package and call procedure. Check the package and procedure
763: -- names. Code to carry out this hook call has not been created.
764: hr_utility.set_message(800, 'HR_51954_AHC_CALL_PARSE');
765: l_describe_error := true;
766: hr_utility.set_location(l_proc, 60);
767: end;
768: hr_utility.set_location(l_proc, 70);
762: -- the call package and call procedure. Check the package and procedure
763: -- names. Code to carry out this hook call has not been created.
764: hr_utility.set_message(800, 'HR_51954_AHC_CALL_PARSE');
765: l_describe_error := true;
766: hr_utility.set_location(l_proc, 60);
767: end;
768: hr_utility.set_location(l_proc, 70);
769: --
770: -- Only carry out the parameter validation if
764: hr_utility.set_message(800, 'HR_51954_AHC_CALL_PARSE');
765: l_describe_error := true;
766: hr_utility.set_location(l_proc, 60);
767: end;
768: hr_utility.set_location(l_proc, 70);
769: --
770: -- Only carry out the parameter validation if
771: -- hr_general.describe_procedure did not raise an error.
772: --
780: -- Build calling code with no parameters
781: --
782: l_call_code := p_call_package || '.' || p_call_procedure || ';';
783: l_call_code := l_call_code || c_new_line;
784: hr_utility.set_location(l_proc, 80);
785: else
786: --
787: -- Build calling code with parameters
788: --
786: --
787: -- Build calling code with parameters
788: --
789: l_call_code := p_call_package || '.' || p_call_procedure || c_new_line;
790: hr_utility.set_location(l_proc, 90);
791: --
792: -- Search through the tables returned to create the parameter list
793: --
794: l_loop := 1;
843: --
844: l_pre_overload := l_overload(l_loop);
845: l_loop := l_loop + 1;
846: end loop; -- end of while loop
847: hr_utility.set_location(l_proc, 100);
848: exception
849: when no_data_found then
850: -- Trap the PL/SQL no_data_found exception. Know we have already
851: -- read the details of the last parameter from the tables.
856: l_call_code := l_call_code || ');' || c_new_line;
857: end if;
858: end;
859: end if;
860: hr_utility.set_location(l_proc, 110);
861: --
862: if l_param_valid then
863: --
864: -- If the last parameter processed was valid then all the parameters must
927: add_to_source('-- investigation and resolution of this problem.');
928: add_to_source(c_new_line);
929: add_to_source('INVALID_SEE_COMMENT_IN_SOURCE;' || c_new_line);
930: end if;
931: hr_utility.set_location(l_proc, 120);
932: end if;
933: hr_utility.set_location(' Leaving:'|| l_proc, 130);
934: end make_procedure_call;
935: --
929: add_to_source('INVALID_SEE_COMMENT_IN_SOURCE;' || c_new_line);
930: end if;
931: hr_utility.set_location(l_proc, 120);
932: end if;
933: hr_utility.set_location(' Leaving:'|| l_proc, 130);
934: end make_procedure_call;
935: --
936: -- ----------------------------------------------------------------------------
937: -- |-------------------------< make_leg_function_call >-----------------------|
1030: l_pre_overload number; -- Overload number for the previous
1031: -- parameter.
1032: l_proc varchar2(72) := g_package||'make_leg_function_call';
1033: begin
1034: hr_utility.set_location('Entering:'|| l_proc, 10);
1035: --
1036: -- Build the code to call the specified legislation package function.
1037: -- Call an RDMS procedure to obtain the list of parameters to the
1038: -- legislation package function. A separate begin ... end block has been
1061: exception
1062: when Package_Not_Exists then
1063: -- Error: The legislation_package does not exist in the database.
1064: -- This API module will not execute until this problem has been resolved.
1065: hr_utility.set_message(800, 'HR_51955_AHK_LEG_PKG_NO_EXIST');
1066: l_err_found := true;
1067: hr_utility.set_location(l_proc, 20);
1068: when Proc_Not_In_Package then
1069: -- Error: The legislation_function does not exist in the
1063: -- Error: The legislation_package does not exist in the database.
1064: -- This API module will not execute until this problem has been resolved.
1065: hr_utility.set_message(800, 'HR_51955_AHK_LEG_PKG_NO_EXIST');
1066: l_err_found := true;
1067: hr_utility.set_location(l_proc, 20);
1068: when Proc_Not_In_Package then
1069: -- Error: The legislation_function does not exist in the
1070: -- legislation_package. This API module will not execute until this
1071: -- problem has been resolved.
1068: when Proc_Not_In_Package then
1069: -- Error: The legislation_function does not exist in the
1070: -- legislation_package. This API module will not execute until this
1071: -- problem has been resolved.
1072: hr_utility.set_message(800, 'HR_51956_AHK_LEG_FUN_NO_EXIST');
1073: l_err_found := true;
1074: hr_utility.set_location(l_proc, 30);
1075: when Remote_Object then
1076: -- Error: Remote objects cannot be called to find out the legislation
1070: -- legislation_package. This API module will not execute until this
1071: -- problem has been resolved.
1072: hr_utility.set_message(800, 'HR_51956_AHK_LEG_FUN_NO_EXIST');
1073: l_err_found := true;
1074: hr_utility.set_location(l_proc, 30);
1075: when Remote_Object then
1076: -- Error: Remote objects cannot be called to find out the legislation
1077: -- code. This API module will not execute until this problem has been
1078: -- resolved.
1075: when Remote_Object then
1076: -- Error: Remote objects cannot be called to find out the legislation
1077: -- code. This API module will not execute until this problem has been
1078: -- resolved.
1079: hr_utility.set_message(800, 'HR_51957_AHK_LEG_REMOTE_OBJ');
1080: l_err_found := true;
1081: hr_utility.set_location(l_proc, 40);
1082: when Invalid_Package then
1083: -- Error: The legislation_package code in the database is invalid.
1077: -- code. This API module will not execute until this problem has been
1078: -- resolved.
1079: hr_utility.set_message(800, 'HR_51957_AHK_LEG_REMOTE_OBJ');
1080: l_err_found := true;
1081: hr_utility.set_location(l_proc, 40);
1082: when Invalid_Package then
1083: -- Error: The legislation_package code in the database is invalid.
1084: -- This API module will not execute until this problem has been resolved.
1085: hr_utility.set_message(800, 'HR_51958_AHK_LEG_PKG_INVALID');
1081: hr_utility.set_location(l_proc, 40);
1082: when Invalid_Package then
1083: -- Error: The legislation_package code in the database is invalid.
1084: -- This API module will not execute until this problem has been resolved.
1085: hr_utility.set_message(800, 'HR_51958_AHK_LEG_PKG_INVALID');
1086: l_err_found := true;
1087: hr_utility.set_location(l_proc, 50);
1088: when Invalid_Object_Name then
1089: -- Error: An error has occurred while attempting to parse the name of
1083: -- Error: The legislation_package code in the database is invalid.
1084: -- This API module will not execute until this problem has been resolved.
1085: hr_utility.set_message(800, 'HR_51958_AHK_LEG_PKG_INVALID');
1086: l_err_found := true;
1087: hr_utility.set_location(l_proc, 50);
1088: when Invalid_Object_Name then
1089: -- Error: An error has occurred while attempting to parse the name of
1090: -- the legislation package and legislation function. Check the package
1091: -- and function names. This API module will not execute until this
1089: -- Error: An error has occurred while attempting to parse the name of
1090: -- the legislation package and legislation function. Check the package
1091: -- and function names. This API module will not execute until this
1092: -- problem has been resolved.
1093: hr_utility.set_message(800, 'HR_51959_AHK_LEG_PARSE');
1094: l_err_found := true;
1095: hr_utility.set_location(l_proc, 60);
1096: end;
1097: hr_utility.set_location(l_proc, 70);
1091: -- and function names. This API module will not execute until this
1092: -- problem has been resolved.
1093: hr_utility.set_message(800, 'HR_51959_AHK_LEG_PARSE');
1094: l_err_found := true;
1095: hr_utility.set_location(l_proc, 60);
1096: end;
1097: hr_utility.set_location(l_proc, 70);
1098: --
1099: -- Only carry out the parameter validation if
1093: hr_utility.set_message(800, 'HR_51959_AHK_LEG_PARSE');
1094: l_err_found := true;
1095: hr_utility.set_location(l_proc, 60);
1096: end;
1097: hr_utility.set_location(l_proc, 70);
1098: --
1099: -- Only carry out the parameter validation if
1100: -- hr_general.describe_procedure did not raise an error.
1101: --
1108: if l_argument_name(1) is not null then
1109: -- Error: The legislation function can only be a function. It cannot be
1110: -- a procedure. This API module will not execute until this problem has
1111: -- been resolved.
1112: hr_utility.set_message(800, 'HR_51965_AHK_LEG_MUST_FUN');
1113: l_err_found := true;
1114: hr_utility.set_location(l_proc, 80);
1115: --
1116: -- Ensure the function return datatype is varchar2.
1110: -- a procedure. This API module will not execute until this problem has
1111: -- been resolved.
1112: hr_utility.set_message(800, 'HR_51965_AHK_LEG_MUST_FUN');
1113: l_err_found := true;
1114: hr_utility.set_location(l_proc, 80);
1115: --
1116: -- Ensure the function return datatype is varchar2.
1117: --
1118: elsif l_datatype(1) <> c_dtype_varchar2 then
1117: --
1118: elsif l_datatype(1) <> c_dtype_varchar2 then
1119: -- Error: The legislation function must return a varchar2 value. This
1120: -- API module will not execute until this problem has been resolved.
1121: hr_utility.set_message(800, 'HR_51966_AHK_LEG_RTN_VARCHAR');
1122: l_err_found := true;
1123: hr_utility.set_location(l_proc, 90);
1124: end if;
1125: hr_utility.set_location(l_proc, 100);
1119: -- Error: The legislation function must return a varchar2 value. This
1120: -- API module will not execute until this problem has been resolved.
1121: hr_utility.set_message(800, 'HR_51966_AHK_LEG_RTN_VARCHAR');
1122: l_err_found := true;
1123: hr_utility.set_location(l_proc, 90);
1124: end if;
1125: hr_utility.set_location(l_proc, 100);
1126: if not l_err_found then
1127: --
1121: hr_utility.set_message(800, 'HR_51966_AHK_LEG_RTN_VARCHAR');
1122: l_err_found := true;
1123: hr_utility.set_location(l_proc, 90);
1124: end if;
1125: hr_utility.set_location(l_proc, 100);
1126: if not l_err_found then
1127: --
1128: -- Build the function call and parameter list. Checking that the
1129: -- required parameters are available in the hook package procedure.
1133: -- across an error would be raised.
1134: --
1135: l_call_code := 'l_legislation_code := ' || p_legislation_package || '.';
1136: l_call_code := l_call_code || p_legislation_function;
1137: hr_utility.set_location(l_proc, 110);
1138: --
1139: -- Search through the tables returned to create the parameter list
1140: --
1141: l_loop := 2;
1195: --
1196: l_pre_overload := l_overload(l_loop);
1197: l_loop := l_loop + 1;
1198: end loop; -- end of while loop
1199: hr_utility.set_location(l_proc, 120);
1200: exception
1201: when no_data_found then
1202: -- Trap the PL/SQL no_data_found exception. Know we have already
1203: -- read the details of the last parameter from the tables.
1210: l_call_code := l_call_code || ');' || c_new_line;
1211: end if;
1212: end;
1213: end if;
1214: hr_utility.set_location(l_proc, 130);
1215: --
1216: -- If no errors have been found then all the parameters must be valid.
1217: -- Add the find legislation source code to the rest of the hook package
1218: -- source code.
1219: --
1220: if not l_err_found then
1221: add_to_source(l_call_code);
1222: end if;
1223: hr_utility.set_location(l_proc, 140);
1224: end if;
1225: hr_utility.set_location(' Leaving:'|| l_proc, 150);
1226: return not l_err_found;
1227: end make_leg_function_call;
1221: add_to_source(l_call_code);
1222: end if;
1223: hr_utility.set_location(l_proc, 140);
1224: end if;
1225: hr_utility.set_location(' Leaving:'|| l_proc, 150);
1226: return not l_err_found;
1227: end make_leg_function_call;
1228: --
1229: -- ----------------------------------------------------------------------------
1290: -- Either p_business_group_id or
1291: -- p_business_group_id_o.
1292: l_proc varchar2(72) := g_package||'make_leg_bus_grp_call';
1293: begin
1294: hr_utility.set_location('Entering:'|| l_proc, 10);
1295: --
1296: -- Check that the p_business_group_id parameter actually exists in the
1297: -- hook package procedure parameter list. Search through the parameter
1298: -- names table until the p_business_group_id parameter is found or the
1307: l_bus_grp_found := true;
1308: end if;
1309: end if;
1310: end loop;
1311: hr_utility.set_location(l_proc, 20);
1312: --
1313: -- If the p_business_group_id parameter could not be found then search
1314: -- through the parameter list again for p_business_group_id_o.
1315: --
1315: --
1316: if not l_bus_grp_found then
1317: l_find_parameter := 'P_BUSINESS_GROUP_ID_O';
1318: l_loop := 0;
1319: hr_utility.set_location(l_proc, 30);
1320: while (not l_bus_grp_found) and (l_loop < p_number_of_parameters) loop
1321: l_loop := l_loop + 1;
1322: if p_hook_parameter_names(l_loop) = l_find_parameter then
1323: -- Check the datatype is NUMBER
1326: end if;
1327: end if;
1328: end loop;
1329: end if;
1330: hr_utility.set_location(l_proc, 40);
1331: --
1332: -- If the p_business_group_id or p_business_group_id_o number parameter
1333: -- has been found then generate a call to the hr_api.return_legislation_code
1334: -- function. Otherwise place an error message on the AOL message stack.
1336: if l_bus_grp_found then
1337: add_to_source('l_legislation_code := hr_api.return_legislation_code');
1338: add_to_source('(p_business_group_id => ' || l_find_parameter);
1339: add_to_source(');' || c_new_line);
1340: hr_utility.set_location(l_proc, 50);
1341: else
1342: -- Error: The legislation specific code cannot be called from this hook.
1343: -- The legislation package function has not been specified in the
1344: -- HR_API_HOOKS table, and the business_group_id value is not available
1343: -- The legislation package function has not been specified in the
1344: -- HR_API_HOOKS table, and the business_group_id value is not available
1345: -- at this hook. This API module will not execute until this problem has
1346: -- been resolved.
1347: hr_utility.set_message(800, 'HR_51967_AHK_LEG_NO_SPECIFIC');
1348: hr_utility.set_location(l_proc, 60);
1349: end if;
1350: hr_utility.set_location(' Leaving:'|| l_proc, 70);
1351: return l_bus_grp_found;
1344: -- HR_API_HOOKS table, and the business_group_id value is not available
1345: -- at this hook. This API module will not execute until this problem has
1346: -- been resolved.
1347: hr_utility.set_message(800, 'HR_51967_AHK_LEG_NO_SPECIFIC');
1348: hr_utility.set_location(l_proc, 60);
1349: end if;
1350: hr_utility.set_location(' Leaving:'|| l_proc, 70);
1351: return l_bus_grp_found;
1352: end make_leg_bus_grp_call;
1346: -- been resolved.
1347: hr_utility.set_message(800, 'HR_51967_AHK_LEG_NO_SPECIFIC');
1348: hr_utility.set_location(l_proc, 60);
1349: end if;
1350: hr_utility.set_location(' Leaving:'|| l_proc, 70);
1351: return l_bus_grp_found;
1352: end make_leg_bus_grp_call;
1353: --
1354: -- ----------------------------------------------------------------------------
1420: l_encoded_err_text varchar2(2000); -- When an error has occurred set to the
1421: -- AOL encoded error message text.
1422: l_proc varchar2(72) := g_package||'make_find_legislation';
1423: begin
1424: hr_utility.set_location('Entering:'|| l_proc, 10);
1425: --
1426: -- Build the source code which will find out the current legislation code
1427: --
1428: if (p_legislation_package is not null) and
1437: ,p_number_of_parameters => p_number_of_parameters
1438: ,p_hook_parameter_names => p_hook_parameter_names
1439: ,p_hook_parameter_datatypes => p_hook_parameter_datatypes
1440: );
1441: hr_utility.set_location(l_proc, 20);
1442: else
1443: --
1444: -- Otherwise the legislation_package and legislation_function has not
1445: -- been specified. Attempt to build the code which will use the
1450: (p_number_of_parameters => p_number_of_parameters
1451: ,p_hook_parameter_names => p_hook_parameter_names
1452: ,p_hook_parameter_datatypes => p_hook_parameter_datatypes
1453: );
1454: hr_utility.set_location(l_proc, 30);
1455: end if;
1456: --
1457: if not l_code_created then
1458: --
1491: add_to_source('created to force' || c_new_line);
1492: add_to_source('-- investigation and resolution of this problem.');
1493: add_to_source(c_new_line);
1494: add_to_source('INVALID_SEE_COMMENT_IN_SOURCE;' || c_new_line);
1495: hr_utility.set_location(l_proc, 40);
1496: --
1497: -- Write details of the error to the HR_API_HOOKS table
1498: --
1499: l_encoded_err_text := fnd_message.get_encoded;
1503: --
1504: update hr_api_hooks
1505: set encoded_error = l_encoded_err_text
1506: where api_hook_id = p_api_hook_id;
1507: hr_utility.set_location(l_proc, 50);
1508: end if;
1509: hr_utility.set_location(' Leaving:'|| l_proc, 60);
1510: end make_find_legislation;
1511: --
1505: set encoded_error = l_encoded_err_text
1506: where api_hook_id = p_api_hook_id;
1507: hr_utility.set_location(l_proc, 50);
1508: end if;
1509: hr_utility.set_location(' Leaving:'|| l_proc, 60);
1510: end make_find_legislation;
1511: --
1512: -- ----------------------------------------------------------------------------
1513: -- |------------------------< make_legislation_calls >------------------------|
1594: l_last_legislation varchar2(30); -- Remembers which legislation the
1595: -- last specific call was for.
1596: l_proc varchar2(72) := g_package||'make_legislation_calls';
1597: begin
1598: hr_utility.set_location('Entering:'|| l_proc, 10);
1599: --
1600: -- Add support call to allow for legislation hook switch off
1601: --
1602: add_to_source('if hr_api.call_leg_hooks then' || c_new_line);
1599: --
1600: -- Add support call to allow for legislation hook switch off
1601: --
1602: add_to_source('if hr_api.call_leg_hooks then' || c_new_line);
1603: hr_utility.set_location(l_proc, 20);
1604: --
1605: -- Build the source code which will find out the current legislation code
1606: -- when the data is held within the context of a business_group_id
1607: --
1614: ,p_hook_parameter_names => p_hook_parameter_names
1615: ,p_hook_parameter_datatypes => p_hook_parameter_datatypes
1616: );
1617: end if;
1618: hr_utility.set_location(l_proc, 30);
1619: --
1620: -- Build the list of legislation procedure calls
1621: --
1622: l_first_leg_call := true;
1670: ,p_hook_parameter_names => p_hook_parameter_names
1671: ,p_hook_parameter_datatypes => p_hook_parameter_datatypes
1672: );
1673: end loop;
1674: hr_utility.set_location(l_proc, 40);
1675: --
1676: -- Close the legislation if elsif ladder when the data is held within the
1677: -- context of a business_group_id and at least one legislation specific
1678: -- hook call has been made. (The if elsif ladder will not have started when
1684: --
1685: -- Close the support if statement
1686: --
1687: add_to_source('end if;' || c_new_line);
1688: hr_utility.set_location(' Leaving:'|| l_proc, 50);
1689: end make_legislation_calls;
1690: --
1691: -- ----------------------------------------------------------------------------
1692: -- |------------------------< make_application_calls >------------------------|
1755: order by ahc.sequence;
1756: --
1757: l_proc varchar2(72) := g_package||'make_application_calls';
1758: begin
1759: hr_utility.set_location('Entering:'|| l_proc, 10);
1760: --
1761: -- Add support call to allow for application hook switch off
1762: --
1763: add_to_source('if hr_api.call_app_hooks then' || c_new_line);
1760: --
1761: -- Add support call to allow for application hook switch off
1762: --
1763: add_to_source('if hr_api.call_app_hooks then' || c_new_line);
1764: hr_utility.set_location(l_proc, 20);
1765: --
1766: -- Build the list of legislation procedure calls
1767: --
1768: for l_app_calls in csr_app_calls loop
1783: --
1784: -- Close the support if statement
1785: --
1786: add_to_source('end if;' || c_new_line);
1787: hr_utility.set_location(' Leaving:'|| l_proc, 50);
1788: end make_application_calls;
1789: --
1790: -- ----------------------------------------------------------------------------
1791: -- |--------------------------< make_customer_calls >-------------------------|
1853: l_call_package varchar2(30); -- Value from Dynamic cursor
1854: l_call_procedure varchar2(30); -- Value from Dynamic cursor
1855: l_proc varchar2(72) := g_package||'make_customer_calls';
1856: begin
1857: hr_utility.set_location('Entering:'|| l_proc, 10);
1858: --
1859: -- Construct the SQL statement to be used. Dynamic SQL is being used
1860: -- because the rows to be processed depending on the sequence number
1861: -- range.
1888: --
1889: -- The p_sequence_number_range parameter
1890: -- has been set to an invalid value.
1891: --
1892: hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
1893: hr_utility.set_message_token('PROCEDURE', l_proc);
1894: hr_utility.set_message_token('STEP','20');
1895: hr_utility.raise_error;
1896: end if;
1889: -- The p_sequence_number_range parameter
1890: -- has been set to an invalid value.
1891: --
1892: hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
1893: hr_utility.set_message_token('PROCEDURE', l_proc);
1894: hr_utility.set_message_token('STEP','20');
1895: hr_utility.raise_error;
1896: end if;
1897: --
1890: -- has been set to an invalid value.
1891: --
1892: hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
1893: hr_utility.set_message_token('PROCEDURE', l_proc);
1894: hr_utility.set_message_token('STEP','20');
1895: hr_utility.raise_error;
1896: end if;
1897: --
1898: -- Execute the Dynamic SQL statement which has been created
1891: --
1892: hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
1893: hr_utility.set_message_token('PROCEDURE', l_proc);
1894: hr_utility.set_message_token('STEP','20');
1895: hr_utility.raise_error;
1896: end if;
1897: --
1898: -- Execute the Dynamic SQL statement which has been created
1899: --
1898: -- Execute the Dynamic SQL statement which has been created
1899: --
1900: -- Open dynamic cursor
1901: l_dynamic_cursor := dbms_sql.open_cursor;
1902: hr_utility.set_location(l_proc, 30);
1903: --
1904: -- Parse dynamic SQL
1905: dbms_sql.parse(l_dynamic_cursor, l_dynamic_sql, dbms_sql.v7);
1906: hr_utility.set_location(l_proc, 40);
1902: hr_utility.set_location(l_proc, 30);
1903: --
1904: -- Parse dynamic SQL
1905: dbms_sql.parse(l_dynamic_cursor, l_dynamic_sql, dbms_sql.v7);
1906: hr_utility.set_location(l_proc, 40);
1907: --
1908: -- Bind dynamic SQL variable
1909: dbms_sql.bind_variable(l_dynamic_cursor, ':p_api_hook_id', p_api_hook_id);
1910: hr_utility.set_location(l_proc, 50);
1906: hr_utility.set_location(l_proc, 40);
1907: --
1908: -- Bind dynamic SQL variable
1909: dbms_sql.bind_variable(l_dynamic_cursor, ':p_api_hook_id', p_api_hook_id);
1910: hr_utility.set_location(l_proc, 50);
1911: --
1912: -- Define dynamic SQL columns
1913: dbms_sql.define_column(l_dynamic_cursor, 1, l_api_hook_call_id);
1914: dbms_sql.define_column(l_dynamic_cursor, 2, l_object_version_number);
1913: dbms_sql.define_column(l_dynamic_cursor, 1, l_api_hook_call_id);
1914: dbms_sql.define_column(l_dynamic_cursor, 2, l_object_version_number);
1915: dbms_sql.define_column(l_dynamic_cursor, 3, l_call_package, 30);
1916: dbms_sql.define_column(l_dynamic_cursor, 4, l_call_procedure, 30);
1917: hr_utility.set_location(l_proc, 60);
1918: --
1919: -- Execute and fetch dynamic SQL
1920: --
1921: l_first_cus_call := true;
1919: -- Execute and fetch dynamic SQL
1920: --
1921: l_first_cus_call := true;
1922: l_execute := dbms_sql.execute(l_dynamic_cursor);
1923: hr_utility.set_location(l_proc, 70);
1924: while dbms_sql.fetch_rows(l_dynamic_cursor) > 0 loop
1925: --
1926: -- Get the column values for the current row
1927: --
1933: --
1934: -- Add support call to allow for customer hook switch off
1935: --
1936: add_to_source('if hr_api.call_cus_hooks then' || c_new_line);
1937: hr_utility.set_location(l_proc, 80);
1938: l_first_cus_call := false;
1939: end if;
1940: --
1941: -- Build the actual procedure call
1950: ,p_hook_parameter_names => p_hook_parameter_names
1951: ,p_hook_parameter_datatypes => p_hook_parameter_datatypes
1952: );
1953: end loop;
1954: hr_utility.set_location(l_proc, 90);
1955: --
1956: -- Close Dynamic Cursor
1957: --
1958: dbms_sql.close_cursor(l_dynamic_cursor);
1961: --
1962: if not l_first_cus_call then
1963: add_to_source('end if;' || c_new_line);
1964: end if;
1965: hr_utility.set_location(' Leaving:'|| l_proc, 100);
1966: exception
1967: --
1968: -- In case of an unexpected error ensure
1969: -- that the Dynamic Cursor is closed.
2025: and api_hook_id = p_api_hook_id;
2026: --
2027: l_proc varchar2(72) := g_package||'update_disabled_calls';
2028: begin
2029: hr_utility.set_location('Entering:'|| l_proc, 10);
2030: --
2031: -- Update all disabled, hook calls for a particular hook
2032: --
2033: for l_disabled in csr_disabled loop
2040: , object_version_number = object_version_number + 1
2041: where api_hook_call_id = l_disabled.api_hook_call_id
2042: and object_version_number = l_disabled.object_version_number;
2043: end loop; -- End Disabled Loop
2044: hr_utility.set_location(' Leaving:'|| l_proc, 20);
2045: end update_disabled_calls;
2046: --
2047: -- ----------------------------------------------------------------------------
2048: -- |----------------------------< procedure_code >----------------------------|
2192: -- before_process hook.
2193: l_exists number(15);
2194: l_proc varchar2(72) := g_package||'procedure_code';
2195: begin
2196: hr_utility.set_location('Entering:'|| l_proc, 10);
2197: --
2198: -- Work out the status of the all the types of hook call. These values
2199: -- affect how much code should be created in the hook procedure.
2200: --
2204: open csr_cus_call_exist;
2205: fetch csr_cus_call_exist into l_exists;
2206: l_cus_call_exist := csr_cus_call_exist%found;
2207: close csr_cus_call_exist;
2208: hr_utility.set_location(l_proc, 20);
2209: --
2210: -- Find out if any enabled, legislation hook calls exist for the
2211: -- current hook package procedure
2212: --
2213: open csr_leg_call_exist;
2214: fetch csr_leg_call_exist into l_exists;
2215: l_leg_call_exist := csr_leg_call_exist%found;
2216: close csr_leg_call_exist;
2217: hr_utility.set_location(l_proc, 30);
2218: --
2219: -- Find out if any enabled, application hook calls exist which
2220: -- match the called Application install status for the
2221: -- current hook package procedure
2223: open csr_app_call_exist;
2224: fetch csr_app_call_exist into l_exists;
2225: l_app_call_exist := csr_app_call_exist%found;
2226: close csr_app_call_exist;
2227: hr_utility.set_location(l_proc, 35);
2228: --
2229: -- For before_process hooks where data is held within the context
2230: -- of a business group find out if any enabled, legislation
2231: -- specific hook calls exist for the corresponding after_process
2235: open csr_ap_leg_call_exist;
2236: fetch csr_ap_leg_call_exist into l_exists;
2237: l_ap_leg_call_exist := csr_ap_leg_call_exist%found;
2238: close csr_ap_leg_call_exist;
2239: hr_utility.set_location(l_proc, 40);
2240: else
2241: l_ap_leg_call_exist := false;
2242: hr_utility.set_location(l_proc, 50);
2243: end if;
2238: close csr_ap_leg_call_exist;
2239: hr_utility.set_location(l_proc, 40);
2240: else
2241: l_ap_leg_call_exist := false;
2242: hr_utility.set_location(l_proc, 50);
2243: end if;
2244: --
2245: -- Create the procedure code. Include or exclude sections depending
2246: -- on the existence of the different types of hook.
2258: add_to_source('l_legislation_code varchar2(30);' || c_new_line);
2259: -- Begin
2260: add_to_source('begin' || c_new_line);
2261: -- 'Entering' set location
2262: add_to_source('hr_utility.set_location(' || '''' || 'Entering: ');
2263: add_to_source(p_hook_package || '.' || p_hook_procedure || '''');
2264: add_to_source(', 10);' || c_new_line);
2265: hr_utility.set_location(l_proc, 60);
2266: --
2261: -- 'Entering' set location
2262: add_to_source('hr_utility.set_location(' || '''' || 'Entering: ');
2263: add_to_source(p_hook_package || '.' || p_hook_procedure || '''');
2264: add_to_source(', 10);' || c_new_line);
2265: hr_utility.set_location(l_proc, 60);
2266: --
2267: if l_cus_call_exist or l_leg_call_exist or l_app_call_exist then
2268: -- When a hook call will be made obtain the commit unit number
2269: add_to_source('l_commit_unit_number := hr_api.return_commit_unit;');
2267: if l_cus_call_exist or l_leg_call_exist or l_app_call_exist then
2268: -- When a hook call will be made obtain the commit unit number
2269: add_to_source('l_commit_unit_number := hr_api.return_commit_unit;');
2270: add_to_source(c_new_line);
2271: hr_utility.set_location(l_proc, 70);
2272: end if;
2273: --
2274: if l_leg_call_exist or l_app_call_exist or l_ap_leg_call_exist then
2275: --
2296: -- legislation or application specific hook call then include a
2297: -- call to hr_multi_message.end_validation_set. This is required
2298: -- to support Multiple Message Detection.
2299: --
2300: hr_utility.set_location(l_proc, 80);
2301: if l_cus_call_exist then
2302: --
2303: -- Process any customer specific calls with a low sequence number.
2304: --
2349: ,p_hook_parameter_names => p_hook_parameter_names
2350: ,p_hook_parameter_datatypes => p_hook_parameter_datatypes
2351: ,p_sequence_number_range => 'HIGH'
2352: );
2353: hr_utility.set_location(l_proc, 110);
2354: end if;
2355: --
2356: if p_api_hook_type = 'AP' and
2357: (l_leg_call_exist or l_app_call_exist) then
2376: ,p_hook_parameter_names => p_hook_parameter_names
2377: ,p_hook_parameter_datatypes => p_hook_parameter_datatypes
2378: ,p_sequence_number_range => 'ALL'
2379: );
2380: hr_utility.set_location(l_proc, 120);
2381: end if;
2382: --
2383: if l_cus_call_exist or l_leg_call_exist or l_app_call_exist then
2384: -- When a hook call has be made check that commit unit
2386: --
2387: add_to_source('hr_api.validate_commit_unit(l_commit_unit_number, ');
2388: add_to_source('''' || p_module_name || '''' || ', ' || '''');
2389: add_to_source(p_api_hook_type || '''' || ');' || c_new_line);
2390: hr_utility.set_location(l_proc, 130);
2391: end if;
2392: else
2393: --
2394: -- No enabled hook calls exist. Do not define any local variables.
2394: -- No enabled hook calls exist. Do not define any local variables.
2395: -- Just define the begin statement and the 'entering' set_location.
2396: --
2397: add_to_source('begin' || c_new_line);
2398: add_to_source('hr_utility.set_location(' || '''' || 'Entering: ');
2399: add_to_source(p_hook_package || '.' || p_hook_procedure || '''');
2400: add_to_source(', 10);' || c_new_line);
2401: hr_utility.set_location(l_proc, 140);
2402: end if;
2397: add_to_source('begin' || c_new_line);
2398: add_to_source('hr_utility.set_location(' || '''' || 'Entering: ');
2399: add_to_source(p_hook_package || '.' || p_hook_procedure || '''');
2400: add_to_source(', 10);' || c_new_line);
2401: hr_utility.set_location(l_proc, 140);
2402: end if;
2403: --
2404: -- Any hook calls which have been disabled ensure the encoded_error,
2405: -- status and pre_processor_date columns are updated.
2409: --
2410: update_disabled_calls
2411: (p_api_hook_id => p_api_hook_id
2412: );
2413: hr_utility.set_location(' Leaving:'|| l_proc, 150);
2414: end procedure_code;
2415: --
2416: -- ----------------------------------------------------------------------------
2417: -- |-------------------------< make_parameter_list >--------------------------|
2507: -- when an error is written to
2508: -- the HR_API_HOOKS table.
2509: l_proc varchar2(72) := g_package||'make_parameter_list';
2510: begin
2511: hr_utility.set_location('Entering:'|| l_proc, 10);
2512: --
2513: -- Call an RDMS procedure to obtain the list of parameters to the hook
2514: -- package procedure. A separate begin ... end block has been specified so
2515: -- that errors raised by hr_general.describe_procedure can be trapped and
2539: -- database. Either the package header has not been loaded into the
2540: -- database or the hook package name specified in the HR_API_HOOKS
2541: -- table is incorrect. This API module will not execute until this
2542: -- problem has been resolved.
2543: hr_utility.set_message(800, 'HR_51960_AHK_HK_PKG_NOT_FOUND');
2544: l_error := true;
2545: hr_utility.set_location(l_proc, 20);
2546: when Proc_Not_In_Package then
2547: -- Error: The hook procedure does not exist in the hook package.
2541: -- table is incorrect. This API module will not execute until this
2542: -- problem has been resolved.
2543: hr_utility.set_message(800, 'HR_51960_AHK_HK_PKG_NOT_FOUND');
2544: l_error := true;
2545: hr_utility.set_location(l_proc, 20);
2546: when Proc_Not_In_Package then
2547: -- Error: The hook procedure does not exist in the hook package.
2548: -- This API module will not execute until this problem has been
2549: -- resolved.
2546: when Proc_Not_In_Package then
2547: -- Error: The hook procedure does not exist in the hook package.
2548: -- This API module will not execute until this problem has been
2549: -- resolved.
2550: hr_utility.set_message(800, 'HR_51961_AHK_HK_PRO_NO_EXIST');
2551: l_error := true;
2552: hr_utility.set_location(l_proc, 30);
2553: when Remote_Object then
2554: -- Error: Remote objects cannot used for API hook package procedures.
2548: -- This API module will not execute until this problem has been
2549: -- resolved.
2550: hr_utility.set_message(800, 'HR_51961_AHK_HK_PRO_NO_EXIST');
2551: l_error := true;
2552: hr_utility.set_location(l_proc, 30);
2553: when Remote_Object then
2554: -- Error: Remote objects cannot used for API hook package procedures.
2555: -- This API module will not execute until this problem has been
2556: -- resolved.
2553: when Remote_Object then
2554: -- Error: Remote objects cannot used for API hook package procedures.
2555: -- This API module will not execute until this problem has been
2556: -- resolved.
2557: hr_utility.set_message(800, 'HR_51962_AHK_HK_REMOTE_OBJ');
2558: l_error := true;
2559: hr_utility.set_location(l_proc, 40);
2560: when Invalid_Package then
2561: -- Error: The hook package code in the database is invalid.
2555: -- This API module will not execute until this problem has been
2556: -- resolved.
2557: hr_utility.set_message(800, 'HR_51962_AHK_HK_REMOTE_OBJ');
2558: l_error := true;
2559: hr_utility.set_location(l_proc, 40);
2560: when Invalid_Package then
2561: -- Error: The hook package code in the database is invalid.
2562: -- This API module will not execute until this problem has been
2563: -- resolved.
2560: when Invalid_Package then
2561: -- Error: The hook package code in the database is invalid.
2562: -- This API module will not execute until this problem has been
2563: -- resolved.
2564: hr_utility.set_message(800, 'HR_51963_AHK_HK_PKG_INVALID');
2565: l_error := true;
2566: hr_utility.set_location(l_proc, 50);
2567: when Invalid_Object_Name then
2568: -- Error: An error has occurred while attempting to parse the name of
2562: -- This API module will not execute until this problem has been
2563: -- resolved.
2564: hr_utility.set_message(800, 'HR_51963_AHK_HK_PKG_INVALID');
2565: l_error := true;
2566: hr_utility.set_location(l_proc, 50);
2567: when Invalid_Object_Name then
2568: -- Error: An error has occurred while attempting to parse the name of
2569: -- the hook package and hook procedure. Check the package and procedure
2570: -- names. This API module will not execute until this problem has been
2568: -- Error: An error has occurred while attempting to parse the name of
2569: -- the hook package and hook procedure. Check the package and procedure
2570: -- names. This API module will not execute until this problem has been
2571: -- resolved.
2572: hr_utility.set_message(800, 'HR_51964_AHK_HK_PARSE');
2573: l_error := true;
2574: hr_utility.set_location(l_proc, 60);
2575: end;
2576: hr_utility.set_location(l_proc, 70);
2570: -- names. This API module will not execute until this problem has been
2571: -- resolved.
2572: hr_utility.set_message(800, 'HR_51964_AHK_HK_PARSE');
2573: l_error := true;
2574: hr_utility.set_location(l_proc, 60);
2575: end;
2576: hr_utility.set_location(l_proc, 70);
2577: --
2578: -- Only continue with the individual parameter validation if
2572: hr_utility.set_message(800, 'HR_51964_AHK_HK_PARSE');
2573: l_error := true;
2574: hr_utility.set_location(l_proc, 60);
2575: end;
2576: hr_utility.set_location(l_proc, 70);
2577: --
2578: -- Only continue with the individual parameter validation if
2579: -- hr_general.describe_procedure did not raise an error.
2580: --
2611: l_datatype(l_loop) <> c_dtype_long then
2612: -- Error: In a hook package procedure all the parameter datatypes
2613: -- must be VARCHAR2, NUMBER, DATE, BOOLEAN or LONG. This API
2614: -- module will not execute until this problem has been resolved.
2615: hr_utility.set_message(800, 'HR_51968_AHK_HK_PARA_D_TYPE');
2616: l_error := true;
2617: hr_utility.set_location(l_proc, 80);
2618: else
2619: -- Set the datatype string with the corresponding word value
2613: -- must be VARCHAR2, NUMBER, DATE, BOOLEAN or LONG. This API
2614: -- module will not execute until this problem has been resolved.
2615: hr_utility.set_message(800, 'HR_51968_AHK_HK_PARA_D_TYPE');
2616: l_error := true;
2617: hr_utility.set_location(l_proc, 80);
2618: else
2619: -- Set the datatype string with the corresponding word value
2620: if l_datatype(l_loop) = c_dtype_varchar2 then
2621: l_datatype_str := 'VARCHAR2';
2636: if l_in_out(l_loop) <> c_ptype_in then
2637: -- Error: In a hook package procedure all the parameters must IN
2638: -- parameters. OUT or IN/OUT parameters are not allowed. This API
2639: -- module will not execute until this problem has been resolved.
2640: hr_utility.set_message(800, 'HR_51969_AHK_HK_ONLY_IN_PARA');
2641: l_error := true;
2642: hr_utility.set_location(l_proc, 90);
2643: --
2644: -- Check the parameter does not have a default value.
2638: -- parameters. OUT or IN/OUT parameters are not allowed. This API
2639: -- module will not execute until this problem has been resolved.
2640: hr_utility.set_message(800, 'HR_51969_AHK_HK_ONLY_IN_PARA');
2641: l_error := true;
2642: hr_utility.set_location(l_proc, 90);
2643: --
2644: -- Check the parameter does not have a default value.
2645: --
2646: elsif l_default_value(l_loop) = c_default_defined then
2647: -- Error: You cannot define default values for parameters to a
2648: -- hook package procedure. Ensure no defaults are defined. This
2649: -- API module will not execute until this problem has been
2650: -- resolved.
2651: hr_utility.set_message(800, 'HR_51970_AHK_HK_NO_DEFLT_PARA');
2652: l_error := true;
2653: hr_utility.set_location(l_proc, 100);
2654: --
2655: -- Check the overload number has not changed. More than one PL/SQL
2649: -- API module will not execute until this problem has been
2650: -- resolved.
2651: hr_utility.set_message(800, 'HR_51970_AHK_HK_NO_DEFLT_PARA');
2652: l_error := true;
2653: hr_utility.set_location(l_proc, 100);
2654: --
2655: -- Check the overload number has not changed. More than one PL/SQL
2656: -- version of the same procedure is not allowed.
2657: --
2658: elsif l_pre_overload <> l_overload(l_loop) then
2659: -- Error: A hook package procedure cannot have any PL/SQL
2660: -- overloaded versions. This API module will not execute until
2661: -- this problem has been resolved.
2662: hr_utility.set_message(800, 'HR_51971_AHK_HK_NO_OVER');
2663: l_error := true;
2664: hr_utility.set_location(l_proc, 110);
2665: --
2666: -- Check the argument name has been set. If it is not set entry
2660: -- overloaded versions. This API module will not execute until
2661: -- this problem has been resolved.
2662: hr_utility.set_message(800, 'HR_51971_AHK_HK_NO_OVER');
2663: l_error := true;
2664: hr_utility.set_location(l_proc, 110);
2665: --
2666: -- Check the argument name has been set. If it is not set entry
2667: -- returned from hr_general.describe_procedure is for a function
2668: -- return value. Hook package functions should not be called.
2670: elsif l_argument_name(l_loop) is null then
2671: -- Error: The hook package procedure can only be a procedure. It
2672: -- cannot be a function. This API module will not execute until
2673: -- this problem has been resolved.
2674: hr_utility.set_message(800, 'HR_51972_AHK_HK_NO_FUNCTIONS');
2675: l_error := true;
2676: hr_utility.set_location(l_proc, 120);
2677: end if;
2678: --
2672: -- cannot be a function. This API module will not execute until
2673: -- this problem has been resolved.
2674: hr_utility.set_message(800, 'HR_51972_AHK_HK_NO_FUNCTIONS');
2675: l_error := true;
2676: hr_utility.set_location(l_proc, 120);
2677: end if;
2678: --
2679: if not l_error then
2680: --
2688: -- Have already processed the first parameter. Separate this
2689: -- parameter from the previous parameter with a ,
2690: l_param_code := l_param_code || ',';
2691: end if;
2692: hr_utility.set_location(l_proc, 130);
2693: --
2694: l_param_code := l_param_code || l_argument_name(l_loop) ||
2695: ' in ' || l_datatype_str || c_new_line;
2696: --
2712: --
2713: exit;
2714: end if;
2715: end loop step_through_param_list;
2716: hr_utility.set_location(l_proc, 140);
2717: exception
2718: when no_data_found then
2719: -- Trap the PL/SQL no_data_found exception. Know we have already
2720: -- read the details of the last parameter from the tables.
2726: end if;
2727: end;
2728: end if;
2729: end if;
2730: hr_utility.set_location(l_proc, 150);
2731: --
2732: -- Set the out parameters for this procedure and update
2733: -- the error details in the hr_api_hooks table.
2734: --
2754: --
2755: update hr_api_hooks
2756: set encoded_error = null
2757: where api_hook_id = p_api_hook_id;
2758: hr_utility.set_location(l_proc, 160);
2759: else
2760: --
2761: -- The parameter list code for this hook procedure could not be generated
2762: -- due to an error. Write details of the error to the HR_API_HOOKS table.
2783: 'created to force' || c_new_line ||
2784: '-- investigation and resolution of this problem.' ||
2785: c_new_line || 'INVALID_SEE_COMMENT_IN_SOURCE;' ||
2786: c_new_line;
2787: hr_utility.set_location(l_proc, 170);
2788: --
2789: -- Write details of the error to the HR_API_HOOKS table
2790: --
2791: l_encoded_err_text := fnd_message.get_encoded;
2795: --
2796: update hr_api_hooks
2797: set encoded_error = l_encoded_err_text
2798: where api_hook_id = p_api_hook_id;
2799: hr_utility.set_location(l_proc, 180);
2800: end if;
2801: --
2802: -- Add the parameter list or error comment text
2803: -- to the rest of the hook package source code
2802: -- Add the parameter list or error comment text
2803: -- to the rest of the hook package source code
2804: --
2805: add_to_source(l_param_code);
2806: hr_utility.set_location(' Leaving:'|| l_proc, 190);
2807: end make_parameter_list;
2808: --
2809: -- ----------------------------------------------------------------------------
2810: -- |-------------------------< make_hook_procedure >--------------------------|
2887: l_hook_parameter_datatypes tbl_parameter_datatype;
2888: --
2889: l_proc varchar2(72) := g_package||'make_hook_procedure';
2890: begin
2891: hr_utility.set_location('Entering:'|| l_proc, 10);
2892: --
2893: -- Start of the procedure code
2894: --
2895: add_to_source('procedure ' || p_hook_procedure || c_new_line);
2904: ,p_hook_parameter_names => l_hook_parameter_names
2905: ,p_hook_parameter_datatypes => l_hook_parameter_datatypes
2906: ,p_param_list_error => l_param_list_error
2907: );
2908: hr_utility.set_location(l_proc, 20);
2909: --
2910: -- When there are no problems with the hook package procedure header and
2911: -- parameters then build the remainder of the hook procedure source code.
2912: --
2927: ,p_number_of_parameters => l_number_of_parameters
2928: ,p_hook_parameter_names => l_hook_parameter_names
2929: ,p_hook_parameter_datatypes => l_hook_parameter_datatypes
2930: );
2931: hr_utility.set_location(l_proc, 30);
2932: --
2933: -- End of the procedure code
2934: --
2935: add_to_source('hr_utility.set_location(' || '''' || ' Leaving: ');
2931: hr_utility.set_location(l_proc, 30);
2932: --
2933: -- End of the procedure code
2934: --
2935: add_to_source('hr_utility.set_location(' || '''' || ' Leaving: ');
2936: add_to_source(p_hook_package || '.' || p_hook_procedure || '''');
2937: add_to_source(', 20);' || c_new_line ||'end ' || p_hook_procedure || ';');
2938: add_to_source(c_new_line);
2939: end if;
2937: add_to_source(', 20);' || c_new_line ||'end ' || p_hook_procedure || ';');
2938: add_to_source(c_new_line);
2939: end if;
2940: --
2941: hr_utility.set_location(' Leaving:'|| l_proc, 40);
2942: end make_hook_procedure;
2943: --
2944: -- ----------------------------------------------------------------------------
2945: -- |--------------------------< create_procedures >---------------------------|
2991: and ahk.hook_package = p_hook_package;
2992: --
2993: l_proc varchar2(72) := g_package||'create_procedures';
2994: begin
2995: hr_utility.set_location('Entering:'|| l_proc, 10);
2996: --
2997: -- For each procedure listed in the current hook package make
2998: -- the hook procedure call.
2999: --
3009: ,p_data_within_business_group => l_proc.data_within_business_group
3010: );
3011: end loop;
3012: --
3013: hr_utility.set_location(' Leaving:'|| l_proc, 20);
3014: end create_procedures;
3015: --
3016: -- ----------------------------------------------------------------------------
3017: -- |-------------------------< create_header_line >---------------------------|
3090: -- i.e. The third and second last
3091: -- letters do not equal 'RK' or 'BK'.
3092: l_proc varchar2(72) := g_package||'create_header_line';
3093: begin
3094: hr_utility.set_location('Entering:'|| l_proc, 10);
3095: --
3096: -- Primary Method
3097: -- --------------
3098: -- Where possible the filename and revision number for the hook package
3264: end if;
3265: end if;
3266: end if;
3267: --
3268: hr_utility.set_location(' Leaving:'||l_proc, 140);
3269: end create_header_line;
3270: --
3271: -- ----------------------------------------------------------------------------
3272: -- |-------------------------< create_package_body >--------------------------|
3277: ) is
3278: --
3279: l_proc varchar2(72) := g_package||'create_package_body';
3280: begin
3281: hr_utility.set_location('Entering:'|| l_proc, 10);
3282: clear_source;
3283: --
3284: -- Build code for the start of the hook package
3285: --
3313: -- source code which has been built up.
3314: --
3315: execute_source;
3316: --
3317: hr_utility.set_location(' Leaving:'||l_proc, 60);
3318: end create_package_body;
3319:
3320: end hr_api_user_hooks;