DBA Data[Home] [Help]

PACKAGE BODY: APPS.GHR_HISTORY_CASCADE

Source


1 Package Body ghr_history_cascade as
2 /* $Header: ghcascad.pkb 115.31 2004/05/27 10:11:41 ajose ship $ */
3 --
4 -- forward declare all local procedures/functions
5 Procedure Cascade_People (
6 	p_pre_record			in	ghr_pa_history%rowtype,
7 	p_post_record			in	ghr_pa_history%rowtype,
8 	p_cascade_type			in	varchar2,
9 	p_interv_on_eff_date		in	Boolean,
10 	p_hist_data_as_of_date		in	ghr_pa_history%rowtype
11 );
12 
13 Procedure Cascade_asgn (
14 	p_pre_record			in	ghr_pa_history%rowtype,
15 	p_post_record			in	ghr_pa_history%rowtype,
16 	p_cascade_type			in	varchar2,
17 	p_interv_on_eff_date		in	Boolean,
18 	p_hist_data_as_of_date		in	ghr_pa_history%rowtype
19 );
20 
21 Procedure Cascade_peopleei (
22 	p_post_record	in	ghr_pa_history%rowtype
23 );
24 
25 Procedure Cascade_asgnei (
26 	p_post_record	in	ghr_pa_history%rowtype);
27 
28 Procedure Cascade_posnei (
29 	p_post_record	in	ghr_pa_history%rowtype
30 	);
31 
32 /*
33 Procedure Cascade_posn (
34 	p_post_record	in	ghr_pa_history%rowtype
35 	);
36 */
37 
38 Procedure Cascade_posn (
39 	p_pre_record			in	ghr_pa_history%rowtype,
40 	p_post_record			in	ghr_pa_history%rowtype,
41 	p_cascade_type			in	varchar2,
42 	p_interv_on_eff_date		in	Boolean,
43 	p_hist_data_as_of_date		in	ghr_pa_history%rowtype
44 );
45 
46 Procedure Cascade_perana (
47 	p_post_record	in	ghr_pa_history%rowtype
48 	);
49 
50 Procedure Cascade_addresses (
51 	p_post_record	in	ghr_pa_history%rowtype	);
52 
53 Procedure correct_people_row (
54 	p_people_data in out nocopy per_all_people_f%rowtype);
55 
56 Procedure correct_asgn_row (
57 	p_asgn_data	in out nocopy per_all_assignments_f%rowtype);
58 
59 Procedure correct_peopleei_row ( p_peopleei_data	in out nocopy per_people_extra_info%rowtype);
60 
61 Procedure correct_addresses_row( p_addr_data	in out nocopy per_addresses%rowtype);
62 
63 Procedure correct_perana_row( p_perana_data	in out nocopy per_person_analyses%rowtype);
64 
65 Procedure Correct_posnei_row (p_posnei_data in out nocopy per_position_extra_info%rowtype);
66 
67 Procedure Correct_posn_row (p_posn_data in out nocopy hr_all_positions_f%rowtype);
68 
69 Procedure Correct_asgnei_row (
70 	p_asgnei_data in out nocopy per_assignment_extra_info%rowtype);
71 
72 Procedure cascade_change( p_pre_record           in     ghr_pa_history%rowtype,
73 			        p_post_record          in     ghr_pa_history%rowtype,
74 			        p_apply_record         in out nocopy ghr_pa_history%rowtype,
75 				  p_true_false           in out nocopy ghr_history_cascade.condition_rg_type
76                         );
77 
78 Procedure cascade_field_value( p_pre_field               in     ghr_pa_history.information1%type,
79 				       p_post_field              in     ghr_pa_history.information1%type,
80 					 p_apply_field             in out nocopy ghr_pa_history.information1%type,
81 					 p_result                  in out nocopy    boolean
82 				     );
83 
84 
85 Function Stop_cascade( p_true_false    ghr_history_cascade.condition_rg_type
86                      ) Return boolean;
87 
88 
89 Procedure cascade_dependencies( p_record         in     ghr_pa_history%rowtype,
90                                 p_apply_record   in out nocopy ghr_pa_history%rowtype
91                              );
92 
93 Procedure Fetch_most_recent_record(
94 		p_table_name 	 in	varchar2,
95 		p_table_pk_id	 in	varchar2,
96 		p_person_id		 in	number,
97 		p_history_data in out nocopy 	ghr_pa_history%rowtype,
98 		p_result_code  in out nocopy varchar2
99 );
100 
101 FUNCTION cascade_pa_req_field(p_refresh_field		in out nocopy varchar2,
102 					 p_shadow_field		in out nocopy varchar2,
103 					 p_sf52_field		in out nocopy varchar2,
104 					p_changed			in out nocopy boolean) return boolean;
105 
106 FUNCTION cascade_pa_req_field(p_refresh_field  in out nocopy  date,
107 					p_shadow_field  in out nocopy  date,
108 					p_sf52_field    in out nocopy  date,
109 					p_changed		in out nocopy boolean) return boolean;
110 
111 PROCEDURE copy_pa_req_field(	p_refresh_field in out nocopy  date,
112 					p_sf52_field    in out nocopy  date,
113 					p_changed	    in out nocopy 	boolean) ;
114 
115 PROCEDURE copy_pa_req_field(	p_refresh_field in out nocopy  varchar2,
116 					p_sf52_field    in out nocopy  varchar2,
117 					p_changed	    in out nocopy 	boolean) ;
118 -- end of forward declare of local procedures/functions
119 
120 -- ---------------------------------------------------------------------------
121 -- |--------------------------< cascade_history_data>-------------------------|
122 -- ---------------------------------------------------------------------------
123 -- {Start Of Comments}
124 --
125 -- Description:
126 --   	This procedure cascades data changes in ghr_pa_history table. If changes
127 --	have been made to a table and there were changes following it, this procedure
128 --	will correctly 'cascade' those changes to all following records.
129 --
130 -- Pre-Requisities:
131 --   	None.
132 --
133 -- In Parameters:
134 --	p_table_name		->	name of the table that this cascade is for.
135 --	p_person_id			->	person_id that this record is associated with.
136 --	p_pre_record		->	old value of row that has been changed by current sf52.
137 --	p_post_record		->	new value of row that has been changed by current sf52.
138 --	p_cascade_type		->	either 'retroactive' or cancel.
139 --	p_interv_on_table		->	output flag that indicates if there are any following records for this change.
140 --	p_interv_on_eff_date 	->	output flag that indicates if there are any following records on the same
141 --						date for this change.
142 --	p_hist_data_as_of_date	->	output data from history for the effective date of this action.
143 --
144 -- Post Success:
145 -- 	All data will have been cascaded to all following rows.
146 --
147 -- Post Failure:
148 --   Error would have been displayed to user and exception raised.
149 --
150 -- Developer Implementation Notes:
151 --   None
152 --
153 -- Access Status:
154 --   Internal Development Use Only.
155 --
156 -- {End Of Comments}
157 -- ---------------------------------------------------------------------------
158 
159 Procedure Cascade_History_data ( p_table_name		in	varchar2,
160                                  p_person_id		in	varchar2,
161 				         p_pre_record		in	ghr_pa_history%rowtype,
162  					   p_post_record        in	ghr_pa_history%rowtype,
163 					   p_cascade_type		in	varchar2,
164 					   p_interv_on_table out nocopy   boolean,
165 					   p_interv_on_eff_date out nocopy   boolean,
166    					   p_hist_data_as_of_date	 out nocopy ghr_pa_history%rowtype )
167 is
168 
169 	l_session_var	ghr_history_api.g_session_var_type;
170 	l_proc		varchar2(72) := 'Cascade_History_data';
171 	l_record_data	ghr_pa_history%rowtype;
172 	l_true_false	ghr_history_cascade.condition_rg_type;
173 	l_stop		boolean;
174 	l_num			number := 1;
175 	l_history_id	number;
176 	l_root_pa_history_id	ghr_pa_history.pa_history_id%type;
177 	l_root_pa_request_id	ghr_pa_history.pa_request_id%type;
178 	l_cascade_history		ghr_pa_history%rowtype;
179 
180 
181 -- To cascade changes in the history table, we need to fetch the history_ids in the exact order
182 -- in which changes have to be applied. For eg.
183 --  History_id     pa_request_id   altered_pa_request_id  effective_date
184 --
185 --    1              1                                       13-JUL-1997
186 --    2              2                                       15-JUL-1997
187 --    3              3                                       16-JUL-1997
188 --    4              4                                       17-JUL-1997
189 --    5              5                        2              16-JUL-1997
190 --    6              6                        5              16-JUL-1997
191 --    7              7                        4              17-JUL-1997
192 --    8              8                                       14-JUL-1997
193 --
194 --    Assuming that pa_request_id 8, corresponds to a retroaction, the foll. is the logic to
195 --    fetch other records to be cascaded.
196 --    Fetch only those records with effective_date > 14-JUL-1997, and the order in which they have
197 --    to  be cascaded is
198 --    2, followed by its correction 5,6
199 --    3
200 --    4  followed by its correction 7
201 --   To do this we first fetch all the history_ids which have null altered_pa_request_id
202 --   Then run a nested fetch to select all child records of the already fetched history_records one after the other.
203 --   cursor to fetch those history_ids from ghr_pa_history, which will be used as the root
204 
205 --   Cursor to select all root history_ids
206 
207 	Cursor c_history(c_table_name     varchar2,
208                        c_information1   varchar2,
209                        c_person_id      number,
210                        c_effective_date date,
211                        c_root_hist_id     number)
212 	is
213 		select PAH.*
214 		from ghr_pa_history pah
215 		where
216 		(table_name = c_table_name and information1 = c_information1 and nvl(person_id, -1) = nvl(c_person_id,-1)) and
217 		((effective_date = c_effective_date and
218 		(( c_root_hist_id < pah.pa_history_id and pah.pa_request_id is null)	or
219 		(pah.pa_request_id is not null and pah.altered_pa_request_id is null and c_root_hist_id <
220 		(select min(pa_history_id) from ghr_pa_history where pa_request_id = pah.pa_request_id
221 		and nature_of_action_id = pah.nature_of_action_id))			or
222 		(altered_pa_request_id is not null and c_root_hist_id <
223 				(select min(pa_history_id) from ghr_pa_history pah2
224 				 where pa_request_id = (select min(pa_request_id) from ghr_pa_requests
225 								connect by pa_request_id = prior altered_pa_request_id
226 								start with pa_request_id = pah.pa_request_id) and
227 										nature_of_action_id = pah.nature_of_action_id and
228 										not exists (select 'exists'
229 												from ghr_pa_history pah3
230 												where pah3.pa_request_id = pah.altered_pa_request_id and
231 													table_name = c_table_name and
232 													information1 = c_information1
233 													and pah3.nature_of_action_id = pah.nature_of_action_id)
234 												)
235 								)
236 					)) OR
237 		(effective_date > c_effective_date and
238 		((pah.pa_request_id is null) or
239 		(pah.pa_request_id is not null and pah.altered_pa_request_id is null) or
240 		(pah.altered_pa_request_id is not null and not exists
241 				(select 'exists'
242 				from ghr_pa_history pah4
243 				where pah4.pa_request_id = pah.altered_pa_request_id
244 				and table_name = c_table_name
245 				and information1	= c_information1
246 				and pah4.nature_of_action_id = pah.nature_of_action_id)))))
247 		order by effective_date , pa_history_id;
248 
249 
250 -- Cursor to fetch history_id in the order in which changes are to be cascaded.
251 	Cursor c_cascade_history(c_table_name    varchar2,
252                                c_information1  varchar2,
253                                c_person_id     number,
254                                c_history_id    number,
255                                c_noa_id        number,
256 					 c_pa_request_id number)
257      is
258 		Select      pah.*
259 		from        ghr_pa_history pah
260 		where       table_name              = c_table_name
261 		and         information1            = c_information1
262 --		and         person_id               = c_person_id
263 -- see comments in the cursor c_history
264 		and		pa_request_id in
265 					(select pa_request_id
266 					 from ghr_pa_requests
267 					 start with pa_request_id 		= c_pa_request_id
268 					 connect by prior pa_request_id	= altered_pa_request_id)
269 		and  nature_of_action_id   = c_noa_id
270 		order by 	pa_history_id;
271 	-- This cursor will retrieve the real root history id of a correction chain.
272 	-- i.e. - The root NOA independent of any particular table or row change.
273 	cursor get_root_hist_id(cp_pa_history_id	in	number) is
274 		select min(pa_history_id)
275 		from ghr_pa_history
276 		where pa_request_id =
277 			(select 	min(pa_request_id)
278 			from 		ghr_pa_requests
279 			connect by 	pa_request_id 		= prior altered_pa_request_id
280 			start with 	pa_request_id 		= 	(select 	pa_request_id
281 										from 		ghr_pa_history
282 										where 	pa_history_id = cp_pa_history_id))
283 		AND	nature_of_action_id			= 	(select 	nature_of_action_id
284 										from 		ghr_pa_history
285 										where 	pa_history_id = cp_pa_history_id);
286 
287 begin
288       hr_utility.set_location('Entering  '|| l_proc,5);
289       hr_utility.set_location('p_table_name  '|| p_table_name || l_proc,5);
290       hr_utility.set_location('p_cascade_type  '|| p_cascade_type || l_proc,5);
291 
292 	p_interv_on_eff_date	:=  FALSE;
293 	p_interv_on_table  	:=  FALSE;
294 
295 	ghr_history_api.get_g_session_var( l_session_var);
296 
297 	-- Initialize the true_false table with TRUE
298 	-- Since only information 4 thru' information101 can be cascaded
299       hr_utility.set_location(l_proc,10);
300 	For rowno in 7..101 loop   -- Bug 1161542 changed 4..101 to 7..101
301     		l_true_false(rowno) := TRUE;
302 	End loop;
303       hr_utility.set_location(l_proc,15);
304       hr_utility.set_location('p_post_record.pa_history_id: ' || p_post_record.pa_history_id || l_proc,2004);
305       hr_utility.set_location('p_post_record.information1: ' || p_post_record.information1 || l_proc,2006);
306       hr_utility.set_location('p_post_record.person_id: ' || p_post_record.person_id || l_proc,2007);
307       hr_utility.set_location('p_post_record.effective_date: ' || p_post_record.effective_date || l_proc,2008);
308       hr_utility.set_location('p_post_record.information9: ' || p_post_record.information9 || l_proc,2013);
309       hr_utility.set_location('p_post_record.information10: ' || p_post_record.information10 || l_proc,2014);
310       hr_utility.set_location('p_post_record.information11: ' || p_post_record.information11 || l_proc,2015);
311       hr_utility.set_location('p_post_record.information12: ' || p_post_record.information12 || l_proc,2016);
312       hr_utility.set_location('p_post_record.information13: ' || p_post_record.information13 || l_proc,2017);
313       hr_utility.set_location('p_post_record.information14: ' || p_post_record.information14 || l_proc,2018);
314 
315       hr_utility.set_location('p_pre_record.pa_request_id: ' || p_pre_record.pa_request_id || l_proc,2008);
316       hr_utility.set_location('p_pre_record.pa_history_id: ' || p_pre_record.pa_history_id || l_proc,2009);
317       hr_utility.set_location('p_pre_record.information1: ' || p_pre_record.information1 || l_proc,2010);
318       hr_utility.set_location('p_pre_record.person_id: ' || p_pre_record.person_id || l_proc,2011);
319       hr_utility.set_location('p_pre_record.effective_date: ' || p_pre_record.effective_date || l_proc,2012);
320       hr_utility.set_location('p_pre_record.information9: ' || p_pre_record.information9 || l_proc,2019);
321       hr_utility.set_location('p_pre_record.information10: ' || p_pre_record.information10 || l_proc,2020);
322       hr_utility.set_location('p_pre_record.information11: ' || p_pre_record.information11 || l_proc,2021);
323       hr_utility.set_location('p_pre_record.information12: ' || p_pre_record.information12 || l_proc,2022);
324       hr_utility.set_location('p_pre_record.information13: ' || p_pre_record.information13 || l_proc,2023);
325       hr_utility.set_location('p_pre_record.information14: ' || p_pre_record.information14 || l_proc,2024);
326 
327 	if (p_post_record.pa_request_id is null) then
328 	      hr_utility.set_location('gh: ' || l_proc,1000);
329 		--this is a core change, set root pa_history_id is the pa_history_id itself.
330 		l_root_pa_history_id := p_post_record.pa_history_id;
331 	else
332 	      hr_utility.set_location('gh: ' || l_proc,1001);
333 		open get_root_hist_id(cp_pa_history_id	=> p_post_record.pa_history_id);
334 	      hr_utility.set_location('gh: ' || l_proc,1002);
335 		fetch get_root_hist_id into l_root_pa_history_id;
336 	      hr_utility.set_location('gh: ' || l_proc,1003);
337 		if l_root_pa_history_id is null then
338 			close get_root_hist_id;
339   			hr_utility.set_message(8301,'GHR_38490_ROOT_HISTID_NFND');
340 	      	hr_utility.raise_error;
341 		end if;
342 		close get_root_hist_id;
343 	end if;
344       hr_utility.set_location('gh: ' || l_proc,1005);
345       hr_utility.set_location('l_root_pa_history_id: ' || l_root_pa_history_id || l_proc,2003);
346       hr_utility.set_location('p_post_record.information1: ' || p_post_record.information1 || l_proc,4010);
347       hr_utility.set_location('p_post_record.person_id : ' || p_post_record.person_id || l_proc,4011);
348       hr_utility.set_location('p_table_name: ' || p_table_name || l_proc,4012);
349       hr_utility.set_location('p_post_record.effective_date ' || p_post_record.effective_date || l_proc,2013);
350 
351 	-- Retrieve all root history_ids
352 	For history_data in c_history(p_table_name,
353       		                  p_post_record.information1,
354                   		      p_post_record.person_id,
355                               	P_post_record.effective_date,
356 						l_root_pa_history_id
357 	                              ) loop
358 		l_history_id  :=  history_data.pa_history_id;
359             hr_utility.set_location(l_proc,20);
360             hr_utility.set_location('l_history_id: ' || l_history_id || l_proc,2002);
361       hr_utility.set_location('l_root_pa_history_id: ' || l_root_pa_history_id || l_proc,2003);
362       hr_utility.set_location('p_post_record.information1: ' || p_post_record.information1 || l_proc,4010);
363       hr_utility.set_location('p_post_record.person_id : ' || p_post_record.person_id || l_proc,4011);
364       hr_utility.set_location('p_table_name: ' || p_table_name || l_proc,4012);
365       hr_utility.set_location('history_data.pa_history_id : ' || history_data.pa_history_id || l_proc,4019);
366       hr_utility.set_location('history_data.nature_of_action_id : ' || history_data.nature_of_action_id || l_proc,4020);
367 	hr_utility.set_location('history_data.pa_request_id : ' || history_data.pa_request_id || l_proc,4021);
368 
369 		-- If any record is retrieved then set p_interv_on_table to TRUE
370 		p_interv_on_table := TRUE;
371 		if (history_data.pa_request_id is not null) then
372 			-- non core change, open cursor to
373 			-- retrieve all subsequent child records in the order of correction, of the root history_id
374 			open c_cascade_history(	p_table_name,
375 	     	        				p_post_record.information1,
376 				                  p_post_record.person_id ,
377 				                  history_data.pa_history_id,
378 				                  history_data.nature_of_action_id,
379 							history_data.pa_request_id
380 					           );
381 		end if;
382 		LOOP
383 			-- note that there are two exit locations for this loop. This is the first. It
384 			-- is meant to handle non-core changes. The second appears at the end of the loop and
385 			-- is meant to handle core changes.
386 			if (history_data.pa_request_id is not null) then
387 				-- non core change, fetch cursor.
388 				fetch c_cascade_history into l_record_data;
389 				if c_cascade_history%NOTFOUND then
390 					exit;
391 				end if;
392 			else
393 				--core change
394 				l_record_data := history_data;
395 			end if;
396                   hr_utility.set_location(l_proc,25);
397 	            hr_utility.set_location('l_record_data.pa_history_id: ' || l_record_data.pa_history_id || l_proc,2005);
398       hr_utility.set_location('l_record_data.information1: ' || l_record_data.information1 || l_proc,3010);
399       hr_utility.set_location('l_record_data.person_id: ' || l_record_data.person_id || l_proc,3011);
400       hr_utility.set_location('l_record_data.effective_date: ' || l_record_data.effective_date || l_proc,3012);
401       hr_utility.set_location('l_record_data.information9: ' || l_record_data.information9 || l_proc,3019);
402       hr_utility.set_location('l_record_data.information10: ' || l_record_data.information10 || l_proc,3020);
403       hr_utility.set_location('l_record_data.information11: ' || l_record_data.information11 || l_proc,3021);
404       hr_utility.set_location('l_record_data.information12: ' || l_record_data.information12 || l_proc,3022);
405       hr_utility.set_location('l_record_data.information13: ' || l_record_data.information13 || l_proc,3023);
406       hr_utility.set_location('l_record_data.information14: ' || l_record_data.information14 || l_proc,3024);
407 
408 			if l_record_data.effective_date = l_session_var.date_effective then
409 				p_interv_on_eff_date := TRUE;
410 				p_hist_data_as_of_date := l_record_data;
411 			end if;
412 
413 			-- If cascade_type is 'retroactive' the new changes by the current SF52, which is the
414 			--  post_record in the history has to be cascaded to all the above fetched records from history
415 			if lower(p_cascade_Type)    = 'retroactive' then
416 
417                         hr_utility.set_location(l_proc,30);
418 				cascade_Change(p_pre_record   => p_Pre_record,
419                                        p_post_record  => p_Post_record,
420                                        p_apply_record => l_record_data,
421                                        p_true_false   => l_true_false
422                                        );
423                         hr_utility.set_location(l_proc,35);
424 
425 			elsif lower(p_cascade_Type) = 'cancel' then
426 
427                         hr_utility.set_location(l_proc,40);
428 				cascade_Change(p_pre_record   => p_Post_record,
429                                        p_post_record  => p_Pre_record,
430                                        p_apply_record => l_record_data,
431                                        p_true_false   => l_true_false
432                                       );
433                         hr_utility.set_location(l_proc,45);
434 
435 			else
436                         hr_utility.set_location(l_proc,50);
437 				hr_utility.set_message(8301, 'GHR_38225_UNKNOWN_CASCADE_TYPE');
438 				hr_utility.raise_error;
439 				--	raise error /* Unknown type */
440 			end if;
441       hr_utility.set_location('l_record_data.pa_history_id: ' || l_record_data.pa_history_id || l_proc,2009);
442       hr_utility.set_location('l_record_data.information1: ' || l_record_data.information1 || l_proc,2010);
443       hr_utility.set_location('l_record_data.person_id: ' || l_record_data.person_id || l_proc,2011);
444       hr_utility.set_location('l_record_data.effective_date: ' || l_record_data.effective_date || l_proc,2012);
445       hr_utility.set_location('l_record_data.information9: ' || l_record_data.information9 || l_proc,2019);
446       hr_utility.set_location('l_record_data.information10: ' || l_record_data.information10 || l_proc,2020);
447       hr_utility.set_location('l_record_data.information11: ' || l_record_data.information11 || l_proc,2021);
448       hr_utility.set_location('l_record_data.information12: ' || l_record_data.information12 || l_proc,2022);
449       hr_utility.set_location('l_record_data.information13: ' || l_record_data.information13 || l_proc,2023);
450       hr_utility.set_location('l_record_data.information14: ' || l_record_data.information14 || l_proc,2024);
451 			-- update history record  with changes to be cascaded :
452                  	hr_utility.set_location(l_proc,80);
453 			ghr_pah_upd.upd
454 			(
455 			p_pa_history_id                        =>  l_record_data.pa_history_id,
456 			p_pa_request_id                        =>  l_record_data.pa_request_id,
457 			p_process_date                         =>  l_record_data.process_date,
458 			p_nature_of_action_id                  =>  l_record_data.nature_of_action_id,
459 			P_effective_date                       =>  l_record_data.effective_date,
460 			p_altered_pa_request_id                =>  l_record_data.altered_pa_request_id,
461 			p_person_id                            =>  l_record_data.person_id,
462 			p_assignment_id                        =>  l_record_data.assignment_id,
463 			p_dml_operation                  	   =>  l_record_data.dml_operation,
464 			p_table_name                           =>  l_record_data.table_name,
465 			p_pre_values_flag                      =>  l_record_data.pre_values_flag,
466 			p_information1                         =>  l_record_data.information1,
467 			p_information2                         =>  l_record_data.information2,
468 			p_information3                         =>  l_record_data.information3,
469 			p_information4                         =>  l_record_data.information4,
470 			p_information5                         =>  l_record_data.information5,
471 			p_information6                         =>  l_record_data.information6,
472 			p_information7                         =>  l_record_data.information7,
473 			p_information8                         =>  l_record_data.information8,
474 			p_information9                         =>  l_record_data.information9,
475 			p_information10                        =>  l_record_data.information10,
476 			p_information11                        =>  l_record_data.information11,
477 			p_information12                        =>  l_record_data.information12,
478 			p_information13                        =>  l_record_data.information13,
479 			p_information14                        =>  l_record_data.information14,
480 			p_information15                        =>  l_record_data.information15,
481 			p_information16                        =>  l_record_data.information16,
482 			P_information17                        =>  l_record_data.information17,
483 			p_information18                        =>  l_record_data.information18,
484 			p_information19                        =>  l_record_data.information19,
485 			P_information20                        =>  l_record_data.information20,
486 		      p_information21                        =>  l_record_data.information21,
487 			p_information22                        =>  l_record_data.information22,
488 			p_information23                        =>  l_record_data.information23,
489 			p_information24                        =>  l_record_data.information24,
490 			p_information25                        =>  l_record_data.information25,
491 			p_information26                        =>  l_record_data.information26,
492 			p_information27                        =>  l_record_data.information27,
493 			p_information28                        =>  l_record_data.information28,
494 			p_information29                        =>  l_record_data.information29,
495 			p_information30                        =>  l_record_data.information30,
496 			p_information31                        =>  l_record_data.information31,
497 			p_information32                        =>  l_record_data.information32,
498 			p_information33                        =>  l_record_data.information33,
499 			p_information34                        =>  l_record_data.information34,
500 			p_information35                        =>  l_record_data.information35,
501 			p_information36                        =>  l_record_data.information36,
502 			p_information37                        =>  l_record_data.information37,
503 			p_information38                        =>  l_record_data.information38,
504 			p_information39                        =>  l_record_data.information39,
505 			p_information40                        =>  l_record_data.information40,
506 			p_information41                        =>  l_record_data.information41,
507 			p_information42                        =>  l_record_data.information42,
508 			P_information43   	               =>  l_record_data.information43,
509 			p_information44                        =>  l_record_data.information44,
510 			p_information45                        =>  l_record_data.information45,
511 			p_information46                        =>  l_record_data.information46,
512 			p_information47                        =>  l_record_data.information47,
513 			p_information48                        =>  l_record_data.information48,
514 			p_information49                        =>  l_record_data.information49,
515 			p_information50                        =>  l_record_data.information50,
516 			P_information51                        =>  l_record_data.information51,
517 			p_information52                        =>  l_record_data.information52,
518 			p_information53                        =>  l_record_data.information53,
519 			p_information54                        =>  l_record_data.information54,
520 			p_information55                        =>  l_record_data.information55,
521 			p_information56                        =>  l_record_data.information56,
522 			p_information57                        =>  l_record_data.information57,
523 			p_information58                        =>  l_record_data.information58,
524 			p_information59                        =>  l_record_data.information59,
525 			p_information60                        =>  l_record_data.information60,
526 			p_information61                        =>  l_record_data.information61,
527 			p_information62   	               =>  l_record_data.information62,
528 			p_information63                        =>  l_record_data.information63,
529 			p_information64                        =>  l_record_data.information64,
530 			p_information65                        =>  l_record_data.information65,
531 			p_information66                        =>  l_record_data.information66,
532 			p_information67                        =>  l_record_data.information67,
533 			p_information68                        =>  l_record_data.information68,
534 			p_information69                        =>  l_record_data.information69,
535 			P_information70                        =>  l_record_data.information70,
536 			p_information71                        =>  l_record_data.information71,
537                   p_information72                        =>  l_record_data.information72,
538 			p_information73                        =>  l_record_data.information73,
539 			p_information74                        =>  l_record_data.information74,
540 			p_information75                        =>  l_record_data.information75,
541 			p_information76                        =>  l_record_data.information76,
542 			p_information77                        =>  l_record_data.information77,
543 			p_information78                        =>  l_record_data.information78,
544 			p_information79                        =>  l_record_data.information79,
545 			p_information80                        =>  l_record_data.information80,
546 			p_information81                        =>  l_record_data.information81,
547 			p_information82                        =>  l_record_data.information82,
548 			p_information83                        =>  l_record_data.information83,
549 			p_information84                        =>  l_record_data.information84,
550 			p_information85                        =>  l_record_data.information85,
551 			p_information86                        =>  l_record_data.information86,
552 			p_information87                        =>  l_record_data.information87,
553 			p_information88                        =>  l_record_data.information88,
554 			p_information89                        =>  l_record_data.information89,
555 			p_information90                        =>  l_record_data.information90,
556 			p_information91                        =>  l_record_data.information91,
557 			p_information92                        =>  l_record_data.information92,
558 			p_information93                        =>  l_record_data.information93,
559 			p_information94                        =>  l_record_data.information94,
560 			p_information95                        =>  l_record_data.information95,
561 			p_information96                        =>  l_record_data.information96,
562 			p_information97                        =>  l_record_data.information97,
563 			p_information98                        =>  l_record_data.information98,
564 			p_information99                        =>  l_record_data.information99,
565 			p_information100                       =>  l_record_data.information100,
566 			p_information101                       =>  l_record_data.information101,
567 			p_information102                       =>  l_record_data.information102,
568 			p_information103                       =>  l_record_data.information103,
569 			p_information104                       =>  l_record_data.information104,
570 			p_information105                       =>  l_record_data.information105,
571 			p_information106                       =>  l_record_data.information106,
572 			p_information107                       =>  l_record_data.information107,
573 			p_information108                       =>  l_record_data.information108,
574 			p_information109                       =>  l_record_data.information109,
575 			p_information110                       =>  l_record_data.information110,
576 			p_information111                       =>  l_record_data.information111,
577 			p_information112                       =>  l_record_data.information112,
578 			p_information113                       =>  l_record_data.information113,
579 			p_information114                       =>  l_record_data.information114,
580 			p_information115                       =>  l_record_data.information115,
581 			p_information116                       =>  l_record_data.information116,
582 			p_information117                       =>  l_record_data.information117,
583 			p_information118                       =>  l_record_data.information118,
584 			p_information119                       =>  l_record_data.information119,
585 			p_information120                       =>  l_record_data.information120,
586 			p_information121                       =>  l_record_data.information121,
587 			p_information122                       =>  l_record_data.information122,
588 			p_information123                       =>  l_record_data.information123,
589 			p_information124                       =>  l_record_data.information124,
590 			p_information125                       =>  l_record_data.information125,
591 			p_information126                       =>  l_record_data.information126,
592 			p_information127                       =>  l_record_data.information127,
593 			p_information128                       =>  l_record_data.information128,
594 			p_information129                       =>  l_record_data.information129,
595 			p_information130                       =>  l_record_data.information130,
596 			p_information131                       =>  l_record_data.information131,
597 			p_information132                       =>  l_record_data.information132,
598 			p_information133                       =>  l_record_data.information133,
599 			p_information134                       =>  l_record_data.information134,
600 			p_information135                       =>  l_record_data.information135,
601 		  	p_information136                       =>  l_record_data.information136,
602 			p_information137                       =>  l_record_data.information137,
603 			p_information138                       =>  l_record_data.information138,
604 			p_information139                       =>  l_record_data.information139,
605 			p_information140                       =>  l_record_data.information140,
606 			p_information141                       =>  l_record_data.information141,
607 			p_information142                       =>  l_record_data.information142,
608 			p_information143                       =>  l_record_data.information143,
609 			p_information144                       =>  l_record_data.information144,
610 			p_information145                       =>  l_record_data.information145,
611 			p_information146                       =>  l_record_data.information146,
612 			p_information147                       =>  l_record_data.information147,
613 			p_information148                       =>  l_record_data.information148,
614 			p_information149                       =>  l_record_data.information149,
615 			p_information150                       =>  l_record_data.information150,
616 			p_information151                       =>  l_record_data.information151,
617 			p_information152                       =>  l_record_data.information152,
618 			p_information153                       =>  l_record_data.information153,
619 			p_information154                       =>  l_record_data.information154,
620 			p_information155                       =>  l_record_data.information155,
621 			p_information156                       =>  l_record_data.information156,
622 			p_information157                       =>  l_record_data.information157,
623 			p_information158                       =>  l_record_data.information158,
624 			p_information159                       =>  l_record_data.information159,
625 			p_information160                       =>  l_record_data.information160,
626 			p_information161                       =>  l_record_data.information161,
627 			p_information162                       =>  l_record_data.information162,
628 			p_information163                       =>  l_record_data.information163,
629 			p_information164                       =>  l_record_data.information164,
630 			p_information165                       =>  l_record_data.information165,
631 			p_information166                       =>  l_record_data.information166,
632 			p_information167                       =>  l_record_data.information167,
633 			p_information168                       =>  l_record_data.information168,
634 			p_information169                       =>  l_record_data.information169,
635 			p_information170                       =>  l_record_data.information170,
636 			p_information171                       =>  l_record_data.information171,
637 			p_information172                       =>  l_record_data.information172,
638 			p_information173                       =>  l_record_data.information173,
639 			p_information174                       =>  l_record_data.information174,
640 			p_information175                       =>  l_record_data.information175,
641 			p_information176                       =>  l_record_data.information176,
642 			p_information177                       =>  l_record_data.information177,
643 			p_information178                       =>  l_record_data.information178,
644 			p_information179                       =>  l_record_data.information179,
645 			p_information180                       =>  l_record_data.information180,
646 			p_information181                       =>  l_record_data.information181,
647 			p_information182                       =>  l_record_data.information182,
648 			p_information183                       =>  l_record_data.information183,
649 			p_information184                       =>  l_record_data.information184,
650 			p_information185                       =>  l_record_data.information185,
651 			p_information186                       =>  l_record_data.information186,
652 			p_information187                       =>  l_record_data.information187,
653 			p_information188                       =>  l_record_data.information188,
654 			p_information189                       =>  l_record_data.information189,
655 			p_information190                       =>  l_record_data.information190,
656 			p_information191                       =>  l_record_data.information191,
657 			p_information192                       =>  l_record_data.information192,
658 			p_information193                       =>  l_record_data.information193,
659 			p_information194                       =>  l_record_data.information194,
660 			p_information195                       =>  l_record_data.information195,
661 			p_information196                       =>  l_record_data.information196,
662 			p_information197                       =>  l_record_data.information197,
663 			p_information198                       =>  l_record_data.information198,
664 			p_information199                       =>  l_record_data.information199,
665 			p_information200                       =>  l_record_data.information200
666 			);
667 
668 			--  Determine whether to continue cascading , which is identified by looking at the
669 			--  true_false flag for all the columns that can be cascaded,
670 			--  If all of them are set to false, then stop cascading.
671 
672                  	hr_utility.set_location(l_proc,85);
673 			l_stop  := Stop_cascade(l_true_false);
674                	hr_utility.set_location(l_proc,90);
675 		      If not l_stop  then
676 				hr_utility.set_location(l_proc,95);
677 			      exit;
678 		      End if;
679             	hr_utility.set_location(l_proc,95);
680 			if (history_data.pa_request_id is null) then
681 				-- core change, only want to do one iteration of this loop.
682 				exit;
683 			end if;
684 		END LOOP; -- End of child loop
685 		if (history_data.pa_request_id is not null) then
686 			-- this was not a core change,so we opened this cursor.
687 			close c_cascade_history;
688 		end if;
689       	hr_utility.set_location(l_proc,100);
690 	End loop; -- End of root loop
691 	hr_utility.set_location('Leaving  ' || l_proc,105);
692 Exception
693 When Others then
694    -- RESET In/Out params and SET Out Params
695    p_interv_on_table        :=null;
696    p_interv_on_eff_date     :=null;
697    p_hist_data_as_of_date   :=null;
698 hr_utility.set_location('Leaving  ' || l_proc,110);
699 Raise;
700 
701 End cascade_history_data;
702 
703 -- ---------------------------------------------------------------------------
704 -- |--------------------------< cascade_appl_table_data>-----------------------|
705 -- ---------------------------------------------------------------------------
706 -- {Start Of Comments}
707 --
708 -- Description:
709 --   	This procedure cascades data changes in corresponding core application table. If changes
710 --	have been made to a table and there were changes following it, this procedure
711 --	will correctly 'cascade' those changes to all following records. Note that
712 --	the actuall application table cascades are handled by calling the appropriate sub-procedure.
713 --
714 -- Pre-Requisities:
715 --   	None.
716 --
717 -- In Parameters:
718 --	p_table_name		->	name of the table that this cascade is for.
719 --	p_person_id			->	person_id that this record is associated with.
720 --	p_pre_record		->	old value of row that has been changed by current sf52.
721 --	p_post_record		->	new value of row that has been changed by current sf52.
722 --	p_cascade_type		->	either 'retroactive' or cancel.
723 --	p_interv_on_table		->	input flag that indicates if there are any following records for this change.
724 --	p_interv_on_eff_date 	->	input flag that indicates if there are any following records on the same
725 --						date for this change.
726 --	p_hist_data_as_of_date	->	input record that containst the data from history for the effective_date
727 --						of this action.
728 --
729 -- Post Success:
730 -- 	All data will have been cascaded to all following rows.
731 --
732 -- Post Failure:
733 --   Error would have been displayed to user and exception raised.
734 --
735 -- Developer Implementation Notes:
736 --   None
737 --
738 -- Access Status:
739 --   Internal Development Use Only.
740 --
741 -- {End Of Comments}
742 -- ---------------------------------------------------------------------------
743 
744 --
745 -- Procedure Cascade_Appl_table_data calls individual table cascade procedures
746 Procedure Cascade_Appl_table_data (
747 	p_table_name			in	varchar2,
748 	p_person_id 			in	varchar2,
749 	p_pre_record			in	ghr_pa_history%rowtype,
750 	p_post_record			in	ghr_pa_history%rowtype,
751 	p_cascade_type			in	varchar2,
752 	p_interv_on_table			in	Boolean,
753 	p_interv_on_eff_date		in	Boolean,
754 	p_hist_data_as_of_date		in	ghr_pa_history%rowtype
755 
756 ) is
757 
758 	l_proc	varchar2(30):='Cascade_appl_table_data';
759 Begin
760 	hr_utility.set_location( 'Entering : ' || l_proc, 10);
761 	if lower(p_table_name) = lower(ghr_history_api.g_peop_table) then
762 		hr_utility.set_location( l_proc, 20);
763 		Cascade_People(
764 			p_pre_record			=> p_pre_record,
765 			p_post_record			=> p_post_record,
766 			p_cascade_type			=> p_cascade_type,
767 			p_interv_on_eff_date		=> p_interv_on_eff_date,
768 			p_hist_data_as_of_date		=> p_hist_data_as_of_date);
769 
770 	elsif lower(p_table_name) = lower(ghr_history_api.g_asgn_table) then
771 		hr_utility.set_location( l_proc, 30);
772 		Cascade_asgn (
773 			p_pre_record			=> p_pre_record,
774 			p_post_record			=> p_post_record,
775 			p_cascade_type			=> p_cascade_type,
776 			p_interv_on_eff_date		=> p_interv_on_eff_date,
777 			p_hist_data_as_of_date		=> p_hist_data_as_of_date);
778 	elsif lower(p_table_name) = lower(ghr_history_api.g_eleent_table) then
779 		hr_utility.set_location( l_proc, 40);
780 		-- this is already handled in cancel/correction procedures
781 		-- retroactive actions need not cascade change in element_entry
782 		null;
783 	elsif lower(p_table_name) = lower(ghr_history_api.g_eleevl_table) then
784 		hr_utility.set_location( l_proc, 50);
785 		-- this is already handled in cancel/correction procedures
786 		-- retroactive actions need not cascade change in element_entry_values
787 		null;
788 	elsif lower(p_table_name) = lower(ghr_history_api.g_peopei_table) then
789 		hr_utility.set_location( l_proc, 60);
790 		Cascade_peopleei (
791 			p_post_record	=> p_post_record);
792 	elsif lower(p_table_name) = lower(ghr_history_api.g_asgnei_table) then
793 		hr_utility.set_location( l_proc, 70);
794 		Cascade_asgnei (
795 			p_post_record	=> p_post_record);
796 	elsif lower(p_table_name) = lower(ghr_history_api.g_addres_table) then
797 		hr_utility.set_location( l_proc, 80);
798 		Cascade_addresses (
799 			p_post_record	=> p_post_record);
800 	elsif lower(p_table_name) = lower(ghr_history_api.g_posnei_table) then
801 		hr_utility.set_location( l_proc, 90);
802 		Cascade_posnei (
803 			p_post_record	=> p_post_record);
804 	elsif lower(p_table_name) = lower(ghr_history_api.g_posn_table) then
805 		hr_utility.set_location( l_proc, 90);
806                 /*
807 		Cascade_posn (
808 			p_post_record	=> p_post_record);
809                 */
810 		Cascade_posn(
811 			p_pre_record			=> p_pre_record,
812 			p_post_record			=> p_post_record,
813 			p_cascade_type			=> p_cascade_type,
814 			p_interv_on_eff_date		=> p_interv_on_eff_date,
815 			p_hist_data_as_of_date		=> p_hist_data_as_of_date);
816 
817 	elsif lower(p_table_name) in 	(lower(ghr_history_api.g_perana_table)) then
818 		-- This table need not cascade.
819 		hr_utility.set_location( l_proc, 95);
820 		Cascade_perana (
821 			p_post_record	=> p_post_record);
822 		null;
823 	else
824 		hr_utility.set_location( 'Unidentified table ' || l_proc, 100);
825 		--raise error
826 		hr_utility.set_message(8301, 'GHR_38363_UNKNOWN_TABLE');
827 		hr_utility.raise_error;
828 	end if;
829 	hr_utility.set_location( 'Leaving : ' || l_proc, 200);
830 
831 End;
832 
833 -- ---------------------------------------------------------------------------
834 -- |--------------------------< cascade_people>-------------------------------|
835 -- ---------------------------------------------------------------------------
836 -- {Start Of Comments}
837 --
838 -- Description:
839 --   	This procedure cascades data changes in per_people_f core application table. If the
840 --	current action made changes to per_people_f and there were changes following it, this procedure
841 --	will correctly 'cascade' those changes to all following records. This procedure can
842 --	be called in either 'retroactive' (p_post_record values will be cascaded) or 'cancel'
843 --	(p_pre_record values will be cascaded) mode.
844 --
845 -- Pre-Requisities:
846 --   	None.
847 --
848 -- In Parameters:
849 --	p_person_id			->	person_id that this record is associated with.
850 --	p_pre_record		->	old value of row that has been changed by current sf52.
851 --	p_post_record		->	new value of row that has been changed by current sf52.
852 --	p_cascade_type		->	either 'retroactive' or cancel.
853 --	p_interv_on_table		->	input flag that indicates if there are any following records for this change.
854 --	p_interv_on_eff_date 	->	input flag that indicates if there are any following records on the same
855 --						date for this change.
856 --	p_hist_data_as_of_date	->	input record that contains the data from history for the effective_date
857 --						of this action.
858 --
859 -- Post Success:
860 -- 	All data will have been cascaded to all following rows.
861 --
862 -- Post Failure:
863 --   Error would have been displayed to user and exception raised.
864 --
865 -- Developer Implementation Notes:
866 --   None
867 --
868 -- Access Status:
869 --   Internal Development Use Only.
870 --
871 -- {End Of Comments}
872 -- ---------------------------------------------------------------------------
873 Procedure Cascade_People (
874 	p_pre_record			in	ghr_pa_history%rowtype,
875 	p_post_record			in	ghr_pa_history%rowtype,
876 	p_cascade_type			in	varchar2,
877 	p_interv_on_eff_date		in	Boolean,
878 	p_hist_data_as_of_date		in	ghr_pa_history%rowtype
879 ) is
880 
881 	l_true_false	ghr_history_cascade.condition_rg_type;
882 	l_people_data	per_all_people_f%rowtype;
883 	l_hist_peop_data	ghr_pa_history%rowtype;
884 	l_stop		Boolean;
885 	l_proc		varchar2(30):='Cascade_People';
886 
887 	-- this cursor is meant to retrieve all following records in per_people_f table.
888 	Cursor c_people( c_date_Effective in date, c_person_id	in number) is
889 	Select *
890 	from per_all_people_f
891 	where effective_start_date >= c_date_effective and
892 	person_id = c_person_id;
893 
894 Begin
895 	hr_utility.set_location( 'Entering : ' || l_proc, 10);
896 	For rowno in 4..101 loop
897     		l_true_false(rowno) := TRUE;
898 	End loop;
899 	hr_utility.set_location( l_proc, 15);
900 	if p_interv_on_eff_date then
901 		-- This is to take care of multiple actions on the same date.
902 		-- When a correction is made to a SF52 and other process had
903 		-- updated the same row on the same date, the data in the
904 		-- core table might be incorrect since the date effectivity has the
905 		-- granularity of a day, and not date and time. So, this will
906 		-- re-apply the data from history for the effective date of the current action to the
907 		-- core table. This will insure that the core table will contain the correct information
908 		-- in all cases.
909 		hr_utility.set_location( l_proc, 20);
910 		ghr_history_conv_rg.Conv_to_people_rg(
911 				p_people_data => l_people_data,
912 				p_history_data => p_hist_data_as_of_date);
913 		correct_people_row( p_people_data => l_people_data);
914 		hr_utility.set_location( l_proc, 30);
915 	elsif	(lower(p_cascade_type) = 'cancel') then
916 		-- if this is a cancellation and there are no intervening rows on this effective date,
917 		-- then apply the pre-record to the core people table for this effective date.
918 		hr_utility.set_location( l_proc, 35);
919 		ghr_history_conv_rg.Conv_to_people_rg(
920 				p_people_data => l_people_data,
921 				p_history_data => p_pre_record);
922 		correct_people_row( p_people_data => l_people_data);
923 	end if;
924 
925 	hr_utility.set_location( l_proc, 40);
926 	-- Fetch all the following rows.
927 	open c_people( p_post_record.effective_date, to_number(p_post_record.information1));
928 	while true
929 	Loop
930 		hr_utility.set_location( l_proc, 50);
931 		fetch c_people into l_people_data;
932 		exit when not c_people%found;
933 		ghr_history_conv_rg.conv_people_rg_to_hist_rg( p_people_data  => l_people_data,
934 							p_history_data => l_hist_peop_data);
935 
936 		if lower(p_cascade_Type)    = 'retroactive' then
937 			hr_utility.set_location( l_proc, 60);
938 			-- for retroactive action post-record values have to be cascaded
939 			-- whereever pre-record values exist.
940 				cascade_Change(p_pre_record   => p_Pre_record,
941                                        p_post_record  => p_Post_record,
942                                        p_apply_record => l_hist_peop_data,
943                                        p_true_false   => l_true_false);
944 
945 		elsif lower(p_cascade_Type) = 'cancel' then
946 			-- for cancellation action pre-record values have to be cascaded
947 			-- whereever post-record values exist.
948 			hr_utility.set_location( l_proc, 70);
949 				cascade_Change(p_pre_record   => p_Post_record,
950                                        p_post_record  => p_Pre_record,
951                                        p_apply_record => l_hist_peop_data,
952                                        p_true_false   => l_true_false);
953 		else
954 			hr_utility.set_location( l_proc, 80);
955 		      hr_utility.set_message(8301, 'GHR_38225_UNKNOWN_CASCADE_TYPE');
956 		      hr_utility.raise_error;
957 		      --	raise error /* Unknown type */
958 		end if;
959 
960 		-- As a column value
961 		l_stop  := Stop_cascade(l_true_false);
962 		if not l_stop  then
963 			hr_utility.set_location( l_proc || ' exit loop ', 90);
964 		      exit;
965 		else
966 			hr_utility.set_location( l_proc, 100);
967 			ghr_history_conv_rg.conv_to_people_rg(
968 						p_people_data  => l_people_data,
969 						p_history_data => l_hist_peop_data);
970 			correct_people_row( p_people_data => l_people_data);
971 		end if;
972 	end loop;
973 	hr_utility.set_location( l_proc, 200);
974 	close c_people;
975 End;
976 
977 -- ---------------------------------------------------------------------------
978 -- |--------------------------< cascade_asgn>---------------------------------|
979 -- ---------------------------------------------------------------------------
980 -- {Start Of Comments}
981 --
982 -- Description:
983 --   	This procedure cascades data changes in per_assignments_f core application table. If the
984 --	current action made changes to per_assignments_f and there were changes following it, this procedure
985 --	will correctly 'cascade' those changes to all following records. This procedure can
986 --	be called in either 'retroactive' (p_post_record values will be cascaded) or 'cancel'
987 --	(p_pre_record values will be cascaded) mode.
988 --
989 -- Pre-Requisities:
990 --   	None.
991 --
992 -- In Parameters:
993 --	p_pre_record		->	old value of row that has been changed by current sf52.
994 --	p_post_record		->	new value of row that has been changed by current sf52.
995 --	p_cascade_type		->	either 'retroactive' or cancel.
996 --	p_interv_on_table		->	input flag that indicates if there are any following records for this change.
997 --	p_interv_on_eff_date 	->	input flag that indicates if there are any following records on the same
998 --						date for this change.
999 --	p_hist_data_as_of_date	->	input record that contains the data from history for the effective_date
1000 --						of this action.
1001 --
1002 -- Post Success:
1003 -- 	All data will have been cascaded to all following rows.
1004 --
1005 -- Post Failure:
1006 --   Error would have been displayed to user and exception raised.
1007 --
1008 -- Developer Implementation Notes:
1009 --   None
1010 --
1011 -- Access Status:
1012 --   Internal Development Use Only.
1013 --
1014 -- {End Of Comments}
1015 -- ---------------------------------------------------------------------------
1016 
1017 Procedure Cascade_asgn (
1018 	p_pre_record			in	ghr_pa_history%rowtype,
1019 	p_post_record			in	ghr_pa_history%rowtype,
1020 	p_cascade_type			in	varchar2,
1021 	p_interv_on_eff_date		in	Boolean,
1022 	p_hist_data_as_of_date		in	ghr_pa_history%rowtype
1023 ) is
1024 
1025 	l_true_false	ghr_history_cascade.condition_rg_type;
1026 	l_asgn_data		per_all_assignments_f%rowtype;
1027 	l_hist_asgn_data	ghr_pa_history%rowtype;
1028 	l_stop		Boolean;
1029 	l_proc		varchar2(30):='Cascade_asgn';
1030 
1031 	-- this cursor is meant to retrieve all following records in per_assignments_f table.
1032 	Cursor c_asgn( c_date_Effective in date, c_asgn_id	in number) is
1033 	Select *
1034 	from per_all_assignments_f
1035 	where effective_start_date >= c_date_effective and
1036 	assignment_id = c_asgn_id;
1037 
1038 Begin
1039 
1040 	hr_utility.set_location( 'Entering : ' || l_proc, 10);
1041 	For rowno in 4..101 loop
1042     		l_true_false(rowno) := TRUE;
1043 	End loop;
1044 	hr_utility.set_location( l_proc, 15);
1045 	if p_interv_on_eff_date then
1046 		-- This is to take care of multiple actions on the same date.
1047 		-- When a correction is made to a SF52 and other process had
1048 		-- updated the same row on the same date, the data in the
1049 		-- core table might be incorrect since the date effectivity has the
1050 		-- granularity of a day, and not date and time. So, this will
1051 		-- re-apply the data from history for the effective date of the current action to the
1052 		-- core table. This will insure that the core table will contain the correct information
1053 		-- in all cases.
1054 		hr_utility.set_location( l_proc, 20);
1055 
1056 		ghr_history_conv_rg.Conv_to_asgn_rg(
1057 				p_assignment_data 	=> l_asgn_data,
1058 				p_history_data 	=> p_hist_data_as_of_date);
1059 
1060 		correct_asgn_row( p_asgn_data => l_asgn_data);
1061 		hr_utility.set_location( l_proc, 30);
1062 	elsif (lower(p_cascade_type) = 'cancel') then
1063 		-- if this is a cancellation and there are no intervening rows on this effective date,
1064 		-- then apply the pre-record to the core people table for this effective date.
1065 		hr_utility.set_location( l_proc, 35);
1066 		ghr_history_conv_rg.Conv_to_asgn_rg(
1067 				p_assignment_data => l_asgn_data,
1068 				p_history_data 	=> p_pre_record);
1069 		correct_asgn_row( p_asgn_data => l_asgn_data);
1070 	end if;
1071 
1072 	hr_utility.set_location( l_proc, 40);
1073 	-- Fetch all the following rows.
1074 	open c_asgn( p_post_record.effective_date, to_number(p_post_record.information1));
1075 	while true
1076 	Loop
1077 		hr_utility.set_location( l_proc, 50);
1078 		fetch c_asgn into l_asgn_data;
1079 		exit when not c_asgn%found;
1080 
1081 		ghr_history_conv_rg.conv_asgn_rg_to_hist_rg(
1082 			p_assignment_data => l_asgn_data,
1083 			p_history_data 	=> l_hist_asgn_data);
1084 
1085 		if lower(p_cascade_Type)    = 'retroactive' then
1086 			hr_utility.set_location( l_proc, 60);
1087 			-- for retroactive action post-record values have to be cascaded
1088 			-- whereever pre-record values exist.
1089 			cascade_Change(p_pre_record   => p_Pre_record,
1090                                  p_post_record  => p_Post_record,
1091                                  p_apply_record => l_hist_asgn_data,
1092                                  p_true_false   => l_true_false);
1093 
1094 		elsif lower(p_cascade_Type) = 'cancel' then
1095 			-- for cancellation action pre-record values have to be cascaded
1096 			-- whereever post-record values exist.
1097 			hr_utility.set_location( l_proc, 70);
1098 				cascade_Change(p_pre_record   => p_Post_record,
1099                                        p_post_record  => p_Pre_record,
1100                                        p_apply_record => l_hist_asgn_data,
1101                                        p_true_false   => l_true_false);
1102 		else
1103 			hr_utility.set_location( l_proc, 80);
1104   		      hr_utility.set_message(8301, 'GHR_38225_UNKNOWN_CASCADE_TYPE');
1105 		      hr_utility.raise_error;
1106 		      --	raise error /* Unknown type */
1107 		end if;
1108 
1109 		-- As a column value
1110 		l_stop  := Stop_cascade(l_true_false);
1111 		if not l_stop  then
1112 			hr_utility.set_location( l_proc || ' exit loop ', 90);
1113 		      exit;
1114 		else
1115 			hr_utility.set_location( l_proc, 100);
1116 			ghr_history_conv_rg.conv_to_asgn_rg(
1117 						p_assignment_data	=> l_asgn_data,
1118 						p_history_data 	=> l_hist_asgn_data);
1119 
1120 			correct_asgn_row( p_asgn_data => l_asgn_data);
1121 		end if;
1122 	end loop;
1123 	hr_utility.set_location( l_proc, 200);
1124 	close c_asgn;
1125 End cascade_Asgn;
1126 
1127 -- ---------------------------------------------------------------------------
1128 -- |--------------------------< cascade_peopleei>-----------------------------|
1129 -- ---------------------------------------------------------------------------
1130 -- {Start Of Comments}
1131 --
1132 -- Description:
1133 --   	This procedure cascades data changes in per_people_extra_info core application table.
1134 --	Since extra information tables are not date-tracked by core, cascade of these
1135 --	tables simply re-applies the most recent record in history according to
1136 --	the sysdate. This is necessary because update to database will have applied
1137 --	any changes to this table regardless of effective date of the action. So, this
1138 --	cascade ensures that this non-datetrack table contains the correct data
1139 --	according to the sysdate.
1140 --
1141 -- Pre-Requisities:
1142 --   	None.
1143 --
1144 -- In Parameters:
1145 --	p_post_record		->	new value of row that has been changed by current sf52.
1146 --
1147 -- Post Success:
1148 -- 	Data will have been re-applied to the non-datetrack table.
1149 --
1150 -- Post Failure:
1151 --   Error would have been displayed to user and exception raised.
1152 --
1153 -- Developer Implementation Notes:
1154 --   None
1155 --
1156 -- Access Status:
1157 --   Internal Development Use Only.
1158 --
1159 -- {End Of Comments}
1160 -- ---------------------------------------------------------------------------
1161 Procedure Cascade_peopleei (
1162 	p_post_record	in	ghr_pa_history%rowtype
1163 ) is
1164 
1165 	l_hist_peopleei_data	ghr_pa_history%rowtype;
1166 	l_peopleei_data		per_people_extra_info%rowtype;
1167 	l_result_code		varchar2(30);
1168 	l_proc			varchar2(30):='Cascade_peopleei';
1169 
1170 Begin
1171 
1172 
1173 	hr_utility.set_location( 'Entering : ' || l_proc, 10);
1174 	-- This procedure will fetch
1175 	-- the most recent record from history and update the database.
1176 	hr_utility.set_location( l_proc, 20);
1177 	Fetch_most_recent_record(
1178 		p_table_name 	=> ghr_history_api.g_peopei_table,
1179 		p_table_pk_id	=> p_post_record.information1,
1180 		p_person_id		=> p_post_record.person_id,
1181 		p_history_data	=> l_hist_peopleei_data,
1182 		p_result_code     => l_result_code);
1183 	if l_result_code = 'not_found' then
1184 		-- this should never be the case
1185 		-- raise error.
1186 		hr_utility.set_location( l_proc, 30);
1187 	      hr_utility.set_message(8301, 'GHR_38364_NO_PEOPLE_RECORD');
1188 	      hr_utility.raise_error;
1189 	else
1190 		hr_utility.set_location( l_proc, 40);
1191 		ghr_history_conv_rg.Conv_to_peopleei_rg(
1192 			p_people_ei_data  => l_peopleei_data,
1193 			p_history_data => l_hist_peopleei_data);
1194 		hr_utility.set_location( 'l_peopleei_data.person_extra_info_id: ' || l_peopleei_data.person_extra_info_id ||l_proc, 46);
1195 		hr_utility.set_location( 'l_peopleei_data.pei_information11: ' || l_peopleei_data.pei_information11 ||l_proc, 47);
1196 		correct_peopleei_row( p_peopleei_data => l_peopleei_data);
1197 	end if;
1198 	hr_utility.set_location( l_proc, 90);
1199 
1200 End cascade_peopleei;
1201 
1202 -- ---------------------------------------------------------------------------
1203 -- |--------------------------< cascade_asgneei>------------------------------|
1204 -- ---------------------------------------------------------------------------
1205 -- {Start Of Comments}
1206 --
1207 -- Description:
1208 --   	This procedure cascades data changes in per_assignment_extra_info core application table.
1209 --	Since extra information tables are not date-tracked by core, cascade of these
1210 --	tables simply re-applies the most recent record in history according to
1211 --	the sysdate. This is necessary because update to database will have applied
1212 --	any changes to this table regardless of effective date of the action. So, this
1213 --	cascade ensures that this non-datetrack table contains the correct data
1214 --	according to the sysdate.
1215 --
1216 -- Pre-Requisities:
1217 --   	None.
1218 --
1219 -- In Parameters:
1220 --	p_post_record		->	new value of row that has been changed by current sf52.
1221 --
1222 -- Post Success:
1223 -- 	Data will have been re-applied to the non-datetrack table.
1224 --
1225 -- Post Failure:
1226 --   Error would have been displayed to user and exception raised.
1227 --
1228 -- Developer Implementation Notes:
1229 --   None
1230 --
1231 -- Access Status:
1232 --   Internal Development Use Only.
1233 --
1234 -- {End Of Comments}
1235 -- ---------------------------------------------------------------------------
1236 
1237 Procedure Cascade_asgnei (
1238 	p_post_record	in	ghr_pa_history%rowtype
1239 ) is
1240 
1241 	l_hist_asgnei_data	ghr_pa_history%rowtype;
1242 	l_asgnei_data		per_assignment_extra_info%rowtype;
1243 	l_result_code		varchar2(30);
1244 	l_proc			varchar2(30):='Cascade_asgnei';
1245 
1246 Begin
1247 
1248 
1249 	hr_utility.set_location( 'Entering : ' || l_proc, 10);
1250 	-- This procedure will fetch
1251 	-- the most recent record from history and update the database.
1252 	hr_utility.set_location( l_proc, 20);
1253 	Fetch_most_recent_record(
1254 		p_table_name 	=> ghr_history_api.g_asgnei_table,
1255 		p_table_pk_id	=> p_post_record.information1,
1256 		p_person_id		=> p_post_record.person_id,
1257 		p_history_data	=> l_hist_asgnei_data,
1258 		p_result_code     => l_result_code);
1259 	if l_result_code = 'not_found' then
1260 		-- this should never be the case
1261 		-- raise error.
1262 		hr_utility.set_location( l_proc, 30);
1263 	      hr_utility.set_message(8301, 'GHR_38365_NO_ASGN_RECORD');
1264 	      hr_utility.raise_error;
1265 	else
1266 		hr_utility.set_location( l_proc, 40);
1267 		ghr_history_conv_rg.Conv_to_asgnei_rg(
1268 			p_asgnei_data  => l_asgnei_data,
1269 			p_history_data => l_hist_asgnei_data);
1270 		correct_asgnei_row( p_asgnei_data => l_asgnei_data);
1271 	end if;
1272 	hr_utility.set_location( l_proc, 90);
1273 
1274 End cascade_asgnei;
1275 
1276 -- ---------------------------------------------------------------------------
1277 -- |--------------------------< cascade_posneei>------------------------------|
1278 -- ---------------------------------------------------------------------------
1279 -- {Start Of Comments}
1280 --
1281 -- Description:
1282 --   	This procedure cascades data changes in per_position_extra_info core application table.
1283 --	Since extra information tables are not date-tracked by core, cascade of these
1284 --	tables simply re-applies the most recent record in history according to
1285 --	the sysdate. This is necessary because update to database will have applied
1286 --	any changes to this table regardless of effective date of the action. So, this
1287 --	cascade ensures that this non-datetrack table contains the correct data
1288 --	according to the sysdate.
1289 --
1290 -- Pre-Requisities:
1291 --   	None.
1292 --
1293 -- In Parameters:
1294 --	p_post_record		->	new value of row that has been changed by current sf52.
1295 --
1296 -- Post Success:
1297 -- 	Data will have been re-applied to the non-datetrack table.
1298 --
1299 -- Post Failure:
1300 --   Error would have been displayed to user and exception raised.
1301 --
1302 -- Developer Implementation Notes:
1303 --   None
1304 --
1305 -- Access Status:
1306 --   Internal Development Use Only.
1307 --
1308 -- {End Of Comments}
1309 -- ---------------------------------------------------------------------------
1310 Procedure Cascade_posnei (
1311 	p_post_record	in	ghr_pa_history%rowtype) is
1312 
1313 	l_hist_posnei_data	ghr_pa_history%rowtype;
1314 	l_posnei_data		per_position_extra_info%rowtype;
1315 	l_result_code		varchar2(30);
1316 	l_proc			varchar2(30):='Cascade_posnei';
1317 
1318 Begin
1319 
1320 	hr_utility.set_location( 'Entering : ' || l_proc, 10);
1321 	-- This procedure will fetch
1322 	-- the most recent record from history and update the database.
1323 	hr_utility.set_location( l_proc, 20);
1324 	Fetch_most_recent_record(
1325 		p_table_name 	=> ghr_history_api.g_posnei_table,
1326 		p_table_pk_id	=> p_post_record.information1,
1327 		p_person_id		=> p_post_record.person_id,
1328 		p_history_data	=> l_hist_posnei_data,
1329 		p_result_code     => l_result_code);
1330 	if l_result_code = 'not_found' then
1331 		-- this should never be the case
1332 		-- raise error.
1333 		hr_utility.set_location( l_proc, 30);
1334 	      hr_utility.set_message(8301, 'GHR_38366_NO_POSNEI_RECORD');
1335 	      hr_utility.raise_error;
1336 	else
1337 		hr_utility.set_location( l_proc, 40);
1338 		ghr_history_conv_rg.Conv_to_positionei_rg(
1339 			p_position_ei_data  => l_posnei_data,
1340 			p_history_data => l_hist_posnei_data);
1341 		correct_posnei_row( p_posnei_data => l_posnei_data);
1342 	end if;
1343 	hr_utility.set_location( l_proc, 90);
1344 
1345 End cascade_posnei;
1346 
1347 /*
1348 -- ---------------------------------------------------------------------------
1349 -- |--------------------------< cascade_posn>---------------------------------|
1350 -- ---------------------------------------------------------------------------
1351 -- {Start Of Comments}
1352 --
1353 -- Description:
1354 --   	This procedure cascades data changes in per_positions core application table.
1355 --	Since this table is not date-tracked by core, cascade of this
1356 --	tables simply re-applies the most recent record in history according to
1357 --	the sysdate. This is necessary because update to database will have applied
1358 --	any changes to this table regardless of effective date of the action. So, this
1359 --	cascade ensures that this non-datetrack table contains the correct data
1360 --	according to the sysdate.
1361 --
1362 -- Pre-Requisities:
1363 --   	None.
1364 --
1365 -- In Parameters:
1366 --	p_post_record		->	new value of row that has been changed by current sf52.
1367 --
1368 -- Post Success:
1369 -- 	Data will have been re-applied to the non-datetrack table.
1370 --
1371 -- Post Failure:
1372 --   Error would have been displayed to user and exception raised.
1373 --
1374 -- Developer Implementation Notes:
1375 --   None
1376 --
1377 -- Access Status:
1378 --   Internal Development Use Only.
1379 --
1380 -- {End Of Comments}
1381 -- ---------------------------------------------------------------------------
1382 Procedure Cascade_posn (
1383 	p_post_record	in	ghr_pa_history%rowtype) is
1384 
1385 	l_hist_posn_data		ghr_pa_history%rowtype;
1386 	l_posn_data			hr_all_positions_f%rowtype;
1387 	l_result_code		varchar2(30);
1388 	l_proc			varchar2(30):='Cascade_posn';
1389 
1390 Begin
1391 
1392 	hr_utility.set_location( 'Entering : ' || l_proc, 10);
1393 	-- This procedure will fetch
1394 	-- the most recent record from history and update the database.
1395 	hr_utility.set_location( l_proc, 20);
1396 	Fetch_most_recent_record(
1397 		p_table_name 	=> ghr_history_api.g_posn_table,
1398 		p_table_pk_id	=> p_post_record.information1,
1399 		p_person_id		=> p_post_record.person_id,
1400 		p_history_data	=> l_hist_posn_data,
1401 		p_result_code     => l_result_code);
1402 	if l_result_code = 'not_found' then
1403 		-- this should never be the case
1404 		-- raise error.
1405 		hr_utility.set_location( l_proc, 30);
1406 	      hr_utility.set_message(8301, 'GHR_38491_NO_POSN_RECORD');
1407 	      hr_utility.raise_error;
1408 	else
1409 		hr_utility.set_location( l_proc, 40);
1410 		ghr_history_conv_rg.Conv_to_position_rg(
1411 			p_position_data  => l_posn_data,
1412 			p_history_data => l_hist_posn_data);
1413 
1414 		correct_posn_row( p_posn_data => l_posn_data);
1415 	end if;
1416 	hr_utility.set_location( l_proc, 90);
1417 
1418 End cascade_posn;
1419 */
1420 
1421 
1422 -- ---------------------------------------------------------------------------
1423 -- |--------------------------< cascade_posn>---------------------------------|
1424 -- ---------------------------------------------------------------------------
1425 -- {Start Of Comments}
1426 --
1427 -- Description:
1428 --   	This procedure cascades data changes in hr_all_positions_f core application table. If the
1429 --	current action made changes to hr_all_positions_f and there were changes following it, this procedure
1430 --	will correctly 'cascade' those changes to all following records. This procedure can
1431 --	be called in either 'retroactive' (p_post_record values will be cascaded) or 'cancel'
1432 --	(p_pre_record values will be cascaded) mode.
1433 --
1434 -- Pre-Requisities:
1435 --   	None.
1436 --
1437 -- In Parameters:
1438 --	p_pre_record		->	old value of row that has been changed by current sf52.
1439 --	p_post_record		->	new value of row that has been changed by current sf52.
1440 --	p_cascade_type		->	either 'retroactive' or cancel.
1441 --	p_interv_on_table		->	input flag that indicates if there are any following records for this change.
1442 --	p_interv_on_eff_date 	->	input flag that indicates if there are any following records on the same
1443 --						date for this change.
1444 --	p_hist_data_as_of_date	->	input record that contains the data from history for the effective_date
1445 --						of this action.
1446 --
1447 -- Post Success:
1448 -- 	All data will have been cascaded to all following rows.
1449 --
1450 -- Post Failure:
1451 --   Error would have been displayed to user and exception raised.
1452 --
1453 -- Developer Implementation Notes:
1454 --   None
1455 --
1456 -- Access Status:
1457 --   Internal Development Use Only.
1458 --
1459 -- {End Of Comments}
1460 -- ---------------------------------------------------------------------------
1461 
1462 Procedure Cascade_posn (
1463 	p_pre_record			in	ghr_pa_history%rowtype,
1464 	p_post_record			in	ghr_pa_history%rowtype,
1465 	p_cascade_type			in	varchar2,
1466 	p_interv_on_eff_date		in	Boolean,
1467 	p_hist_data_as_of_date		in	ghr_pa_history%rowtype
1468 ) is
1469 
1470 	l_true_false	ghr_history_cascade.condition_rg_type;
1471 	l_posn_data		hr_all_positions_f%rowtype;
1472 	l_hist_posn_data	ghr_pa_history%rowtype;
1473 	l_stop		Boolean;
1474 	l_proc		varchar2(30):='Cascade_posn';
1475 
1476 	-- this cursor is meant to retrieve all following records in per_assignments_f table.
1477 	Cursor c_posn( c_date_Effective in date, c_posn_id	in number) is
1478 	Select *
1479 	from hr_all_positions_f
1480 	where effective_start_date >= c_date_effective and
1481 	position_id = c_posn_id;
1482 
1483 Begin
1484 
1485 	hr_utility.set_location( 'Entering : ' || l_proc, 10);
1486 	For rowno in 4..101 loop
1487     		l_true_false(rowno) := TRUE;
1488 	End loop;
1489 	hr_utility.set_location( l_proc, 15);
1490 	if p_interv_on_eff_date then
1491 		-- This is to take care of multiple actions on the same date.
1492 		-- When a correction is made to a SF52 and other process had
1493 		-- updated the same row on the same date, the data in the
1494 		-- core table might be incorrect since the date effectivity has the
1495 		-- granularity of a day, and not date and time. So, this will
1496 		-- re-apply the data from history for the effective date of the current action to the
1497 		-- core table. This will insure that the core table will contain the correct information
1498 		-- in all cases.
1499 		hr_utility.set_location( l_proc, 20);
1500 
1501 		ghr_history_conv_rg.Conv_to_position_rg(
1502 				p_position_data 	=> l_posn_data,
1503 				p_history_data 	=> p_hist_data_as_of_date);
1504 
1505 		correct_posn_row( p_posn_data => l_posn_data);
1506 		hr_utility.set_location( l_proc, 30);
1507 	elsif (lower(p_cascade_type) = 'cancel') then
1508 		-- if this is a cancellation and there are no intervening rows on this effective date,
1509 		-- then apply the pre-record to the core people table for this effective date.
1510 		hr_utility.set_location( l_proc, 35);
1511 		ghr_history_conv_rg.Conv_to_position_rg(
1512 				p_position_data => l_posn_data,
1513 				p_history_data 	=> p_pre_record);
1514 		correct_posn_row( p_posn_data => l_posn_data);
1515 	end if;
1516 
1517 	hr_utility.set_location( l_proc, 40);
1518 	-- Fetch all the following rows.
1519 	open c_posn( p_post_record.effective_date, to_number(p_post_record.information1));
1520 	while true
1521 	Loop
1522 		hr_utility.set_location( l_proc, 50);
1523 		fetch c_posn into l_posn_data;
1524 		exit when not c_posn%found;
1525 
1526 		ghr_history_conv_rg.conv_position_rg_to_hist_rg(
1527 			p_position_data => l_posn_data,
1528 			p_history_data 	=> l_hist_posn_data);
1529 
1530 		if lower(p_cascade_Type)    = 'retroactive' then
1531 			hr_utility.set_location( l_proc, 60);
1532 			-- for retroactive action post-record values have to be cascaded
1533 			-- whereever pre-record values exist.
1534 			cascade_Change(p_pre_record   => p_Pre_record,
1535                                  p_post_record  => p_Post_record,
1536                                  p_apply_record => l_hist_posn_data,
1537                                  p_true_false   => l_true_false);
1538 
1539 		elsif lower(p_cascade_Type) = 'cancel' then
1540 			-- for cancellation action pre-record values have to be cascaded
1541 			-- whereever post-record values exist.
1542 			hr_utility.set_location( l_proc, 70);
1543 				cascade_Change(p_pre_record   => p_Post_record,
1544                                        p_post_record  => p_Pre_record,
1545                                        p_apply_record => l_hist_posn_data,
1546                                        p_true_false   => l_true_false);
1547 		else
1548 			hr_utility.set_location( l_proc, 80);
1549   		      hr_utility.set_message(8301, 'GHR_38225_UNKNOWN_CASCADE_TYPE');
1550 		      hr_utility.raise_error;
1551 		      --	raise error /* Unknown type */
1552 		end if;
1553 
1554 		-- As a column value
1555 		l_stop  := Stop_cascade(l_true_false);
1556 		if not l_stop  then
1557 			hr_utility.set_location( l_proc || ' exit loop ', 90);
1558 		      exit;
1559 		else
1560 			hr_utility.set_location( l_proc, 100);
1561 			ghr_history_conv_rg.conv_to_position_rg(
1562 						p_position_data	=> l_posn_data,
1563 						p_history_data 	=> l_hist_posn_data);
1564 
1565 			correct_posn_row( p_posn_data => l_posn_data);
1566 		end if;
1567 	end loop;
1568 	hr_utility.set_location( l_proc, 200);
1569 	close c_posn;
1570 End cascade_posn;
1571 
1572 -- ---------------------------------------------------------------------------
1573 -- |--------------------------< cascade_addresses>----------------------------|
1574 -- ---------------------------------------------------------------------------
1575 -- {Start Of Comments}
1576 --
1577 -- Description:
1578 --   	This procedure cascades data changes in per_addresses core application table.
1579 --	Since extra information tables are not date-tracked by core, cascade of these
1580 --	tables simply re-applies the most recent record in history according to
1581 --	the sysdate. This is necessary because update to database will have applied
1582 --	any changes to this table regardless of effective date of the action. So, this
1583 --	cascade ensures that this non-datetrack table contains the correct data
1584 --	according to the sysdate.
1585 --
1586 -- Pre-Requisities:
1587 --   	None.
1588 --
1589 -- In Parameters:
1590 --	p_post_record		->	new value of row that has been changed by current sf52.
1591 --
1592 -- Post Success:
1593 -- 	Data will have been re-applied to the non-datetrack table.
1594 --
1595 -- Post Failure:
1596 --   Error would have been displayed to user and exception raised.
1597 --
1598 -- Developer Implementation Notes:
1599 --   None
1600 --
1601 -- Access Status:
1602 --   Internal Development Use Only.
1603 --
1604 -- {End Of Comments}
1605 -- ---------------------------------------------------------------------------
1606 Procedure Cascade_addresses (
1607 	p_post_record	in	ghr_pa_history%rowtype) is
1608 
1609 	l_hist_addresses_data	ghr_pa_history%rowtype;
1610 	l_addresses_data		per_addresses%rowtype;
1611 	l_result_code		varchar2(30);
1612 	l_proc			varchar2(30):='Cascade_addresses';
1613 
1614 Begin
1615 
1616 
1617 	hr_utility.set_location( 'Entering : ' || l_proc, 10);
1618 	-- This procedure will fetch
1619 	-- the most recent record from history and update the database.
1620 	hr_utility.set_location( l_proc, 20);
1621 	Fetch_most_recent_record(
1622 		p_table_name 	=> ghr_history_api.g_addres_table,
1623 		p_table_pk_id	=> p_post_record.information1,
1624 		p_person_id		=> p_post_record.person_id,
1625 		p_history_data	=> l_hist_addresses_data,
1626 		p_result_code     => l_result_code);
1627 	if l_result_code = 'not_found' then
1628 		-- this should never be the case
1629 		-- raise error.
1630 		hr_utility.set_location( l_proc, 30);
1631 	      hr_utility.set_message(8301, 'GHR_38367_NO_ADDRESS_RECORD');
1632 	      hr_utility.raise_error;
1633 	else
1634 		hr_utility.set_location( l_proc, 40);
1635 			ghr_history_conv_rg.Conv_to_addresses_rg(
1636 			p_addresses_data  => l_addresses_data,
1637 			p_history_data 	=> l_hist_addresses_data);
1638 			correct_addresses_row( p_addr_data => l_addresses_data);
1639 	end if;
1640 	hr_utility.set_location( l_proc, 90);
1641 End cascade_addresses;
1642 
1643 -- ---------------------------------------------------------------------------
1644 -- |--------------------------< cascade_perana>-------------------------------|
1645 -- ---------------------------------------------------------------------------
1646 -- {Start Of Comments}
1647 --
1648 -- Description:
1649 --   	This procedure cascades data changes in per_person_analyses core application table.
1650 --	Since this table is not date-tracked by core, cascade of these
1651 --	tables simply re-applies the most recent record in history according to
1652 --	the sysdate. This is necessary because update to database will have applied
1653 --	any changes to this table regardless of effective date of the action. So, this
1654 --	cascade ensures that this non-datetrack table contains the correct data
1655 --	according to the sysdate.
1656 --
1657 -- Pre-Requisities:
1658 --   	None.
1659 --
1660 -- In Parameters:
1661 --	p_post_record		->	new value of row that has been changed by current sf52.
1662 --
1663 -- Post Success:
1664 -- 	Data will have been re-applied to the non-datetrack table.
1665 --
1666 -- Post Failure:
1667 --   Error would have been displayed to user and exception raised.
1668 --
1669 -- Developer Implementation Notes:
1670 --   None
1671 --
1672 -- Access Status:
1673 --   Internal Development Use Only.
1674 --
1675 -- {End Of Comments}
1676 -- ---------------------------------------------------------------------------
1677 Procedure Cascade_perana (
1678 	p_post_record	in	ghr_pa_history%rowtype) is
1679 
1680 	l_hist_perana_data	ghr_pa_history%rowtype;
1681 	l_perana_data		per_person_analyses%rowtype;
1682 	l_result_code		varchar2(30);
1683 	l_proc			varchar2(30):='Cascade_perana';
1684 
1685 Begin
1686 
1687 
1688 	hr_utility.set_location( 'Entering : ' || l_proc, 10);
1689 	-- This procedure will fetch
1690 	-- the most recent record from history and update the database.
1691 	hr_utility.set_location( l_proc, 20);
1692 	Fetch_most_recent_record(
1693 		p_table_name 	=> ghr_history_api.g_perana_table,
1694 		p_table_pk_id	=> p_post_record.information1,
1695 		p_person_id		=> p_post_record.person_id,
1696 		p_history_data	=> l_hist_perana_data,
1697 		p_result_code     => l_result_code);
1698 	if l_result_code = 'not_found' then
1699 		-- this should never be the case
1700 		-- raise error.
1701 		hr_utility.set_location( l_proc, 30);
1702 	      hr_utility.set_message(8301, 'GHR_38367_NO_ADDRESS_RECORD');
1703 	      hr_utility.raise_error;
1704 	else
1705 		hr_utility.set_location( l_proc, 40);
1706 			ghr_history_conv_rg.Conv_to_peranalyses_rg(
1707 			p_peranalyses_data 	=> l_perana_data,
1708 			p_history_data 		=> l_hist_perana_data);
1709 			correct_perana_row( p_perana_data => l_perana_data);
1710 	end if;
1711 	hr_utility.set_location( l_proc, 90);
1712 End cascade_perana;
1713 
1714 -- ---------------------------------------------------------------------------
1715 -- |--------------------------< correct_people_row>---------------------------|
1716 -- ---------------------------------------------------------------------------
1717 -- {Start Of Comments}
1718 --
1719 -- Description:
1720 --   	This procedure applies the record given to the per_people_f table.
1721 --
1722 -- Pre-Requisities:
1723 --   	None.
1724 --
1725 -- In Parameters:
1726 --	p_people_data		->	per_people_f record that is being applied.
1727 --
1728 -- Post Success:
1729 -- 	per_people_f record will have been applied.
1730 --
1731 -- Post Failure:
1732 --   Error would have been displayed to user and exception raised.
1733 --
1734 -- Developer Implementation Notes:
1735 --   None
1736 --
1737 -- Access Status:
1738 --   Internal Development Use Only.
1739 --
1740 -- {End Of Comments}
1741 -- ---------------------------------------------------------------------------
1742 -- Procedure Correct_people_row will update the Per_People_F row in correct mode
1743 Procedure Correct_people_row (p_people_data in out nocopy per_all_people_f%rowtype) is
1744 
1745 	-- this cursor gets the object_version_number from core table, so the core
1746 	-- table can be updated.
1747 	cursor c_people_getovn(  cp_person_id	number,
1748 					 cp_eff_st_dt	date
1749 					,cp_eff_end_dt	date) is
1750 	select object_version_number
1751 	from per_all_people_f
1752 	where person_id = cp_person_id
1753 	and	effective_start_date	= cp_eff_st_dt;
1754 
1755 --	and	effective_end_date	= cp_eff_end_dt;
1756 
1757 	l_datetrack_mode			varchar2(30):=hr_api.g_correction;
1758 	l_dob_null_warning		boolean;
1759 	l_name_combination_warning	boolean;
1760         l_orig_hire_warning             boolean;
1761 	l_people_data                   per_all_people_f%rowtype;
1762 	l_proc 				varchar2(30):='Correct_people_Row';
1763         l_date1                         per_all_people_f.effective_start_date%type;
1764 
1765 Begin
1766 
1767 	hr_utility.set_location( 'Entering : ' || l_proc, 10);
1768 	-- Initialise Local Variables
1769 	   l_people_data:=p_people_data;
1770 	--
1771 	open c_people_getovn( 	cp_person_id	=> 	p_people_data.person_id,
1772 					cp_eff_st_dt	=> 	p_people_data.effective_start_date,
1773 					cp_eff_end_dt	=>	p_people_data.effective_end_date );
1774 	Fetch c_people_getovn into p_people_data.object_version_number;
1775 	if c_people_getovn%notfound then
1776 		close c_people_getovn;
1777 	      hr_utility.set_message(8301, 'GHR_38368_PEOPLE_OVN_NFND');
1778 	      hr_utility.raise_error;
1779 	else
1780 		close c_people_getovn;
1781 	end if;
1782     l_date1 := p_people_data.effective_start_date;
1783 
1784     per_per_upd.upd(
1785       p_person_id                             => p_people_data.person_id                     ,
1786       p_effective_start_date                  => l_date1,
1787       p_effective_end_date                    => p_people_data.effective_end_date            ,
1788       p_person_type_id                        => p_people_data.person_type_id                ,
1789       p_last_name                             => p_people_data.last_name                     ,
1790       p_start_date                            => p_people_data.start_date                    ,
1791       p_applicant_number                      => p_people_data.applicant_number              ,
1792       p_background_check_status               => p_people_data.background_check_status       ,
1793       p_background_date_check                 => p_people_data.background_date_check         ,
1794       p_blood_type                            => p_people_data.blood_type                    ,
1795       p_comment_id                            => p_people_data.comment_id                    ,
1796       p_correspondence_language               => p_people_data.correspondence_language       ,
1797       p_current_applicant_flag                => p_people_data.current_applicant_flag        ,
1798       p_current_emp_or_apl_flag               => p_people_data.current_emp_or_apl_flag       ,
1799       p_current_employee_flag                 => p_people_data.current_employee_flag         ,
1800       p_date_employee_data_verified           => p_people_data.date_employee_data_verified   ,
1801       p_date_of_birth                         => p_people_data.date_of_birth                 ,
1802       p_email_address                         => p_people_data.email_address                 ,
1803       p_employee_number                       => p_people_data.employee_number               ,
1804       p_expense_check_send_to_addres          => p_people_data.expense_check_send_to_address ,
1805       p_fast_path_employee                    => p_people_data.fast_path_employee            ,
1806       p_first_name                            => p_people_data.first_name                    ,
1807       p_fte_capacity                          => p_people_data.fte_capacity                  ,
1808       p_full_name                             => p_people_data.full_name                     ,
1809       p_hold_applicant_date_until             => p_people_data.hold_applicant_date_until     ,
1810       p_honors                                => p_people_data.honors                        ,
1811       p_internal_location                     => p_people_data.internal_location             ,
1812       p_known_as                              => p_people_data.known_as                      ,
1813       p_last_medical_test_by                  => p_people_data.last_medical_test_by          ,
1814       p_last_medical_test_date                => p_people_data.last_medical_test_date        ,
1815       p_mailstop                              => p_people_data.mailstop                      ,
1816       p_marital_status                        => p_people_data.marital_status                ,
1817       p_middle_names                          => p_people_data.middle_names                  ,
1818       p_nationality                           => p_people_data.nationality                   ,
1819       p_national_identifier                   => p_people_data.national_identifier           ,
1820       p_office_number                         => p_people_data.office_number                 ,
1821       p_on_military_service                   => p_people_data.on_military_service           ,
1822      -- 2461762
1823      -- p_order_name                            => p_people_data.order_name                    ,
1824       p_pre_name_adjunct                      => p_people_data.pre_name_adjunct              ,
1825       p_previous_last_name                    => p_people_data.previous_last_name            ,
1826       p_projected_start_date                  => p_people_data.projected_start_date          ,
1827       p_rehire_authorizor                     => p_people_data.rehire_authorizor             ,
1828       p_rehire_recommendation                 => p_people_data.rehire_recommendation         ,
1829       p_resume_exists                         => p_people_data.resume_exists                 ,
1830       p_resume_last_updated                   => p_people_data.resume_last_updated           ,
1831       p_registered_disabled_flag              => p_people_data.registered_disabled_flag      ,
1832       p_second_passport_exists                => p_people_data.second_passport_exists        ,
1833       p_sex                                   => p_people_data.sex                           ,
1834       p_student_status                        => p_people_data.student_status                ,
1835       p_suffix                                => p_people_data.suffix                        ,
1836       p_title                                 => p_people_data.title                         ,
1837       p_vendor_id                             => p_people_data.vendor_id                     ,
1838       p_work_schedule                         => p_people_data.work_schedule                 ,
1839       p_work_telephone                        => p_people_data.work_telephone                ,
1840       p_request_id                            => p_people_data.request_id                    ,
1841       p_program_application_id                => p_people_data.program_application_id        ,
1842       p_program_id                            => p_people_data.program_id                    ,
1843       p_program_update_date                   => p_people_data.program_update_date           ,
1844       p_attribute_category                    => p_people_data.attribute_category            ,
1845       p_attribute1                            => p_people_data.attribute1                    ,
1846       p_attribute2                            => p_people_data.attribute2                    ,
1847       p_attribute3                            => p_people_data.attribute3                    ,
1848       p_attribute4                            => p_people_data.attribute4                    ,
1849       p_attribute5                            => p_people_data.attribute5                    ,
1850       p_attribute6                            => p_people_data.attribute6                    ,
1851       p_attribute7                            => p_people_data.attribute7                    ,
1852       p_attribute8                            => p_people_data.attribute8                    ,
1853       p_attribute9                            => p_people_data.attribute9                    ,
1854       p_attribute10                           => p_people_data.attribute10                   ,
1855       p_attribute11                           => p_people_data.attribute11                   ,
1856       p_attribute12                           => p_people_data.attribute12                   ,
1857       p_attribute13                           => p_people_data.attribute13                   ,
1858       p_attribute14                           => p_people_data.attribute14                   ,
1859       p_attribute15                           => p_people_data.attribute15                   ,
1860       p_attribute16                           => p_people_data.attribute16                   ,
1861       p_attribute17                           => p_people_data.attribute17                   ,
1862       p_attribute18                           => p_people_data.attribute18                   ,
1863       p_attribute19                           => p_people_data.attribute19                   ,
1864       p_attribute20                           => p_people_data.attribute20                   ,
1865       p_attribute21                           => p_people_data.attribute21                   ,
1866       p_attribute22                           => p_people_data.attribute22                   ,
1867       p_attribute23                           => p_people_data.attribute23                   ,
1868       p_attribute24                           => p_people_data.attribute24                   ,
1869       p_attribute25                           => p_people_data.attribute25                   ,
1870       p_attribute26                           => p_people_data.attribute26                   ,
1871       p_attribute27                           => p_people_data.attribute27                   ,
1872       p_attribute28                           => p_people_data.attribute28                   ,
1873       p_attribute29                           => p_people_data.attribute29                   ,
1874       p_attribute30                           => p_people_data.attribute30                   ,
1875       p_per_information_category              => p_people_data.per_information_category      ,
1876       p_per_information1                      => p_people_data.per_information1              ,
1877       p_per_information2                      => p_people_data.per_information2              ,
1878       p_per_information3                      => p_people_data.per_information3              ,
1879       p_per_information4                      => p_people_data.per_information4              ,
1880       p_per_information5                      => p_people_data.per_information5              ,
1881       p_per_information6                      => p_people_data.per_information6              ,
1882       p_per_information7                      => p_people_data.per_information7              ,
1883       p_per_information8                      => p_people_data.per_information8              ,
1884       p_per_information9                      => p_people_data.per_information9              ,
1885       p_per_information10                     => p_people_data.per_information10             ,
1886       p_per_information11                     => p_people_data.per_information11             ,
1887       p_per_information12                     => p_people_data.per_information12             ,
1888       p_per_information13                     => p_people_data.per_information13             ,
1889       p_per_information14                     => p_people_data.per_information14             ,
1890       p_per_information15                     => p_people_data.per_information15             ,
1891       p_per_information16                     => p_people_data.per_information16             ,
1892       p_per_information17                     => p_people_data.per_information17             ,
1893       p_per_information18                     => p_people_data.per_information18             ,
1894       p_per_information19                     => p_people_data.per_information19             ,
1895       p_per_information20                     => p_people_data.per_information20             ,
1896       p_per_information21                     => p_people_data.per_information21             ,
1897       p_per_information22                     => p_people_data.per_information22             ,
1898       p_per_information23                     => p_people_data.per_information23             ,
1899       p_per_information24                     => p_people_data.per_information24             ,
1900       p_per_information25                     => p_people_data.per_information25             ,
1901       p_per_information26                     => p_people_data.per_information26             ,
1902       p_per_information27                     => p_people_data.per_information27             ,
1903       p_per_information28                     => p_people_data.per_information28             ,
1904       p_per_information29                     => p_people_data.per_information29             ,
1905       p_per_information30                     => p_people_data.per_information30             ,
1906       p_object_version_number                 => p_people_data.object_version_number         ,
1907       p_date_of_death                         => p_people_data.date_of_death                 ,
1908       p_rehire_reason                         => p_people_data.rehire_reason                 ,
1909       p_effective_date		                => p_people_data.effective_start_date          ,
1910       p_datetrack_mode		                => l_datetrack_mode                            ,
1911       p_name_combination_warning              => l_name_combination_warning                  ,
1912       p_dob_null_warning                      => l_dob_null_warning,
1913       p_orig_hire_warning                     => l_orig_hire_warning,
1914       p_npw_number                            => p_people_data.npw_number,
1915       p_current_npw_flag                      => p_people_data.current_npw_flag
1916     );
1917     hr_utility.set_location( 'Leaving : ' || l_proc, 20);
1918 Exception
1919 When Others then
1920    -- RESET In/Out Params and SET Out Params
1921    p_people_data:=l_people_data;
1922    hr_utility.set_location( 'Leaving : ' || l_proc, 25);
1923    Raise;
1924 
1925 End Correct_people_row;
1926 
1927 -- ---------------------------------------------------------------------------
1928 -- |--------------------------< correct_asgn_row>-----------------------------|
1929 -- ---------------------------------------------------------------------------
1930 -- {Start Of Comments}
1931 --
1932 -- Description:
1933 --   	This procedure applies the record given to the per_assignments_f table.
1934 --
1935 -- Pre-Requisities:
1936 --   	None.
1937 --
1938 -- In Parameters:
1939 --	p_asgn_data		->	per_assignments_f record that is being applied.
1940 --
1941 -- Post Success:
1942 -- 	per_assignments_f record will have been applied.
1943 --
1944 -- Post Failure:
1945 --   Error would have been displayed to user and exception raised.
1946 --
1947 -- Developer Implementation Notes:
1948 --   None
1949 --
1950 -- Access Status:
1951 --   Internal Development Use Only.
1952 --
1953 -- {End Of Comments}
1954 -- ---------------------------------------------------------------------------
1955 Procedure Correct_asgn_row (
1956 	p_asgn_data	in out nocopy per_all_assignments_f%rowtype) is
1957 
1958 	-- this cursor gets the object_version_number from core table, so the core
1959 	-- table can be updated.
1960 	cursor c_asgn_getovn( 	 cp_assignment_id	number,
1961 					 cp_eff_st_dt	date
1962 					,cp_eff_end_dt	date) is
1963 	select object_version_number
1964 	from per_all_assignments_f
1965 	where assignment_id = cp_assignment_id
1966 	and effective_start_date	= cp_eff_st_dt;
1967 
1968 --	and effective_end_date		= cp_eff_end_dt;
1969 
1970 	l_asgn_data		       per_all_assignments_f%rowtype;
1971 	l_payroll_id_updated           boolean;
1972 	l_other_manager_warning        boolean;
1973 	l_no_managers_warning          boolean;
1974 	l_hourly_salaried_warning      boolean;
1975 	l_org_now_no_manager_warning   boolean;
1976 	l_validation_start_date        date;
1977 	l_validation_end_date          date;
1978 	l_object_version_number        number;
1979 	l_effective_date               date:= p_asgn_data.effective_Start_date;
1980 	l_datetrack_mode               varchar2(30):=hr_api.g_correction;
1981 	l_validate                     boolean;
1982 
1983 	l_proc	varchar2(30):='correct_asgn_row';
1984 
1985 Begin
1986 	hr_utility.set_location('Entering : ' || l_proc, 10);
1987 
1988      -- Initialise local variables
1989 	l_asgn_data:=p_asgn_data;
1990      --
1991 	open c_asgn_getovn( 	cp_assignment_id	=>	p_asgn_data.assignment_id,
1992 					cp_eff_st_dt	=>	p_asgn_data.effective_start_date,
1993 					cp_eff_end_dt	=>	p_asgn_data.effective_end_date );
1994 	Fetch c_asgn_getovn into p_asgn_data.object_version_number;
1995 	if c_asgn_getovn%notfound then
1996 		close c_asgn_getovn;
1997 	      hr_utility.set_message(8301, 'GHR_38369_ASGN_OVN_NFND');
1998 	      hr_utility.raise_error;
1999 	else
2000 		close c_asgn_getovn;
2001 	end if;
2002 
2003    Per_asg_upd.upd(
2004       p_assignment_id                         => p_asgn_data.assignment_id                   ,
2005       p_effective_start_date                  => p_asgn_data.effective_start_date            ,
2006       p_effective_end_date                    => p_asgn_data.effective_end_date              ,
2007       p_business_group_id                     => p_asgn_data.business_group_id               ,
2008 --
2009       p_recruiter_id                          => p_asgn_data.recruiter_id                    ,
2010       p_grade_id                              => p_asgn_data.grade_id                        ,
2011       p_position_id                           => p_asgn_data.position_id                     ,
2012       p_job_id                                => p_asgn_data.job_id                          ,
2013       p_assignment_status_type_id             => p_asgn_data.assignment_status_type_id       ,
2014       p_payroll_id                            => p_asgn_data.payroll_id                      ,
2015       p_location_id                           => p_asgn_data.location_id                     ,
2016       p_person_referred_by_id                 => p_asgn_data.person_referred_by_id           ,
2017       p_supervisor_id                         => p_asgn_data.supervisor_id                   ,
2018       p_special_ceiling_step_id               => p_asgn_data.special_ceiling_step_id         ,
2019       p_recruitment_activity_id               => p_asgn_data.recruitment_activity_id         ,
2020       p_source_organization_id                => p_asgn_data.source_organization_id          ,
2021       p_organization_id                       => p_asgn_data.organization_id                 ,
2022       p_people_group_id                       => p_asgn_data.people_group_id                 ,
2023       p_soft_coding_keyflex_id                => p_asgn_data.soft_coding_keyflex_id          ,
2024       p_vacancy_id                            => p_asgn_data.vacancy_id                      ,
2025       p_pay_basis_id                          => p_asgn_data.pay_basis_id                    ,
2026       p_assignment_type                       => p_asgn_data.assignment_type                 ,
2027       p_primary_flag                          => p_asgn_data.primary_flag                    ,
2028       p_application_id                        => p_asgn_data.application_id                  ,
2029       p_assignment_number                     => p_asgn_data.assignment_number               ,
2030       p_change_reason                         => p_asgn_data.change_reason                   ,
2031       p_comment_id                            => p_asgn_data.comment_id                      ,
2032       p_date_probation_end                    => p_asgn_data.date_probation_end              ,
2033       p_default_code_comb_id                  => p_asgn_data.default_code_comb_id            ,
2034       p_employment_category                   => p_asgn_data.employment_category             ,
2035       p_frequency                             => p_asgn_data.frequency                       ,
2036       p_internal_address_line                 => p_asgn_data.internal_address_line           ,
2037       p_manager_flag                          => p_asgn_data.manager_flag                    ,
2038       p_normal_hours                          => p_asgn_data.normal_hours                    ,
2039       p_perf_review_period                    => p_asgn_data.perf_review_period              ,
2040       p_perf_review_period_frequency          => p_asgn_data.perf_review_period_frequency    ,
2041       p_period_of_service_id                  => p_asgn_data.period_of_service_id            ,
2042       p_probation_period                      => p_asgn_data.probation_period                ,
2043       p_probation_unit                        => p_asgn_data.probation_unit                  ,
2044       p_sal_review_period                     => p_asgn_data.sal_review_period               ,
2045       p_sal_review_period_frequency           => p_asgn_data.sal_review_period_frequency     ,
2046       p_set_of_books_id                       => p_asgn_data.set_of_books_id                 ,
2047       p_source_type                           => p_asgn_data.source_type                     ,
2048       p_time_normal_finish                    => p_asgn_data.time_normal_finish              ,
2049       p_time_normal_start                     => p_asgn_data.time_normal_start               ,
2050       p_request_id                            => p_asgn_data.request_id                      ,
2051       p_program_application_id                => p_asgn_data.program_application_id          ,
2052       p_program_id                            => p_asgn_data.program_id                      ,
2053       p_program_update_date                   => p_asgn_data.program_update_date             ,
2054       p_ass_attribute_category                => p_asgn_data.ass_attribute_category          ,
2055       p_ass_attribute1                        => p_asgn_data.ass_attribute1                  ,
2056       p_ass_attribute2                        => p_asgn_data.ass_attribute2                  ,
2057       p_ass_attribute3                        => p_asgn_data.ass_attribute3                  ,
2058       p_ass_attribute4                        => p_asgn_data.ass_attribute4                  ,
2059       p_ass_attribute5                        => p_asgn_data.ass_attribute5                  ,
2060       p_ass_attribute6                        => p_asgn_data.ass_attribute6                  ,
2061       p_ass_attribute7                        => p_asgn_data.ass_attribute7                  ,
2062       p_ass_attribute8                        => p_asgn_data.ass_attribute8                  ,
2063       p_ass_attribute9                        => p_asgn_data.ass_attribute9                  ,
2064       p_ass_attribute10                       => p_asgn_data.ass_attribute10                 ,
2065       p_ass_attribute11                       => p_asgn_data.ass_attribute11                 ,
2066       p_ass_attribute12                       => p_asgn_data.ass_attribute12                 ,
2067       p_ass_attribute13                       => p_asgn_data.ass_attribute13                 ,
2068       p_ass_attribute14                       => p_asgn_data.ass_attribute14                 ,
2069       p_ass_attribute15                       => p_asgn_data.ass_attribute15                 ,
2070       p_ass_attribute16                       => p_asgn_data.ass_attribute16                 ,
2071       p_ass_attribute17                       => p_asgn_data.ass_attribute17                 ,
2072       p_ass_attribute18                       => p_asgn_data.ass_attribute18                 ,
2073       p_ass_attribute19                       => p_asgn_data.ass_attribute19                 ,
2074       p_ass_attribute20                       => p_asgn_data.ass_attribute20                 ,
2075       p_ass_attribute21                       => p_asgn_data.ass_attribute21                 ,
2076       p_ass_attribute22                       => p_asgn_data.ass_attribute22                 ,
2077       p_ass_attribute23                       => p_asgn_data.ass_attribute23                 ,
2078       p_ass_attribute24                       => p_asgn_data.ass_attribute24                 ,
2079       p_ass_attribute25                       => p_asgn_data.ass_attribute25                 ,
2080       p_ass_attribute26                       => p_asgn_data.ass_attribute26                 ,
2081       p_ass_attribute27                       => p_asgn_data.ass_attribute27                 ,
2082       p_ass_attribute28                       => p_asgn_data.ass_attribute28                 ,
2083       p_ass_attribute29                       => p_asgn_data.ass_attribute29                 ,
2084       p_ass_attribute30                       => p_asgn_data.ass_attribute30                 ,
2085       p_title                                 => p_asgn_data.title                           ,
2086       p_object_version_number                 => p_asgn_data.object_version_number           ,
2087 	p_payroll_id_updated                    => l_payroll_id_updated                        ,
2088 	p_other_manager_warning                 => l_other_manager_warning                     ,
2089 	p_no_managers_warning                   => l_no_managers_warning                       ,
2090 	p_org_now_no_manager_warning            => l_org_now_no_manager_warning                ,
2091         p_hourly_salaried_warning               => l_hourly_salaried_warning                   ,
2092 	p_validation_start_date                 => l_validation_start_date                     ,
2093 	p_validation_end_date                   => l_validation_end_date                       ,
2094 	p_effective_date                        => l_effective_date                        ,
2095 	p_datetrack_mode                        => l_datetrack_mode                            ,
2096 	p_validate                              => l_validate
2097 	);
2098 
2099 	hr_utility.set_location('Leaving : ' || l_proc, 20);
2100 Exception
2101 When Others then
2102    -- RESET In/Out params and SET Out Params
2103    p_asgn_data:=l_asgn_data;
2104    hr_utility.set_location('Leaving : ' || l_proc,25);
2105    Raise;
2106 
2107 End correct_asgn_row;
2108 
2109 -- ---------------------------------------------------------------------------
2110 -- |--------------------------< correct_peopleei_row>-------------------------|
2111 -- ---------------------------------------------------------------------------
2112 -- {Start Of Comments}
2113 --
2114 -- Description:
2115 --   	This procedure applies the record given to the per_people_extra_info table.
2116 --
2117 -- Pre-Requisities:
2118 --   	None.
2119 --
2120 -- In Parameters:
2121 --	p_peopleei_data		->	per_people_extra_info record that is being applied.
2122 --
2123 -- Post Success:
2124 -- 	per_people_extra_info record will have been applied.
2125 --
2126 -- Post Failure:
2127 --   Error would have been displayed to user and exception raised.
2128 --
2129 -- Developer Implementation Notes:
2130 --   None
2131 --
2132 -- Access Status:
2133 --   Internal Development Use Only.
2134 --
2135 -- {End Of Comments}
2136 -- ---------------------------------------------------------------------------
2137 Procedure Correct_peopleei_row ( p_peopleei_data	in out nocopy per_people_extra_info%rowtype) is
2138 
2139 	-- this cursor gets the object_version_number from core table, so the core
2140 	-- table can be updated.
2141 	cursor c_peopleei_getovn( cp_people_ei_id	number) is
2142 	select object_version_number
2143 	from per_people_extra_info
2144 	where person_extra_info_id = cp_people_ei_id;
2145 
2146 	l_peopleei_data	  per_people_extra_info%rowtype;
2147 	l_proc		  varchar2(30):='correct_peopleei_row';
2148 Begin
2149 	hr_utility.set_location( 'Entering : ' || l_proc, 10);
2150 	hr_utility.set_location( 'p_peopleei_data.person_extra_info_id : ' || p_peopleei_data.person_extra_info_id || l_proc, 11);
2151 	hr_utility.set_location( 'p_peopleei_data.pei_information11 : ' || p_peopleei_data.pei_information11 || l_proc, 12);
2152 
2153 	--Initialise Local Variables
2154 	l_peopleei_data := p_peopleei_data;
2155 	--
2156 
2157 	open c_peopleei_getovn( p_peopleei_data.person_extra_info_id );
2158 	Fetch c_peopleei_getovn into p_peopleei_data.object_version_number;
2159 	if c_peopleei_getovn%notfound then
2160 	hr_utility.set_location( 'Entering : ' || l_proc, 11);
2161 		close c_peopleei_getovn;
2162 	      hr_utility.set_message(8301, 'GHR_38370_PEOPLEEI_OVN_NFND');
2163 	      hr_utility.raise_error;
2164 	else
2165 		close c_peopleei_getovn;
2166 	end if;
2167     pe_pei_upd.upd(
2168       p_person_extra_info_id     => p_peopleei_data.person_extra_info_id     ,
2169 --      p_person_id                => p_peopleei_data.person_id                ,
2170 --      p_information_type         => p_peopleei_data.information_type         ,
2171       p_request_id               => p_peopleei_data.request_id               ,
2172       p_program_application_id   => p_peopleei_data.program_application_id   ,
2173       p_program_id               => p_peopleei_data.program_id               ,
2174       p_program_update_date      => p_peopleei_data.program_update_date      ,
2175       p_pei_attribute_category   => p_peopleei_data.pei_attribute_category   ,
2176       p_pei_attribute1           => p_peopleei_data.pei_attribute1           ,
2177       p_pei_attribute2           => p_peopleei_data.pei_attribute2           ,
2178       p_pei_attribute3           => p_peopleei_data.pei_attribute3           ,
2179       p_pei_attribute4           => p_peopleei_data.pei_attribute4           ,
2180       p_pei_attribute5           => p_peopleei_data.pei_attribute5           ,
2181       p_pei_attribute6           => p_peopleei_data.pei_attribute6           ,
2182       p_pei_attribute7           => p_peopleei_data.pei_attribute7           ,
2183       p_pei_attribute8           => p_peopleei_data.pei_attribute8           ,
2184       p_pei_attribute9           => p_peopleei_data.pei_attribute9           ,
2185       p_pei_attribute10          => p_peopleei_data.pei_attribute10          ,
2186       p_pei_attribute11          => p_peopleei_data.pei_attribute11          ,
2187       p_pei_attribute12          => p_peopleei_data.pei_attribute12          ,
2188       p_pei_attribute13          => p_peopleei_data.pei_attribute13          ,
2189       p_pei_attribute14          => p_peopleei_data.pei_attribute14          ,
2190       p_pei_attribute15          => p_peopleei_data.pei_attribute15          ,
2191       p_pei_attribute16          => p_peopleei_data.pei_attribute16          ,
2192       p_pei_attribute17          => p_peopleei_data.pei_attribute17          ,
2193       p_pei_attribute18          => p_peopleei_data.pei_attribute18          ,
2194       p_pei_attribute19          => p_peopleei_data.pei_attribute19          ,
2195       p_pei_attribute20          => p_peopleei_data.pei_attribute20          ,
2196       p_pei_information_category => p_peopleei_data.pei_information_category ,
2197       p_pei_information1         => p_peopleei_data.pei_information1         ,
2198       p_pei_information2         => p_peopleei_data.pei_information2         ,
2199       p_pei_information3         => p_peopleei_data.pei_information3         ,
2200       p_pei_information4         => p_peopleei_data.pei_information4         ,
2201       p_pei_information5         => p_peopleei_data.pei_information5         ,
2202       p_pei_information6         => p_peopleei_data.pei_information6         ,
2203       p_pei_information7         => p_peopleei_data.pei_information7         ,
2204       p_pei_information8         => p_peopleei_data.pei_information8         ,
2205       p_pei_information9         => p_peopleei_data.pei_information9         ,
2206       p_pei_information10        => p_peopleei_data.pei_information10        ,
2207       p_pei_information11        => p_peopleei_data.pei_information11        ,
2208       p_pei_information12        => p_peopleei_data.pei_information12        ,
2209       p_pei_information13        => p_peopleei_data.pei_information13        ,
2210       p_pei_information14        => p_peopleei_data.pei_information14        ,
2211       p_pei_information15        => p_peopleei_data.pei_information15        ,
2212       p_pei_information16        => p_peopleei_data.pei_information16        ,
2213       p_pei_information17        => p_peopleei_data.pei_information17        ,
2214       p_pei_information18        => p_peopleei_data.pei_information18        ,
2215       p_pei_information19        => p_peopleei_data.pei_information19        ,
2216       p_pei_information20        => p_peopleei_data.pei_information20        ,
2217       p_pei_information21        => p_peopleei_data.pei_information21        ,
2218       p_pei_information22        => p_peopleei_data.pei_information22        ,
2219       p_pei_information23        => p_peopleei_data.pei_information23        ,
2220       p_pei_information24        => p_peopleei_data.pei_information24        ,
2221       p_pei_information25        => p_peopleei_data.pei_information25        ,
2222       p_pei_information26        => p_peopleei_data.pei_information26        ,
2223       p_pei_information27        => p_peopleei_data.pei_information27        ,
2224       p_pei_information28        => p_peopleei_data.pei_information28        ,
2225       p_pei_information29        => p_peopleei_data.pei_information29        ,
2226       p_pei_information30        => p_peopleei_data.pei_information30        ,
2227       p_object_version_number    => p_peopleei_data.object_version_number
2228 	);
2229 	hr_utility.set_location( 'Leaving : ' || l_proc, 20);
2230 
2231 Exception
2232 When Others then
2233    -- RESET In/Out params and SET Out Params
2234    p_peopleei_data:=l_peopleei_data;
2235    hr_utility.set_location('Leaving  ' || l_proc,25);
2236    Raise;
2237 
2238 End;
2239 
2240 -- ---------------------------------------------------------------------------
2241 -- |--------------------------< correct_asgnei_row>---------------------------|
2242 -- ---------------------------------------------------------------------------
2243 -- {Start Of Comments}
2244 --
2245 -- Description:
2246 --   	This procedure applies the record given to the per_assignment_extra_info table.
2247 --
2248 -- Pre-Requisities:
2249 --   	None.
2250 --
2251 -- In Parameters:
2252 --	p_asgnei_data		->	per_assignment_extra_info record that is being applied.
2253 --
2254 -- Post Success:
2255 -- 	per_assignment_extra_info record will have been applied.
2256 --
2257 -- Post Failure:
2258 --   Error would have been displayed to user and exception raised.
2259 --
2260 -- Developer Implementation Notes:
2261 --   None
2262 --
2263 -- Access Status:
2264 --   Internal Development Use Only.
2265 --
2266 -- {End Of Comments}
2267 -- ---------------------------------------------------------------------------
2268 
2269 -- Procedure Correct_asgnei_row will update the Per_People_F row in correct mode
2270 Procedure Correct_asgnei_row (p_asgnei_data in out nocopy per_assignment_extra_info%rowtype) is
2271 
2272 	-- this cursor gets the object_version_number from core table, so the core
2273 	-- table can be updated.
2274 	cursor c_asgnei_getovn( cp_assignment_ei_id	number) is
2275 	select object_version_number
2276 	from per_assignment_extra_info
2277 	where assignment_extra_info_id = cp_assignment_ei_id;
2278 
2279 	l_asgnei_data 	per_assignment_extra_info%rowtype;
2280 	l_proc 		varchar2(30):='Correct_asgnei_Row';
2281 
2282 Begin
2283 	hr_utility.set_location( 'Entering : ' || l_proc, 20);
2284 	-- Initialise Local variables
2285 	l_asgnei_data := p_asgnei_data;
2286 	--
2287 	open c_asgnei_getovn( p_asgnei_data.assignment_extra_info_id );
2288 	Fetch c_asgnei_getovn into p_asgnei_data.object_version_number;
2289 	if c_asgnei_getovn%notfound then
2290 		close c_asgnei_getovn;
2291 		-- raise error
2292 	      hr_utility.set_message(8301, 'GHR_38371_ASGNEI_OVN_NFND');
2293 	      hr_utility.raise_error;
2294 	else
2295 		close c_asgnei_getovn;
2296 	end if;
2297 	pe_aei_upd.upd(
2298       p_assignment_extra_info_id              => p_asgnei_data.assignment_extra_info_id      ,
2299       p_request_id                            => p_asgnei_data.request_id                    ,
2300       p_program_application_id                => p_asgnei_data.program_application_id        ,
2301       p_program_id                            => p_asgnei_data.program_id                    ,
2302       p_program_update_date                   => p_asgnei_data.program_update_date           ,
2303       p_aei_attribute_category                => p_asgnei_data.aei_attribute_category        ,
2304       p_aei_attribute1                        => p_asgnei_data.aei_attribute1                ,
2305       p_aei_attribute2                        => p_asgnei_data.aei_attribute2                ,
2306       p_aei_attribute3                        => p_asgnei_data.aei_attribute3                ,
2307       p_aei_attribute4                        => p_asgnei_data.aei_attribute4                ,
2308       p_aei_attribute5                        => p_asgnei_data.aei_attribute5                ,
2309       p_aei_attribute6                        => p_asgnei_data.aei_attribute6                ,
2310       p_aei_attribute7                        => p_asgnei_data.aei_attribute7                ,
2311       p_aei_attribute8                        => p_asgnei_data.aei_attribute8                ,
2312       p_aei_attribute9                        => p_asgnei_data.aei_attribute9                ,
2313       p_aei_attribute10                       => p_asgnei_data.aei_attribute10               ,
2314       p_aei_attribute11                       => p_asgnei_data.aei_attribute11               ,
2315       p_aei_attribute12                       => p_asgnei_data.aei_attribute12               ,
2316       p_aei_attribute13                       => p_asgnei_data.aei_attribute13               ,
2317       p_aei_attribute14                       => p_asgnei_data.aei_attribute14               ,
2318       p_aei_attribute15                       => p_asgnei_data.aei_attribute15               ,
2319       p_aei_attribute16                       => p_asgnei_data.aei_attribute16               ,
2320       p_aei_attribute17                       => p_asgnei_data.aei_attribute17               ,
2321       p_aei_attribute18                       => p_asgnei_data.aei_attribute18               ,
2322       p_aei_attribute19                       => p_asgnei_data.aei_attribute19               ,
2323       p_aei_attribute20                       => p_asgnei_data.aei_attribute20               ,
2324       p_aei_information_category              => p_asgnei_data.aei_information_category      ,
2325       p_aei_information1                      => p_asgnei_data.aei_information1              ,
2326       p_aei_information2                      => p_asgnei_data.aei_information2              ,
2327       p_aei_information3                      => p_asgnei_data.aei_information3              ,
2328       p_aei_information4                      => p_asgnei_data.aei_information4              ,
2329       p_aei_information5                      => p_asgnei_data.aei_information5              ,
2330       p_aei_information6                      => p_asgnei_data.aei_information6              ,
2331       p_aei_information7                      => p_asgnei_data.aei_information7              ,
2332       p_aei_information8                      => p_asgnei_data.aei_information8              ,
2333       p_aei_information9                      => p_asgnei_data.aei_information9              ,
2334       p_aei_information10                     => p_asgnei_data.aei_information10             ,
2335       p_aei_information11                     => p_asgnei_data.aei_information11             ,
2336       p_aei_information12                     => p_asgnei_data.aei_information12             ,
2337       p_aei_information13                     => p_asgnei_data.aei_information13             ,
2338       p_aei_information14                     => p_asgnei_data.aei_information14             ,
2339       p_aei_information15                     => p_asgnei_data.aei_information15             ,
2340       p_aei_information16                     => p_asgnei_data.aei_information16             ,
2341       p_aei_information17                     => p_asgnei_data.aei_information17             ,
2342       p_aei_information18                     => p_asgnei_data.aei_information18             ,
2343       p_aei_information19                     => p_asgnei_data.aei_information19             ,
2344       p_aei_information20                     => p_asgnei_data.aei_information20             ,
2345       p_aei_information21                     => p_asgnei_data.aei_information21             ,
2346       p_aei_information22                     => p_asgnei_data.aei_information22             ,
2347       p_aei_information23                     => p_asgnei_data.aei_information23             ,
2348       p_aei_information24                     => p_asgnei_data.aei_information24             ,
2349       p_aei_information25                     => p_asgnei_data.aei_information25             ,
2350       p_aei_information26                     => p_asgnei_data.aei_information26             ,
2351       p_aei_information27                     => p_asgnei_data.aei_information27             ,
2352       p_aei_information28                     => p_asgnei_data.aei_information28             ,
2353       p_aei_information29                     => p_asgnei_data.aei_information29             ,
2354       p_aei_information30                     => p_asgnei_data.aei_information30             ,
2355       p_object_version_number                 => p_asgnei_data.object_version_number
2356 	);
2357    hr_utility.set_location( 'Leaving : ' || l_proc, 20);
2358 Exception
2359 When Others then
2360    -- RESET In/Out Params and SET Out params
2361    p_asgnei_data:=l_asgnei_data;
2362    hr_utility.set_location( 'Leaving : ' || l_proc, 25);
2363    Raise;
2364 
2365 End;
2366 
2367 -- ---------------------------------------------------------------------------
2368 -- |--------------------------< correct_posnei_row>---------------------------|
2369 -- ---------------------------------------------------------------------------
2370 -- {Start Of Comments}
2371 --
2372 -- Description:
2373 --   	This procedure applies the record given to the per_position_extra_info table.
2374 --
2375 -- Pre-Requisities:
2376 --   	None.
2377 --
2378 -- In Parameters:
2379 --	p_posnei_data		->	per_position_extra_info record that is being applied.
2380 --
2381 -- Post Success:
2382 -- 	per_position_extra_info record will have been applied.
2383 --
2384 -- Post Failure:
2385 --   Error would have been displayed to user and exception raised.
2386 --
2387 -- Developer Implementation Notes:
2388 --   None
2389 --
2390 -- Access Status:
2391 --   Internal Development Use Only.
2392 --
2393 -- {End Of Comments}
2394 -- ---------------------------------------------------------------------------
2395 -- Procedure Correct_posnei_row will update the Per_position_extra_info row in correct mode
2396 Procedure Correct_posnei_row (p_posnei_data in out nocopy per_position_extra_info%rowtype) is
2397 
2398 	-- this cursor gets the object_version_number from core table, so the core
2399 	-- table can be updated.
2400 	cursor c_posnei_getovn( cp_position_ei_id	number) is
2401 	select object_version_number
2402 	from per_position_extra_info
2403 	where position_extra_info_id = cp_position_ei_id;
2404 
2405 	l_posnei_data 	per_position_extra_info%rowtype;
2406 	l_proc 		varchar2(30):='Correct_posnei_Row';
2407 
2408 Begin
2409 	hr_utility.set_location( 'Entering : ' || l_proc, 10);
2410 	-- Initialise Local Variables
2411 	l_posnei_data := p_posnei_data;
2412 	--
2413 	open c_posnei_getovn( p_posnei_data.position_extra_info_id );
2414 	Fetch c_posnei_getovn into p_posnei_data.object_version_number;
2415 	if c_posnei_getovn%notfound then
2416 		close c_posnei_getovn;
2417 		-- raise error
2418 	      hr_utility.set_message(8301, 'GHR_38372_POSNEI_OVN_NFND');
2419 	      hr_utility.raise_error;
2420 	else
2421 		close c_posnei_getovn;
2422 	end if;
2423 	pe_poi_upd.upd(
2424       p_position_extra_info_id              => p_posnei_data.position_extra_info_id      ,
2425       p_request_id                            => p_posnei_data.request_id                    ,
2426       p_program_application_id                => p_posnei_data.program_application_id        ,
2427       p_program_id                            => p_posnei_data.program_id                    ,
2428       p_program_update_date                   => p_posnei_data.program_update_date           ,
2429       p_poei_attribute_category                => p_posnei_data.poei_attribute_category        ,
2430       p_poei_attribute1                        => p_posnei_data.poei_attribute1                ,
2431       p_poei_attribute2                        => p_posnei_data.poei_attribute2                ,
2432       p_poei_attribute3                        => p_posnei_data.poei_attribute3                ,
2433       p_poei_attribute4                        => p_posnei_data.poei_attribute4                ,
2434       p_poei_attribute5                        => p_posnei_data.poei_attribute5                ,
2435       p_poei_attribute6                        => p_posnei_data.poei_attribute6                ,
2436       p_poei_attribute7                        => p_posnei_data.poei_attribute7                ,
2437       p_poei_attribute8                        => p_posnei_data.poei_attribute8                ,
2438       p_poei_attribute9                        => p_posnei_data.poei_attribute9                ,
2439       p_poei_attribute10                       => p_posnei_data.poei_attribute10               ,
2440       p_poei_attribute11                       => p_posnei_data.poei_attribute11               ,
2441       p_poei_attribute12                       => p_posnei_data.poei_attribute12               ,
2442       p_poei_attribute13                       => p_posnei_data.poei_attribute13               ,
2443       p_poei_attribute14                       => p_posnei_data.poei_attribute14               ,
2444       p_poei_attribute15                       => p_posnei_data.poei_attribute15               ,
2445       p_poei_attribute16                       => p_posnei_data.poei_attribute16               ,
2446       p_poei_attribute17                       => p_posnei_data.poei_attribute17               ,
2447       p_poei_attribute18                       => p_posnei_data.poei_attribute18               ,
2448       p_poei_attribute19                       => p_posnei_data.poei_attribute19               ,
2449       p_poei_attribute20                       => p_posnei_data.poei_attribute20               ,
2450       p_poei_information_category              => p_posnei_data.poei_information_category      ,
2451       p_poei_information1                      => p_posnei_data.poei_information1              ,
2452       p_poei_information2                      => p_posnei_data.poei_information2              ,
2453       p_poei_information3                      => p_posnei_data.poei_information3              ,
2454       p_poei_information4                      => p_posnei_data.poei_information4              ,
2455       p_poei_information5                      => p_posnei_data.poei_information5              ,
2456       p_poei_information6                      => p_posnei_data.poei_information6              ,
2457       p_poei_information7                      => p_posnei_data.poei_information7              ,
2458       p_poei_information8                      => p_posnei_data.poei_information8              ,
2459       p_poei_information9                      => p_posnei_data.poei_information9              ,
2460       p_poei_information10                     => p_posnei_data.poei_information10             ,
2461       p_poei_information11                     => p_posnei_data.poei_information11             ,
2462       p_poei_information12                     => p_posnei_data.poei_information12             ,
2463       p_poei_information13                     => p_posnei_data.poei_information13             ,
2464       p_poei_information14                     => p_posnei_data.poei_information14             ,
2465       p_poei_information15                     => p_posnei_data.poei_information15             ,
2466       p_poei_information16                     => p_posnei_data.poei_information16             ,
2467       p_poei_information17                     => p_posnei_data.poei_information17             ,
2468       p_poei_information18                     => p_posnei_data.poei_information18             ,
2469       p_poei_information19                     => p_posnei_data.poei_information19             ,
2470       p_poei_information20                     => p_posnei_data.poei_information20             ,
2471       p_poei_information21                     => p_posnei_data.poei_information21             ,
2472       p_poei_information22                     => p_posnei_data.poei_information22             ,
2473       p_poei_information23                     => p_posnei_data.poei_information23             ,
2474       p_poei_information24                     => p_posnei_data.poei_information24             ,
2475       p_poei_information25                     => p_posnei_data.poei_information25             ,
2476       p_poei_information26                     => p_posnei_data.poei_information26             ,
2477       p_poei_information27                     => p_posnei_data.poei_information27             ,
2478       p_poei_information28                     => p_posnei_data.poei_information28             ,
2479       p_poei_information29                     => p_posnei_data.poei_information29             ,
2480       p_poei_information30                     => p_posnei_data.poei_information30             ,
2481       p_object_version_number                 => p_posnei_data.object_version_number
2482 	);
2483 
2484 	hr_utility.set_location( 'Leaving : ' || l_proc, 20);
2485 
2486 Exception
2487 When Others then
2488    -- RESET In/Out params and SET Out params
2489    p_posnei_data:=l_posnei_data;
2490    hr_utility.set_location( 'Leaving : ' || l_proc, 25);
2491    Raise;
2492 End Correct_posnei_Row;
2493 
2494 -- ---------------------------------------------------------------------------
2495 -- |--------------------------< correct_posn_row>-----------------------------|
2496 -- ---------------------------------------------------------------------------
2497 -- {Start Of Comments}
2498 --
2499 -- Description:
2500 --   	This procedure applies the record given to the per_positions table.
2501 --
2502 -- Pre-Requisities:
2503 --   	None.
2504 --
2505 -- In Parameters:
2506 --	p_posn_data		->	per_positions record that is being applied.
2507 --
2508 -- Post Success:
2509 -- 	per_positions record will have been applied.
2510 --
2511 -- Post Failure:
2512 --   Error would have been displayed to user and exception raised.
2513 --
2514 -- Developer Implementation Notes:
2515 --   None
2516 --
2517 -- Access Status:
2518 --   Internal Development Use Only.
2519 --
2520 -- {End Of Comments}
2521 -- ---------------------------------------------------------------------------
2522 -- Procedure Correct_posn_row will update the Per_positions row in correct mode
2523 Procedure Correct_posn_row (p_posn_data in out nocopy hr_all_positions_f%rowtype) is
2524 
2525 	-- this cursor gets the object_version_number from core table, so the core
2526 	-- table can be updated.
2527 	cursor c_posn_getovn( cp_position_id	number
2528 			     ,cp_eff_st_dt	date
2529 			     ,cp_eff_end_dt	date) is
2530 	select object_version_number
2531 	from hr_all_positions_f
2532 	where position_id = cp_position_id
2533           and effective_start_date = cp_eff_st_dt;
2534 
2535 	l_posn_data 			hr_all_positions_f%rowtype;
2536 	l_position_data_rec        	ghr_sf52_pos_update.position_data_rec_type;
2537 	l_proc 				varchar2(30):='Correct_posn_Row';
2538 	l_datetrack_mode		varchar2(30):=hr_api.g_correction;
2539         l_date2                         hr_all_positions_f.effective_start_date%type;
2540 
2541 Begin
2542 	hr_utility.set_location( 'Entering : ' || l_proc, 10);
2543 	--Initialise Local Variables
2544 	l_posn_data := p_posn_data;
2545 	--
2546 
2547 	open c_posn_getovn( p_posn_data.position_id ,
2548                             p_posn_data.effective_start_date,
2549                             p_posn_data.effective_end_date);
2550 	Fetch c_posn_getovn into p_posn_data.object_version_number;
2551 	if c_posn_getovn%notfound then
2552 		close c_posn_getovn;
2553 		-- raise error
2554 	      hr_utility.set_message(8301, 'GHR_38492_POSN_OVN_NFND');
2555 	      hr_utility.raise_error;
2556 	else
2557 		close c_posn_getovn;
2558 	end if;
2559         l_date2 :=  p_posn_data.effective_start_date;
2560 	hr_psf_upd.upd (
2561 		p_position_id                  =>	p_posn_data.position_id			 ,
2562                 p_effective_start_date         =>       l_date2,
2563                 p_effective_end_date           =>       p_posn_data.effective_end_date           ,
2564                 p_availability_status_id       =>       p_posn_data.availability_status_id       ,
2565                 p_entry_step_id                =>       p_posn_data.entry_step_id                ,
2566                 p_entry_grade_rule_id          =>       p_posn_data.entry_grade_rule_id          ,
2567                 p_location_id                  =>       p_posn_data.location_id                  ,
2568                 p_pay_freq_payroll_id          =>       p_posn_data.pay_freq_payroll_id          ,
2569                 p_position_definition_id       =>       p_posn_data.position_definition_id       ,
2570                 p_position_transaction_id      =>       p_posn_data.position_transaction_id      ,
2571                 p_prior_position_id            =>       p_posn_data.prior_position_id            ,
2572                 p_relief_position_id           =>       p_posn_data.relief_position_id           ,
2573                 p_entry_grade_id               =>       p_posn_data.entry_grade_id               ,
2574                 p_successor_position_id        =>       p_posn_data.successor_position_id        ,
2575                 p_supervisor_position_id       =>       p_posn_data.supervisor_position_id       ,
2576                 p_amendment_date               =>       p_posn_data.amendment_date               ,
2577                 p_amendment_recommendation     =>       p_posn_data.amendment_recommendation     ,
2578                 p_amendment_ref_number         =>       p_posn_data.amendment_ref_number         ,
2579                 p_bargaining_unit_cd           =>       p_posn_data.bargaining_unit_cd           ,
2580                 p_comments                     =>       p_posn_data.comments                     ,
2581                 p_current_job_prop_end_date    =>       p_posn_data.current_job_prop_end_date    ,
2582                 p_current_org_prop_end_date    =>       p_posn_data.current_org_prop_end_date    ,
2583                 p_avail_status_prop_end_date   =>       p_posn_data.avail_status_prop_end_date   ,
2584                 p_date_effective               =>       p_posn_data.date_effective               ,
2585                 p_date_end                     =>       p_posn_data.date_end                     ,
2586                 p_earliest_hire_date           =>       p_posn_data.earliest_hire_date           ,
2587                 p_fill_by_date                 =>       p_posn_data.fill_by_date                 ,
2588                 p_frequency                    =>       p_posn_data.frequency                    ,
2589                 p_fte                          =>       p_posn_data.fte                          ,
2590                 p_max_persons                  =>       p_posn_data.max_persons                  ,
2591                 p_name                         =>       p_posn_data.name                         ,
2592                 p_overlap_period               =>       p_posn_data.overlap_period               ,
2593                 p_overlap_unit_cd              =>       p_posn_data.overlap_unit_cd              ,
2594                 p_pay_term_end_day_cd          =>       p_posn_data.pay_term_end_day_cd          ,
2595                 p_pay_term_end_month_cd        =>       p_posn_data.pay_term_end_month_cd        ,
2596                 p_permanent_temporary_flag     =>       p_posn_data.permanent_temporary_flag     ,
2597                 p_permit_recruitment_flag      =>       p_posn_data.permit_recruitment_flag      ,
2598                 p_position_type                =>       p_posn_data.position_type                ,
2599                 p_posting_description          =>       p_posn_data.posting_description          ,
2600                 p_probation_period             =>       p_posn_data.probation_period             ,
2601                 p_probation_period_unit_cd     =>       p_posn_data.probation_period_unit_cd     ,
2602                 p_replacement_required_flag    =>       p_posn_data.replacement_required_flag    ,
2603                 p_review_flag                  =>       p_posn_data.review_flag                  ,
2604                 p_seasonal_flag                =>       p_posn_data.seasonal_flag                ,
2605                 p_security_requirements        =>       p_posn_data.security_requirements        ,
2606                 p_status                       =>       p_posn_data.status                       ,
2607                 p_term_start_day_cd            =>       p_posn_data.term_start_day_cd            ,
2608                 p_term_start_month_cd          =>       p_posn_data.term_start_month_cd          ,
2609                 p_time_normal_finish           =>       p_posn_data.time_normal_finish           ,
2610                 p_time_normal_start            =>       p_posn_data.time_normal_start            ,
2611                 p_update_source_cd             =>       p_posn_data.update_source_cd             ,
2612                 p_working_hours                =>       p_posn_data.working_hours                ,
2613                 p_works_council_approval_flag  =>       p_posn_data.works_council_approval_flag  ,
2614                 p_work_period_type_cd          =>       p_posn_data.work_period_type_cd          ,
2615                 p_work_term_end_day_cd         =>       p_posn_data.work_term_end_day_cd         ,
2616                 p_work_term_end_month_cd       =>       p_posn_data.work_term_end_month_cd       ,
2617                 p_proposed_fte_for_layoff      =>       p_posn_data.proposed_fte_for_layoff      ,
2618                 p_proposed_date_for_layoff     =>       p_posn_data.proposed_date_for_layoff     ,
2619                 p_pay_basis_id                 =>       p_posn_data.pay_basis_id                 ,
2620                 p_supervisor_id                =>       p_posn_data.supervisor_id                ,
2621                 p_copied_to_old_table_flag     =>       p_posn_data.copied_to_old_table_flag     ,
2622                 p_information1                 =>       p_posn_data.information1                 ,
2623                 p_information2                 =>       p_posn_data.information2                 ,
2624                 p_information3                 =>       p_posn_data.information3                 ,
2625                 p_information4                 =>       p_posn_data.information4                 ,
2626                 p_information5                 =>       p_posn_data.information5                 ,
2627                 p_information6                 =>       p_posn_data.information6                 ,
2628                 p_information7                 =>       p_posn_data.information7                 ,
2629                 p_information8                 =>       p_posn_data.information8                 ,
2630                 p_information9                 =>       p_posn_data.information9                 ,
2631                 p_information10                =>       p_posn_data.information10                ,
2632                 p_information11                =>       p_posn_data.information11                ,
2633                 p_information12                =>       p_posn_data.information12                ,
2634                 p_information13                =>       p_posn_data.information13                ,
2635                 p_information14                =>       p_posn_data.information14                ,
2636                 p_information15                =>       p_posn_data.information15                ,
2637                 p_information16                =>       p_posn_data.information16                ,
2638                 p_information17                =>       p_posn_data.information17                ,
2639                 p_information18                =>       p_posn_data.information18                ,
2640                 p_information19                =>       p_posn_data.information19                ,
2641                 p_information20                =>       p_posn_data.information20                ,
2642                 p_information21                =>       p_posn_data.information21                ,
2643                 p_information22                =>       p_posn_data.information22                ,
2644                 p_information23                =>       p_posn_data.information23                ,
2645                 p_information24                =>       p_posn_data.information24                ,
2646                 p_information25                =>       p_posn_data.information25                ,
2647                 p_information26                =>       p_posn_data.information26                ,
2648                 p_information27                =>       p_posn_data.information27                ,
2649                 p_information28                =>       p_posn_data.information28                ,
2650                 p_information29                =>       p_posn_data.information29                ,
2651                 p_information30                =>       p_posn_data.information30                ,
2652                 p_information_category         =>       p_posn_data.information_category         ,
2653                 p_attribute1                   =>       p_posn_data.attribute1                   ,
2654                 p_attribute2                   =>       p_posn_data.attribute2                   ,
2655                 p_attribute3                   =>       p_posn_data.attribute3                   ,
2656                 p_attribute4                   =>       p_posn_data.attribute4                   ,
2657                 p_attribute5                   =>       p_posn_data.attribute5                   ,
2658                 p_attribute6                   =>       p_posn_data.attribute6                   ,
2659                 p_attribute7                   =>       p_posn_data.attribute7                   ,
2660                 p_attribute8                   =>       p_posn_data.attribute8                   ,
2661                 p_attribute9                   =>       p_posn_data.attribute9                   ,
2662                 p_attribute10                  =>       p_posn_data.attribute10                  ,
2663                 p_attribute11                  =>       p_posn_data.attribute11                  ,
2664                 p_attribute12                  =>       p_posn_data.attribute12                  ,
2665                 p_attribute13                  =>       p_posn_data.attribute13                  ,
2666                 p_attribute14                  =>       p_posn_data.attribute14                  ,
2667                 p_attribute15                  =>       p_posn_data.attribute15                  ,
2668                 p_attribute16                  =>       p_posn_data.attribute16                  ,
2669                 p_attribute17                  =>       p_posn_data.attribute17                  ,
2670                 p_attribute18                  =>       p_posn_data.attribute18                  ,
2671                 p_attribute19                  =>       p_posn_data.attribute19                  ,
2672                 p_attribute20                  =>       p_posn_data.attribute20                  ,
2673                 p_attribute21                  =>       p_posn_data.attribute21                  ,
2674                 p_attribute22                  =>       p_posn_data.attribute22                  ,
2675                 p_attribute23                  =>       p_posn_data.attribute23                  ,
2676                 p_attribute24                  =>       p_posn_data.attribute24                  ,
2677                 p_attribute25                  =>       p_posn_data.attribute25                  ,
2678                 p_attribute26                  =>       p_posn_data.attribute26                  ,
2679                 p_attribute27                  =>       p_posn_data.attribute27                  ,
2680                 p_attribute28                  =>       p_posn_data.attribute28                  ,
2681                 p_attribute29                  =>       p_posn_data.attribute29                  ,
2682                 p_attribute30                  =>       p_posn_data.attribute30                  ,
2683                 p_attribute_category           =>       p_posn_data.attribute_category           ,
2684 		p_request_id                   =>	p_posn_data.request_id                   ,
2685 		p_program_application_id       =>	p_posn_data.program_application_id       ,
2686 		p_program_id                   =>	p_posn_data.program_id                   ,
2687 		p_program_update_date          =>	p_posn_data.program_update_date          ,
2688 		p_object_version_number        =>	p_posn_data.object_version_number        ,
2689                 p_datetrack_mode               =>       l_datetrack_mode                         ,
2690                 p_effective_date               =>       p_posn_data.effective_start_date
2691 		);
2692 	l_position_data_rec.position_id	:= p_posn_data.position_id;
2693 	l_position_data_rec.organization_id	:= p_posn_data.organization_id;
2694     	l_position_data_rec.job_id		:= p_posn_data.job_id;
2695         -- Line Added by Edward Nunez 17-APR-2000 for bug# 1268773
2696         -- l_position_data_rec.effective_date      := p_posn_data.effective_start_date;
2697         -- Changes made by Venkat 30-JAN-2003 for No Copy Changes
2698         -- Assigning l_date1 instaed of p_posn_data.effective_start date because of nocopy changes
2699         l_position_data_rec.effective_date      := l_date2;
2700     	hr_utility.set_location(l_proc || 'change in data element-pos ' || p_posn_data.job_id,15);
2701 
2702     ghr_sf52_pos_update.update_position_info
2703                         (p_pos_data_rec   =>  l_position_data_rec
2704                         );
2705 
2706 	hr_utility.set_location( 'Leaving : ' || l_proc, 20);
2707 Exception
2708 When Others then
2709    -- RESET In/Out Params and SET Out Params
2710    p_posn_data:=l_posn_data;
2711    hr_utility.set_location( 'Leaving : ' || l_proc, 25);
2712    Raise;
2713 
2714 End Correct_posn_Row;
2715 
2716 -- ---------------------------------------------------------------------------
2717 -- |--------------------------< correct_addresses_row>------------------------|
2718 -- ---------------------------------------------------------------------------
2719 -- {Start Of Comments}
2720 --
2721 -- Description:
2722 --   	This procedure applies the record given to the per_addresses table.
2723 --
2724 -- Pre-Requisities:
2725 --   	None.
2726 --
2727 -- In Parameters:
2728 --	p_addr_data		->	per_addresses record that is being applied.
2729 --
2730 -- Post Success:
2731 -- 	per_addresses record will have been applied.
2732 --
2733 -- Post Failure:
2734 --   Error would have been displayed to user and exception raised.
2735 --
2736 -- Developer Implementation Notes:
2737 --   None
2738 --
2739 -- Access Status:
2740 --   Internal Development Use Only.
2741 --
2742 -- {End Of Comments}
2743 -- ---------------------------------------------------------------------------
2744 Procedure correct_addresses_row( p_addr_data	in out nocopy per_addresses%rowtype) is
2745 
2746 	-- this cursor gets the object_version_number from core table, so the core
2747 	-- table can be updated.
2748 	cursor c_addr is
2749 	select object_version_number
2750 	from per_addresses
2751 	where address_id = p_addr_data.address_id;
2752 
2753 	l_addr_data	per_addresses%rowtype;
2754 	l_session_var	ghr_history_api.g_session_var_type;
2755 	l_proc		varchar2(30):='correct_addresses_row';
2756 
2757 Begin
2758 	hr_utility.set_location(' entering : ' || l_proc, 10);
2759 	--Initialise Local Variables
2760 	l_addr_data := p_addr_data;
2761 	--
2762 	ghr_history_api.get_g_session_var( l_session_var);
2763 	hr_utility.set_location(l_proc, 20);
2764 
2765 	open c_addr;
2766 	fetch c_addr into p_addr_data.object_version_number;
2767 	if c_addr%notfound then
2768 		hr_utility.set_location(l_proc, 21);
2769 		close c_addr;
2770 	      hr_utility.set_message(8301, 'GHR_38373_ADDRESS_OVN_NFND');
2771 	      hr_utility.raise_error;
2772 	end if;
2773 	close c_addr;
2774 	hr_utility.set_location(l_proc, 30);
2775 
2776 	per_add_upd.upd(
2777 		p_address_id                   => p_addr_data.address_id ,
2778 		p_date_from                    => p_addr_data.date_from ,
2779 		p_address_line1                => p_addr_data.address_line1 ,
2780 		p_address_line2                => p_addr_data.address_line2 ,
2781 		p_address_line3                => p_addr_data.address_line3 ,
2782 		p_address_type                 => p_addr_data.address_type ,
2783 		p_comments                     => p_addr_data.comments ,
2784 		p_country                      => p_addr_data.country ,
2785 		p_date_to                      => p_addr_data.date_to ,
2786 		p_postal_code                  => p_addr_data.postal_code ,
2787 		p_region_1                     => p_addr_data.region_1 ,
2788 		p_region_2                     => p_addr_data.region_2 ,
2789 		p_region_3                     => p_addr_data.region_3 ,
2790 		p_telephone_number_1           => p_addr_data.telephone_number_1 ,
2791 		p_telephone_number_2           => p_addr_data.telephone_number_2 ,
2792 		p_telephone_number_3           => p_addr_data.telephone_number_3 ,
2793 		p_town_or_city                 => p_addr_data.town_or_city ,
2794 		p_object_version_number        => p_addr_data.object_version_number ,
2795 		p_effective_date               => l_session_var.date_effective);
2796  	hr_utility.set_location(' leaving : ' || l_proc, 40);
2797 
2798 Exception
2799 When Others then
2800    --RESET In/Out Params and SET Out Params
2801    p_addr_data:=l_addr_data;
2802    hr_utility.set_location( 'Leaving : ' || l_proc, 45);
2803    Raise;
2804 
2805 End correct_addresses_row;
2806 
2807 -- ---------------------------------------------------------------------------
2808 -- |--------------------------< correct_perana_row>---------------------------|
2809 -- ---------------------------------------------------------------------------
2810 -- {Start Of Comments}
2811 --
2812 -- Description:
2813 --   	This procedure applies the record given to the per_person_analyses table.
2814 --
2815 -- Pre-Requisities:
2816 --   	None.
2817 --
2818 -- In Parameters:
2819 --	p_perana_data		->	per_person_analyses record that is being applied.
2820 --
2821 -- Post Success:
2822 -- 	per_person_analyses record will have been applied.
2823 --
2824 -- Post Failure:
2825 --   Error would have been displayed to user and exception raised.
2826 --
2827 -- Developer Implementation Notes:
2828 --   None
2829 --
2830 -- Access Status:
2831 --   Internal Development Use Only.
2832 --
2833 -- {End Of Comments}
2834 -- ---------------------------------------------------------------------------
2835 Procedure correct_perana_row( p_perana_data	in out nocopy per_person_analyses%rowtype) is
2836 
2837 	-- this cursor gets the object_version_number from core table, so the core
2838 	-- table can be updated.
2839 	cursor c_perana is
2840 	select object_version_number
2841 	from per_person_analyses
2842 	where person_analysis_id = p_perana_data.person_analysis_id;
2843 
2844 	l_perana_data	per_person_analyses%rowtype;
2845 	l_session_var	ghr_history_api.g_session_var_type;
2846 	l_proc		varchar2(30):='correct_perana_row';
2847 
2848 Begin
2849 	hr_utility.set_location(' entering : ' || l_proc, 10);
2850 	-- Initialise Local Variables
2851    	   l_perana_data := p_perana_data;
2852 	--
2853 
2854 	ghr_history_api.get_g_session_var( l_session_var);
2855 	hr_utility.set_location(l_proc, 20);
2856 
2857 	open c_perana;
2858 	fetch c_perana into p_perana_data.object_version_number;
2859 	if c_perana%notfound then
2860 		hr_utility.set_location(l_proc, 21);
2861 		close c_perana;
2862 	      hr_utility.set_message(8301, 'GHR_99999_PERANA_OVN_NFND');
2863 	      hr_utility.raise_error;
2864 	end if;
2865 	close c_perana;
2866 	hr_utility.set_location(l_proc, 30);
2867 
2868 	per_pea_upd.upd(
2869 		p_person_analysis_id      	=>	p_perana_data.person_analysis_id,
2870   		p_analysis_criteria_id        =>	p_perana_data.analysis_criteria_id,
2871   		p_comments                    =>	p_perana_data.comments,
2872   		p_date_from                   =>	p_perana_data.date_from,
2873   		p_date_to                     =>	p_perana_data.date_to,
2874   		p_id_flex_num                 =>	p_perana_data.id_flex_num,
2875   		p_attribute_category          =>	p_perana_data.attribute_category,
2876   		p_attribute1                  =>	p_perana_data.attribute1,
2877   		p_attribute2                  =>	p_perana_data.attribute2,
2878   		p_attribute3                  =>	p_perana_data.attribute3,
2879   		p_attribute4                  =>	p_perana_data.attribute4,
2880   		p_attribute5                  =>	p_perana_data.attribute5,
2881   		p_attribute6                  =>	p_perana_data.attribute6,
2882 		p_attribute7                  =>	p_perana_data.attribute7,
2883 		p_attribute8                  =>	p_perana_data.attribute8,
2884 		p_attribute9                  =>	p_perana_data.attribute9,
2885   		p_attribute10                 =>	p_perana_data.attribute10,
2886    		p_attribute11                 =>	p_perana_data.attribute11,
2887     		p_attribute12                 =>	p_perana_data.attribute12,
2888     		p_attribute13                 =>	p_perana_data.attribute13,
2889     		p_attribute14                 =>	p_perana_data.attribute14,
2890     		p_attribute15                 =>	p_perana_data.attribute15,
2891    		p_attribute16                 =>	p_perana_data.attribute16,
2892    		p_attribute17                 =>	p_perana_data.attribute17,
2893     		p_attribute18                 =>	p_perana_data.attribute18,
2894     		p_attribute19                 =>	p_perana_data.attribute19,
2895     		p_attribute20                 =>	p_perana_data.attribute20,
2896   		p_object_version_number       =>	p_perana_data.object_version_number
2897   	);
2898 
2899  	hr_utility.set_location(' leaving : ' || l_proc, 40);
2900 
2901 Exception
2902 When Others then
2903    --RESET In/Out Params and SET Out Params
2904    p_perana_data:=l_perana_data;
2905    hr_utility.set_location( 'Leaving : ' || l_proc, 45);
2906    Raise;
2907 
2908 End correct_perana_row;
2909 
2910 -- ---------------------------------------------------------------------------
2911 -- |--------------------------< cascade_change>-------------------------------|
2912 -- ---------------------------------------------------------------------------
2913 -- {Start Of Comments}
2914 --
2915 -- Description:
2916 --   	This procedure calls cascade_field_value to cascade changes for every field
2917 --	in ghr_pa_hisory record. it also handles the dependent fields by calling
2918 --	cascade_dependencies if information101 field needs to be cascaded.
2919 --
2920 -- Pre-Requisities:
2921 --   	None.
2922 --
2923 -- In Parameters:
2924 --	p_pre_record		->	contains row as it appeared prior to this action.
2925 --	p_post_record		->	contains row as it appeared after this action
2926 --	p_apply_record		->	contains the row that we are (possibly) applying the
2927 --						cascaded data to.
2928 --	p_true_false		-> 	contains true_false flags for all fields to indicate if
2929 --						the given field is still in need of cascading.
2930 --
2931 -- Post Success:
2932 -- 	The changes will have been cascaded the the p_apply_record as appropriate.
2933 --
2934 -- Post Failure:
2935 --   Error would have been displayed to user and exception raised.
2936 --
2937 -- Developer Implementation Notes:
2938 --   None
2939 --
2940 -- Access Status:
2941 --   Internal Development Use Only.
2942 --
2943 -- {End Of Comments}
2944 -- ---------------------------------------------------------------------------
2945 Procedure cascade_change(p_pre_record           in     ghr_pa_history%rowtype,
2946                          p_post_record          in     ghr_pa_history%rowtype,
2947                          p_apply_record         in out nocopy ghr_pa_history%rowtype,
2948                          p_true_false           in out nocopy ghr_history_cascade.condition_rg_type)
2949 is
2950 
2951 	l_apply_record	ghr_pa_history%rowtype;
2952 	l_true_false	ghr_history_cascade.condition_rg_type;
2953 	l_proc   varchar2(72) := 'cascade_change';
2954 
2955 Begin
2956       hr_utility.set_location('Entering  ' || l_proc,5);
2957       --Initialise Local variables
2958       l_apply_record:=p_apply_record;
2959       l_true_false:=p_true_false;
2960       --
2961 
2962 -- Information1, Information2 and Information3 will not be cascaded as it is reserved for
2963 -- Table Primary Key, effective_start_date and Effective_end_date respectively
2964 
2965 -- Bug 1161542
2966   /*    hr_utility.set_location(l_proc,10);
2967 	cascade_field_value
2968 	(p_pre_field   => p_pre_record.information4,
2969  	 p_post_field  => p_post_record.information4,
2970  	 p_apply_field => p_apply_record.information4,
2971  	 p_result      => p_true_false(4)
2972 	);
2973 
2974       hr_utility.set_location(l_proc,15);
2975 	cascade_field_value
2976 	(p_pre_field   => p_pre_record.information5,
2977  	 p_post_field  => p_post_record.information5,
2978  	 p_apply_field => p_apply_record.information5,
2979  	 p_result      => p_true_false(5)
2980 	);
2981 
2982       hr_utility.set_location(l_proc,20);
2983 	cascade_field_value
2984 	(p_pre_field   => p_pre_record.information6,
2985  	 p_post_field  => p_post_record.information6,
2986  	 p_apply_field => p_apply_record.information6,
2987  	 p_result      => p_true_false(6)
2988 	); */ -- Bug 1161542
2989 
2990       hr_utility.set_location(l_proc,25);
2991 	---Added for Bug  3413335
2992 	      IF p_post_record.table_name <>  ghr_history_api.g_perana_table THEN
2993      		hr_utility.set_location(l_proc,34);
2994                  cascade_field_value
2995 		(p_pre_field   => p_pre_record.information7,
2996  		 p_post_field  => p_post_record.information7,
2997  		 p_apply_field => p_apply_record.information7,
2998  		 p_result      => p_true_false(7)
2999 		);
3000 	     ELSE
3001                IF p_post_record.information11 is not null THEN
3002                  hr_utility.set_location(l_proc,36);
3003 		cascade_field_value
3004 		(p_pre_field   => p_pre_record.information7,
3005  		 p_post_field  => p_post_record.information7,
3006  		 p_apply_field => p_apply_record.information7,
3007  		 p_result      => p_true_false(7)
3008 		);
3009         	END IF;
3010              END IF;
3011 
3012       hr_utility.set_location(l_proc,30);
3013 	---Added for Bug  3413335
3014 	      IF p_post_record.table_name <>  ghr_history_api.g_perana_table THEN
3015      		hr_utility.set_location(l_proc,34);
3016                  cascade_field_value
3017 	         (p_pre_field   => p_pre_record.information8,
3018  	          p_post_field  => p_post_record.information8,
3019  	          p_apply_field => p_apply_record.information8,
3020  	 	  p_result      => p_true_false(8)
3021 		 );
3022 	     ELSE
3023                IF p_post_record.information11 is not null THEN
3024                  hr_utility.set_location(l_proc,36);
3025 		cascade_field_value
3026 		(p_pre_field   => p_pre_record.information8,
3027  		 p_post_field  => p_post_record.information8,
3028  		 p_apply_field => p_apply_record.information8,
3029  		 p_result      => p_true_false(8)
3030 		);
3031         	END IF;
3032              END IF;
3033 
3034 	if (p_post_record.table_name = ghr_history_api.g_addres_table) then
3035 		if (p_true_false(9) = FALSE) then
3036 			null;
3037 		else
3038 			If  (nvl(p_pre_record.information9,hr_api.g_varchar2) <> nvl(p_post_record.information9,hr_api.g_varchar2) or
3039 				nvl(p_pre_record.information10,hr_api.g_varchar2) <> nvl(p_post_record.information10,hr_api.g_varchar2) or
3040 				nvl(p_pre_record.information11,hr_api.g_varchar2) <> nvl(p_post_record.information11,hr_api.g_varchar2) or
3041 				nvl(p_pre_record.information14,hr_api.g_varchar2) <> nvl(p_post_record.information14,hr_api.g_varchar2) or
3042 				nvl(p_pre_record.information16,hr_api.g_varchar2) <> nvl(p_post_record.information16,hr_api.g_varchar2) or
3043 				nvl(p_pre_record.information17,hr_api.g_varchar2) <> nvl(p_post_record.information17,hr_api.g_varchar2) or
3044 				nvl(p_pre_record.information18,hr_api.g_varchar2) <> nvl(p_post_record.information18,hr_api.g_varchar2) or
3045 				nvl(p_pre_record.information19,hr_api.g_varchar2) <> nvl(p_post_record.information19,hr_api.g_varchar2) or
3046 				nvl(p_pre_record.information23,hr_api.g_varchar2) <> nvl(p_post_record.information23,hr_api.g_varchar2)) and
3047                       	(nvl(p_pre_record.information9,hr_api.g_varchar2)  =   nvl(p_apply_record.information9,hr_api.g_varchar2) and
3048                        	nvl(p_pre_record.information10,hr_api.g_varchar2)  =   nvl(p_apply_record.information10,hr_api.g_varchar2) and
3049                        	nvl(p_pre_record.information11,hr_api.g_varchar2)  =   nvl(p_apply_record.information11,hr_api.g_varchar2) and
3050                        	nvl(p_pre_record.information14,hr_api.g_varchar2)  =   nvl(p_apply_record.information14,hr_api.g_varchar2) and
3051                        	nvl(p_pre_record.information16,hr_api.g_varchar2)  =   nvl(p_apply_record.information16,hr_api.g_varchar2) and
3052                        	nvl(p_pre_record.information17,hr_api.g_varchar2)  =   nvl(p_apply_record.information17,hr_api.g_varchar2) and
3053                        	nvl(p_pre_record.information18,hr_api.g_varchar2)  =   nvl(p_apply_record.information18,hr_api.g_varchar2) and
3054                        	nvl(p_pre_record.information19,hr_api.g_varchar2)  =   nvl(p_apply_record.information19,hr_api.g_varchar2) and
3055                        	nvl(p_pre_record.information23,hr_api.g_varchar2)  =   nvl(p_apply_record.information23,hr_api.g_varchar2))
3056 			 then
3057 			    	hr_utility.set_location(l_proc,20);
3058 			    	p_apply_record.information9  :=  p_post_record.information9;
3059 			    	p_apply_record.information10  :=  p_post_record.information10;
3060 			    	p_apply_record.information11  :=  p_post_record.information11;
3061 			    	p_apply_record.information14  :=  p_post_record.information14;
3062 			    	p_apply_record.information16  :=  p_post_record.information16;
3063 			    	p_apply_record.information17  :=  p_post_record.information17;
3064 			    	p_apply_record.information18  :=  p_post_record.information18;
3065 			    	p_apply_record.information19  :=  p_post_record.information19;
3066 				p_apply_record.information23  :=  p_post_record.information23;
3067 			else
3068 			    	p_true_false(9) := FALSE;
3069 			    	p_true_false(10) := FALSE;
3070 			    	p_true_false(11) := FALSE;
3071 			    	p_true_false(14) := FALSE;
3072 			    	p_true_false(16) := FALSE;
3073 			    	p_true_false(17) := FALSE;
3074 			    	p_true_false(18) := FALSE;
3075 			    	p_true_false(19) := FALSE;
3076 			    	p_true_false(23) := FALSE;
3077 			end if;
3078 		end if;
3079 	else
3080 	      hr_utility.set_location(l_proc,35);
3081 		 ---Added for Bug  3413335
3082 	      IF p_post_record.table_name <>  ghr_history_api.g_perana_table THEN
3083      		hr_utility.set_location(l_proc,34);
3084 		cascade_field_value
3085 		(p_pre_field   => p_pre_record.information9,
3086  		 p_post_field  => p_post_record.information9,
3087  		 p_apply_field => p_apply_record.information9,
3088  		 p_result      => p_true_false(9)
3089 		);
3090 	     ELSE
3091                IF p_post_record.information11 is not null THEN
3092                  hr_utility.set_location(l_proc,36);
3093 		 cascade_field_value
3094 		(p_pre_field   => p_pre_record.information9,
3095  		 p_post_field  => p_post_record.information9,
3096  		 p_apply_field => p_apply_record.information9,
3097  		 p_result      => p_true_false(9)
3098 		);
3099         	END IF;
3100              END IF;
3101 
3102 	      hr_utility.set_location(l_proc,40);
3103 		---Added for Bug  3413335
3104 	      IF p_post_record.table_name <>  ghr_history_api.g_perana_table THEN
3105      		hr_utility.set_location(l_proc,44);
3106 		cascade_field_value
3107 		(p_pre_field   => p_pre_record.information10,
3108  		 p_post_field  => p_post_record.information10,
3109  		 p_apply_field => p_apply_record.information10,
3110  		 p_result      => p_true_false(10)
3111 		);
3112 	     ELSE
3113                IF p_post_record.information11 is not null THEN
3114                  hr_utility.set_location(l_proc,46);
3115 		 cascade_field_value
3116 		(p_pre_field   => p_pre_record.information10,
3117  		 p_post_field  => p_post_record.information10,
3118  		 p_apply_field => p_apply_record.information10,
3119  		 p_result      => p_true_false(10)
3120 		);
3121         	END IF;
3122              END IF;
3123 
3124              -- Start processing for Bug  3413335
3125              IF p_post_record.table_name <>  ghr_history_api.g_perana_table THEN
3126      		hr_utility.set_location(l_proc,45);
3127 		cascade_field_value
3128 		(p_pre_field   => p_pre_record.information11,
3129  		 p_post_field  => p_post_record.information11,
3130  		 p_apply_field => p_apply_record.information11,
3131  		 p_result      => p_true_false(11)
3132 		);
3133              ELSE
3134                IF p_post_record.information11 is not null THEN
3135                  hr_utility.set_location(l_proc,45);
3136 		 cascade_field_value
3137 		 (p_pre_field   => p_pre_record.information11,
3138  		 p_post_field  => p_post_record.information11,
3139  		 p_apply_field => p_apply_record.information11,
3140  		 p_result      => p_true_false(11)
3141                  );
3142                END IF;
3143              END IF;
3144              -- End processing for Bug  3413335
3145 
3146       	hr_utility.set_location(l_proc,60);
3147 		cascade_field_value
3148 		(p_pre_field   => p_pre_record.information14,
3149  		 p_post_field  => p_post_record.information14,
3150  		 p_apply_field => p_apply_record.information14,
3151  		 p_result      => p_true_false(14)
3152 		);
3153 
3154      		hr_utility.set_location(l_proc,70);
3155 		cascade_field_value
3156 		(p_pre_field   => p_pre_record.information16,
3157  		 p_post_field  => p_post_record.information16,
3158  		 p_apply_field => p_apply_record.information16,
3159  		 p_result      => p_true_false(16)
3160 		);
3161 
3162 	      hr_utility.set_location(l_proc,75);
3163 		cascade_field_value
3164 		(p_pre_field   => p_pre_record.information17,
3165  		 p_post_field  => p_post_record.information17,
3166  		 p_apply_field => p_apply_record.information17,
3167  		 p_result      => p_true_false(17)
3168 		);
3169 
3170      		hr_utility.set_location(l_proc,80);
3171 		cascade_field_value
3172 		(p_pre_field   => p_pre_record.information18,
3173  		 p_post_field  => p_post_record.information18,
3174  		 p_apply_field => p_apply_record.information18,
3175  		 p_result      => p_true_false(18)
3176 		);
3177 
3178      		hr_utility.set_location(l_proc,85);
3179 		cascade_field_value
3180 		(p_pre_field   => p_pre_record.information19,
3181  		 p_post_field  => p_post_record.information19,
3182  		 p_apply_field => p_apply_record.information19,
3183  		 p_result      => p_true_false(19)
3184 		);
3185 
3186      	 	hr_utility.set_location(l_proc,101);
3187 		cascade_field_value
3188 		(p_pre_field   => p_pre_record.information23,
3189  		 p_post_field  => p_post_record.information23,
3190  		 p_apply_field => p_apply_record.information23,
3191  		 p_result      => p_true_false(23)
3192 		);
3193 	end if;
3194       hr_utility.set_location(l_proc,50);
3195 	cascade_field_value
3196 	(p_pre_field   => p_pre_record.information12,
3197  	 p_post_field  => p_post_record.information12,
3198  	 p_apply_field => p_apply_record.information12,
3199  	 p_result      => p_true_false(12)
3200 	);
3201 
3202       hr_utility.set_location(l_proc,55);
3203 	cascade_field_value
3204 	(p_pre_field   => p_pre_record.information13,
3205  	 p_post_field  => p_post_record.information13,
3206  	 p_apply_field => p_apply_record.information13,
3207  	 p_result      => p_true_false(13)
3208 	);
3209 
3210       hr_utility.set_location(l_proc,65);
3211 	cascade_field_value
3212 	(p_pre_field   => p_pre_record.information15,
3213  	 p_post_field  => p_post_record.information15,
3214  	 p_apply_field => p_apply_record.information15,
3215  	 p_result      => p_true_false(15)
3216 	);
3217 
3218       hr_utility.set_location(l_proc,90);
3219 	cascade_field_value
3220 	(p_pre_field   => p_pre_record.information20,
3221  	 p_post_field  => p_post_record.information20,
3222  	 p_apply_field => p_apply_record.information20,
3223  	 p_result      => p_true_false(20)
3224 	);
3225 
3226       hr_utility.set_location(l_proc,95);
3227 	cascade_field_value
3228 	(p_pre_field   => p_pre_record.information21,
3229  	 p_post_field  => p_post_record.information21,
3230  	 p_apply_field => p_apply_record.information21,
3231  	 p_result      => p_true_false(21)
3232 	);
3233 
3234       hr_utility.set_location(l_proc,100);
3235 	cascade_field_value
3236 	(p_pre_field   => p_pre_record.information22,
3237  	 p_post_field  => p_post_record.information22,
3238  	 p_apply_field => p_apply_record.information22,
3239  	 p_result      => p_true_false(22)
3240 	);
3241 
3242       hr_utility.set_location(l_proc,102);
3243 	cascade_field_value
3244 	(p_pre_field   => p_pre_record.information24,
3245  	 p_post_field  => p_post_record.information24,
3246  	 p_apply_field => p_apply_record.information24,
3247  	 p_result      => p_true_false(24)
3248 	);
3249 
3250       hr_utility.set_location(l_proc,103);
3251 	cascade_field_value
3252 	(p_pre_field   => p_pre_record.information25,
3253  	 p_post_field  => p_post_record.information25,
3254  	 p_apply_field => p_apply_record.information25,
3255  	 p_result      => p_true_false(25)
3256 	);
3257 
3258       hr_utility.set_location(l_proc,104);
3259 	cascade_field_value
3260 	(p_pre_field   => p_pre_record.information26,
3261  	 p_post_field  => p_post_record.information26,
3262  	 p_apply_field => p_apply_record.information26,
3263  	 p_result      => p_true_false(26)
3264 	);
3265 
3266       hr_utility.set_location(l_proc,105);
3267 	cascade_field_value
3268 	(p_pre_field   => p_pre_record.information27,
3269  	 p_post_field  => p_post_record.information27,
3270  	 p_apply_field => p_apply_record.information27,
3271  	 p_result      => p_true_false(27)
3272 	);
3273 
3274       hr_utility.set_location(l_proc,106);
3275 	cascade_field_value
3276 	(p_pre_field   => p_pre_record.information28,
3277  	 p_post_field  => p_post_record.information28,
3278  	 p_apply_field => p_apply_record.information28,
3279  	 p_result      => p_true_false(28)
3280 	);
3281 
3282       hr_utility.set_location(l_proc,107);
3283 	cascade_field_value
3284 	(p_pre_field   => p_pre_record.information29,
3285  	 p_post_field  => p_post_record.information29,
3286  	 p_apply_field => p_apply_record.information29,
3287  	 p_result      => p_true_false(29)
3288 	);
3289 
3290       hr_utility.set_location(l_proc,108);
3291 	cascade_field_value
3292 	(p_pre_field   => p_pre_record.information30,
3293  	 p_post_field  => p_post_record.information30,
3294  	 p_apply_field => p_apply_record.information30,
3295  	 p_result      => p_true_false(30)
3296 	);
3297 
3298       hr_utility.set_location(l_proc,109);
3299 	cascade_field_value
3300 	(p_pre_field   => p_pre_record.information31,
3301  	 p_post_field  => p_post_record.information31,
3302  	 p_apply_field => p_apply_record.information31,
3303  	 p_result      => p_true_false(31)
3304 	);
3305 
3306       hr_utility.set_location(l_proc,110);
3307 	cascade_field_value
3308 	(p_pre_field   => p_pre_record.information32,
3309  	 p_post_field  => p_post_record.information32,
3310  	 p_apply_field => p_apply_record.information32,
3311  	 p_result      => p_true_false(32)
3312 	);
3313 
3314       hr_utility.set_location(l_proc,111);
3315 	cascade_field_value
3316 	(p_pre_field   => p_pre_record.information33,
3317  	 p_post_field  => p_post_record.information33,
3318  	 p_apply_field => p_apply_record.information33,
3319  	 p_result      => p_true_false(33)
3320 	);
3321 
3322       hr_utility.set_location(l_proc,112);
3323 	cascade_field_value
3324 	(p_pre_field   => p_pre_record.information34,
3325  	 p_post_field  => p_post_record.information34,
3326  	 p_apply_field => p_apply_record.information34,
3327  	 p_result      => p_true_false(34)
3328 	);
3329 
3330       hr_utility.set_location(l_proc,113);
3331       cascade_field_value
3332 	(p_pre_field   => p_pre_record.information35,
3333  	 p_post_field  => p_post_record.information35,
3334  	 p_apply_field => p_apply_record.information35,
3335  	 p_result      => p_true_false(35)
3336 	);
3337 
3338       hr_utility.set_location(l_proc,114);
3339 	cascade_field_value
3340 	(p_pre_field   => p_pre_record.information36,
3341  	 p_post_field  => p_post_record.information36,
3342  	 p_apply_field => p_apply_record.information36,
3343  	 p_result      => p_true_false(36)
3344 	);
3345 
3346       hr_utility.set_location(l_proc,115);
3347 	cascade_field_value
3348 	(p_pre_field   => p_pre_record.information37,
3349  	 p_post_field  => p_post_record.information37,
3350  	 p_apply_field => p_apply_record.information37,
3351  	 p_result      => p_true_false(37)
3352 	);
3353 
3354       hr_utility.set_location(l_proc,116);
3355       cascade_field_value
3356 	(p_pre_field   => p_pre_record.information38,
3357  	 p_post_field  => p_post_record.information38,
3358  	 p_apply_field => p_apply_record.information38,
3359  	 p_result      => p_true_false(38)
3360 	);
3361 
3362       hr_utility.set_location(l_proc,117);
3363 	cascade_field_value
3364 	(p_pre_field   => p_pre_record.information39,
3365  	 p_post_field  => p_post_record.information39,
3366  	 p_apply_field => p_apply_record.information39,
3367  	 p_result      => p_true_false(39)
3368 	);
3369 
3370       hr_utility.set_location(l_proc,118);
3371 	cascade_field_value
3372 	(p_pre_field   => p_pre_record.information40,
3373  	 p_post_field  => p_post_record.information40,
3374  	 p_apply_field => p_apply_record.information40,
3375  	 p_result      => p_true_false(40)
3376 	);
3377 
3378       hr_utility.set_location(l_proc,119);
3379 	cascade_field_value
3380 	(p_pre_field   => p_pre_record.information41,
3381  	 p_post_field  => p_post_record.information41,
3382  	 p_apply_field => p_apply_record.information41,
3383  	 p_result      => p_true_false(41)
3384 	);
3385 
3386       hr_utility.set_location(l_proc,120);
3387 	cascade_field_value
3388 	(p_pre_field   => p_pre_record.information42,
3389  	 p_post_field  => p_post_record.information42,
3390  	 p_apply_field => p_apply_record.information42,
3391  	 p_result      => p_true_false(42)
3392 	);
3393 
3394       hr_utility.set_location(l_proc,121);
3395 	cascade_field_value
3396 	(p_pre_field   => p_pre_record.information43,
3397  	 p_post_field  => p_post_record.information43,
3398  	 p_apply_field => p_apply_record.information43,
3399  	 p_result      => p_true_false(43)
3400 	);
3401 
3402       hr_utility.set_location(l_proc,122);
3403 	cascade_field_value
3404 	(p_pre_field   => p_pre_record.information44,
3405  	 p_post_field  => p_post_record.information44,
3406  	 p_apply_field => p_apply_record.information44,
3407  	 p_result      => p_true_false(44)
3408 	);
3409 
3410       hr_utility.set_location(l_proc,123);
3411 	cascade_field_value
3412 	(p_pre_field   => p_pre_record.information45,
3413  	 p_post_field  => p_post_record.information45,
3414  	 p_apply_field => p_apply_record.information45,
3415  	 p_result      => p_true_false(45)
3416 	);
3417 
3418       hr_utility.set_location(l_proc,124);
3419 	cascade_field_value
3420 	(p_pre_field   => p_pre_record.information46,
3421  	 p_post_field  => p_post_record.information46,
3422  	 p_apply_field => p_apply_record.information46,
3423  	 p_result      => p_true_false(46)
3424 	);
3425 
3426       hr_utility.set_location(l_proc,125);
3427 	cascade_field_value
3428 	(p_pre_field   => p_pre_record.information47,
3429  	 p_post_field  => p_post_record.information47,
3430  	 p_apply_field => p_apply_record.information47,
3431  	 p_result      => p_true_false(47)
3432 	);
3433 
3434       hr_utility.set_location(l_proc,126);
3435 	cascade_field_value
3436 	(p_pre_field   => p_pre_record.information48,
3437  	 p_post_field  => p_post_record.information48,
3438  	 p_apply_field => p_apply_record.information48,
3439  	 p_result      => p_true_false(48)
3440 	);
3441 
3442       hr_utility.set_location(l_proc,127);
3443 	cascade_field_value
3444 	(p_pre_field   => p_pre_record.information49,
3445  	 p_post_field  => p_post_record.information49,
3446  	 p_apply_field => p_apply_record.information49,
3447  	 p_result      => p_true_false(49)
3448 	);
3449 
3450       hr_utility.set_location(l_proc,128);
3451 	cascade_field_value
3452 	(p_pre_field   => p_pre_record.information50,
3453  	 p_post_field  => p_post_record.information50,
3454  	 p_apply_field => p_apply_record.information50,
3455  	 p_result      => p_true_false(50)
3456 	);
3457 
3458       hr_utility.set_location(l_proc,129);
3459 	cascade_field_value
3460 	(p_pre_field   => p_pre_record.information51,
3461  	 p_post_field  => p_post_record.information51,
3462  	 p_apply_field => p_apply_record.information51,
3463  	 p_result      => p_true_false(51)
3464 	);
3465 
3466       hr_utility.set_location(l_proc,130);
3467 	cascade_field_value
3468 	(p_pre_field   => p_pre_record.information52,
3469  	 p_post_field  => p_post_record.information52,
3470  	 p_apply_field => p_apply_record.information52,
3471  	 p_result      => p_true_false(52)
3472 	);
3473 
3474       hr_utility.set_location(l_proc,131);
3475 	cascade_field_value
3476 	(p_pre_field   => p_pre_record.information53,
3477  	 p_post_field  => p_post_record.information53,
3478  	 p_apply_field => p_apply_record.information53,
3479  	 p_result      => p_true_false(53)
3480 	);
3481 
3482       hr_utility.set_location(l_proc,132);
3483 	cascade_field_value
3484 	(p_pre_field   => p_pre_record.information54,
3485  	 p_post_field  => p_post_record.information54,
3486  	 p_apply_field => p_apply_record.information54,
3487  	 p_result      => p_true_false(54)
3488 	);
3489 
3490       hr_utility.set_location(l_proc,133);
3491 	cascade_field_value
3492 	(p_pre_field   => p_pre_record.information55,
3493  	 p_post_field  => p_post_record.information55,
3494  	 p_apply_field => p_apply_record.information55,
3495  	 p_result      => p_true_false(55)
3496 	);
3497 
3498       hr_utility.set_location(l_proc,134);
3499 	cascade_field_value
3500 	(p_pre_field   => p_pre_record.information56,
3501  	 p_post_field  => p_post_record.information56,
3502  	 p_apply_field => p_apply_record.information56,
3503  	 p_result      => p_true_false(56)
3504 	);
3505 
3506       hr_utility.set_location(l_proc,135);
3507 	cascade_field_value
3508 	(p_pre_field   => p_pre_record.information57,
3509  	 p_post_field  => p_post_record.information57,
3510  	 p_apply_field => p_apply_record.information57,
3511  	 p_result      => p_true_false(57)
3512 	);
3513 
3514       hr_utility.set_location(l_proc,136);
3515 	cascade_field_value
3516 	(p_pre_field   => p_pre_record.information58,
3517  	 p_post_field  => p_post_record.information58,
3518  	 p_apply_field => p_apply_record.information58,
3519  	 p_result      => p_true_false(58)
3520 	);
3521 
3522       hr_utility.set_location(l_proc,137);
3523 	cascade_field_value
3524 	(p_pre_field   => p_pre_record.information59,
3525  	 p_post_field  => p_post_record.information59,
3526  	 p_apply_field => p_apply_record.information59,
3527  	 p_result      => p_true_false(59)
3528 	);
3529 
3530       hr_utility.set_location(l_proc,138);
3531 	cascade_field_value
3532 	(p_pre_field   => p_pre_record.information60,
3533  	 p_post_field  => p_post_record.information60,
3534  	 p_apply_field => p_apply_record.information60,
3535  	 p_result      => p_true_false(60)
3536 	);
3537 
3538       hr_utility.set_location(l_proc,139);
3539 	cascade_field_value
3540 	(p_pre_field   => p_pre_record.information61,
3541  	 p_post_field  => p_post_record.information61,
3542  	 p_apply_field => p_apply_record.information61,
3543  	 p_result      => p_true_false(61)
3544 	);
3545 
3546       hr_utility.set_location(l_proc,140);
3547 	cascade_field_value
3548 	(p_pre_field   => p_pre_record.information62,
3549  	 p_post_field  => p_post_record.information62,
3550  	 p_apply_field => p_apply_record.information62,
3551  	 p_result      => p_true_false(62)
3552 	);
3553 
3554       hr_utility.set_location(l_proc,141);
3555 	cascade_field_value
3556 	(p_pre_field   => p_pre_record.information63,
3557  	 p_post_field  => p_post_record.information63,
3558  	 p_apply_field => p_apply_record.information63,
3559  	 p_result      => p_true_false(63)
3560 	);
3561 
3562       hr_utility.set_location(l_proc,142);
3563       cascade_field_value
3564 	(p_pre_field   => p_pre_record.information64,
3565  	 p_post_field  => p_post_record.information64,
3566  	 p_apply_field => p_apply_record.information64,
3567  	 p_result      => p_true_false(64)
3568 	);
3569 
3570       hr_utility.set_location(l_proc,143);
3571 	cascade_field_value
3572 	(p_pre_field   => p_pre_record.information65,
3573  	 p_post_field  => p_post_record.information65,
3574  	 p_apply_field => p_apply_record.information65,
3575  	 p_result      => p_true_false(65)
3576 	);
3577 
3578       hr_utility.set_location(l_proc,144);
3579 	cascade_field_value
3580 	(p_pre_field   => p_pre_record.information66,
3581  	 p_post_field  => p_post_record.information66,
3582  	 p_apply_field => p_apply_record.information66,
3583  	 p_result      => p_true_false(66)
3584 	);
3585 
3586       hr_utility.set_location(l_proc,145);
3587 	cascade_field_value
3588 	(p_pre_field   => p_pre_record.information67,
3589  	 p_post_field  => p_post_record.information67,
3590  	 p_apply_field => p_apply_record.information67,
3591  	 p_result      => p_true_false(67)
3592 	);
3593 
3594       hr_utility.set_location(l_proc,146);
3595 	cascade_field_value
3596 	(p_pre_field   => p_pre_record.information68,
3597  	 p_post_field  => p_post_record.information68,
3598  	 p_apply_field => p_apply_record.information68,
3599  	 p_result      => p_true_false(68)
3600 	);
3601 
3602       hr_utility.set_location(l_proc,147);
3603 	cascade_field_value
3604 	(p_pre_field   => p_pre_record.information69,
3605  	 p_post_field  => p_post_record.information69,
3606  	 p_apply_field => p_apply_record.information69,
3607  	 p_result      => p_true_false(69)
3608 	);
3609 
3610       hr_utility.set_location(l_proc,148);
3611 	cascade_field_value
3612 	(p_pre_field   => p_pre_record.information70,
3613  	 p_post_field  => p_post_record.information70,
3614  	 p_apply_field => p_apply_record.information70,
3615  	 p_result      => p_true_false(70)
3616 	);
3617 
3618       hr_utility.set_location(l_proc,149);
3619 	cascade_field_value
3620 	(p_pre_field   => p_pre_record.information71,
3621  	 p_post_field  => p_post_record.information71,
3622  	 p_apply_field => p_apply_record.information71,
3623  	 p_result      => p_true_false(71)
3624 	);
3625 
3626       hr_utility.set_location(l_proc,150);
3627 	cascade_field_value
3628 	(p_pre_field   => p_pre_record.information72,
3629  	 p_post_field  => p_post_record.information72,
3630  	 p_apply_field => p_apply_record.information72,
3631  	 p_result      => p_true_false(72)
3632 	);
3633 
3634       hr_utility.set_location(l_proc,151);
3635 	cascade_field_value
3636 	(p_pre_field   => p_pre_record.information73,
3637  	 p_post_field  => p_post_record.information73,
3638  	 p_apply_field => p_apply_record.information73,
3639  	 p_result      => p_true_false(73)
3640 	);
3641 
3642       hr_utility.set_location(l_proc,152);
3643 	cascade_field_value
3644 	(p_pre_field   => p_pre_record.information74,
3645  	 p_post_field  => p_post_record.information74,
3646  	 p_apply_field => p_apply_record.information74,
3647  	 p_result      => p_true_false(74)
3648 	);
3649 
3650       hr_utility.set_location(l_proc,153);
3651 	cascade_field_value
3652 	(p_pre_field   => p_pre_record.information75,
3653  	 p_post_field  => p_post_record.information75,
3654  	 p_apply_field => p_apply_record.information75,
3655  	 p_result      => p_true_false(75)
3656 	);
3657 
3658       hr_utility.set_location(l_proc,154);
3659 	cascade_field_value
3660 	(p_pre_field   => p_pre_record.information76,
3661  	 p_post_field  => p_post_record.information76,
3662  	 p_apply_field => p_apply_record.information76,
3663  	 p_result      => p_true_false(76)
3664 	);
3665 
3666       hr_utility.set_location(l_proc,155);
3667 	cascade_field_value
3668 	(p_pre_field   => p_pre_record.information77,
3669  	 p_post_field  => p_post_record.information77,
3670  	 p_apply_field => p_apply_record.information77,
3671  	 p_result      => p_true_false(77)
3672 	);
3673 
3674       hr_utility.set_location(l_proc,156);
3675 	cascade_field_value
3676 	(p_pre_field   => p_pre_record.information78,
3677  	 p_post_field  => p_post_record.information78,
3678  	 p_apply_field => p_apply_record.information78,
3679  	 p_result      => p_true_false(78)
3680 	);
3681 
3682       hr_utility.set_location(l_proc,157);
3683 	cascade_field_value
3684 	(p_pre_field   => p_pre_record.information79,
3685  	 p_post_field  => p_post_record.information79,
3686  	 p_apply_field => p_apply_record.information79,
3687  	 p_result      => p_true_false(79)
3688 	);
3689 
3690       hr_utility.set_location(l_proc,158);
3691 	cascade_field_value
3692 	(p_pre_field   => p_pre_record.information80,
3693  	 p_post_field  => p_post_record.information80,
3694  	 p_apply_field => p_apply_record.information80,
3695  	 p_result      => p_true_false(80)
3696 	);
3697 
3698       hr_utility.set_location(l_proc,159);
3699 	cascade_field_value
3700 	(p_pre_field   => p_pre_record.information81,
3701  	 p_post_field  => p_post_record.information81,
3702  	 p_apply_field => p_apply_record.information81,
3703  	 p_result      => p_true_false(81)
3704 	);
3705 
3706       hr_utility.set_location(l_proc,160);
3707 	cascade_field_value
3708 	(p_pre_field   => p_pre_record.information82,
3709  	 p_post_field  => p_post_record.information82,
3710  	 p_apply_field => p_apply_record.information82,
3711  	 p_result      => p_true_false(82)
3712 	);
3713 
3714       hr_utility.set_location(l_proc,161);
3715 	cascade_field_value
3716 	(p_pre_field   => p_pre_record.information83,
3717  	 p_post_field  => p_post_record.information83,
3718  	 p_apply_field => p_apply_record.information83,
3719  	 p_result      => p_true_false(83)
3720 	);
3721 
3722       hr_utility.set_location(l_proc,162);
3723 	cascade_field_value
3724 	(p_pre_field   => p_pre_record.information84,
3725  	 p_post_field  => p_post_record.information84,
3726  	 p_apply_field => p_apply_record.information84,
3727  	 p_result      => p_true_false(84)
3728 	);
3729 
3730       hr_utility.set_location(l_proc,163);
3731 	cascade_field_value
3732 	(p_pre_field   => p_pre_record.information85,
3733  	 p_post_field  => p_post_record.information85,
3734  	 p_apply_field => p_apply_record.information85,
3735  	 p_result      => p_true_false(85)
3736 	);
3737 
3738       hr_utility.set_location(l_proc,164);
3739 	cascade_field_value
3740 	(p_pre_field   => p_pre_record.information86,
3741  	 p_post_field  => p_post_record.information86,
3742  	 p_apply_field => p_apply_record.information86,
3743  	 p_result      => p_true_false(86)
3744 	);
3745 
3746       hr_utility.set_location(l_proc,165);
3747 	cascade_field_value
3748 	(p_pre_field   => p_pre_record.information87,
3749  	 p_post_field  => p_post_record.information87,
3750  	 p_apply_field => p_apply_record.information87,
3751  	 p_result      => p_true_false(87)
3752 	);
3753 
3754       hr_utility.set_location(l_proc,166);
3755 	cascade_field_value
3756 	(p_pre_field   => p_pre_record.information88,
3757  	 p_post_field  => p_post_record.information88,
3758  	 p_apply_field => p_apply_record.information88,
3759  	 p_result      => p_true_false(88)
3760 	);
3761 
3762       hr_utility.set_location(l_proc,167);
3763 	cascade_field_value
3764 	(p_pre_field   => p_pre_record.information89,
3765  	 p_post_field  => p_post_record.information89,
3766  	 p_apply_field => p_apply_record.information89,
3767  	 p_result      => p_true_false(89)
3768 	);
3769 
3770       hr_utility.set_location(l_proc,168);
3771 	cascade_field_value
3772 	(p_pre_field   => p_pre_record.information90,
3773  	 p_post_field  => p_post_record.information90,
3774  	 p_apply_field => p_apply_record.information90,
3775  	 p_result      => p_true_false(90)
3776 	);
3777 
3778       hr_utility.set_location(l_proc,169);
3779 	cascade_field_value
3780 	(p_pre_field   => p_pre_record.information91,
3781  	 p_post_field  => p_post_record.information91,
3782  	 p_apply_field => p_apply_record.information91,
3783  	 p_result      => p_true_false(91)
3784 	);
3785 
3786       hr_utility.set_location(l_proc,170);
3787 	cascade_field_value
3788 	(p_pre_field   => p_pre_record.information92,
3789  	 p_post_field  => p_post_record.information92,
3790  	 p_apply_field => p_apply_record.information92,
3791  	 p_result      => p_true_false(92)
3792 	);
3793 
3794       hr_utility.set_location(l_proc,171);
3795 	cascade_field_value
3796 	(p_pre_field   => p_pre_record.information93,
3797  	 p_post_field  => p_post_record.information93,
3798  	 p_apply_field => p_apply_record.information93,
3799  	 p_result      => p_true_false(93)
3800 	);
3801 
3802       hr_utility.set_location(l_proc,172);
3803 	cascade_field_value
3804 	(p_pre_field   => p_pre_record.information94,
3805  	 p_post_field  => p_post_record.information94,
3806  	 p_apply_field => p_apply_record.information94,
3807  	 p_result      => p_true_false(94)
3808 	);
3809 
3810       hr_utility.set_location(l_proc,173);
3811 	cascade_field_value
3812 	(p_pre_field   => p_pre_record.information95,
3813  	 p_post_field  => p_post_record.information95,
3814  	 p_apply_field => p_apply_record.information95,
3815  	 p_result      => p_true_false(95)
3816 	);
3817 
3818       hr_utility.set_location(l_proc,174);
3819 	cascade_field_value
3820 	(p_pre_field   => p_pre_record.information96,
3821  	 p_post_field  => p_post_record.information96,
3822  	 p_apply_field => p_apply_record.information96,
3823  	 p_result      => p_true_false(96)
3824 	);
3825 
3826       hr_utility.set_location(l_proc,175);
3827 	cascade_field_value
3828 	(p_pre_field   => p_pre_record.information97,
3829  	 p_post_field  => p_post_record.information97,
3830  	 p_apply_field => p_apply_record.information97,
3831  	 p_result      => p_true_false(97)
3832 	);
3833 
3834       hr_utility.set_location(l_proc,180);
3835 	cascade_field_value
3836 	(p_pre_field   => p_pre_record.information98,
3837  	 p_post_field  => p_post_record.information98,
3838  	 p_apply_field => p_apply_record.information98,
3839  	 p_result      => p_true_false(98)
3840 	);
3841 
3842       hr_utility.set_location(l_proc,181);
3843 	cascade_field_value
3844 	(p_pre_field   => p_pre_record.information99,
3845  	 p_post_field  => p_post_record.information99,
3846  	 p_apply_field => p_apply_record.information99,
3847  	 p_result      => p_true_false(99)
3848 	);
3849 
3850       hr_utility.set_location(l_proc,182);
3851 	cascade_field_value
3852 	(p_pre_field   => p_pre_record.information100,
3853  	 p_post_field  => p_post_record.information100,
3854  	 p_apply_field => p_apply_record.information100,
3855  	 p_result      => p_true_false(100)
3856 	);
3857 
3858       hr_utility.set_location(l_proc,183);
3859 	cascade_field_value
3860 	(p_pre_field   => p_pre_record.information101,
3861  	 p_post_field  => p_post_record.information101,
3862  	 p_apply_field => p_apply_record.information101,
3863  	 p_result      => p_true_false(101)
3864 	);
3865       hr_utility.set_location('Leaving ' ||l_proc,184);
3866 
3867 -- If information101 is supposed to be cascaded, then information102 thru' information125
3868 -- have to be cascaded as well, because of their dependency on the former.
3869 
3870       If p_true_false(101) then
3871       	hr_utility.set_location(l_proc,185);
3872 		cascade_dependencies(p_record        =>  p_post_record,
3873 					   p_apply_record  =>  p_apply_record
3874 				        );
3875             hr_utility.set_location(l_proc,190);
3876 	End if;
3877 
3878 Exception
3879 When Others then
3880   --RESET In/Out Params and SET Out Params
3881   p_apply_record:=l_apply_record;
3882   p_true_false:=l_true_false;
3883   hr_utility.set_location('Leaving ' ||l_proc,200);
3884   Raise;
3885 
3886 End cascade_change;
3887 
3888 -- ---------------------------------------------------------------------------
3889 -- |--------------------------< cascade_field_value>--------------------------|
3890 -- ---------------------------------------------------------------------------
3891 -- {Start Of Comments}
3892 --
3893 -- Description:
3894 --   	This procedure applies changes to p_apply_field under the following conditions:
3895 --	1) 	p_result is true (cascading on this field is still continuing).
3896 --	2) 	p_post_field is not null (we are not cascading nulls).
3897 --	3) 	p_pre_field, p_post_field are NOT the same (this field was changed by the sf52
3898 --		we are processing).
3899 --	4) 	p_apply_field and p_pre_field are the same (subsequent changes have not been made
3900 --		to this row by a later action).
3901 --
3902 --	p_result will be set to false (this will halt any further cascading of this field) under
3903 --	the following conditions:
3904 --	1) if p_post_field is null (we are not cascading nulls).
3905 --	2) if p_pre_field and p_post_field are the same (this field was not changed by the sf52 we are processing).
3906 --	3) If p_pre_field and p_apply_field are NOT the same (a change was made to this row by a subsequent action).
3907 --
3908 -- Pre-Requisities:
3909 --   	None.
3910 --
3911 -- In Parameters:
3912 --	p_pre_field			->	contains field as it appeared prior to this action.
3913 --	p_post_field		->	contains field as it appeared after this action.
3914 --	p_apply_field		->	contains the field that we are (possibly) applying the
3915 --						cascaded data to.
3916 --	p_result			-> 	IN/OUT Boolean flag to indicate if this field (still) needs to be cascaded.
3917 --
3918 -- Post Success:
3919 -- 	The changes will have been applied the the p_apply_field as appropriate.
3920 --
3921 -- Post Failure:
3922 --   Error would have been displayed to user and exception raised.
3923 --
3924 -- Developer Implementation Notes:
3925 --   None
3926 --
3927 -- Access Status:
3928 --   Internal Development Use Only.
3929 --
3930 -- {End Of Comments}
3931 -- ---------------------------------------------------------------------------
3932 Procedure cascade_field_value( p_pre_field               in     ghr_pa_history.information1%type,
3933                                p_post_field              in     ghr_pa_history.information1%type,
3934                                p_apply_field             in out nocopy ghr_pa_history.information1%type,
3935                                p_result                  in out nocopy    boolean )
3936 is
3937 
3938 	l_apply_field	ghr_pa_history.information1%type;
3939 	l_result	boolean;
3940 	l_proc     varchar2(72) := 'cascade_field_value';
3941 begin
3942 
3943 -- Proceed only if the column still needs to cascaded. i.e if that column was altered by another SF52, we should
3944 -- stop cascading for that column
3945 
3946       hr_utility.set_location('Entering  ' ||l_proc,5);
3947       -- Initialise Local Variables
3948         l_apply_field := p_apply_field;
3949 	l_result      := p_result;
3950       --
3951 	If p_result then
3952  		hr_utility.set_location(l_proc,10);
3953 -- removed following line in order to allow cascading of null values.
3954 --		If p_post_field is not null then
3955 			hr_utility.set_location(l_proc,15);
3956 			If  nvl(p_pre_field,hr_api.g_varchar2)  <>  nvl(p_post_field,hr_api.g_varchar2)  and
3957                       nvl(p_pre_field,hr_api.g_varchar2)  =   nvl(p_apply_field,hr_api.g_varchar2) then
3958 			    hr_utility.set_location(l_proc,20);
3959 			     p_apply_field  :=  p_post_field;
3960 		       Else
3961 				p_result   := FALSE;
3962 			end if;
3963 
3964 /* Removed following three lines in order to allow cascading of null values.
3965 		Else
3966 			p_result   := FALSE;
3967 		End if;
3968 */
3969 	End if;
3970      	hr_utility.set_location('Leaving  '|| l_proc,25);
3971 Exception
3972 When Others then
3973    --RESET In/Out Params and SET Out Params
3974    p_apply_field:=l_apply_field;
3975    p_result:=l_result;
3976    hr_utility.set_location('Leaving  : '||l_proc,30);
3977    Raise;
3978 
3979 End cascade_field_value;
3980 
3981 -- ---------------------------------------------------------------------------
3982 -- |--------------------------< stop_cascade>---------------------------------|
3983 -- ---------------------------------------------------------------------------
3984 -- {Start Of Comments}
3985 --
3986 -- Description:
3987 --   	This procedure loops through the p_true_false records and
3988 --	returns TRUE as soon as it finds a record with a TRUE value. This procedure
3989 --	is used to determine if there are still fields that need to be cascaded for
3990 --	the given row.
3991 --
3992 -- Pre-Requisities:
3993 --   	None.
3994 --
3995 -- In Parameters:
3996 --	p_true_false			-> 	array of boolean values to be scanned.
3997 --
3998 -- Post Success:
3999 -- 	The function will have returned the appropriate value.
4000 --
4001 -- Post Failure:
4002 --   No failure conditions.
4003 --
4004 -- Developer Implementation Notes:
4005 --   None
4006 --
4007 -- Access Status:
4008 --   Internal Development Use Only.
4009 --
4010 -- {End Of Comments}
4011 -- ---------------------------------------------------------------------------
4012 Function Stop_cascade( p_true_false    ghr_history_cascade.condition_rg_type)
4013 Return boolean
4014 is
4015 
4016 l_proc   varchar2(72) := 'Stop_cascade';
4017 l_dummy  boolean := FALSE;
4018 
4019 
4020 Begin
4021 --  If the true_false flags for even one of the columns is TRUE, we have to proceed cascade
4022 --  else if all flags are FALSE, then we can stop cascading.
4023 
4024       hr_utility.set_location('Entering  ' || l_proc,5);
4025 	For rowno in 7..101 loop  -- Bug 1161542 changed 4..101 to 7..101
4026 		If p_true_false(rowno) then
4027                  	hr_utility.set_location(l_proc,10);
4028 			l_dummy := TRUE;
4029 			exit;
4030 		End if;
4031  		hr_utility.set_location(l_proc,15);
4032 	End loop;
4033 	hr_utility.set_location(l_proc,20);
4034 	Return l_dummy;
4035 	hr_utility.set_location(l_proc,25);
4036 End stop_cascade;
4037 
4038 -- ---------------------------------------------------------------------------
4039 -- |--------------------------< cascade_dependencies>-------------------------|
4040 -- ---------------------------------------------------------------------------
4041 -- {Start Of Comments}
4042 --
4043 -- Description:
4044 --   	This procedure applies fields 102 thru 120 to p_apply_record.
4045 --	This is meant to be called when information1 field has changed. Information2
4046 --	thru information120 are meant to be dependent on information101 and thus
4047 --	only/always cascaded if information101 needs to be cascaded.
4048 --
4049 -- Pre-Requisities:
4050 --   	None.
4051 --
4052 -- In Parameters:
4053 --	p_record			-> 	contains fields to be cascaded.
4054 --	p_apply_record		-> 	record to cascade changes to.
4055 --
4056 -- Post Success:
4057 -- 	Data from p_record will have been applied to p_apply_record for fields
4058 --	information102 thru information120.
4059 --
4060 -- Post Failure:
4061 --   No failure conditions.
4062 --
4063 -- Developer Implementation Notes:
4064 --   None
4065 --
4066 -- Access Status:
4067 --   Internal Development Use Only.
4068 --
4069 -- {End Of Comments}
4070 -- ---------------------------------------------------------------------------
4071 
4072 Procedure cascade_dependencies( p_record         in     ghr_pa_history%rowtype,
4073                                 p_apply_record   in out nocopy ghr_pa_history%rowtype )
4074 is
4075 
4076 	l_apply_record	ghr_pa_history%rowtype;
4077 	l_proc          varchar2(72)  := 'cascade_dependencies';
4078 begin
4079 
4080 -- Since information102 thru' 125 are always dependent on information101,
4081 -- cascade changes to these columns if information101 is supposed to be cascaded.
4082 
4083 	hr_utility.set_location('Entering  ' || l_proc , 5);
4084 	--Initialise Local Variables
4085 	  l_apply_record := p_apply_record;
4086         --
4087 
4088 	p_apply_record.information102  :=  p_record.information102;
4089 	p_apply_record.information103  :=  p_record.information103;
4090 	p_apply_record.information104  :=  p_record.information104;
4091 	p_apply_record.information105  :=  p_record.information105;
4092 	p_apply_record.information106  :=  p_record.information106;
4093 	p_apply_record.information107  :=  p_record.information107;
4094 	p_apply_record.information108  :=  p_record.information108;
4095 	p_apply_record.information109  :=  p_record.information109;
4096 	p_apply_record.information110  :=  p_record.information110;
4097 	p_apply_record.information111  :=  p_record.information111;
4098 	p_apply_record.information112  :=  p_record.information112;
4099 	p_apply_record.information113  :=  p_record.information113;
4100 	p_apply_record.information114  :=  p_record.information114;
4101 	p_apply_record.information115  :=  p_record.information115;
4102 	p_apply_record.information116  :=  p_record.information116;
4103 	p_apply_record.information117  :=  p_record.information117;
4104 	p_apply_record.information118  :=  p_record.information118;
4105 	p_apply_record.information119  :=  p_record.information119;
4106 	p_apply_record.information120  :=  p_record.information120;
4107 
4108 	hr_utility.set_location('Leaving  ' || l_proc,10);
4109 
4110 Exception
4111 When Others then
4112    --RESET In/Out Params and SET Out Params
4113    p_apply_record:=l_apply_record;
4114    hr_utility.set_location('Leaving  ' || l_proc,15);
4115    Raise;
4116 
4117 End cascade_dependencies;
4118 
4119 -- ---------------------------------------------------------------------------
4120 -- |--------------------------< fetch_most_recent_record>---------------------|
4121 -- ---------------------------------------------------------------------------
4122 -- {Start Of Comments}
4123 --
4124 -- Description:
4125 --   	This procedure fetches the most recent (according to sysdate) record from history
4126 --	for the p_table_name, p_table_pk_id, p_person_id specified.
4127 --
4128 -- Pre-Requisities:
4129 --   	None.
4130 --
4131 -- In Parameters:
4132 --	p_table_name		-> 	table name to fetch from.
4133 --	p_table_pk_id		->	table_pk_id of row to be fetched.
4134 --	p_person_id			-> 	person_id the row is associated with.
4135 --	p_history_data		->	fetched record will be returned here.
4136 --	p_result_code		-> 	indicates success or failure. If null,
4137 --						procedure succeeded. Otherwise,
4138 --						contains error message.
4139 --
4140 -- Post Success:
4141 -- 	Row will have been fetched from ghr_pa_history.
4142 --
4143 -- Post Failure:
4144 --   p_result_code will contain failure message.
4145 --
4146 -- Developer Implementation Notes:
4147 --   None
4148 --
4149 -- Access Status:
4150 --   Internal Development Use Only.
4151 --
4152 -- {End Of Comments}
4153 -- ---------------------------------------------------------------------------
4154 Procedure Fetch_most_recent_record(
4155 		p_table_name 	 in	varchar2,
4156 		p_table_pk_id	 in	varchar2,
4157 		p_person_id		 in	number,
4158 		p_history_data in out nocopy 	ghr_pa_history%rowtype,
4159 		p_result_code  in out nocopy varchar2
4160 ) is
4161 
4162 	l_history_data		ghr_pa_history%rowtype;
4163 	l_result_code		varchar2(200);
4164 	l_date_effective	date:=sysdate;
4165 	l_proc 		varchar2(30):='fetch_most_recent_record';
4166 
4167 Begin
4168 	-- This procedure passes sysdate for the most recent record to fetch_history_info
4169 	-- Assuming there will be no future action already applied to the extra_information table
4170 	hr_utility.set_location( 'Entering : ' || l_proc, 10);
4171 	--Initialise local variables
4172 	  l_history_data := p_history_data;
4173 	  l_result_code  := p_result_code;
4174 	--
4175 
4176 	ghr_history_api.fetch_history_info(
4177 		p_table_name	=> p_table_name,
4178 		p_table_pk_id	=> p_table_pk_id,
4179 		p_person_id		=> p_person_id,
4180 		p_date_effective	=> l_date_effective,
4181 		p_hist_data		=> p_history_data,
4182 		p_result_code	=> p_result_code);
4183 	hr_utility.set_location( 'Leaving : ' || l_proc, 20);
4184 
4185 Exception
4186 When Others then
4187    --RESET In/Out Params and SET Out Params
4188    p_history_data:=l_history_data;
4189    p_result_code:=l_result_code;
4190    hr_utility.set_location( 'Leaving : ' || l_proc, 25);
4191 Raise;
4192 
4193 End fetch_most_recent_record;
4194 
4195 -- ---------------------------------------------------------------------------
4196 -- |--------------------------< cascade_pa_req_field>-------------------------|
4197 -- ---------------------------------------------------------------------------
4198 -- {Start Of Comments}
4199 --
4200 -- Description:
4201 --   	This procedure applies changes to p_apply_field under the following conditions:
4202 --	1) 	p_result is true (cascading on this field is still continuing).
4203 --	2) 	p_post_field is not null (we are not cascading nulls).
4204 --	3) 	p_pre_field, p_post_field are NOT the same (this field was changed by the sf52
4205 --		we are processing).
4206 --	4) 	p_apply_field and p_pre_field are the same (subsequent changes have not been made
4207 --		to this row by a later action).
4208 --
4209 --	p_result will be set to false (this will halt any further cascading of this field) under
4210 --	the following conditions:
4211 --	1) if p_post_field is null (we are not cascading nulls).
4212 --	2) if p_pre_field and p_post_field are the same (this field was not changed by the sf52 we are processing).
4213 --	3) If p_pre_field and p_apply_field are NOT the same (a change was made to this row by a subsequent action).
4214 --
4215 -- Pre-Requisities:
4216 --   	None.
4217 --
4218 -- In Parameters:
4219 --	p_pre_field			->	contains field as it appeared prior to this action.
4220 --	p_post_field		->	contains field as it appeared after this action.
4221 --	p_apply_field		->	contains the field that we are (possibly) applying the
4222 --						cascaded data to.
4223 --	p_result			-> 	IN/OUT Boolean flag to indicate if this field (still) needs to be cascaded.
4224 --
4225 -- Post Success:
4226 -- 	The changes will have been applied the the p_apply_field as appropriate.
4227 --
4228 -- Post Failure:
4229 --   Error would have been displayed to user and exception raised.
4230 --
4231 -- Developer Implementation Notes:
4232 --   None
4233 --
4234 -- Access Status:
4235 --   Internal Development Use Only.
4236 --
4237 -- {End Of Comments}
4238 -- ---------------------------------------------------------------------------
4239 FUNCTION cascade_pa_req_field(p_refresh_field		in out nocopy varchar2,
4240 					 p_shadow_field		in out nocopy varchar2,
4241 					 p_sf52_field		in out nocopy varchar2,
4242 					p_changed			in out nocopy boolean) return boolean
4243 IS
4244 	l_refresh_field		 varchar2(150);
4245 	l_shadow_field		 varchar2(150);
4246 	l_sf52_field		 varchar2(150);
4247  	l_changed_boo		 boolean;  -- Created for NOCOPY changes
4248  	l_changed 		 boolean := FALSE;
4249 
4250 	l_proc   varchar2(72) := 'cascade_pa_req_field';
4251 
4252 BEGIN
4253 	hr_utility.set_location('entering: ' || l_proc,10);
4254         -- Initialise Local Variables
4255 	l_refresh_field	:= p_refresh_field;
4256 	l_shadow_field	:= p_shadow_field;
4257 	l_sf52_field	:= p_sf52_field;
4258  	l_changed_boo   := p_changed;
4259 --
4260 	if (p_refresh_field is not null) then
4261 		If (p_refresh_field <> nvl(p_sf52_field,hr_api.g_varchar2)) then
4262 			if (nvl(p_shadow_field,hr_api.g_varchar2) = nvl(p_sf52_field,hr_api.g_varchar2)) then
4263 				p_shadow_field 	:= p_refresh_field;
4264 				p_sf52_field 	:= p_refresh_field;
4265 				l_changed 		:= TRUE;
4266 				p_changed 		:= TRUE;
4267 			end if;
4268 		end if;
4269 	end if;
4270 /*
4271 -- Currently functionality is limited to copying UE and APUE which have been changed by the
4272 -- user to refresh rg.
4273 -- It is not refreshing the shadoe and sf52 RGs
4274 --
4275 	if (nvl(p_shadow_field,hr_api.g_varchar2) <> nvl(p_sf52_field,hr_api.g_varchar2)) then
4276 		p_refresh_field	:= p_sf52_field;
4277 		l_changed 		:= TRUE;
4278 	else
4279 		-- ie. either field is AP or APUE and user did not change it.
4280 		-- then refresh shadow record group.
4281 		-- this should take care of refreshing shadow table. As desc. are not in shadow table.
4282 		p_shadow_field := p_refresh_field;
4283 	end if;
4284 */
4285 	hr_utility.set_location('leaving: ' || l_proc,20);
4286 	return l_changed;
4287 Exception
4288 When Others then
4289    --Reset In/Out Params and SET Out Params
4290    p_refresh_field	:=l_refresh_field;
4291    p_shadow_field	:=l_shadow_field;
4292    p_sf52_field	:=l_sf52_field;
4293    p_changed	:=l_changed_boo;
4294    hr_utility.set_location('leaving: ' || l_proc,25);
4295    Raise;
4296 
4297 END;
4298 
4299 --
4300 -- ---------------------------------------------------------------------------
4301 -- |--------------------------< cascade_pa_req_field>-------------------------|
4302 -- ---------------------------------------------------------------------------
4303 FUNCTION cascade_pa_req_field(p_refresh_field  in out nocopy  date,
4304 				p_shadow_field  in out nocopy  date,
4305 				p_sf52_field    in out nocopy  date,
4306 				p_changed		in out nocopy boolean) return boolean
4307 IS
4308 
4309 
4310  	l_changed_boo      boolean;  -- Created for NOCOPY changes
4311 	l_proc             varchar2(72) := 'cascade_pa_req_field';
4312 	l_changed          boolean := FALSE;
4313         l_refresh_field    varchar2(150);
4314         l_shadow_field     varchar2(150);
4315         l_sf52_field       varchar2(150);
4316 BEGIN
4317     --
4318     -- function added on 29-oct-1998 to avoid the conversion problems for date
4319     -- fields. This overloading function converts the date to varchar and
4320     -- calls the original cascade_pa_req_field function.
4321     --
4322     hr_utility.set_location('entering: ' || l_proc,10);
4323     --Initialise local variables
4324     l_refresh_field := fnd_date.date_to_canonical(p_refresh_field);
4325     l_shadow_field  := fnd_date.date_to_canonical(p_shadow_field);
4326     l_sf52_field    := fnd_date.date_to_canonical(p_sf52_field);
4327     l_changed_boo   := p_changed;
4328     --
4329 
4330     l_changed := cascade_pa_req_field (p_refresh_field => l_refresh_field,
4331                                        p_shadow_field  => l_shadow_field,
4332                                        p_sf52_field    => l_sf52_field,
4333 						   p_changed	 => p_changed);
4334 
4335     p_refresh_field := fnd_date.canonical_to_date(l_refresh_field);
4336     p_shadow_field  := fnd_date.canonical_to_date(l_shadow_field);
4337     p_sf52_field    := fnd_date.canonical_to_date(l_sf52_field);
4338 
4339     return l_changed;
4340     hr_utility.set_location('leaving: ' || l_proc,20);
4341 
4342 Exception
4343 When Others then
4344    --RESET In/Out Params and SET Out Params
4345    p_refresh_field	:=l_refresh_field;
4346    p_shadow_field	:=l_shadow_field;
4347    p_sf52_field	:=l_sf52_field;
4348    p_changed	:=l_changed_boo;
4349    hr_utility.set_location('leaving: ' || l_proc,25);
4350    Raise;
4351 
4352 END;
4353 
4354 --
4355 -- ---------------------------------------------------------------------------
4356 -- |--------------------------< copy_pa_req_field>-------------------------|
4357 -- ---------------------------------------------------------------------------
4358 PROCEDURE copy_pa_req_field(	p_refresh_field in out nocopy  date,
4359 					p_sf52_field    in out nocopy  date,
4360 					p_changed	    in out nocopy 	boolean)
4361 IS
4362 	l_proc          varchar2(72) := 'copy_pa_req_field (date)';
4363 	l_changed       boolean := FALSE;
4364         l_refresh_field varchar2(150);
4365         l_sf52_field    varchar2(150);
4366         l_changed_boo	BOOLEAN;
4367 BEGIN
4368 
4369     hr_utility.set_location('entering: ' || l_proc,10);
4370     --Initialise Local Variables
4371     l_refresh_field := fnd_date.date_to_canonical(p_refresh_field);
4372     l_sf52_field    := fnd_date.date_to_canonical(p_sf52_field);
4373     l_changed_boo   := p_changed;
4374     --
4375     copy_pa_req_field (	p_refresh_field 	=> l_refresh_field,
4376                        	p_sf52_field    	=> l_sf52_field,
4377 				p_changed		=> l_changed);
4378 
4379     p_refresh_field := fnd_date.canonical_to_date(l_refresh_field);
4380     p_sf52_field    := fnd_date.canonical_to_date(l_sf52_field);
4381 
4382     hr_utility.set_location('leaving: ' || l_proc,20);
4383 
4384 Exception
4385 When Others then
4386    -- RESET In/Out Params and SET Out Params
4387    p_refresh_field:= l_refresh_field;
4388    p_sf52_field   := l_sf52_field;
4389    p_changed      := l_changed_boo;
4390    hr_utility.set_location('leaving : ' || l_proc,25);
4391    Raise;
4392 
4393 END;
4394 
4395 --
4396 -- ---------------------------------------------------------------------------
4397 -- |--------------------------< copy_pa_req_field>-------------------------|
4398 -- ---------------------------------------------------------------------------
4399 PROCEDURE copy_pa_req_field(	p_refresh_field in out nocopy  varchar2,
4400 					p_sf52_field    in out nocopy  varchar2,
4401 					p_changed	    in out nocopy 	boolean)
4402 IS
4403 
4404       l_refresh_field    varchar2(150);
4405       l_sf52_field       varchar2(150);
4406       l_changed	 	 BOOLEAN;
4407       l_proc             varchar2(72) := 'copy_pa_req_field (varchar2)';
4408 BEGIN
4409 
4410    hr_utility.set_location('entering: ' || l_proc,10);
4411     -- Initialise local variables
4412    l_refresh_field:= p_refresh_field;
4413    l_sf52_field   := p_sf52_field;
4414    l_changed      := p_changed;
4415     --
4416 
4417     if (p_sf52_field <> p_refresh_field) then
4418 	p_sf52_field := p_refresh_field;
4419 	p_changed := TRUE;
4420     end if;
4421 
4422     hr_utility.set_location('leaving: ' || l_proc,20);
4423 
4424 Exception
4425 When Others then
4426    --RESET In/Out Params and SET Out Params
4427    p_refresh_field := l_refresh_field;
4428    p_sf52_field    := l_sf52_field;
4429    p_changed       := l_changed;
4430    hr_utility.set_location('leaving: ' || l_proc,25);
4431    Raise;
4432 
4433 END;
4434 
4435 --
4436 --
4437 -- ---------------------------------------------------------------------------
4438 -- |--------------------------< cascade_pa_req>-------------------------------|
4439 -- ---------------------------------------------------------------------------
4440 -- {Start Of Comments}
4441 --
4442 -- Description:
4443 --   	This procedure calls cascade_field_value to cascade changes for every field
4444 --	in ghr_pa_hisory record. it also handles the dependent fields by calling
4445 --	cascade_dependencies if information101 field needs to be cascaded.
4446 --
4447 -- Pre-Requisities:
4448 --   	None.
4449 --
4450 -- In Parameters:
4451 --
4452 -- Post Success:
4453 -- 	The changes will have been cascaded the the p_apply_record as appropriate.
4454 --
4455 -- Post Failure:
4456 --   Error would have been displayed to user and exception raised.
4457 --
4458 -- Developer Implementation Notes:
4459 --   None
4460 --
4461 -- Access Status:
4462 --   Internal Development Use Only.
4463 --
4464 -- {End Of Comments}
4465 -- ---------------------------------------------------------------------------
4466 Procedure cascade_pa_req(p_rfrsh_rec	      in out nocopy ghr_pa_requests%rowtype,
4467 				 p_shadow_rec           in out nocopy ghr_pa_requests%rowtype,
4468 				 p_sf52_rec			in out nocopy ghr_pa_requests%rowtype,
4469 				 p_changed			in out nocopy boolean)
4470 is
4471 
4472 	l_rfrsh_rec		ghr_pa_requests%rowtype;
4473 	l_shadow_rec		ghr_pa_Requests%rowtype;
4474 	l_sf52_rec		ghr_pa_Requests%rowtype;
4475 	l_changed_boo		Boolean;
4476 
4477 	l_proc   	        varchar2(72) := 'cascade_pa_req';
4478 	l_changed	        boolean := FALSE;
4479 begin
4480 
4481 	-- Only those fields which are in shadow table can be refreshed. And this procedure
4482 	-- must not call cascade_pa_req_field to refresh any other field which is not in the
4483 	-- shadow table.
4484 
4485 
4486 	hr_utility.set_location('par cascade: annuitant_indicator' || l_proc,15);
4487 	-- Initialise local variables
4488 	   l_rfrsh_rec   := p_rfrsh_rec;
4489 	   l_shadow_Rec  := p_shadow_rec;
4490 	   l_sf52_rec    := p_sf52_rec;
4491 	   l_changed_boo := p_changed;
4492 	 --
4493 
4494 	l_changed := cascade_pa_req_field(p_rfrsh_rec.annuitant_indicator,
4495 		               		    p_shadow_rec.annuitant_indicator,
4496 		               		    p_sf52_rec.annuitant_indicator,
4497 						    p_changed);
4498 
4499 	hr_utility.set_location('par cascade: annuitant_indicator_desc' || l_proc,15);
4500 	-- if annuitant_indicator has changed than change annuitant_indicator_desc.
4501 	if (l_changed) then
4502 		p_sf52_rec.annuitant_indicator_desc		:= p_rfrsh_rec.annuitant_indicator_desc;
4503 	end if;
4504 
4505 	hr_utility.set_location('par cascade: appropriation_code1' || l_proc,15);
4506 	l_changed := cascade_pa_req_field(p_rfrsh_rec.appropriation_code1,
4507 		               		    p_shadow_rec.appropriation_code1,
4508 		               		    p_sf52_rec.appropriation_code1,
4509 						    p_changed);
4510 
4511 	hr_utility.set_location('par cascade: appropriation_code2' || l_proc,15);
4512 	l_changed := cascade_pa_req_field(p_rfrsh_rec.appropriation_code2,
4513 		               		    p_shadow_rec.appropriation_code2,
4514 		               		    p_sf52_rec.appropriation_code2,
4515 						    p_changed);
4516 
4517 	hr_utility.set_location('par cascade: bargaining_unit_status' || l_proc,15);
4518 	l_changed := cascade_pa_req_field(p_rfrsh_rec.bargaining_unit_status,
4519 		               		    p_shadow_rec.bargaining_unit_status,
4520 		               		    p_sf52_rec.bargaining_unit_status,
4521 						    p_changed);
4522 
4523 	hr_utility.set_location('par cascade: citizenship' || l_proc,15);
4524 	l_changed := cascade_pa_req_field(p_rfrsh_rec.citizenship,
4525 		               		    p_shadow_rec.citizenship,
4526 		               		    p_sf52_rec.citizenship,
4527 						    p_changed);
4528 
4529 	hr_utility.set_location('par cascade: duty_station_id' || l_proc,15);
4530 	l_changed := cascade_pa_req_field(p_rfrsh_rec.duty_station_id,
4531 		               		    p_shadow_rec.duty_station_id,
4532 		               		    p_sf52_rec.duty_station_id,
4533 						    p_changed);
4534 
4535 	-- if duty_station_id has changed than change duty_station_desc, and duty_station_code
4536 	if (l_changed) then
4537 		p_sf52_rec.duty_station_desc 		:= p_rfrsh_rec.duty_station_desc ;
4538 		p_sf52_rec.duty_station_code		:= p_rfrsh_rec.duty_station_code;
4539 	end if;
4540 
4541 	-- if education_level is cascaded, automatically cascade academic discipline and year degree attained. This is
4542 	-- so that nulls will be cascaded for academic discipline and year degree attained, if necessary.
4543 	hr_utility.set_location('par cascade: education_level' || l_proc,15);
4544 	l_changed := cascade_pa_req_field(p_rfrsh_rec.education_level,
4545 		               		    p_shadow_rec.education_level,
4546 		               		    p_sf52_rec.education_level,
4547 						    p_changed);
4548 
4549 	if l_changed then
4550 		p_sf52_rec.academic_discipline	:=	p_rfrsh_rec.academic_discipline;
4551 		p_shadow_rec.academic_discipline	:=	p_rfrsh_rec.academic_discipline;
4552 		p_sf52_rec.year_degree_attained	:=	p_rfrsh_rec.year_degree_attained;
4553 		p_shadow_rec.year_degree_attained	:=	p_rfrsh_rec.year_degree_attained;
4554 	end if;
4555 
4556 	hr_utility.set_location('par cascade: fegli' || l_proc,15);
4557 	l_changed := cascade_pa_req_field(p_rfrsh_rec.fegli,
4558 		               		    p_shadow_rec.fegli,
4559 		               		    p_sf52_rec.fegli,
4560 						    p_changed);
4561 
4562 	-- if fegli has changed than change fegli_desc.
4563 	if (l_changed) then
4564 		p_sf52_rec.fegli_desc 		:= p_rfrsh_rec.fegli_desc ;
4565 	end if;
4566 
4567 	hr_utility.set_location('par cascade: flsa_category' || l_proc,15);
4568 	l_changed := cascade_pa_req_field(p_rfrsh_rec.flsa_category,
4569 		               		    p_shadow_rec.flsa_category,
4570 		               		    p_sf52_rec.flsa_category,
4571 						    p_changed);
4572 
4573 	hr_utility.set_location('par cascade: forwarding_address_line1' || l_proc,15);
4574 	l_changed := cascade_pa_req_field(p_rfrsh_rec.forwarding_address_line1,
4575 		               		    p_shadow_rec.forwarding_address_line1,
4576 		               		    p_sf52_rec.forwarding_address_line1,
4577 						    p_changed);
4578 
4579 	hr_utility.set_location('par cascade: forwarding_address_line2' || l_proc,15);
4580 	l_changed := cascade_pa_req_field(p_rfrsh_rec.forwarding_address_line2,
4581 		               		    p_shadow_rec.forwarding_address_line2,
4582 		               		    p_sf52_rec.forwarding_address_line2,
4583 						    p_changed);
4584 
4585 	hr_utility.set_location('par cascade: forwarding_address_line3' || l_proc,15);
4586 	l_changed := cascade_pa_req_field(p_rfrsh_rec.forwarding_address_line3,
4587 		               		    p_shadow_rec.forwarding_address_line3,
4588 		               		    p_sf52_rec.forwarding_address_line3,
4589 						    p_changed);
4590 
4591 	hr_utility.set_location('par cascade: forwarding_country_short_name' || l_proc,15);
4592 	l_changed := cascade_pa_req_field(p_rfrsh_rec.forwarding_country_short_name,
4593 		               		    p_shadow_rec.forwarding_country_short_name,
4594 		               		    p_sf52_rec.forwarding_country_short_name,
4595 						    p_changed);
4596 
4597 	-- if forwarding country short name has changed than change forwarding country.
4598 	if (l_changed) then
4599 		p_sf52_rec.forwarding_country 	:= p_rfrsh_rec.forwarding_country ;
4600 		p_shadow_rec.forwarding_country 	:= p_rfrsh_rec.forwarding_country ;
4601 	end if;
4602 
4603 	hr_utility.set_location('par cascade: forwarding_postal_code' || l_proc,15);
4604 	l_changed := cascade_pa_req_field(p_rfrsh_rec.forwarding_postal_code,
4605 		               		    p_shadow_rec.forwarding_postal_code,
4606 		               		    p_sf52_rec.forwarding_postal_code,
4607 						    p_changed);
4608 
4609 	hr_utility.set_location('par cascade: forwarding_town_or_city' || l_proc,15);
4610 	l_changed := cascade_pa_req_field(p_rfrsh_rec.forwarding_town_or_city,
4611 		               		    p_shadow_rec.forwarding_town_or_city,
4612 		               		    p_sf52_rec.forwarding_town_or_city,
4613 						    p_changed);
4614 
4615 	hr_utility.set_location('par cascade: forwarding_country' || l_proc,15);
4616 	l_changed := cascade_pa_req_field(p_rfrsh_rec.forwarding_region_2,
4617 		               		    p_shadow_rec.forwarding_region_2,
4618 		               		    p_sf52_rec.forwarding_region_2,
4619 						    p_changed);
4620 
4621 	hr_utility.set_location('par cascade: functional_class' || l_proc,15);
4622 	l_changed := cascade_pa_req_field(p_rfrsh_rec.functional_class,
4623 		               		    p_shadow_rec.functional_class,
4624 		               		    p_sf52_rec.functional_class,
4625 						    p_changed);
4626 
4627 	hr_utility.set_location('par cascade: pay_rate_determinant' || l_proc,15);
4628 	l_changed := cascade_pa_req_field(p_rfrsh_rec.pay_rate_determinant,
4629 		               		    p_shadow_rec.pay_rate_determinant,
4630 		               		    p_sf52_rec.pay_rate_determinant,
4631 						    p_changed);
4632 
4633 	hr_utility.set_location('par cascade: position_occupied' || l_proc,15);
4634 	l_changed := cascade_pa_req_field(p_rfrsh_rec.position_occupied,
4635 		               		    p_shadow_rec.position_occupied,
4636 		               		    p_sf52_rec.position_occupied,
4637 						    p_changed);
4638 
4639 	hr_utility.set_location('par cascade: retirement_plan' || l_proc,15);
4640 	l_changed := cascade_pa_req_field(p_rfrsh_rec.retirement_plan,
4641 		               		    p_shadow_rec.retirement_plan,
4642 		               		    p_sf52_rec.retirement_plan,
4643 						    p_changed);
4644 
4645 	-- if retirement_plan has changed than change retirement_plan_desc.
4646 	if (l_changed) then
4647 		p_sf52_rec.retirement_plan_desc	:= p_rfrsh_rec.retirement_plan_desc;
4648 	end if;
4649 
4650 	hr_utility.set_location('par cascade: supervisory_status' || l_proc,15);
4651 	l_changed := cascade_pa_req_field(p_rfrsh_rec.supervisory_status,
4652 		               		    p_shadow_rec.supervisory_status,
4653 		               		    p_sf52_rec.supervisory_status,
4654 						    p_changed);
4655 
4656 	hr_utility.set_location('par cascade: tenure' || l_proc,15);
4657 	l_changed := cascade_pa_req_field(p_rfrsh_rec.tenure,
4658 		               		    p_shadow_rec.tenure,
4659 		               		    p_sf52_rec.tenure,
4660 						    p_changed);
4661 
4662 	hr_utility.set_location('par cascade: veterans_preference' || l_proc,15);
4663 	l_changed := cascade_pa_req_field(p_rfrsh_rec.veterans_preference,
4664 		               		    p_shadow_rec.veterans_preference,
4665 		               		    p_sf52_rec.veterans_preference,
4666 						    p_changed);
4667 
4668 	hr_utility.set_location('par cascade: veterans_pref_for_rif' || l_proc,15);
4669 	l_changed := cascade_pa_req_field(p_rfrsh_rec.veterans_pref_for_rif,
4670 		               		    p_shadow_rec.veterans_pref_for_rif,
4671 		               		    p_sf52_rec.veterans_pref_for_rif,
4672 						    p_changed);
4673 
4674 	hr_utility.set_location('par cascade: veterans_status' || l_proc,15);
4675 	l_changed := cascade_pa_req_field(p_rfrsh_rec.veterans_status,
4676 		               		    p_shadow_rec.veterans_status,
4677 		               		    p_sf52_rec.veterans_status,
4678 						    p_changed);
4679 
4680 	hr_utility.set_location('par cascade: work_schedule' || l_proc,15);
4681 	l_changed := cascade_pa_req_field(p_rfrsh_rec.work_schedule,
4682 		               		    p_shadow_rec.work_schedule,
4683 		               		    p_sf52_rec.work_schedule,
4684 						    p_changed);
4685 
4686 	-- if work_schedule has changed then change work_schedule_desc.
4687 	if (l_changed) then
4688 		p_sf52_rec.work_schedule_desc		:= p_rfrsh_rec.work_schedule_desc;
4689 		p_shadow_rec.work_schedule_desc	:= p_rfrsh_rec.work_schedule_desc;
4690 	end if;
4691 
4692 	hr_utility.set_location('par cascade: part_time_hours' || l_proc,15);
4693 	l_changed := cascade_pa_req_field(p_rfrsh_rec.part_time_hours,
4694 		               		    p_shadow_rec.part_time_hours,
4695 		               		    p_sf52_rec.part_time_hours,
4696 						    p_changed);
4697 
4698 	-- part_time_hours is a special case. We should cascade part_time_hours even if it is null.
4699 	-- so, if part_time_hours was not changed by cascade_pa_req_field and the refresh value for
4700 	-- PTH is null, then we need to handle the cascade here.
4701 	if (not l_changed and p_rfrsh_rec.part_time_hours is null) then
4702 		If (p_sf52_rec.part_time_hours is not null) then
4703 			if (nvl(p_shadow_rec.part_time_hours,hr_api.g_number) = nvl(p_sf52_rec.part_time_hours,hr_api.g_number)) then
4704 				p_changed := TRUE;
4705 				p_shadow_rec.part_time_hours 	:= p_rfrsh_rec.part_time_hours;
4706 				p_sf52_rec.part_time_hours 	:= p_rfrsh_rec.part_time_hours;
4707 			end if;
4708 		end if;
4709 	end if;
4710 
4711 	hr_utility.set_location('par cascade: service_comp_date' || l_proc,15);
4712 	l_changed := cascade_pa_req_field(p_rfrsh_rec.service_comp_date,
4713 		               		    p_shadow_rec.service_comp_date,
4714 		               		    p_sf52_rec.service_comp_date,
4715 						    p_changed);
4716 
4717 	hr_utility.set_location('par cascade: to_position_id' || l_proc,15);
4718 	l_changed := cascade_pa_req_field(p_rfrsh_rec.to_position_id,
4719 		               		    p_shadow_rec.to_position_id,
4720 		               		    p_sf52_rec.to_position_id,
4721 						    p_changed);
4722 
4723 	if p_sf52_rec.first_noa_code not in ('893', '892') then
4724 		if p_sf52_rec.custom_pay_calc_flag <> 'Y' then
4725 			l_changed := cascade_pa_req_field(p_rfrsh_rec.to_step_or_rate,
4726 				               		    p_shadow_rec.to_step_or_rate,
4727 			      	         		    p_sf52_rec.to_step_or_rate,
4728 								    p_changed);
4729 		end if;
4730 	end if;
4731 
4732 	hr_utility.set_location('par cascade:  auo premium pay indc' || l_proc,15);
4733 	l_changed := cascade_pa_req_field(p_rfrsh_rec.to_auo_premium_pay_indicator,
4734 		               		    p_shadow_rec.to_auo_premium_pay_indicator,
4735 		               		    p_sf52_rec.to_auo_premium_pay_indicator,
4736 						    p_changed);
4737 
4738         -- Bug# 1257515: cascading AUO Amount when auo Ind NOT NULL,
4739         -- otherwise copying it.
4740         IF p_sf52_rec.to_auo_premium_pay_indicator IS NOT NULL THEN
4741   	  hr_utility.set_location('par cascade:  auo premium pay amount' || l_proc,15);
4742 	  l_changed := cascade_pa_req_field(p_rfrsh_rec.to_au_overtime,
4743 		               		    p_shadow_rec.to_au_overtime,
4744 		               		    p_sf52_rec.to_au_overtime,
4745 					    p_changed);
4746         ELSE
4747 	  copy_pa_req_field(p_rfrsh_rec.to_au_overtime,
4748 			    p_sf52_rec.to_au_overtime,
4749 			    p_changed);
4750         END IF;
4751 
4752 	hr_utility.set_location('par cascade:  to_occ_code' || l_proc,15);
4753 	l_changed := cascade_pa_req_field(p_rfrsh_rec.to_occ_code,
4754 		               		    p_shadow_rec.to_occ_code,
4755 		               		    p_sf52_rec.to_occ_code,
4756 						    p_changed);
4757 	if (l_changed) then
4758 		p_sf52_rec.to_job_id			:= p_rfrsh_rec.to_job_id;
4759 	end if;
4760 
4761 	hr_utility.set_location('par cascade:  Premium Pay Indc' || l_proc,15);
4762 	l_changed := cascade_pa_req_field(p_rfrsh_rec.to_ap_premium_pay_indicator,
4763 		               		    p_shadow_rec.to_ap_premium_pay_indicator,
4764 		               		    p_sf52_rec.to_ap_premium_pay_indicator,
4765 						    p_changed);
4766 
4767         -- Bug# 2196971 : cascading AP Amount when ap Ind NOT NULL,
4768         -- otherwise copying it.
4769             IF p_sf52_rec.to_ap_premium_pay_indicator IS NOT NULL THEN
4770                hr_utility.set_location('par cascade:  ap premium pay amount' || l_proc,15);
4771                l_changed := cascade_pa_req_field(p_rfrsh_rec.to_availability_pay,
4772                                                  p_shadow_rec.to_availability_pay,
4773                                                  p_sf52_rec.to_availability_pay,
4774                                                  p_changed);
4775             ELSE
4776                copy_pa_req_field(p_rfrsh_rec.to_availability_pay,
4777                                  p_sf52_rec.to_availability_pay,
4778                                  p_changed);
4779             END IF;
4780 	hr_utility.set_location('par cascade:  Retention Allowance' || l_proc,15);
4781 	l_changed := cascade_pa_req_field(p_rfrsh_rec.to_retention_allowance,
4782 		               		    p_shadow_rec.to_retention_allowance,
4783 		               		    p_sf52_rec.to_retention_allowance,
4784 						    p_changed);
4785 
4786 	hr_utility.set_location('par cascade:  Retention Allowance' || l_proc,15);
4787 	l_changed := cascade_pa_req_field(p_rfrsh_rec.to_retention_allow_percentage,
4788 		               		    p_shadow_rec.to_retention_allow_percentage,
4789 		               		    p_sf52_rec.to_retention_allow_percentage,
4790 						    p_changed);
4791 
4792 	hr_utility.set_location('par cascade:  Superv. Diff' || l_proc,15);
4793 	l_changed := cascade_pa_req_field(p_rfrsh_rec.to_supervisory_differential,
4794 		               		    p_shadow_rec.to_supervisory_differential,
4795 		               		    p_sf52_rec.to_supervisory_differential,
4796 						    p_changed);
4797 
4798 	hr_utility.set_location('par cascade:  Superv. Diff' || l_proc,15);
4799 	l_changed := cascade_pa_req_field(p_rfrsh_rec.to_supervisory_diff_percentage,
4800 		               		    p_shadow_rec.to_supervisory_diff_percentage,
4801 		               		    p_sf52_rec.to_supervisory_diff_percentage,
4802 						    p_changed);
4803 
4804 	hr_utility.set_location('par cascade:  Staffing Diff.' || l_proc,15);
4805 	l_changed := cascade_pa_req_field(p_rfrsh_rec.to_staffing_differential,
4806 		               		    p_shadow_rec.to_staffing_differential,
4807 		               		    p_sf52_rec.to_staffing_differential,
4808 						    p_changed);
4809 
4810 	hr_utility.set_location('par cascade:  Staffing Diff. Percentage' || l_proc,15);
4811 	l_changed := cascade_pa_req_field(p_rfrsh_rec.to_staffing_diff_percentage,
4812 		               		    p_shadow_rec.to_staffing_diff_percentage,
4813 		               		    p_sf52_rec.to_staffing_diff_percentage,
4814 						    p_changed);
4815 
4816 	hr_utility.set_location('par cascade: duty_station_location_id' || l_proc,15);
4817 	l_changed := cascade_pa_req_field(p_rfrsh_rec.duty_station_location_id,
4818 		       		          p_shadow_rec.duty_station_location_id,
4819 		              		    p_sf52_rec.duty_station_location_id,
4820 						    p_changed);
4821 
4822 	-- always refresh national_identifier and date_of_birth
4823 	copy_pa_req_field(p_rfrsh_rec.employee_national_identifier,
4824 				p_sf52_rec.employee_national_identifier,
4825 				p_changed);
4826 
4827 	copy_pa_req_field(p_rfrsh_rec.employee_date_of_birth,
4828 				p_sf52_rec.employee_date_of_birth,
4829 				p_changed);
4830 
4831 	-- Cascade Name
4832 	-- if this a name change family
4833 	-- then retain what-ever user entered
4834 	if p_sf52_rec.noa_family_code = 'CHG_NAME' then
4835 		null;
4836 	else
4837 		-- copy refreshed values from refresh_rec
4838 		copy_pa_req_field(p_rfrsh_rec.employee_first_name,
4839 					p_sf52_rec.employee_first_name,
4840 					p_changed);
4841 		copy_pa_req_field(p_rfrsh_rec.employee_last_name,
4842 					p_sf52_rec.employee_last_name,
4843 					p_changed);
4844 		copy_pa_req_field(p_rfrsh_rec.employee_middle_names,
4845 					p_sf52_rec.employee_middle_names,
4846 					p_changed);
4847 	end if;
4848 	copy_pa_req_field(p_rfrsh_rec.from_adj_basic_pay,
4849 				p_sf52_rec.from_adj_basic_pay,
4850 				p_changed);
4851 	copy_pa_req_field(p_rfrsh_rec.from_agency_code,
4852 				p_sf52_rec.from_agency_code,
4853 				p_changed);
4854 	copy_pa_req_field(p_rfrsh_rec.from_agency_desc,
4855 				p_sf52_rec.from_agency_desc,
4856 				p_changed);
4857 	copy_pa_req_field(p_rfrsh_rec.from_basic_pay,
4858 				p_sf52_rec.from_basic_pay,
4859 				p_changed);
4860 	copy_pa_req_field(p_rfrsh_rec.from_grade_or_level,
4861 				p_sf52_rec.from_grade_or_level,
4862 				p_changed);
4863 	copy_pa_req_field(p_rfrsh_rec.from_locality_adj,
4864 				p_sf52_rec.from_locality_adj,
4865 				p_changed);
4866 	copy_pa_req_field(p_rfrsh_rec.from_occ_code,
4867 				p_sf52_rec.from_occ_code,
4868 				p_changed);
4869 	copy_pa_req_field(p_rfrsh_rec.from_office_symbol,
4870 				p_sf52_rec.from_office_symbol,
4871 				p_changed);
4872 	copy_pa_req_field(p_rfrsh_rec.from_other_pay_amount,
4873 				p_sf52_rec.from_other_pay_amount,
4874 				p_changed);
4875 	copy_pa_req_field(p_rfrsh_rec.from_pay_basis,
4876 				p_sf52_rec.from_pay_basis,
4877 				p_changed);
4878 	copy_pa_req_field(p_rfrsh_rec.from_pay_plan,
4879 				p_sf52_rec.from_pay_plan,
4880 				p_changed);
4881 	copy_pa_req_field(p_rfrsh_rec.from_position_id,
4882 				p_sf52_rec.from_position_id,
4883 				p_changed);
4884 	copy_pa_req_field(p_rfrsh_rec.from_position_org_line1,
4885 				p_sf52_rec.from_position_org_line1,
4886 				p_changed);
4887 	copy_pa_req_field(p_rfrsh_rec.from_position_org_line2,
4888 				p_sf52_rec.from_position_org_line2,
4889 				p_changed);
4890 	copy_pa_req_field(p_rfrsh_rec.from_position_org_line3,
4891 				p_sf52_rec.from_position_org_line3,
4892 				p_changed);
4893 	copy_pa_req_field(p_rfrsh_rec.from_position_org_line4,
4894 				p_sf52_rec.from_position_org_line4,
4895 				p_changed);
4896 	copy_pa_req_field(p_rfrsh_rec.from_position_org_line5,
4897 				p_sf52_rec.from_position_org_line5,
4898 				p_changed);
4899 	copy_pa_req_field(p_rfrsh_rec.from_position_org_line6,
4900 				p_sf52_rec.from_position_org_line6,
4901 				p_changed);
4902 	copy_pa_req_field(p_rfrsh_rec.from_position_number,
4903 				p_sf52_rec.from_position_number,
4904 				p_changed);
4905 	copy_pa_req_field(p_rfrsh_rec.from_position_seq_no,
4906 				p_sf52_rec.from_position_seq_no,
4907 				p_changed);
4908 	copy_pa_req_field(p_rfrsh_rec.from_position_title,
4909 				p_sf52_rec.from_position_title,
4910 				p_changed);
4911 	copy_pa_req_field(p_rfrsh_rec.from_step_or_rate,
4912 				p_sf52_rec.from_step_or_rate,
4913 				p_changed);
4914 	copy_pa_req_field(p_rfrsh_rec.from_total_salary,
4915 				p_sf52_rec.from_total_salary,
4916 				p_changed);
4917 	copy_pa_req_field(p_rfrsh_rec.to_position_id,
4918 				p_sf52_rec.to_position_id,
4919 				p_changed);
4920 	copy_pa_req_field(p_rfrsh_rec.to_grade_id,
4921 				p_sf52_rec.to_grade_id,
4922 				p_changed);
4923 	copy_pa_req_field(p_rfrsh_rec.to_grade_or_level,
4924 				p_sf52_rec.to_grade_or_level,
4925 				p_changed);
4926 	copy_pa_req_field(p_rfrsh_rec.to_office_symbol,
4927 				p_sf52_rec.to_office_symbol,
4928 				p_changed);
4929 	copy_pa_req_field(p_rfrsh_rec.to_organization_id,
4930 				p_sf52_rec.to_organization_id,
4931 				p_changed);
4932 	copy_pa_req_field(p_rfrsh_rec.to_pay_basis,
4933 				p_sf52_rec.to_pay_basis,
4934 				p_changed);
4935 	copy_pa_req_field(p_rfrsh_rec.to_pay_plan,
4936 				p_sf52_rec.to_pay_plan,
4937 				p_changed);
4938 	copy_pa_req_field(p_rfrsh_rec.to_position_org_line1,
4939 				p_sf52_rec.to_position_org_line1,
4940 				p_changed);
4941 	copy_pa_req_field(p_rfrsh_rec.to_position_org_line2,
4942 				p_sf52_rec.to_position_org_line2,
4943 				p_changed);
4944 	copy_pa_req_field(p_rfrsh_rec.to_position_org_line3,
4945 				p_sf52_rec.to_position_org_line3,
4946 				p_changed);
4947 	copy_pa_req_field(p_rfrsh_rec.to_position_org_line4,
4948 				p_sf52_rec.to_position_org_line4,
4949 				p_changed);
4950 	copy_pa_req_field(p_rfrsh_rec.to_position_org_line5,
4951 				p_sf52_rec.to_position_org_line5,
4952 				p_changed);
4953 	copy_pa_req_field(p_rfrsh_rec.to_position_org_line6,
4954 				p_sf52_rec.to_position_org_line6,
4955 				p_changed);
4956 	copy_pa_req_field(p_rfrsh_rec.to_position_number,
4957 				p_sf52_rec.to_position_number,
4958 				p_changed);
4959 	copy_pa_req_field(p_rfrsh_rec.to_position_seq_no,
4960 				p_sf52_rec.to_position_seq_no,
4961 				p_changed);
4962 	copy_pa_req_field(p_rfrsh_rec.to_position_title,
4963 				p_sf52_rec.to_position_title,
4964 				p_changed);
4965 	copy_pa_req_field(p_rfrsh_rec.to_basic_pay,
4966 				p_sf52_rec.to_basic_pay,
4967 				p_changed);
4968 	copy_pa_req_field(p_rfrsh_rec.to_locality_adj,
4969 				p_sf52_rec.to_locality_adj,
4970 				p_changed);
4971 	copy_pa_req_field(p_rfrsh_rec.to_adj_basic_pay,
4972 				p_sf52_rec.to_adj_basic_pay,
4973 				p_changed);
4974 	copy_pa_req_field(p_rfrsh_rec.to_total_salary,
4975 				p_sf52_rec.to_total_salary,
4976 				p_changed);
4977 
4978 	-- Assignment_id remains same so is not copied from sf52_rec.
4979 Exception
4980 When Others then
4981    --RESET In/Out Params and SET Out Params
4982    p_rfrsh_rec	:=l_rfrsh_rec;
4983    p_shadow_rec	:=l_shadow_rec;
4984    p_sf52_rec	:=l_sf52_rec;
4985    p_changed	:=l_changed_boo;
4986    hr_utility.set_location('leaving: ' || l_proc,25);
4987    Raise;
4988 
4989 end cascade_pa_req;
4990 
4991 End ghr_history_cascade;