[Home] [Help]
PACKAGE BODY: APPS.PER_CANCEL_APPLICATION_API
Source
1 Package Body per_cancel_application_api as
2 /* $Header: pecapapi.pkb 115.2 2004/01/23 06:43:52 njaladi noship $ */
3 --
4 -- Package Variables
5 --
6 g_package varchar2(33) := 'per_cancel_application_api.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |--------------------------< cancel_application >--------------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure cancel_application
13 (p_validate in boolean default false
14 ,p_business_group_id in number
15 ,p_person_id in number
16 ,p_application_id in number
17 ) is
18 --
19 -- Declare cursors and local variables
20 --
21 cursor date_received is
22 select pa.date_received
23 from per_applications pa
24 where pa.person_id = p_person_id
25 and pa.application_id = p_application_id;
26 --
27 cursor get_person_type(p_received_date DATE) is
28 select pt.system_person_type,
29 p.effective_start_date
30 from per_all_people_f p,
31 per_person_types pt
32 where p.person_id = p_person_id
33 and p.person_type_id = pt.person_type_id
34 and p_received_date between
35 p.effective_start_date and p.effective_end_date ;
36 --
37 l_proc VARCHAR2(72) := g_package||'cancel_application';
38 l_system_person_type per_person_types.system_person_type%TYPE;
39 l_primary_date DATE;
40 l_date_received DATE;
41 l_cancel_type VARCHAR2(10) := 'APL';
42 l_where VARCHAR2(10) := 'BEGIN';
43 --
44 begin
45 hr_utility.set_location('Entering:'|| l_proc, 10);
46 --
47 -- Issue a savepoint
48 --
49 savepoint cancel_application;
50 --
51 -- Truncate the time portion from all IN date parameters
52 --
53 --
54 -- Initialise local variables
55 --
56 open date_received;
57 fetch date_received into l_date_received;
58 if date_received%notfound then
59 hr_utility.set_message(800,'PER_289080_APL_NON_EXIST');
60 hr_utility.raise_error;
61 end if;
62 close date_received;
63 --
64 open get_person_type(l_date_received);
65 fetch get_person_type into l_system_person_type, l_primary_date;
66 close get_person_type;
67 --
68 --
69 -- Call Before Process User Hook
70 --
71 begin
72 per_cancel_application_bk1.cancel_application_b
73 (p_business_group_id => p_business_group_id
74 ,p_person_id => p_person_id
75 ,p_application_id => p_application_id
76 );
77 exception
78 when hr_api.cannot_find_prog_unit then
79 hr_api.cannot_find_prog_unit_error
80 (p_module_name => 'cancel_application'
81 ,p_hook_type => 'BP'
82 );
83 end;
84 --
85 -- Validation in addition to Row Handlers
86 --
87 -- changed from l_system_person_type to 'APL' for fix of #3285486
88 --
89 per_cancel_hire_or_apl_pkg.pre_cancel_checks
90 (
91 p_person_id => p_person_id
92 ,p_where => l_where
93 ,p_business_group_id => p_business_group_id
94 ,p_system_person_type => 'APL' --l_system_person_type
95 ,p_primary_id => null
96 ,p_primary_date => l_primary_date
97 ,p_cancel_type => l_cancel_type
98 );
99 --
100 -- Process Logic
101 --
102 per_cancel_hire_or_apl_pkg.do_cancel_appl
103 (
104 p_person_id => p_person_id
105 ,p_date_received => l_date_received
106 ,p_end_of_time => hr_api.g_eot
107 ,p_business_group_id => p_business_group_id
108 ,p_application_id => p_application_id
109 );
110
111 --
112 -- Call After Process User Hook
113 --
114 begin
115 per_cancel_application_bk1.cancel_application_a
116 (p_business_group_id => p_business_group_id
117 ,p_person_id => p_person_id
118 ,p_application_id => p_application_id
119 );
120 exception
121 when hr_api.cannot_find_prog_unit then
122 hr_api.cannot_find_prog_unit_error
123 (p_module_name => 'cancel_application'
124 ,p_hook_type => 'AP'
125 );
126 end;
127 --
128 -- When in validation only mode raise the Validate_Enabled exception
129 --
130 if p_validate then
131 raise hr_api.validate_enabled;
132 end if;
133 --
134 -- Set all output arguments
135 --
136 --
137 hr_utility.set_location(' Leaving:'||l_proc, 70);
138 exception
139 when hr_api.validate_enabled then
140 --
141 -- As the Validate_Enabled exception has been raised
142 -- we must rollback to the savepoint
143 --
144 rollback to cancel_application;
145 --
146 -- Only set output warning arguments
147 -- (Any key or derived arguments must be set to null
148 -- when validation only mode is being used.)
149 --
150 hr_utility.set_location(' Leaving:'||l_proc, 80);
151 when others then
152 --
153 -- A validation or unexpected error has occured
154 --
155 rollback to cancel_application;
156 hr_utility.set_location(' Leaving:'||l_proc, 90);
157 raise;
158 end cancel_application;
159 --
160 end per_cancel_application_api;