DBA Data[Home] [Help]

PACKAGE BODY: APPS.GHR_HISTORY_CASCADE

Source


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