DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_PROCESS_ASSIGNMENT_SS

Source


1 PACKAGE body hr_process_assignment_ss AS
2 /* $Header: hrascwrs.pkb 120.37.12020000.5 2012/07/04 22:07:43 amnaraya ship $*/
3 
4 
5 g_package      constant varchar2(75):='HR_PROCESS_ASSIGNMENT_SS.';
6 g_api_name     constant varchar2(75):=g_package || 'PROCESS_API';
7 g_data_error            exception;
8 --g_date_format  constant varchar2(10):='RRRR/MM/DD';
9 g_registration boolean :=false;
10 g_applicant_hire boolean := false;
11 g_exemp_hire boolean := false;
12 --
13 
14 -- bug 5032032
15 PROCEDURE update_salary_proposal(p_assignment_id number
16                                  , p_effective_date date) IS
17 
18      l_pay_proposal_id           per_pay_proposals.pay_proposal_id%TYPE;
19      l_pyp_object_version_number per_pay_proposals.object_version_number%TYPE;
20      l_change_date               per_pay_proposals.change_date%TYPE;
21      l_proposed_salary           per_pay_proposals.PROPOSED_SALARY_N%TYPE;
22      l_approved_flag             varchar2(1) := 'Y';
23      l_inv_next_sal_date_warning boolean;
24      l_proposed_salary_warning   boolean;
25      l_approved_warning          boolean;
26      l_payroll_warning           boolean;
27 
28      cursor csr_payproposal is
29         select pay_proposal_id, object_version_number, change_date
30               ,PROPOSED_SALARY_N
31           from per_pay_proposals
32           where assignment_id = p_assignment_id
33           order by change_date DESC;
34   BEGIN
35     open csr_payproposal;
36     fetch csr_payproposal into l_pay_proposal_id, l_pyp_object_version_number
37                               ,l_change_date, l_proposed_salary;
38     if csr_payproposal%found and l_change_date < p_effective_date then
39 
40         hr_maintain_proposal_api.cre_or_upd_salary_proposal
41           (p_pay_proposal_id              => l_pay_proposal_id
42           ,p_object_version_number        => l_pyp_object_version_number
43           ,p_change_date                  => p_effective_date
44           ,p_approved                     => l_approved_flag
45           ,p_inv_next_sal_date_warning    => l_inv_next_sal_date_warning
46           ,p_proposed_salary_warning      => l_proposed_salary_warning
47           ,p_approved_warning             => l_approved_warning
48           ,p_payroll_warning              => l_payroll_warning
49         );
50     end if;
51     close csr_payproposal;
52   END update_salary_proposal;
53 
54 
55 -- bug 5032032
56 procedure get_asg_from_tt
57 (p_transaction_step_id in     number
58 ,p_assignment_rec   out nocopy per_all_assignments_f%rowtype) is
59 l_proc   varchar2(72)  := g_package||'get_asg_from_tt';
60 
61 begin
62 --dbms_output.put_line(' ');
63 hr_utility.set_location('Entering:'||l_proc, 5);
64 p_assignment_rec.assignment_id:=
65     hr_transaction_api.get_number_value
66     (p_transaction_step_id =>  p_transaction_step_id
67     ,p_name                => 'P_ASSIGNMENT_ID');
68 --
69 p_assignment_rec.object_version_number :=
70     hr_transaction_api.get_number_value
71     (p_transaction_step_id =>  p_transaction_step_id
72     ,p_name                => 'P_OBJECT_VERSION_NUMBER');
73 --
74 p_assignment_rec.business_group_id :=
75     hr_transaction_api.get_number_value
76     (p_transaction_step_id => p_transaction_step_id
77     ,p_name                => 'P_BUSINESS_GROUP_ID');
78 --
79 p_assignment_rec.person_id :=
80     hr_transaction_api.get_number_value
81     (p_transaction_step_id => p_transaction_step_id
82     ,p_name                => 'P_PERSON_ID');
83 --
84 p_assignment_rec.organization_id :=
85     hr_transaction_api.get_number_value
86     (p_transaction_step_id => p_transaction_step_id
87     ,p_name                => 'P_ORGANIZATION_ID');
88 --
89 p_assignment_rec.grade_id :=
90     hr_transaction_api.get_number_value
91     (p_transaction_step_id => p_transaction_step_id
92     ,p_name                => 'P_GRADE_ID');
93 --
94 p_assignment_rec.position_id :=
95     hr_transaction_api.get_number_value
96     (p_transaction_step_id => p_transaction_step_id
97     ,p_name                => 'P_POSITION_ID');
98 --
99 p_assignment_rec.job_id :=
100     hr_transaction_api.get_number_value
101     (p_transaction_step_id => p_transaction_step_id
102     ,p_name                => 'P_JOB_ID');
103 --
104 p_assignment_rec.location_id :=
105     hr_transaction_api.get_number_value
106     (p_transaction_step_id => p_transaction_step_id
107     ,p_name                => 'P_LOCATION_ID');
108 --
109 p_assignment_rec.special_ceiling_step_id  :=
110     hr_transaction_api.get_number_value
111     (p_transaction_step_id => p_transaction_step_id
112     ,p_name                => 'P_SPECIAL_CEILING_STEP_ID');
113 --
114 p_assignment_rec.employment_category :=
115     hr_transaction_api.get_varchar2_value
116     (p_transaction_step_id => p_transaction_step_id
117     ,p_name                => 'P_EMPLOYMENT_CATEGORY');
118 --
119 p_assignment_rec.supervisor_id :=
120     hr_transaction_api.get_number_value
121     (p_transaction_step_id => p_transaction_step_id
122     ,p_name                => 'P_SUPERVISOR_ID');
123 --
124 p_assignment_rec.manager_flag :=
125     hr_transaction_api.get_varchar2_value
126     (p_transaction_step_id => p_transaction_step_id
127     ,p_name                => 'P_MANAGER_FLAG');
128 --
129 p_assignment_rec.normal_hours  :=
130     hr_transaction_api.get_number_value
131     (p_transaction_step_id => p_transaction_step_id
132     ,p_name                => 'P_NORMAL_HOURS');
133 --
134 p_assignment_rec.frequency :=
135     hr_transaction_api.get_varchar2_value
136     (p_transaction_step_id => p_transaction_step_id
137     ,p_name                => 'P_FREQUENCY');
138 --
139 p_assignment_rec.time_normal_finish  :=
140     substr(hr_transaction_api.get_varchar2_value
141     (p_transaction_step_id => p_transaction_step_id
142     ,p_name                => 'P_TIME_NORMAL_FINISH'),0,5);
143 --
144 p_assignment_rec.time_normal_start :=
145     substr(hr_transaction_api.get_varchar2_value
146     (p_transaction_step_id => p_transaction_step_id
147     ,p_name                => 'P_TIME_NORMAL_START'),0,5);
148 --
149 p_assignment_rec.bargaining_unit_code  :=
150     hr_transaction_api.get_varchar2_value
151     (p_transaction_step_id => p_transaction_step_id
152     ,p_name                => 'P_BARGAINING_UNIT_CODE');
153 --
154 p_assignment_rec.labour_union_member_flag :=
155     hr_transaction_api.get_varchar2_value
156     (p_transaction_step_id => p_transaction_step_id
157     ,p_name                => 'P_LABOUR_UNION_MEMBER_FLAG');
158 --
159 p_assignment_rec.assignment_status_type_id :=
160     hr_transaction_api.get_number_value
161     (p_transaction_step_id => p_transaction_step_id
162     ,p_name                => 'P_ASSIGNMENT_STATUS_TYPE_ID');
163 --
164 p_assignment_rec.change_reason  :=
165     hr_transaction_api.get_varchar2_value
166     (p_transaction_step_id => p_transaction_step_id
167     ,p_name                => 'P_CHANGE_REASON');
168 --
169 p_assignment_rec.ass_attribute_category :=
170     hr_transaction_api.get_varchar2_value
171     (p_transaction_step_id => p_transaction_step_id
172     ,p_name                => 'P_ASS_ATTRIBUTE_CATEGORY');
173 --
174 p_assignment_rec.ass_attribute1 :=
175     hr_transaction_api.get_varchar2_value
176     (p_transaction_step_id => p_transaction_step_id
177     ,p_name                => 'P_ASS_ATTRIBUTE1');
178 --
179 p_assignment_rec.ass_attribute2 :=
180     hr_transaction_api.get_varchar2_value
181     (p_transaction_step_id => p_transaction_step_id
182     ,p_name                => 'P_ASS_ATTRIBUTE2');
183 --
184 p_assignment_rec.ass_attribute3 :=
185     hr_transaction_api.get_varchar2_value
186     (p_transaction_step_id => p_transaction_step_id
187     ,p_name                => 'P_ASS_ATTRIBUTE3');
188 --
189 p_assignment_rec.ass_attribute4 :=
190     hr_transaction_api.get_varchar2_value
191     (p_transaction_step_id => p_transaction_step_id
192     ,p_name                => 'P_ASS_ATTRIBUTE4');
193 --
194 p_assignment_rec.ass_attribute5 :=
195     hr_transaction_api.get_varchar2_value
196     (p_transaction_step_id => p_transaction_step_id
197     ,p_name                => 'P_ASS_ATTRIBUTE5');
198 --
199 p_assignment_rec.ass_attribute6 :=
200     hr_transaction_api.get_varchar2_value
201     (p_transaction_step_id => p_transaction_step_id
202     ,p_name                => 'P_ASS_ATTRIBUTE6');
203 --
204 p_assignment_rec.ass_attribute7 :=
205     hr_transaction_api.get_varchar2_value
206     (p_transaction_step_id => p_transaction_step_id
207     ,p_name                => 'P_ASS_ATTRIBUTE7');
208 --
209 p_assignment_rec.ass_attribute8 :=
210     hr_transaction_api.get_varchar2_value
211     (p_transaction_step_id => p_transaction_step_id
212     ,p_name                => 'P_ASS_ATTRIBUTE8');
213 --
214 p_assignment_rec.ass_attribute9 :=
215     hr_transaction_api.get_varchar2_value
216     (p_transaction_step_id => p_transaction_step_id
217     ,p_name                => 'P_ASS_ATTRIBUTE9');
218 --
219 p_assignment_rec.ass_attribute10 :=
220     hr_transaction_api.get_varchar2_value
221     (p_transaction_step_id => p_transaction_step_id
222     ,p_name                => 'P_ASS_ATTRIBUTE10');
223 --
224 p_assignment_rec.ass_attribute11 :=
225     hr_transaction_api.get_varchar2_value
226     (p_transaction_step_id => p_transaction_step_id
227     ,p_name                => 'P_ASS_ATTRIBUTE11');
228 --
229 p_assignment_rec.ass_attribute12 :=
230     hr_transaction_api.get_varchar2_value
231     (p_transaction_step_id => p_transaction_step_id
232     ,p_name                => 'P_ASS_ATTRIBUTE12');
233 --
234 p_assignment_rec.ass_attribute13 :=
235     hr_transaction_api.get_varchar2_value
236     (p_transaction_step_id => p_transaction_step_id
237     ,p_name                => 'P_ASS_ATTRIBUTE13');
238 --
239 p_assignment_rec.ass_attribute14 :=
240     hr_transaction_api.get_varchar2_value
241     (p_transaction_step_id => p_transaction_step_id
242     ,p_name                => 'P_ASS_ATTRIBUTE14');
243 --
244 p_assignment_rec.ass_attribute15 :=
245     hr_transaction_api.get_varchar2_value
246     (p_transaction_step_id => p_transaction_step_id
247     ,p_name                => 'P_ASS_ATTRIBUTE15');
248 --
249 p_assignment_rec.ass_attribute16 :=
250     hr_transaction_api.get_varchar2_value
251     (p_transaction_step_id => p_transaction_step_id
252     ,p_name                => 'P_ASS_ATTRIBUTE16');
253 --
254 p_assignment_rec.ass_attribute17 :=
255     hr_transaction_api.get_varchar2_value
256     (p_transaction_step_id => p_transaction_step_id
257     ,p_name                => 'P_ASS_ATTRIBUTE17');
258 --
259 p_assignment_rec.ass_attribute18 :=
260     hr_transaction_api.get_varchar2_value
261     (p_transaction_step_id => p_transaction_step_id
262     ,p_name                => 'P_ASS_ATTRIBUTE18');
263 --
264 p_assignment_rec.ass_attribute19 :=
265     hr_transaction_api.get_varchar2_value
266     (p_transaction_step_id => p_transaction_step_id
267     ,p_name                => 'P_ASS_ATTRIBUTE19');
268 --
269 p_assignment_rec.ass_attribute20 :=
270     hr_transaction_api.get_varchar2_value
271     (p_transaction_step_id => p_transaction_step_id
272     ,p_name                => 'P_ASS_ATTRIBUTE20');
273 --
274 p_assignment_rec.ass_attribute21 :=
275     hr_transaction_api.get_varchar2_value
276     (p_transaction_step_id => p_transaction_step_id
277     ,p_name                => 'P_ASS_ATTRIBUTE21');
278 --
279 p_assignment_rec.ass_attribute22 :=
280     hr_transaction_api.get_varchar2_value
281     (p_transaction_step_id => p_transaction_step_id
282     ,p_name                => 'P_ASS_ATTRIBUTE22');
283 --
284 p_assignment_rec.ass_attribute23 :=
285     hr_transaction_api.get_varchar2_value
286     (p_transaction_step_id => p_transaction_step_id
287     ,p_name                => 'P_ASS_ATTRIBUTE23');
288 --
289 p_assignment_rec.ass_attribute24 :=
290     hr_transaction_api.get_varchar2_value
291     (p_transaction_step_id => p_transaction_step_id
292     ,p_name                => 'P_ASS_ATTRIBUTE24');
293 --
294 p_assignment_rec.ass_attribute25 :=
295     hr_transaction_api.get_varchar2_value
296     (p_transaction_step_id => p_transaction_step_id
297     ,p_name                => 'P_ASS_ATTRIBUTE25');
298 --
299 p_assignment_rec.ass_attribute26 :=
300     hr_transaction_api.get_varchar2_value
301     (p_transaction_step_id => p_transaction_step_id
302     ,p_name                => 'P_ASS_ATTRIBUTE26');
303 --
304 p_assignment_rec.ass_attribute27 :=
305     hr_transaction_api.get_varchar2_value
306     (p_transaction_step_id => p_transaction_step_id
307     ,p_name                => 'P_ASS_ATTRIBUTE27');
308 --
309 p_assignment_rec.ass_attribute28 :=
310     hr_transaction_api.get_varchar2_value
311     (p_transaction_step_id => p_transaction_step_id
312     ,p_name                => 'P_ASS_ATTRIBUTE28');
313 --
314 p_assignment_rec.ass_attribute29 :=
315     hr_transaction_api.get_varchar2_value
316     (p_transaction_step_id => p_transaction_step_id
317     ,p_name                => 'P_ASS_ATTRIBUTE29');
318 --
319 p_assignment_rec.ass_attribute30 :=
320     hr_transaction_api.get_varchar2_value
321     (p_transaction_step_id => p_transaction_step_id
322     ,p_name                => 'P_ASS_ATTRIBUTE30');
323 --
324 p_assignment_rec.contract_id :=
325     hr_transaction_api.get_number_value
326     (p_transaction_step_id => p_transaction_step_id
327     ,p_name                => 'P_CONTRACT_ID');
328 --
329 p_assignment_rec.establishment_id :=
330     hr_transaction_api.get_number_value
331     (p_transaction_step_id => p_transaction_step_id
332     ,p_name                => 'P_ESTABLISHMENT_ID');
333 --
334 p_assignment_rec.cagr_grade_def_id :=
335     hr_transaction_api.get_number_value
336     (p_transaction_step_id => p_transaction_step_id
337     ,p_name                => 'P_CAGR_GRADE_DEF_ID');
338 --
339 p_assignment_rec.collective_agreement_id :=
340     hr_transaction_api.get_number_value
341     (p_transaction_step_id => p_transaction_step_id
342     ,p_name                => 'P_COLLECTIVE_AGREEMENT_ID');
343 --
344 p_assignment_rec.cagr_id_flex_num :=
345     hr_transaction_api.get_number_value
346     (p_transaction_step_id => p_transaction_step_id
347     ,p_name                => 'P_CAGR_ID_FLEX_NUM');
348 --
349 p_assignment_rec.payroll_id :=
350     hr_transaction_api.get_number_value
351     (p_transaction_step_id => p_transaction_step_id
352     ,p_name                => 'P_PAYROLL_ID');
353 --
354 p_assignment_rec.pay_basis_id :=
355     hr_transaction_api.get_number_value
356     (p_transaction_step_id => p_transaction_step_id
357     ,p_name                => 'P_PAY_BASIS_ID');
358 --
359 p_assignment_rec.sal_review_period :=
360     hr_transaction_api.get_number_value
361     (p_transaction_step_id => p_transaction_step_id
362     ,p_name                => 'P_SAL_REVIEW_PERIOD');
363 --
364 p_assignment_rec.sal_review_period_frequency :=
365     hr_transaction_api.get_varchar2_value
366     (p_transaction_step_id => p_transaction_step_id
367     ,p_name                => 'P_SAL_REVIEW_PERIOD_FREQUENCY');
368 
369 --
370 p_assignment_rec.date_probation_end :=
371     hr_transaction_api.get_date_value
372     (p_transaction_step_id => p_transaction_step_id
373     ,p_name                => 'P_DATE_PROBATION_END');
374 --
375 p_assignment_rec.probation_period :=
376     hr_transaction_api.get_number_value
377     (p_transaction_step_id => p_transaction_step_id
378     ,p_name                => 'P_PROBATION_PERIOD');
379 --
380 p_assignment_rec.probation_unit :=
381     hr_transaction_api.get_varchar2_value
382     (p_transaction_step_id => p_transaction_step_id
383     ,p_name                => 'P_PROBATION_UNIT');
384 --
385 p_assignment_rec.notice_period :=
386     hr_transaction_api.get_number_value
387     (p_transaction_step_id => p_transaction_step_id
388     ,p_name                => 'P_NOTICE_PERIOD');
389 --
390 p_assignment_rec.notice_period_uom :=
391     hr_transaction_api.get_varchar2_value
392     (p_transaction_step_id => p_transaction_step_id
393     ,p_name                => 'P_NOTICE_PERIOD_UOM');
394 --
395 p_assignment_rec.employee_category :=
396     hr_transaction_api.get_varchar2_value
397     (p_transaction_step_id => p_transaction_step_id
398     ,p_name                => 'P_EMPLOYEE_CATEGORY');
399 --
400 p_assignment_rec.work_at_home :=
401     hr_transaction_api.get_varchar2_value
402     (p_transaction_step_id => p_transaction_step_id
403     ,p_name                => 'P_WORK_AT_HOME');
404 --
405 p_assignment_rec.job_post_source_name :=
406     hr_transaction_api.get_varchar2_value
407     (p_transaction_step_id => p_transaction_step_id
408     ,p_name                => 'P_JOB_POST_SOURCE_NAME');
409 --
410 p_assignment_rec.perf_review_period :=
411     hr_transaction_api.get_number_value
412     (p_transaction_step_id => p_transaction_step_id
413     ,p_name                => 'P_PERF_REVIEW_PERIOD');
414 --
415 p_assignment_rec.perf_review_period_frequency :=
416     hr_transaction_api.get_varchar2_value
417     (p_transaction_step_id => p_transaction_step_id
418     ,p_name                => 'P_PERF_REVIEW_PERIOD_FREQUENCY');
419 --
420 p_assignment_rec.internal_address_line :=
421     hr_transaction_api.get_varchar2_value
422     (p_transaction_step_id => p_transaction_step_id
423     ,p_name                => 'P_INTERNAL_ADDRESS_LINE');
424 --
425 p_assignment_rec.people_group_id:=
426     hr_transaction_api.get_number_value
427     (p_transaction_step_id => p_transaction_step_id
428     ,p_name                => 'P_PEOPLE_GROUP_ID');
429 --
430 p_assignment_rec.soft_coding_keyflex_id:=
431     hr_transaction_api.get_number_value
432     (p_transaction_step_id => p_transaction_step_id
433     ,p_name                => 'P_SOFT_CODING_KEYFLEX_ID');
434 --
435 p_assignment_rec.title:=
436     hr_transaction_api.get_varchar2_value
437     (p_transaction_step_id => p_transaction_step_id
438     ,p_name                => 'P_TITLE');
439 --
440   p_assignment_rec.project_title:=
441     hr_transaction_api.get_varchar2_value
442     (p_transaction_step_id => p_transaction_step_id
443     ,p_name                => 'P_PROJECT_TITLE');
444 --
445   p_assignment_rec.source_type:=
446     hr_transaction_api.get_varchar2_value
447     (p_transaction_step_id => p_transaction_step_id
448     ,p_name                => 'P_SOURCE_TYPE');
449 --
450   p_assignment_rec.vendor_assignment_number:=
451     hr_transaction_api.get_varchar2_value
452     (p_transaction_step_id => p_transaction_step_id
453     ,p_name                => 'P_VENDOR_ASSIGNMENT_NUMBER');
454 --
455   p_assignment_rec.vendor_employee_number:=
456     hr_transaction_api.get_varchar2_value
457     (p_transaction_step_id => p_transaction_step_id
458     ,p_name                => 'P_VENDOR_EMPLOYEE_NUMBER');
459 --
460   p_assignment_rec.default_code_comb_id := to_char(
461     hr_transaction_api.get_number_value
462     (p_transaction_step_id => p_transaction_step_id
463     ,p_name                => 'P_DEFAULT_CODE_COMB_ID'));
464 --
465   p_assignment_rec.set_of_books_id := to_char(
466     hr_transaction_api.get_number_value
467     (p_transaction_step_id => p_transaction_step_id
468     ,p_name                => 'P_SET_OF_BOOKS_ID'));
469 --
470   p_assignment_rec.vendor_id := to_char(
471     hr_transaction_api.get_number_value
472     (p_transaction_step_id => p_transaction_step_id
473     ,p_name                => 'P_VENDOR_ID'));
474 --
475   p_assignment_rec.assignment_type:=
476     hr_transaction_api.get_varchar2_value
477     (p_transaction_step_id => p_transaction_step_id
478     ,p_name                => 'P_ASSIGNMENT_TYPE');
479 --
480   -- GSP change
481   p_assignment_rec.grade_ladder_pgm_id:=
482     hr_transaction_api.get_number_value
483     (p_transaction_step_id => p_transaction_step_id
484     ,p_name                => 'P_GRADE_LADDER_PGM_ID');
485   -- End of GSP change
486 
487   --p_assignment_rec.supervisor_assignment_id:=
488   --  hr_transaction_api.get_number_value
489   --  (p_transaction_step_id => p_transaction_step_id
490   --  ,p_name                => 'P_SUPERVISOR_ASSIGNMENT_ID');
491 --
492 
493   p_assignment_rec.po_header_id :=
494     hr_transaction_api.get_number_value
495     (p_transaction_step_id => p_transaction_step_id
496     ,p_name                => 'P_PO_HEADER_ID');
497 
498   p_assignment_rec.po_line_id :=
499     hr_transaction_api.get_number_value
500     (p_transaction_step_id => p_transaction_step_id
501     ,p_name                => 'P_PO_LINE_ID');
502 
503   p_assignment_rec.vendor_site_id :=
504     hr_transaction_api.get_number_value
505     (p_transaction_step_id => p_transaction_step_id
506     ,p_name                => 'P_VENDOR_SITE_ID');
507 
508 
509   p_assignment_rec.projected_assignment_end :=
510     hr_transaction_api.get_date_value
511     (p_transaction_step_id => p_transaction_step_id
512     ,p_name                => 'P_PROJ_ASGN_END');
513 
514 hr_utility.set_location('Exiting:'||l_proc, 15);
515 end get_asg_from_tt;
516 --
517 procedure get_assignment_from_tt
518 (p_item_type                in     varchar2
519 ,p_item_key                 in     varchar2
520 ,p_actid                    in     varchar2
521 ,p_transaction_step_id      in     varchar2
522 ,p_assignment_id             out nocopy varchar2
523 ,p_object_version_number     out nocopy varchar2
524 ,p_effective_date            out nocopy varchar2
525 ,p_grade_id                  out nocopy varchar2
526 ,p_position_id               out nocopy varchar2
527 ,p_job_id                    out nocopy varchar2
528 ,p_location_id               out nocopy varchar2
529 ,p_special_ceiling_step_id   out nocopy varchar2
530 ,p_organization_id           out nocopy varchar2
531 ,p_employment_category       out nocopy varchar2
532 ,p_supervisor_id             out nocopy varchar2
533 ,p_manager_flag              out nocopy varchar2
534 ,p_normal_hours              out nocopy varchar2
535 ,p_frequency                 out nocopy varchar2
536 ,p_time_normal_finish        out nocopy varchar2
537 ,p_time_normal_start         out nocopy varchar2
538 ,p_bargaining_unit_code      out nocopy varchar2
539 ,p_labour_union_member_flag  out nocopy varchar2
540 ,p_assignment_status_type_id out nocopy varchar2
541 ,p_change_reason             out nocopy varchar2
542 ,p_ass_attribute_category    out nocopy varchar2
543 ,p_ass_attribute1            out nocopy varchar2
544 ,p_ass_attribute2            out nocopy varchar2
545 ,p_ass_attribute3            out nocopy varchar2
546 ,p_ass_attribute4            out nocopy varchar2
547 ,p_ass_attribute5            out nocopy varchar2
548 ,p_ass_attribute6            out nocopy varchar2
549 ,p_ass_attribute7            out nocopy varchar2
550 ,p_ass_attribute8            out nocopy varchar2
551 ,p_ass_attribute9            out nocopy varchar2
552 ,p_ass_attribute10           out nocopy varchar2
553 ,p_ass_attribute11           out nocopy varchar2
554 ,p_ass_attribute12           out nocopy varchar2
555 ,p_ass_attribute13           out nocopy varchar2
556 ,p_ass_attribute14           out nocopy varchar2
557 ,p_ass_attribute15           out nocopy varchar2
558 ,p_ass_attribute16           out nocopy varchar2
559 ,p_ass_attribute17           out nocopy varchar2
560 ,p_ass_attribute18           out nocopy varchar2
561 ,p_ass_attribute19           out nocopy varchar2
562 ,p_ass_attribute20           out nocopy varchar2
563 ,p_ass_attribute21           out nocopy varchar2
564 ,p_ass_attribute22           out nocopy varchar2
565 ,p_ass_attribute23           out nocopy varchar2
566 ,p_ass_attribute24           out nocopy varchar2
567 ,p_ass_attribute25           out nocopy varchar2
568 ,p_ass_attribute26           out nocopy varchar2
569 ,p_ass_attribute27           out nocopy varchar2
570 ,p_ass_attribute28           out nocopy varchar2
571 ,p_ass_attribute29           out nocopy varchar2
572 ,p_ass_attribute30           out nocopy varchar2
573 ,p_soft_coding_keyflex_id    out nocopy varchar2
574 ,p_people_group_id           out nocopy varchar2
575 ,p_org_name                  out nocopy varchar2
576 ,p_job_name                  out nocopy varchar2
577 ,p_pos_name                  out nocopy varchar2
578 ,p_grade_name                out nocopy varchar2
579 ,p_contract_id               out nocopy varchar2
580 ,p_establishment_id          out nocopy varchar2
581 ,p_cagr_grade_def_id         out nocopy varchar2
582 ,p_collective_agreement_id   out nocopy varchar2
583 ,p_cagr_id_flex_num          out nocopy varchar2
584 ,p_payroll_id                out nocopy varchar2
585 ,p_pay_basis_id              out nocopy varchar2
586 ,p_sal_review_period         out nocopy varchar2
587 ,p_sal_review_period_frequency out nocopy varchar2
588 ,p_date_probation_end        out nocopy varchar2
589 ,p_probation_period          out nocopy varchar2
590 ,p_probation_unit            out nocopy varchar2
591 ,p_notice_period             out nocopy varchar2
592 ,p_notice_period_uom         out nocopy varchar2
593 ,p_employee_category         out nocopy varchar2
594 ,p_work_at_home              out nocopy varchar2
595 ,p_job_post_source_name      out nocopy varchar2
596 ,p_perf_review_period        out nocopy varchar2
597 ,p_perf_review_period_frequency out nocopy varchar2
598 ,p_internal_address_line     out nocopy varchar2
599 ,p_display_org               out nocopy varchar2
600 ,p_display_job               out nocopy varchar2
601 ,p_display_pos               out nocopy varchar2
602 ,p_display_grade             out nocopy varchar2
603 ,p_display_ass_status        out nocopy varchar2
604 ,p_business_group_id         out nocopy varchar2
605 ,p_title                     out nocopy varchar2
606 ,p_default_code_comb_id      out nocopy varchar2
607 ,p_set_of_books_id           out nocopy varchar2
608 ,p_source_type               out nocopy varchar2
609 ,p_project_title             out nocopy varchar2
610 ,p_vendor_assignment_number  out nocopy varchar2
611 ,p_vendor_employee_number    out nocopy varchar2
612 ,p_vendor_id                 out nocopy varchar2
613 ,p_assignment_type           out nocopy varchar2
614 ,p_grade_ladder_pgm_id       out nocopy varchar2
615 ,p_supervisor_assignment_id  out nocopy varchar2
616 ,p_vendor_name               out nocopy varchar2
617 ,p_po_header_id                 out nocopy varchar2
618 ,p_po_line_id                 out nocopy varchar2
619 ,p_vendor_site_id                 out nocopy varchar2
620 ,p_po_number                 out nocopy varchar2
621 ,p_po_line_number                 out nocopy varchar2
622 ,p_vendor_site_name                 out nocopy varchar2
623 ,p_projected_asgn_end        out nocopy date
624 
625 
626 )is
627 
628 cursor csr_org_name(p_id in number) is
629 select name
630 from hr_organization_units
631 where organization_id = p_id;
632 
633 cursor csr_job_name(p_id in number) is
634 select name
635 from per_jobs_vl
636 where job_id = p_id;
637 
638 cursor csr_pos_name(p_id in number) is
639 select name
640 from hr_positions_f
641 where position_id = p_id
642 and to_date(p_effective_date,g_date_format)
643 between effective_start_date
644 and effective_end_date;
645 
646 cursor csr_grade_name(p_id in number) is
647 select name
648 from per_grades_vl
649 where grade_id = p_id;
650 
651 cursor csr_vendor_name(p_id in number) is
652 select vendor_name
653 from po_vendors
654 where vendor_id = p_id;
655 
656 cursor csr_po_number(p_id in number) is
657 -- 4894113: R12 performance repository related fix
658 -- ISSUE : Shared memory size 2,413,494
659 -- RESOLUTION:
660 -- 1.Since we are interested only in  poh.segment1 we can
661 -- drop the rest of the columns and unwanted WHERE clauses from the
662 -- view po_temp_labor_headers_v
663 -- 2. The SQL below we have retained all the WHERE clauses
664 -- dealing with the table po_headers_all, but dropped the rest
665 -- which are not required in this case.
666 
667 SELECT poh.segment1 po_number
668 FROM
669     po_headers_all poh
670 WHERE
671     poh.po_header_id = p_id
672     AND poh.type_lookup_code = 'STANDARD'
673     AND poh.authorization_status IN ('APPROVED', 'PRE-APPROVED')
674     AND poh.approved_flag = 'Y'
675     AND poh.enabled_flag = 'Y'
676     AND NVL(poh.cancel_flag, 'N') <> 'Y'
677     AND NVL(poh.frozen_flag, 'N') <> 'Y'
678     AND poh.org_id IS NOT NULL
679     AND EXISTS
680     (
681     SELECT
682         NULL
683     FROM po_lines_all pol ,
684         po_line_types_b polt
685     WHERE pol.po_header_id = poh.po_header_id
686         AND NVL(pol.cancel_flag, 'N') <> 'Y'
687         AND pol.line_type_id = polt.line_type_id
688         AND polt.purchase_basis = 'TEMP LABOR'
689     );
690 
691 --select po_number
692 --from po_temp_labor_headers_v
693 --where po_header_id = p_id;
694 
695 cursor csr_po_line_number(p_id in number) is
696 select line_number
697 from po_temp_labor_lines_v
698 where po_line_id = p_id;
699 
700 cursor csr_vendor_site_name(p_id in number) is
701 select vendor_site_code
702 from po_vendor_sites_all
703 where vendor_site_id  = p_id;
704 
705   l_transaction_id       number;
706   l_transaction_step_id  number;
707   l_proc   varchar2(72)  := g_package||'get_assignment_from_tt';
708 
709 begin
710 
711 
712   hr_utility.set_location('Entering:'||l_proc, 5);
713   if p_transaction_step_id is null then
714 
715     hr_utility.set_location('if p_transaction_step_id is null then:'||l_proc,10);
716     hr_assignment_common_save_web.get_step
717           (p_item_type           => p_item_type
718           ,p_item_key            => p_item_key
719           ,p_api_name            => g_api_name
720           ,p_transaction_step_id => l_transaction_step_id
721           ,p_transaction_id      => l_transaction_id);
722   else
723     l_transaction_step_id := to_number(p_transaction_step_id);
724   end if;
725 
726   if l_transaction_step_id is null then
727   hr_utility.set_location('l_transaction_step_id is null thenExiting:'||l_proc, 15);
728     return;
729   end if;
730 --
731   p_assignment_id:= to_char(
732     hr_transaction_api.get_number_value
733     (p_transaction_step_id =>  l_transaction_step_id
734     ,p_name                => 'P_ASSIGNMENT_ID'));
735 --
736   p_business_group_id:= to_char(
737     hr_transaction_api.get_number_value
738     (p_transaction_step_id =>  l_transaction_step_id
739     ,p_name                => 'P_BUSINESS_GROUP_ID'));
740 --
741   p_effective_date:= to_char(
742     hr_transaction_api.get_date_value
743     (p_transaction_step_id => l_transaction_step_id
744     ,p_name                => 'P_EFFECTIVE_DATE')
745    ,g_date_format);
746 --
747   p_object_version_number := to_char(
748     hr_transaction_api.get_number_value
749     (p_transaction_step_id =>  l_transaction_step_id
750     ,p_name                => 'P_OBJECT_VERSION_NUMBER'));
751 --
752   p_organization_id := to_char(
753     hr_transaction_api.get_number_value
754     (p_transaction_step_id => l_transaction_step_id
755     ,p_name                => 'P_ORGANIZATION_ID'));
756 --
757   open csr_org_name(to_number(p_organization_id));
758   fetch csr_org_name into p_org_name;
759   close csr_org_name;
760 --
761   p_position_id := to_char(
762     hr_transaction_api.get_number_value
763     (p_transaction_step_id => l_transaction_step_id
764     ,p_name                => 'P_POSITION_ID'));
765 --
766   open csr_pos_name(to_number(p_position_id));
767   fetch csr_pos_name into p_pos_name;
768   close csr_pos_name;
769 --
770   p_job_id := to_char(
771     hr_transaction_api.get_number_value
772     (p_transaction_step_id => l_transaction_step_id
773     ,p_name                => 'P_JOB_ID'));
774 --
775   open csr_job_name(to_number(p_job_id));
776   fetch csr_job_name into p_job_name;
777   close csr_job_name;
778 --
779   p_grade_id := to_char(
780     hr_transaction_api.get_number_value
781     (p_transaction_step_id => l_transaction_step_id
782     ,p_name                => 'P_GRADE_ID'));
783 --
784   open csr_grade_name(to_number(p_grade_id));
785   fetch csr_grade_name into p_grade_name;
786   close csr_grade_name;
787 --
788   p_location_id := to_char(
789     hr_transaction_api.get_number_value
790     (p_transaction_step_id => l_transaction_step_id
791     ,p_name                => 'P_LOCATION_ID'));
792 --
793   p_employment_category :=
794     hr_transaction_api.get_varchar2_value
795     (p_transaction_step_id => l_transaction_step_id
796     ,p_name                => 'P_EMPLOYMENT_CATEGORY');
797 --
798   p_supervisor_id := to_char(
799     hr_transaction_api.get_number_value
800     (p_transaction_step_id => l_transaction_step_id
801     ,p_name                => 'P_SUPERVISOR_ID'));
802 --
803   p_manager_flag :=
804     hr_transaction_api.get_varchar2_value
805     (p_transaction_step_id => l_transaction_step_id
806     ,p_name                => 'P_MANAGER_FLAG');
807 --
808 
809   -- Fix for Bug 2943224 and 3205625 for number format/invalid number error
810   p_normal_hours := to_char(
811     hr_transaction_api.get_number_value
812     (p_transaction_step_id => l_transaction_step_id
813     ,p_name                => 'P_NORMAL_HOURS')
814      ,'9999999999999999999D999', 'NLS_NUMERIC_CHARACTERS = ''.,'''
815     );
816 --
817   p_frequency :=
818     hr_transaction_api.get_varchar2_value
819     (p_transaction_step_id => l_transaction_step_id
820     ,p_name                => 'P_FREQUENCY');
821 --
822   p_time_normal_finish :=
823     substr(hr_transaction_api.get_varchar2_value
824     (p_transaction_step_id => l_transaction_step_id
825     ,p_name                => 'P_TIME_NORMAL_FINISH'),0,5);
826 --
827   p_time_normal_start :=
828     substr(hr_transaction_api.get_varchar2_value
829     (p_transaction_step_id => l_transaction_step_id
830     ,p_name                => 'P_TIME_NORMAL_START'),0,5);
831 --
832   p_bargaining_unit_code :=
833     hr_transaction_api.get_varchar2_value
834     (p_transaction_step_id => l_transaction_step_id
835     ,p_name                => 'P_BARGAINING_UNIT_CODE');
836 --
837   p_labour_union_member_flag :=
838     hr_transaction_api.get_varchar2_value
839     (p_transaction_step_id => l_transaction_step_id
840     ,p_name                => 'P_LABOUR_UNION_MEMBER_FLAG');
841 --
842   p_special_ceiling_step_id := to_char(
843     hr_transaction_api.get_number_value
844     (p_transaction_step_id => l_transaction_step_id
845     ,p_name                => 'P_SPECIAL_CEILING_STEP_ID'));
846 --
847   p_assignment_status_type_id := to_char(
848     hr_transaction_api.get_number_value
849     (p_transaction_step_id => l_transaction_step_id
850     ,p_name                => 'P_ASSIGNMENT_STATUS_TYPE_ID'));
851 --
852   p_change_reason :=
853     hr_transaction_api.get_varchar2_value
854     (p_transaction_step_id => l_transaction_step_id
855     ,p_name                => 'P_CHANGE_REASON');
856 --
857   p_ass_attribute_category :=
858     hr_transaction_api.get_varchar2_value
859     (p_transaction_step_id => l_transaction_step_id
860     ,p_name                => 'P_ASS_ATTRIBUTE_CATEGORY');
861 --
862   p_ass_attribute1 :=
863     hr_transaction_api.get_varchar2_value
864     (p_transaction_step_id => l_transaction_step_id
865     ,p_name                => 'P_ASS_ATTRIBUTE1');
866 --
867   p_ass_attribute2 :=
868     hr_transaction_api.get_varchar2_value
869     (p_transaction_step_id => l_transaction_step_id
870     ,p_name                => 'P_ASS_ATTRIBUTE2');
871 --
872   p_ass_attribute3 :=
873     hr_transaction_api.get_varchar2_value
874     (p_transaction_step_id => l_transaction_step_id
875     ,p_name                => 'P_ASS_ATTRIBUTE3');
876 --
877   p_ass_attribute4 :=
878     hr_transaction_api.get_varchar2_value
879     (p_transaction_step_id => l_transaction_step_id
880     ,p_name                => 'P_ASS_ATTRIBUTE4');
881 --
882   p_ass_attribute5 :=
883     hr_transaction_api.get_varchar2_value
884     (p_transaction_step_id => l_transaction_step_id
885     ,p_name                => 'P_ASS_ATTRIBUTE5');
886 --
887   p_ass_attribute6 :=
888     hr_transaction_api.get_varchar2_value
889     (p_transaction_step_id => l_transaction_step_id
890     ,p_name                => 'P_ASS_ATTRIBUTE6');
891 --
892   p_ass_attribute7 :=
893     hr_transaction_api.get_varchar2_value
894     (p_transaction_step_id => l_transaction_step_id
895     ,p_name                => 'P_ASS_ATTRIBUTE7');
896 --
897   p_ass_attribute8 :=
898     hr_transaction_api.get_varchar2_value
899     (p_transaction_step_id => l_transaction_step_id
900     ,p_name                => 'P_ASS_ATTRIBUTE8');
901 --
902   p_ass_attribute9 :=
903     hr_transaction_api.get_varchar2_value
904     (p_transaction_step_id => l_transaction_step_id
905     ,p_name                => 'P_ASS_ATTRIBUTE9');
906 --
907   p_ass_attribute10 :=
908     hr_transaction_api.get_varchar2_value
909     (p_transaction_step_id => l_transaction_step_id
910     ,p_name                => 'P_ASS_ATTRIBUTE10');
911 --
912   p_ass_attribute11 :=
913     hr_transaction_api.get_varchar2_value
914     (p_transaction_step_id => l_transaction_step_id
915     ,p_name                => 'P_ASS_ATTRIBUTE11');
916 --
917   p_ass_attribute12 :=
918     hr_transaction_api.get_varchar2_value
919     (p_transaction_step_id => l_transaction_step_id
920     ,p_name                => 'P_ASS_ATTRIBUTE12');
921 --
922   p_ass_attribute13 :=
923     hr_transaction_api.get_varchar2_value
924     (p_transaction_step_id => l_transaction_step_id
925     ,p_name                => 'P_ASS_ATTRIBUTE13');
926 --
927   p_ass_attribute14 :=
928     hr_transaction_api.get_varchar2_value
929     (p_transaction_step_id => l_transaction_step_id
930     ,p_name                => 'P_ASS_ATTRIBUTE14');
931 --
932   p_ass_attribute15 :=
933     hr_transaction_api.get_varchar2_value
934     (p_transaction_step_id => l_transaction_step_id
935     ,p_name                => 'P_ASS_ATTRIBUTE15');
936 --
937   p_ass_attribute16 :=
938     hr_transaction_api.get_varchar2_value
939     (p_transaction_step_id => l_transaction_step_id
940     ,p_name                => 'P_ASS_ATTRIBUTE16');
941 --
942   p_ass_attribute17 :=
943     hr_transaction_api.get_varchar2_value
944     (p_transaction_step_id => l_transaction_step_id
945     ,p_name                => 'P_ASS_ATTRIBUTE17');
946 --
947   p_ass_attribute18 :=
948     hr_transaction_api.get_varchar2_value
949     (p_transaction_step_id => l_transaction_step_id
950     ,p_name                => 'P_ASS_ATTRIBUTE18');
951 --
952   p_ass_attribute19 :=
953     hr_transaction_api.get_varchar2_value
954     (p_transaction_step_id => l_transaction_step_id
955     ,p_name                => 'P_ASS_ATTRIBUTE19');
956 --
957   p_ass_attribute20 :=
958     hr_transaction_api.get_varchar2_value
959     (p_transaction_step_id => l_transaction_step_id
960     ,p_name                => 'P_ASS_ATTRIBUTE20');
961 --
962   p_ass_attribute21 :=
963     hr_transaction_api.get_varchar2_value
964     (p_transaction_step_id => l_transaction_step_id
965     ,p_name                => 'P_ASS_ATTRIBUTE21');
966 --
967   p_ass_attribute22 :=
968     hr_transaction_api.get_varchar2_value
969     (p_transaction_step_id => l_transaction_step_id
970     ,p_name                => 'P_ASS_ATTRIBUTE22');
971 --
972   p_ass_attribute23 :=
973     hr_transaction_api.get_varchar2_value
974     (p_transaction_step_id => l_transaction_step_id
975     ,p_name                => 'P_ASS_ATTRIBUTE23');
976 --
977   p_ass_attribute24 :=
978     hr_transaction_api.get_varchar2_value
979     (p_transaction_step_id => l_transaction_step_id
980     ,p_name                => 'P_ASS_ATTRIBUTE24');
981 --
982   p_ass_attribute25 :=
983     hr_transaction_api.get_varchar2_value
984     (p_transaction_step_id => l_transaction_step_id
985     ,p_name                => 'P_ASS_ATTRIBUTE25');
986 --
987   p_ass_attribute26 :=
988     hr_transaction_api.get_varchar2_value
989     (p_transaction_step_id => l_transaction_step_id
990     ,p_name                => 'P_ASS_ATTRIBUTE26');
991 --
992   p_ass_attribute27 :=
993     hr_transaction_api.get_varchar2_value
994     (p_transaction_step_id => l_transaction_step_id
995     ,p_name                => 'P_ASS_ATTRIBUTE27');
996 --
997   p_ass_attribute28 :=
998     hr_transaction_api.get_varchar2_value
999     (p_transaction_step_id => l_transaction_step_id
1000     ,p_name                => 'P_ASS_ATTRIBUTE28');
1001 --
1002   p_ass_attribute29 :=
1003     hr_transaction_api.get_varchar2_value
1004     (p_transaction_step_id => l_transaction_step_id
1005     ,p_name                => 'P_ASS_ATTRIBUTE29');
1006 --
1007   p_ass_attribute30 :=
1008     hr_transaction_api.get_varchar2_value
1009     (p_transaction_step_id => l_transaction_step_id
1010     ,p_name                => 'P_ASS_ATTRIBUTE30');
1011 
1012   p_people_group_id:=to_char(
1013     hr_transaction_api.get_number_value
1014     (p_transaction_step_id => l_transaction_step_id
1015     ,p_name                => 'P_PEOPLE_GROUP_ID'));
1016 --
1017   p_soft_coding_keyflex_id:= to_char(
1018     hr_transaction_api.get_number_value
1019     (p_transaction_step_id => l_transaction_step_id
1020     ,p_name                => 'P_SOFT_CODING_KEYFLEX_ID'));
1021 --
1022   p_sal_review_period:=
1023     hr_transaction_api.get_number_value
1024     (p_transaction_step_id => l_transaction_step_id
1025     ,p_name                => 'P_SAL_REVIEW_PERIOD');
1026 --
1027   p_sal_review_period_frequency:=
1028     hr_transaction_api.get_varchar2_value
1029     (p_transaction_step_id => l_transaction_step_id
1030     ,p_name                => 'P_SAL_REVIEW_PERIOD_FREQUENCY');
1031 --
1032   p_date_probation_end:= to_char(
1033     hr_transaction_api.get_date_value
1034     (p_transaction_step_id => l_transaction_step_id
1035     ,p_name                => 'P_DATE_PROBATION_END'), g_date_format);
1036 --
1037   p_probation_period:=
1038     hr_transaction_api.get_number_value
1039     (p_transaction_step_id => l_transaction_step_id
1040     ,p_name                => 'P_PROBATION_PERIOD');
1041 --
1042   p_probation_unit:=
1043     hr_transaction_api.get_varchar2_value
1044     (p_transaction_step_id => l_transaction_step_id
1045     ,p_name                => 'P_PROBATION_UNIT');
1046 --
1047   p_notice_period:=
1048     hr_transaction_api.get_number_value
1049     (p_transaction_step_id => l_transaction_step_id
1050     ,p_name                => 'P_NOTICE_PERIOD');
1051 --
1052   p_notice_period_uom:=
1053     hr_transaction_api.get_varchar2_value
1054     (p_transaction_step_id => l_transaction_step_id
1055     ,p_name                => 'P_NOTICE_PERIOD_UOM');
1056 --
1057   p_employee_category:=
1058     hr_transaction_api.get_varchar2_value
1059     (p_transaction_step_id => l_transaction_step_id
1060     ,p_name                => 'P_EMPLOYEE_CATEGORY');
1061 --
1062   p_work_at_home:=
1063     hr_transaction_api.get_varchar2_value
1064     (p_transaction_step_id => l_transaction_step_id
1065     ,p_name                => 'P_WORK_AT_HOME');
1066 --
1067   p_job_post_source_name:=
1068     hr_transaction_api.get_varchar2_value
1069     (p_transaction_step_id => l_transaction_step_id
1070     ,p_name                => 'P_JOB_POST_SOURCE_NAME');
1071 --
1072   p_perf_review_period:= to_char(
1073     hr_transaction_api.get_number_value
1074     (p_transaction_step_id => l_transaction_step_id
1075     ,p_name                => 'P_PERF_REVIEW_PERIOD'));
1076 --
1077   p_perf_review_period_frequency:=
1078     hr_transaction_api.get_varchar2_value
1079     (p_transaction_step_id => l_transaction_step_id
1080     ,p_name                => 'P_PERF_REVIEW_PERIOD_FREQUENCY');
1081 --
1082   p_internal_address_line:=
1083     hr_transaction_api.get_varchar2_value
1084     (p_transaction_step_id => l_transaction_step_id
1085     ,p_name                => 'P_INTERNAL_ADDRESS_LINE');
1086 --
1087   p_payroll_id:=
1088     to_char(hr_transaction_api.get_number_value
1089     (p_transaction_step_id => l_transaction_step_id
1090     ,p_name                => 'P_PAYROLL_ID'));
1091 --
1092   p_pay_basis_id:=
1093     to_char(hr_transaction_api.get_number_value
1094     (p_transaction_step_id => l_transaction_step_id
1095     ,p_name                => 'P_PAY_BASIS_ID'));
1096 --
1097   p_contract_id:=
1098     to_char(hr_transaction_api.get_number_value
1099     (p_transaction_step_id => l_transaction_step_id
1100     ,p_name                => 'P_CONTRACT_ID'));
1101 --
1102   p_establishment_id:=
1103     to_char(hr_transaction_api.get_number_value
1104     (p_transaction_step_id => l_transaction_step_id
1105     ,p_name                => 'P_ESTABLISHMENT_ID'));
1106 --
1107   p_cagr_grade_def_id:=
1108     to_char(hr_transaction_api.get_number_value
1109     (p_transaction_step_id => l_transaction_step_id
1110     ,p_name                => 'P_CAGR_GRADE_DEF_ID'));
1111 --
1112   p_collective_agreement_id:=
1113     to_char(hr_transaction_api.get_number_value
1114     (p_transaction_step_id => l_transaction_step_id
1115     ,p_name                => 'P_COLLECTIVE_AGREEMENT_ID'));
1116 --
1117   p_cagr_id_flex_num:=
1118     to_char(hr_transaction_api.get_number_value
1119     (p_transaction_step_id => l_transaction_step_id
1120     ,p_name                => 'P_CAGR_ID_FLEX_NUM'));
1121 --
1122   p_display_org:=
1123     hr_transaction_api.get_varchar2_value
1124     (p_transaction_step_id => l_transaction_step_id
1125     ,p_name                => 'P_DISPLAY_ORG');
1126 --
1127   p_display_job:=
1128     hr_transaction_api.get_varchar2_value
1129     (p_transaction_step_id => l_transaction_step_id
1130     ,p_name                => 'P_DISPLAY_JOB');
1131 --
1132   p_display_pos:=
1133     hr_transaction_api.get_varchar2_value
1134     (p_transaction_step_id => l_transaction_step_id
1135     ,p_name                => 'P_DISPLAY_POS');
1136 --
1137   p_display_grade:=
1138     hr_transaction_api.get_varchar2_value
1139     (p_transaction_step_id => l_transaction_step_id
1140     ,p_name                => 'P_DISPLAY_GRADE');
1141 --
1142   p_display_ass_status:=
1143     hr_transaction_api.get_varchar2_value
1144     (p_transaction_step_id => l_transaction_step_id
1145     ,p_name                => 'P_DISPLAY_ASS_STATUS');
1146 --
1147   p_title:=
1148     hr_transaction_api.get_varchar2_value
1149     (p_transaction_step_id => l_transaction_step_id
1150     ,p_name                => 'P_TITLE');
1151 --
1152   p_project_title:=
1153     hr_transaction_api.get_varchar2_value
1154     (p_transaction_step_id => l_transaction_step_id
1155     ,p_name                => 'P_PROJECT_TITLE');
1156 --
1157   p_source_type:=
1158     hr_transaction_api.get_varchar2_value
1159     (p_transaction_step_id => l_transaction_step_id
1160     ,p_name                => 'P_SOURCE_TYPE');
1161 --
1162   p_vendor_assignment_number:=
1163     hr_transaction_api.get_varchar2_value
1164     (p_transaction_step_id => l_transaction_step_id
1165     ,p_name                => 'P_VENDOR_ASSIGNMENT_NUMBER');
1166 --
1167   p_vendor_employee_number:=
1168     hr_transaction_api.get_varchar2_value
1169     (p_transaction_step_id => l_transaction_step_id
1170     ,p_name                => 'P_VENDOR_EMPLOYEE_NUMBER');
1171 --
1172   p_default_code_comb_id := to_char(
1173     hr_transaction_api.get_number_value
1174     (p_transaction_step_id => l_transaction_step_id
1175     ,p_name                => 'P_DEFAULT_CODE_COMB_ID'));
1176 --
1177   p_set_of_books_id := to_char(
1178     hr_transaction_api.get_number_value
1179     (p_transaction_step_id => l_transaction_step_id
1180     ,p_name                => 'P_SET_OF_BOOKS_ID'));
1181 --
1182   p_vendor_id := to_char(
1183     hr_transaction_api.get_number_value
1184     (p_transaction_step_id => l_transaction_step_id
1185     ,p_name                => 'P_VENDOR_ID'));
1186 --
1187   open csr_vendor_name(to_number(p_vendor_id));
1188   fetch csr_vendor_name into p_vendor_name;
1189   close csr_vendor_name;
1190 --
1191   p_po_header_id := to_char(
1192     hr_transaction_api.get_number_value
1193     (p_transaction_step_id => l_transaction_step_id
1194     ,p_name                => 'P_PO_HEADER_ID'));
1195 --
1196   open csr_po_number(to_number(p_po_header_id));
1197   fetch csr_po_number into p_po_number;
1198   close csr_po_number;
1199 
1200   p_po_line_id := to_char(
1201     hr_transaction_api.get_number_value
1202     (p_transaction_step_id => l_transaction_step_id
1203     ,p_name                => 'P_PO_LINE_ID'));
1204 --
1205   open csr_po_line_number(to_number(p_po_line_id));
1206   fetch csr_po_line_number into p_po_line_number;
1207   close csr_po_line_number;
1208 
1209   p_vendor_site_id := to_char(
1210     hr_transaction_api.get_number_value
1211     (p_transaction_step_id => l_transaction_step_id
1212     ,p_name                => 'P_VENDOR_SITE_ID'));
1213 --
1214   open csr_vendor_site_name(to_number(p_vendor_site_id));
1215   fetch csr_vendor_site_name into p_vendor_site_name;
1216   close csr_vendor_site_name;
1217 
1218   p_projected_asgn_end :=
1219     hr_transaction_api.get_date_value
1220     (p_transaction_step_id => l_transaction_step_id
1221     ,p_name                => 'P_PROJ_ASGN_END');
1222 
1223 --
1224 
1225   p_assignment_type:=
1226     hr_transaction_api.get_varchar2_value
1227     (p_transaction_step_id => l_transaction_step_id
1228     ,p_name                => 'P_ASSIGNMENT_TYPE');
1229 --
1230   -- GSP changes
1231   p_grade_ladder_pgm_id := to_char(
1232     hr_transaction_api.get_number_value
1233     (p_transaction_step_id => l_transaction_step_id
1234     ,p_name                => 'P_GRADE_LADDER_PGM_ID'));
1235   -- End of GSP changes
1236 
1237   --p_supervisor_assignment_id := to_char(
1238   --  hr_transaction_api.get_number_value
1239   --  (p_transaction_step_id => l_transaction_step_id
1240   --  ,p_name                => 'P_SUPERVISOR_ASSIGNMENT_ID'));
1241 --
1242 
1243 hr_utility.set_location('Exiting:'||l_proc, 20);
1244 end get_assignment_from_tt;
1245 
1246 procedure get_assignment_from_tt
1247 (p_transaction_step_id in     number
1248 ,p_assignment_id             out nocopy number
1249 ,p_object_version_number     out nocopy number
1250 ,p_effective_date            out nocopy varchar2
1251 ,p_grade_id                  out nocopy number
1252 ,p_position_id               out nocopy number
1253 ,p_job_id                    out nocopy number
1254 ,p_location_id               out nocopy number
1255 ,p_special_ceiling_step_id   out nocopy number
1256 ,p_organization_id           out nocopy number
1257 ,p_employment_category       out nocopy varchar2
1258 ,p_supervisor_id             out nocopy number
1259 ,p_manager_flag              out nocopy varchar2
1260 ,p_normal_hours              out nocopy number
1261 ,p_frequency                 out nocopy varchar2
1262 ,p_time_normal_finish        out nocopy varchar2
1263 ,p_time_normal_start         out nocopy varchar2
1264 ,p_bargaining_unit_code      out nocopy varchar2
1265 ,p_labour_union_member_flag  out nocopy varchar2
1266 ,p_assignment_status_type_id  out nocopy number
1267 ,p_change_reason             out nocopy varchar2
1268 ,p_ass_attribute_category    out nocopy varchar2
1269 ,p_ass_attribute1            out nocopy varchar2
1270 ,p_ass_attribute2            out nocopy varchar2
1271 ,p_ass_attribute3            out nocopy varchar2
1272 ,p_ass_attribute4            out nocopy varchar2
1273 ,p_ass_attribute5            out nocopy varchar2
1274 ,p_ass_attribute6            out nocopy varchar2
1275 ,p_ass_attribute7            out nocopy varchar2
1276 ,p_ass_attribute8            out nocopy varchar2
1277 ,p_ass_attribute9            out nocopy varchar2
1278 ,p_ass_attribute10           out nocopy varchar2
1279 ,p_ass_attribute11           out nocopy varchar2
1280 ,p_ass_attribute12           out nocopy varchar2
1281 ,p_ass_attribute13           out nocopy varchar2
1282 ,p_ass_attribute14           out nocopy varchar2
1283 ,p_ass_attribute15           out nocopy varchar2
1284 ,p_ass_attribute16           out nocopy varchar2
1285 ,p_ass_attribute17           out nocopy varchar2
1286 ,p_ass_attribute18           out nocopy varchar2
1287 ,p_ass_attribute19           out nocopy varchar2
1288 ,p_ass_attribute20           out nocopy varchar2
1289 ,p_ass_attribute21           out nocopy varchar2
1290 ,p_ass_attribute22           out nocopy varchar2
1291 ,p_ass_attribute23           out nocopy varchar2
1292 ,p_ass_attribute24           out nocopy varchar2
1293 ,p_ass_attribute25           out nocopy varchar2
1294 ,p_ass_attribute26           out nocopy varchar2
1295 ,p_ass_attribute27           out nocopy varchar2
1296 ,p_ass_attribute28           out nocopy varchar2
1297 ,p_ass_attribute29           out nocopy varchar2
1298 ,p_ass_attribute30           out nocopy varchar2
1299 ,p_soft_coding_keyflex_id    out nocopy number
1300 ,p_people_group_id           out nocopy number
1301 ,p_contract_id               out nocopy number
1302 ,p_establishment_id          out nocopy number
1303 ,p_cagr_grade_def_id         out nocopy number
1304 ,p_collective_agreement_id   out nocopy number
1305 ,p_cagr_id_flex_num          out nocopy number
1306 ,p_payroll_id                out nocopy number
1307 ,p_pay_basis_id              out nocopy number
1308 ,p_sal_review_period         out nocopy number
1309 ,p_sal_review_period_frequency out nocopy varchar2
1310 ,p_date_probation_end        out nocopy date
1311 ,p_probation_period          out nocopy number
1312 ,p_probation_unit            out nocopy varchar2
1313 ,p_notice_period             out nocopy number
1314 ,p_notice_period_uom         out nocopy varchar2
1315 ,p_employee_category         out nocopy varchar2
1316 ,p_work_at_home              out nocopy varchar2
1317 ,p_job_post_source_name      out nocopy varchar2
1318 ,p_perf_review_period        out nocopy number
1319 ,p_perf_review_period_frequency out nocopy varchar2
1320 ,p_internal_address_line     out nocopy varchar2
1321 ,p_display_org               out nocopy varchar2
1322 ,p_display_job               out nocopy varchar2
1323 ,p_display_pos               out nocopy varchar2
1324 ,p_display_grade             out nocopy varchar2
1325 ,p_display_ass_status        out nocopy varchar2
1326 ,p_business_group_id         out nocopy number
1327 ,p_title                     out nocopy varchar2
1328 ,p_default_code_comb_id      out nocopy number
1329 ,p_set_of_books_id           out nocopy number
1330 ,p_source_type               out nocopy varchar2
1331 ,p_project_title             out nocopy varchar2
1332 ,p_vendor_assignment_number  out nocopy varchar2
1333 ,p_vendor_employee_number    out nocopy varchar2
1334 ,p_vendor_id                 out nocopy number
1335 ,p_assignment_type           out nocopy varchar2
1336 ,p_grade_ladder_pgm_id       out nocopy number
1337 ,p_supervisor_assignment_id  out nocopy number
1338 ,p_po_header_id                 out nocopy number
1339 ,p_po_line_id                out nocopy number
1340 ,p_vendor_site_id                 out nocopy number
1341 ,p_projected_asgn_end        out nocopy date
1342 
1343 ) is
1344 l_proc   varchar2(72)  := g_package||'get_assignment_from_tt';
1345 
1346 begin
1347 --
1348   hr_utility.set_location('Entering:'||l_proc, 5);
1349   p_assignment_id:=
1350     hr_transaction_api.get_number_value
1351     (p_transaction_step_id =>  p_transaction_step_id
1352     ,p_name                => 'P_ASSIGNMENT_ID');
1353 --
1354   p_business_group_id:=
1355     hr_transaction_api.get_number_value
1356     (p_transaction_step_id =>  p_transaction_step_id
1357     ,p_name                => 'P_BUSINESS_GROUP_ID');
1358 --
1359   p_effective_date:=
1360     hr_transaction_api.get_date_value
1361     (p_transaction_step_id => p_transaction_step_id
1362     ,p_name                => 'P_EFFECTIVE_DATE');
1363 --
1364   p_object_version_number :=
1365     hr_transaction_api.get_number_value
1366     (p_transaction_step_id =>  p_transaction_step_id
1367     ,p_name                => 'P_OBJECT_VERSION_NUMBER');
1368 --
1369   p_position_id :=
1370     hr_transaction_api.get_number_value
1371     (p_transaction_step_id => p_transaction_step_id
1372     ,p_name                => 'P_POSITION_ID');
1373 --
1374   p_job_id :=
1375     hr_transaction_api.get_number_value
1376     (p_transaction_step_id => p_transaction_step_id
1377     ,p_name                => 'P_JOB_ID');
1378 --
1379   p_grade_id :=
1380     hr_transaction_api.get_number_value
1381     (p_transaction_step_id => p_transaction_step_id
1382     ,p_name                => 'P_GRADE_ID');
1383 --
1384   p_location_id :=
1385     hr_transaction_api.get_number_value
1386     (p_transaction_step_id => p_transaction_step_id
1387     ,p_name                => 'P_LOCATION_ID');
1388 --
1389   p_employment_category :=
1390     hr_transaction_api.get_varchar2_value
1391     (p_transaction_step_id => p_transaction_step_id
1392     ,p_name                => 'P_EMPLOYMENT_CATEGORY');
1393 --
1394   p_supervisor_id :=
1395     hr_transaction_api.get_number_value
1396     (p_transaction_step_id => p_transaction_step_id
1397     ,p_name                => 'P_SUPERVISOR_ID');
1398 --
1399   p_manager_flag :=
1400     hr_transaction_api.get_varchar2_value
1401     (p_transaction_step_id => p_transaction_step_id
1402     ,p_name                => 'P_MANAGER_FLAG');
1403 --
1404   p_normal_hours :=
1405     hr_transaction_api.get_number_value
1406     (p_transaction_step_id => p_transaction_step_id
1407     ,p_name                => 'P_NORMAL_HOURS');
1408 --
1409   p_frequency :=
1410     hr_transaction_api.get_varchar2_value
1411     (p_transaction_step_id => p_transaction_step_id
1412     ,p_name                => 'P_FREQUENCY');
1413 --
1414   p_time_normal_finish :=
1415     substr(hr_transaction_api.get_varchar2_value
1416     (p_transaction_step_id => p_transaction_step_id
1417     ,p_name                => 'P_TIME_NORMAL_FINISH'),0,5);
1418 --
1419   p_time_normal_start :=
1420     substr(hr_transaction_api.get_varchar2_value
1421     (p_transaction_step_id => p_transaction_step_id
1422     ,p_name                => 'P_TIME_NORMAL_START'),0,5);
1423 --
1424   p_bargaining_unit_code :=
1425     hr_transaction_api.get_varchar2_value
1426     (p_transaction_step_id => p_transaction_step_id
1427     ,p_name                => 'P_BARGAINING_UNIT_CODE');
1428 --
1429   p_labour_union_member_flag :=
1430     hr_transaction_api.get_varchar2_value
1431     (p_transaction_step_id => p_transaction_step_id
1432     ,p_name                => 'P_LABOUR_UNION_MEMBER_FLAG');
1433 --
1434   p_special_ceiling_step_id :=
1435     hr_transaction_api.get_number_value
1436     (p_transaction_step_id => p_transaction_step_id
1437     ,p_name                => 'P_SPECIAL_CEILING_STEP_ID');
1438 --
1439   p_assignment_status_type_id :=
1440     hr_transaction_api.get_number_value
1441     (p_transaction_step_id => p_transaction_step_id
1442     ,p_name                => 'P_ASSIGNMENT_STATUS_TYPE_ID');
1443 --
1444   p_change_reason :=
1445     hr_transaction_api.get_varchar2_value
1446     (p_transaction_step_id => p_transaction_step_id
1447     ,p_name                => 'P_CHANGE_REASON');
1448 --
1449   p_ass_attribute_category :=
1450     hr_transaction_api.get_varchar2_value
1451     (p_transaction_step_id => p_transaction_step_id
1452     ,p_name                => 'P_ASS_ATTRIBUTE_CATEGORY');
1453 --
1454   p_ass_attribute1 :=
1455     hr_transaction_api.get_varchar2_value
1456     (p_transaction_step_id => p_transaction_step_id
1457     ,p_name                => 'P_ASS_ATTRIBUTE1');
1458 --
1459   p_ass_attribute2 :=
1460     hr_transaction_api.get_varchar2_value
1461     (p_transaction_step_id => p_transaction_step_id
1462     ,p_name                => 'P_ASS_ATTRIBUTE2');
1463 --
1464   p_ass_attribute3 :=
1465     hr_transaction_api.get_varchar2_value
1466     (p_transaction_step_id => p_transaction_step_id
1467     ,p_name                => 'P_ASS_ATTRIBUTE3');
1468 --
1469   p_ass_attribute4 :=
1470     hr_transaction_api.get_varchar2_value
1471     (p_transaction_step_id => p_transaction_step_id
1472     ,p_name                => 'P_ASS_ATTRIBUTE4');
1473 --
1474   p_ass_attribute5 :=
1475     hr_transaction_api.get_varchar2_value
1476     (p_transaction_step_id => p_transaction_step_id
1477     ,p_name                => 'P_ASS_ATTRIBUTE5');
1478 --
1479   p_ass_attribute6 :=
1480     hr_transaction_api.get_varchar2_value
1481     (p_transaction_step_id => p_transaction_step_id
1482     ,p_name                => 'P_ASS_ATTRIBUTE6');
1483 --
1484   p_ass_attribute7 :=
1485     hr_transaction_api.get_varchar2_value
1486     (p_transaction_step_id => p_transaction_step_id
1487     ,p_name                => 'P_ASS_ATTRIBUTE7');
1488 --
1489   p_ass_attribute8 :=
1490     hr_transaction_api.get_varchar2_value
1491     (p_transaction_step_id => p_transaction_step_id
1492     ,p_name                => 'P_ASS_ATTRIBUTE8');
1493 --
1494   p_ass_attribute9 :=
1495     hr_transaction_api.get_varchar2_value
1496     (p_transaction_step_id => p_transaction_step_id
1497     ,p_name                => 'P_ASS_ATTRIBUTE9');
1498 --
1499   p_ass_attribute10 :=
1500     hr_transaction_api.get_varchar2_value
1501     (p_transaction_step_id => p_transaction_step_id
1502     ,p_name                => 'P_ASS_ATTRIBUTE10');
1503 --
1504   p_ass_attribute11 :=
1505     hr_transaction_api.get_varchar2_value
1506     (p_transaction_step_id => p_transaction_step_id
1507     ,p_name                => 'P_ASS_ATTRIBUTE11');
1508 --
1509   p_ass_attribute12 :=
1510     hr_transaction_api.get_varchar2_value
1511     (p_transaction_step_id => p_transaction_step_id
1512     ,p_name                => 'P_ASS_ATTRIBUTE12');
1513 --
1514   p_ass_attribute13 :=
1515     hr_transaction_api.get_varchar2_value
1516     (p_transaction_step_id => p_transaction_step_id
1517     ,p_name                => 'P_ASS_ATTRIBUTE13');
1518 --
1519   p_ass_attribute14 :=
1520     hr_transaction_api.get_varchar2_value
1521     (p_transaction_step_id => p_transaction_step_id
1522     ,p_name                => 'P_ASS_ATTRIBUTE14');
1523 --
1524   p_ass_attribute15 :=
1525     hr_transaction_api.get_varchar2_value
1526     (p_transaction_step_id => p_transaction_step_id
1527     ,p_name                => 'P_ASS_ATTRIBUTE15');
1528 --
1529   p_ass_attribute16 :=
1530     hr_transaction_api.get_varchar2_value
1531     (p_transaction_step_id => p_transaction_step_id
1532     ,p_name                => 'P_ASS_ATTRIBUTE16');
1533 --
1534   p_ass_attribute17 :=
1535     hr_transaction_api.get_varchar2_value
1536     (p_transaction_step_id => p_transaction_step_id
1537     ,p_name                => 'P_ASS_ATTRIBUTE17');
1538 --
1539   p_ass_attribute18 :=
1540     hr_transaction_api.get_varchar2_value
1541     (p_transaction_step_id => p_transaction_step_id
1542     ,p_name                => 'P_ASS_ATTRIBUTE18');
1543 --
1544   p_ass_attribute19 :=
1545     hr_transaction_api.get_varchar2_value
1546     (p_transaction_step_id => p_transaction_step_id
1547     ,p_name                => 'P_ASS_ATTRIBUTE19');
1548 --
1549   p_ass_attribute20 :=
1550     hr_transaction_api.get_varchar2_value
1551     (p_transaction_step_id => p_transaction_step_id
1552     ,p_name                => 'P_ASS_ATTRIBUTE20');
1553 --
1554   p_ass_attribute21 :=
1555     hr_transaction_api.get_varchar2_value
1556     (p_transaction_step_id => p_transaction_step_id
1557     ,p_name                => 'P_ASS_ATTRIBUTE21');
1558 --
1559   p_ass_attribute22 :=
1560     hr_transaction_api.get_varchar2_value
1561     (p_transaction_step_id => p_transaction_step_id
1562     ,p_name                => 'P_ASS_ATTRIBUTE22');
1563 --
1564   p_ass_attribute23 :=
1565     hr_transaction_api.get_varchar2_value
1566     (p_transaction_step_id => p_transaction_step_id
1567     ,p_name                => 'P_ASS_ATTRIBUTE23');
1568 --
1569   p_ass_attribute24 :=
1570     hr_transaction_api.get_varchar2_value
1571     (p_transaction_step_id => p_transaction_step_id
1572     ,p_name                => 'P_ASS_ATTRIBUTE24');
1573 --
1574   p_ass_attribute25 :=
1575     hr_transaction_api.get_varchar2_value
1576     (p_transaction_step_id => p_transaction_step_id
1577     ,p_name                => 'P_ASS_ATTRIBUTE25');
1578 --
1579   p_ass_attribute26 :=
1580     hr_transaction_api.get_varchar2_value
1581     (p_transaction_step_id => p_transaction_step_id
1582     ,p_name                => 'P_ASS_ATTRIBUTE26');
1583 --
1584   p_ass_attribute27 :=
1585     hr_transaction_api.get_varchar2_value
1586     (p_transaction_step_id => p_transaction_step_id
1587     ,p_name                => 'P_ASS_ATTRIBUTE27');
1588 --
1589   p_ass_attribute28 :=
1590     hr_transaction_api.get_varchar2_value
1591     (p_transaction_step_id => p_transaction_step_id
1592     ,p_name                => 'P_ASS_ATTRIBUTE28');
1593 --
1594   p_ass_attribute29 :=
1595     hr_transaction_api.get_varchar2_value
1596     (p_transaction_step_id => p_transaction_step_id
1597     ,p_name                => 'P_ASS_ATTRIBUTE29');
1598 --
1599   p_ass_attribute30 :=
1600     hr_transaction_api.get_varchar2_value
1601     (p_transaction_step_id => p_transaction_step_id
1602     ,p_name                => 'P_ASS_ATTRIBUTE30');
1603 
1604   p_people_group_id:=
1605     hr_transaction_api.get_number_value
1606     (p_transaction_step_id => p_transaction_step_id
1607     ,p_name                => 'P_PEOPLE_GROUP_ID');
1608 --
1609   p_soft_coding_keyflex_id:=
1610     hr_transaction_api.get_number_value
1611     (p_transaction_step_id => p_transaction_step_id
1612     ,p_name                => 'P_SOFT_CODING_KEYFLEX_ID');
1613 --
1614   p_sal_review_period:=
1615     hr_transaction_api.get_number_value
1616     (p_transaction_step_id => p_transaction_step_id
1617     ,p_name                => 'P_SAL_REVIEW_PERIOD');
1618 --
1619   p_sal_review_period_frequency:=
1620     hr_transaction_api.get_varchar2_value
1621     (p_transaction_step_id => p_transaction_step_id
1622     ,p_name                => 'P_SAL_REVIEW_PERIOD_FREQUENCY');
1623 --
1624   p_date_probation_end :=
1625     hr_transaction_api.get_date_value
1626     (p_transaction_step_id => p_transaction_step_id
1627     ,p_name                => 'P_DATE_PROBATION_END');
1628 --
1629   p_probation_period :=
1630     hr_transaction_api.get_number_value
1631     (p_transaction_step_id => p_transaction_step_id
1632     ,p_name                => 'P_PROBATION_PERIOD');
1633 --
1634   p_probation_unit :=
1635     hr_transaction_api.get_varchar2_value
1636     (p_transaction_step_id => p_transaction_step_id
1637     ,p_name                => 'P_PROBATION_UNIT');
1638 --
1639   p_notice_period :=
1640     hr_transaction_api.get_number_value
1641     (p_transaction_step_id => p_transaction_step_id
1642     ,p_name                => 'P_NOTICE_PERIOD');
1643 --
1644   p_notice_period_uom :=
1645     hr_transaction_api.get_varchar2_value
1646     (p_transaction_step_id => p_transaction_step_id
1647     ,p_name                => 'P_NOTICE_PERIOD_UOM');
1648 --
1649   p_employee_category :=
1650     hr_transaction_api.get_varchar2_value
1651     (p_transaction_step_id => p_transaction_step_id
1652     ,p_name                => 'P_EMPLOYEE_CATEGORY');
1653 --
1654   p_work_at_home :=
1655     hr_transaction_api.get_varchar2_value
1656     (p_transaction_step_id => p_transaction_step_id
1657     ,p_name                => 'P_WORK_AT_HOME');
1658 --
1659   p_job_post_source_name :=
1660     hr_transaction_api.get_varchar2_value
1661     (p_transaction_step_id => p_transaction_step_id
1662     ,p_name                => 'P_JOB_POST_SOURCE_NAME');
1663 --
1664   p_perf_review_period :=
1665     hr_transaction_api.get_number_value
1666     (p_transaction_step_id => p_transaction_step_id
1667     ,p_name                => 'P_PERF_REVIEW_PERIOD');
1668 --
1669   p_perf_review_period_frequency :=
1670     hr_transaction_api.get_varchar2_value
1671     (p_transaction_step_id => p_transaction_step_id
1672     ,p_name                => 'P_PERF_REVIEW_PERIOD_FREQUENCY');
1673 --
1674   p_internal_address_line :=
1675     hr_transaction_api.get_varchar2_value
1676     (p_transaction_step_id => p_transaction_step_id
1677     ,p_name                => 'P_INTERNAL_ADDRESS_LINE');
1678 --
1679   p_payroll_id:=
1680     hr_transaction_api.get_number_value
1681     (p_transaction_step_id => p_transaction_step_id
1682     ,p_name                => 'P_PAYROLL_ID');
1683 --
1684   p_pay_basis_id:=
1685     hr_transaction_api.get_number_value
1686     (p_transaction_step_id => p_transaction_step_id
1687     ,p_name                => 'P_PAY_BASIS_ID');
1688 --
1689   p_contract_id:=
1690     hr_transaction_api.get_number_value
1691     (p_transaction_step_id => p_transaction_step_id
1692     ,p_name                => 'P_CONTRACT_ID');
1693 --
1694   p_establishment_id:=
1695     hr_transaction_api.get_number_value
1696     (p_transaction_step_id => p_transaction_step_id
1697     ,p_name                => 'P_ESTABLISHMENT_ID');
1698 --
1699   p_cagr_grade_def_id:=
1700     hr_transaction_api.get_number_value
1701     (p_transaction_step_id => p_transaction_step_id
1702     ,p_name                => 'P_CAGR_GRADE_DEF_ID');
1703 --
1704   p_collective_agreement_id:=
1705     hr_transaction_api.get_number_value
1706     (p_transaction_step_id => p_transaction_step_id
1707     ,p_name                => 'P_COLLECTIVE_AGREEMENT_ID');
1708 --
1709   p_cagr_id_flex_num:=
1710     hr_transaction_api.get_number_value
1711     (p_transaction_step_id => p_transaction_step_id
1712     ,p_name                => 'P_CAGR_ID_FLEX_NUM');
1713 --
1714   p_display_org:=
1715     hr_transaction_api.get_varchar2_value
1716     (p_transaction_step_id => p_transaction_step_id
1717     ,p_name                => 'P_DISPLAY_ORG');
1718 --
1719   p_display_job:=
1720     hr_transaction_api.get_varchar2_value
1721     (p_transaction_step_id => p_transaction_step_id
1722     ,p_name                => 'P_DISPLAY_JOB');
1723 --
1724   p_display_pos:=
1725     hr_transaction_api.get_varchar2_value
1726     (p_transaction_step_id => p_transaction_step_id
1727     ,p_name                => 'P_DISPLAY_POS');
1728 --
1729   p_display_grade:=
1730     hr_transaction_api.get_varchar2_value
1731     (p_transaction_step_id => p_transaction_step_id
1732     ,p_name                => 'P_DISPLAY_GRADE');
1733 --
1734   p_display_ass_status:=
1735     hr_transaction_api.get_varchar2_value
1736     (p_transaction_step_id => p_transaction_step_id
1737     ,p_name                => 'P_DISPLAY_ASS_STATUS');
1738 --
1739 --
1740   p_title:=
1741     hr_transaction_api.get_varchar2_value
1742     (p_transaction_step_id => p_transaction_step_id
1743     ,p_name                => 'P_TITLE');
1744 --
1745   p_project_title:=
1746     hr_transaction_api.get_varchar2_value
1747     (p_transaction_step_id => p_transaction_step_id
1748     ,p_name                => 'P_PROJECT_TITLE');
1749 --
1750   p_source_type:=
1751     hr_transaction_api.get_varchar2_value
1752     (p_transaction_step_id => p_transaction_step_id
1753     ,p_name                => 'P_SOURCE_TYPE');
1754 --
1755   p_vendor_assignment_number:=
1756     hr_transaction_api.get_varchar2_value
1757     (p_transaction_step_id => p_transaction_step_id
1758     ,p_name                => 'P_VENDOR_ASSIGNMENT_NUMBER');
1759 --
1760   p_vendor_employee_number:=
1761     hr_transaction_api.get_varchar2_value
1762     (p_transaction_step_id => p_transaction_step_id
1763     ,p_name                => 'P_VENDOR_EMPLOYEE_NUMBER');
1764 --
1765   p_default_code_comb_id :=
1766     hr_transaction_api.get_number_value
1767     (p_transaction_step_id => p_transaction_step_id
1768     ,p_name                => 'P_DEFAULT_CODE_COMB_ID');
1769 --
1770   p_set_of_books_id :=
1771     hr_transaction_api.get_number_value
1772     (p_transaction_step_id => p_transaction_step_id
1773     ,p_name                => 'P_SET_OF_BOOKS_ID');
1774 --
1775   p_vendor_id :=
1776     hr_transaction_api.get_number_value
1777     (p_transaction_step_id => p_transaction_step_id
1778     ,p_name                => 'P_VENDOR_ID');
1779 --
1780   p_po_header_id :=
1781     hr_transaction_api.get_number_value
1782     (p_transaction_step_id => p_transaction_step_id
1783     ,p_name                => 'P_PO_HEADER_ID');
1784 --
1785   p_po_line_id :=
1786     hr_transaction_api.get_number_value
1787     (p_transaction_step_id => p_transaction_step_id
1788     ,p_name                => 'P_PO_LINE_ID');
1789 --
1790   p_vendor_site_id :=
1791     hr_transaction_api.get_number_value
1792     (p_transaction_step_id => p_transaction_step_id
1793     ,p_name                => 'P_VENDOR_SITE_ID');
1794 --
1795 
1796   p_assignment_type:=
1797     hr_transaction_api.get_varchar2_value
1798     (p_transaction_step_id => p_transaction_step_id
1799     ,p_name                => 'P_ASSIGNMENT_TYPE');
1800 --
1801   -- GSP changes
1802   p_grade_ladder_pgm_id :=
1803     hr_transaction_api.get_number_value
1804     (p_transaction_step_id => p_transaction_step_id
1805     ,p_name                => 'P_GRADE_LADDER_PGM_ID');
1806 
1807  -- End of GSP changes
1808 
1809 --
1810   -- p_supervisor_assignment_id :=
1811   --  hr_transaction_api.get_number_value
1812   --  (p_transaction_step_id => p_transaction_step_id
1813   --  ,p_name                => 'P_SUPERVISOR_ASSIGNMENT_ID');
1814 --
1815 
1816   p_projected_asgn_end :=
1817     hr_transaction_api.get_date_value
1818     (p_transaction_step_id => p_transaction_step_id
1819     ,p_name                => 'P_PROJ_ASGN_END');
1820 
1821 hr_utility.set_location('Exiting:'||l_proc, 15);
1822 end get_assignment_from_tt;
1823 
1824 procedure process_save
1825 (p_save_mode                in     varchar2  default null
1826 ,p_item_type                in     varchar2
1827 ,p_item_key                 in     varchar2
1828 ,p_actid                    in     varchar2
1829 ,p_login_person_id          in     varchar2 default null
1830 ,p_assignment_id            in     varchar2
1831 ,p_object_version_number    in     varchar2
1832 ,p_effective_date           in     varchar2
1833 ,p_grade_id                 in     varchar2   default to_char(hr_api.g_number)
1834 ,p_position_id              in     varchar2   default to_char(hr_api.g_number)
1835 ,p_job_id                   in     varchar2   default to_char(hr_api.g_number)
1836 ,p_location_id              in     varchar2   default to_char(hr_api.g_number)
1837 ,p_special_ceiling_step_id  in     varchar2   default to_char(hr_api.g_number)
1838 ,p_organization_id          in     varchar2   default to_char(hr_api.g_number)
1839 ,p_employment_category      in     varchar2 default hr_api.g_varchar2
1840 ,p_supervisor_id            in     varchar2   default to_char(hr_api.g_number)
1841 ,p_manager_flag             in     varchar2 default hr_api.g_varchar2
1842 ,p_normal_hours             in     varchar2   default to_char(hr_api.g_number)
1843 ,p_frequency                in     varchar2 default hr_api.g_varchar2
1844 ,p_time_normal_finish       in     varchar2 default hr_api.g_varchar2
1845 ,p_time_normal_start        in     varchar2 default hr_api.g_varchar2
1846 ,p_bargaining_unit_code         in     varchar2 default hr_api.g_varchar2
1847 ,p_labour_union_member_flag     in     varchar2 default hr_api.g_varchar2
1848 ,p_assignment_status_type_id in    varchar2   default to_char(hr_api.g_number)
1849 ,p_change_reason            in     varchar2 default hr_api.g_varchar2
1850 ,p_ass_attribute_category   in     varchar2 default hr_api.g_varchar2
1851 ,p_ass_attribute1           in     varchar2 default hr_api.g_varchar2
1852 ,p_ass_attribute2           in     varchar2 default hr_api.g_varchar2
1853 ,p_ass_attribute3           in     varchar2 default hr_api.g_varchar2
1854 ,p_ass_attribute4           in     varchar2 default hr_api.g_varchar2
1855 ,p_ass_attribute5           in     varchar2 default hr_api.g_varchar2
1856 ,p_ass_attribute6           in     varchar2 default hr_api.g_varchar2
1857 ,p_ass_attribute7           in     varchar2 default hr_api.g_varchar2
1858 ,p_ass_attribute8           in     varchar2 default hr_api.g_varchar2
1859 ,p_ass_attribute9           in     varchar2 default hr_api.g_varchar2
1860 ,p_ass_attribute10          in     varchar2 default hr_api.g_varchar2
1861 ,p_ass_attribute11          in     varchar2 default hr_api.g_varchar2
1862 ,p_ass_attribute12          in     varchar2 default hr_api.g_varchar2
1863 ,p_ass_attribute13          in     varchar2 default hr_api.g_varchar2
1864 ,p_ass_attribute14          in     varchar2 default hr_api.g_varchar2
1865 ,p_ass_attribute15          in     varchar2 default hr_api.g_varchar2
1866 ,p_ass_attribute16          in     varchar2 default hr_api.g_varchar2
1867 ,p_ass_attribute17          in     varchar2 default hr_api.g_varchar2
1868 ,p_ass_attribute18          in     varchar2 default hr_api.g_varchar2
1869 ,p_ass_attribute19          in     varchar2 default hr_api.g_varchar2
1870 ,p_ass_attribute20          in     varchar2 default hr_api.g_varchar2
1871 ,p_ass_attribute21          in     varchar2 default hr_api.g_varchar2
1872 ,p_ass_attribute22          in     varchar2 default hr_api.g_varchar2
1873 ,p_ass_attribute23          in     varchar2 default hr_api.g_varchar2
1874 ,p_ass_attribute24          in     varchar2 default hr_api.g_varchar2
1875 ,p_ass_attribute25          in     varchar2 default hr_api.g_varchar2
1876 ,p_ass_attribute26          in     varchar2 default hr_api.g_varchar2
1877 ,p_ass_attribute27          in     varchar2 default hr_api.g_varchar2
1878 ,p_ass_attribute28          in     varchar2 default hr_api.g_varchar2
1879 ,p_ass_attribute29          in     varchar2 default hr_api.g_varchar2
1880 ,p_ass_attribute30          in     varchar2 default hr_api.g_varchar2
1881 ,p_soft_coding_keyflex_id   in     varchar2 default to_char(hr_api.g_number)
1882 ,p_people_group_id          in     varchar2 default to_char(hr_api.g_number)
1883 ,p_hrs_last_date            in     varchar2 default hr_api.g_varchar2
1884 ,p_display_pos              in     varchar2 default hr_api.g_varchar2
1885 ,p_display_org              in     varchar2 default hr_api.g_varchar2
1886 ,p_display_job              in     varchar2 default hr_api.g_varchar2
1887 ,p_display_ass_status       in     varchar2 default hr_api.g_varchar2
1888 ,p_grade_lov                in     varchar2 default hr_api.g_varchar2
1889 ,p_approver_id              in     varchar2   default to_char(hr_api.g_number)
1890 ,p_review_proc_call         in     varchar2
1891 ,p_display_grade            in     varchar2 default hr_api.g_varchar2
1892 ,p_contract_id                  in     varchar2 default to_char(hr_api.g_number)
1893 ,p_establishment_id         in     varchar2 default to_char(hr_api.g_number)
1894 ,p_cagr_grade_def_id        in     varchar2 default to_char(hr_api.g_number)
1895 ,p_collective_agreement_id      in     varchar2 default to_char(hr_api.g_number)
1896 ,p_cagr_id_flex_num             in     varchar2 default to_char(hr_api.g_number)
1897 ,p_payroll_id           in     varchar2   default to_char(hr_api.g_number)
1898 ,p_pay_basis_id         in     varchar2   default to_char(hr_api.g_number)
1899 ,p_sal_review_period    in     varchar2   default to_char(hr_api.g_number)
1900 ,p_sal_review_period_frequency  in     varchar2 default hr_api.g_varchar2
1901 ,p_date_probation_end       in varchar2 default to_char(hr_api.g_date,g_date_format)
1902 ,p_probation_period         in varchar2 default to_char(hr_api.g_number)
1903 ,p_probation_unit           in varchar2 default hr_api.g_varchar2
1904 ,p_notice_period             in varchar2 default to_char(hr_api.g_number)
1905 ,p_notice_period_uom        in varchar2 default hr_api.g_varchar2
1906 ,p_employee_category        in varchar2 default hr_api.g_varchar2
1907 ,p_work_at_home             in varchar2 default hr_api.g_varchar2
1908 ,p_job_post_source_name     in varchar2 default hr_api.g_varchar2
1909 ,p_perf_review_period       in varchar2 default to_char(hr_api.g_number)
1910 ,p_perf_review_period_frequency in varchar2 default hr_api.g_varchar2
1911 ,p_internal_address_line    in varchar2 default hr_api.g_varchar2
1912 ,p_element_changed          in out nocopy varchar2
1913 ,p_page_error               in out nocopy varchar2
1914 ,p_page_error_msg           in out nocopy varchar2
1915 ,p_page_warning             in out nocopy varchar2
1916 ,p_page_warning_msg         in out nocopy varchar2
1917 ,p_organization_error       in out nocopy varchar2
1918 ,p_organization_error_msg   in out nocopy varchar2
1919 ,p_job_error                in out nocopy varchar2
1920 ,p_job_error_msg            in out nocopy varchar2
1921 ,p_position_error           in out nocopy varchar2
1922 ,p_position_error_msg       in out nocopy varchar2
1923 ,p_grade_error              in out nocopy varchar2
1924 ,p_grade_error_msg          in out nocopy varchar2
1925 ,p_supervisor_error         in out nocopy varchar2
1926 ,p_supervisor_error_msg     in out nocopy varchar2
1927 ,p_location_error           in out nocopy varchar2
1928 ,p_location_error_msg       in out nocopy varchar2
1929 ,p_transaction_step_id      in out nocopy varchar2
1930 ,p_flow_mode                in     varchar2 default null
1931 ,p_rptg_grp_id              in     varchar2 default null
1932 ,p_plan_id                  in     varchar2 default null
1933 ,p_effective_date_option    in     varchar2 default null
1934 ,p_title                    in varchar2 default hr_api.g_varchar2
1935 ,p_default_code_comb_id     in varchar2 default to_char(hr_api.g_number)
1936 ,p_set_of_books_id          in varchar2 default to_char(hr_api.g_number)
1937 ,p_source_type              in varchar2 default hr_api.g_varchar2
1938 ,p_project_title            in varchar2 default hr_api.g_varchar2
1939 ,p_vendor_assignment_number in varchar2 default hr_api.g_varchar2
1940 ,p_vendor_employee_number   in varchar2 default hr_api.g_varchar2
1941 ,p_vendor_id                in varchar2 default to_char(hr_api.g_number)
1942 ,p_assignment_type          in varchar2 default hr_api.g_varchar2
1943 ,p_grade_ladder_pgm_id      in varchar2 default to_char(hr_api.g_number)
1944 ,p_supervisor_assignment_id in varchar2 default to_char(hr_api.g_number)
1945 -- GSP changes
1946 ,p_salary_change_warning    in out nocopy varchar2
1947 ,p_gsp_post_process_warning out nocopy varchar2
1948 ,p_gsp_salary_effective_date out nocopy date
1949 -- End of GSP changes
1950 ,p_po_header_id             in varchar2 default to_char(hr_api.g_number)
1951 ,p_po_line_id             in varchar2 default to_char(hr_api.g_number)
1952 ,p_vendor_site_id             in varchar2 default to_char(hr_api.g_number)
1953 ,p_projected_asgn_end in date  default g_canonical_date
1954 ) is
1955 l_proc   varchar2(72)  := g_package||'process_save';
1956 begin
1957 
1958   hr_utility.set_location('Entering:'||l_proc, 5);
1959   process_save
1960     (p_save_mode => p_save_mode
1961     ,p_item_type => p_item_type
1962     ,p_item_key => p_item_key
1963     ,p_actid => to_number(p_actid)
1964     ,p_login_person_id => to_number(p_login_person_id)
1965     ,p_assignment_id => to_number(p_assignment_id)
1966     ,p_object_version_number => to_number(p_object_version_number)
1967     ,p_effective_date => p_effective_date
1968     ,p_grade_id => to_number(p_grade_id)
1969     ,p_position_id => to_number(p_position_id)
1970     ,p_job_id  => to_number(p_job_id)
1971     ,p_location_id => to_number(p_location_id)
1972     ,p_special_ceiling_step_id => to_number(p_special_ceiling_step_id)
1973     ,p_organization_id => to_number(p_organization_id)
1974     ,p_employment_category => p_employment_category
1975     ,p_supervisor_id => to_number(p_supervisor_id)
1976     ,p_manager_flag => p_manager_flag
1977     -- Fix for Bug 2943224 for number format which
1978     -- is always in fixed decimal format
1979     ,p_normal_hours => to_number(p_normal_hours,'9999999999999999999D999',
1980                                    'NLS_NUMERIC_CHARACTERS = ''.,''')
1981     ,p_frequency => p_frequency
1982     ,p_time_normal_finish => p_time_normal_finish
1983     ,p_time_normal_start => p_time_normal_start
1984     ,p_bargaining_unit_code => p_bargaining_unit_code
1985     ,p_labour_union_member_flag => p_labour_union_member_flag
1986     ,p_assignment_status_type_id => to_number(p_assignment_status_type_id)
1987     ,p_change_reason => p_change_reason
1988     ,p_ass_attribute_category => p_ass_attribute_category
1989     ,p_ass_attribute1 => p_ass_attribute1
1990     ,p_ass_attribute2 => p_ass_attribute2
1991     ,p_ass_attribute3 => p_ass_attribute3
1992     ,p_ass_attribute4 => p_ass_attribute4
1993     ,p_ass_attribute5 => p_ass_attribute5
1994     ,p_ass_attribute6 => p_ass_attribute6
1995     ,p_ass_attribute7 => p_ass_attribute7
1996     ,p_ass_attribute8 => p_ass_attribute8
1997     ,p_ass_attribute9 => p_ass_attribute9
1998     ,p_ass_attribute10 => p_ass_attribute10
1999     ,p_ass_attribute11 => p_ass_attribute11
2000     ,p_ass_attribute12 => p_ass_attribute12
2001     ,p_ass_attribute13 => p_ass_attribute13
2002     ,p_ass_attribute14 => p_ass_attribute14
2003     ,p_ass_attribute15 => p_ass_attribute15
2004     ,p_ass_attribute16 => p_ass_attribute16
2005     ,p_ass_attribute17 => p_ass_attribute17
2006     ,p_ass_attribute18 => p_ass_attribute18
2007     ,p_ass_attribute19 => p_ass_attribute19
2008     ,p_ass_attribute20 => p_ass_attribute20
2009     ,p_ass_attribute21 => p_ass_attribute21
2010     ,p_ass_attribute22 => p_ass_attribute22
2011     ,p_ass_attribute23 => p_ass_attribute23
2012     ,p_ass_attribute24 => p_ass_attribute24
2013     ,p_ass_attribute25 => p_ass_attribute25
2014     ,p_ass_attribute26 => p_ass_attribute26
2015     ,p_ass_attribute27 => p_ass_attribute27
2016     ,p_ass_attribute28 => p_ass_attribute28
2017     ,p_ass_attribute29 => p_ass_attribute29
2018     ,p_ass_attribute30 => p_ass_attribute30
2019     ,p_soft_coding_keyflex_id => to_number(p_soft_coding_keyflex_id)
2020     ,p_people_group_id => to_number(p_people_group_id)
2021     ,p_hrs_last_date => p_hrs_last_date
2022     ,p_display_pos => p_display_pos
2023     ,p_display_org => p_display_org
2024     ,p_display_job => p_display_job
2025     ,p_display_ass_status => p_display_ass_status
2026     ,p_grade_lov => p_grade_lov
2027     ,p_approver_id => to_number(p_approver_id)
2028     ,p_review_proc_call => p_review_proc_call
2029     ,p_element_changed => p_element_changed
2030     ,p_display_grade => p_display_grade
2031     ,p_contract_id => to_number(p_contract_id)
2032     ,p_establishment_id => to_number(p_establishment_id)
2033     ,p_cagr_grade_def_id => to_number(p_cagr_grade_def_id)
2034     ,p_collective_agreement_id => to_number(p_collective_agreement_id)
2035     ,p_cagr_id_flex_num => to_number(p_cagr_id_flex_num)
2036     ,p_payroll_id => to_number(p_payroll_id)
2037     ,p_pay_basis_id => to_number(p_pay_basis_id)
2038     ,p_sal_review_period => to_number(p_sal_review_period)
2039     ,p_sal_review_period_frequency => p_sal_review_period_frequency
2040     ,p_date_probation_end => to_date(p_date_probation_end,g_date_format)
2041     ,p_probation_period => to_number(p_probation_period)
2042     ,p_probation_unit => p_probation_unit
2043     ,p_notice_period => to_number(p_notice_period)
2044     ,p_notice_period_uom => p_notice_period_uom
2045     ,p_employee_category => p_employee_category
2046     ,p_work_at_home => p_work_at_home
2047     ,p_job_post_source_name => p_job_post_source_name
2048     ,p_perf_review_period => to_number(p_perf_review_period)
2049     ,p_perf_review_period_frequency => p_perf_review_period_frequency
2050     ,p_internal_address_line => p_internal_address_line
2051     ,p_page_error => p_page_error
2052     ,p_page_error_msg => p_page_error_msg
2053     ,p_page_warning => p_page_warning
2054     ,p_page_warning_msg => p_page_warning_msg
2055     ,p_organization_error => p_organization_error
2056     ,p_organization_error_msg => p_organization_error_msg
2057     ,p_job_error => p_job_error
2058     ,p_job_error_msg => p_job_error_msg
2059     ,p_position_error => p_position_error
2060     ,p_position_error_msg => p_position_error_msg
2061     ,p_grade_error => p_grade_error
2062     ,p_grade_error_msg => p_grade_error_msg
2063     ,p_supervisor_error => p_supervisor_error
2064     ,p_supervisor_error_msg => p_supervisor_error_msg
2065     ,p_location_error => p_location_error
2066     ,p_location_error_msg => p_location_error_msg
2067     ,p_transaction_step_id => p_transaction_step_id
2068     ,p_flow_mode=>p_flow_mode
2069     ,p_rptg_grp_id           => p_rptg_grp_id
2070     ,p_plan_id                 => p_plan_id
2071     ,p_effective_date_option => p_effective_date_option
2072     ,p_title                  => p_title
2073     ,p_default_code_comb_id   => to_number(p_default_code_comb_id)
2074     ,p_set_of_books_id        => to_number(p_set_of_books_id)
2075     ,p_source_type            => p_source_type
2076     ,p_project_title          => p_project_title
2077     ,p_vendor_assignment_number => p_vendor_assignment_number
2078     ,p_vendor_employee_number   => p_vendor_employee_number
2079     ,p_vendor_id                => to_number(p_vendor_id)
2080     ,p_assignment_type          => p_assignment_type
2081     ,p_grade_ladder_pgm_id      => to_number(p_grade_ladder_pgm_id)
2082     ,p_supervisor_assignment_id => to_number(p_supervisor_assignment_id)
2083     -- GSP change
2084     ,p_salary_change_warning => p_salary_change_warning
2085     ,p_gsp_post_process_warning => p_gsp_post_process_warning
2086     ,p_gsp_salary_effective_date => p_gsp_salary_effective_date
2087     -- GSP change
2088     ,p_po_header_id => to_number(p_po_header_id)
2089     ,p_po_line_id => to_number(p_po_line_id)
2090     ,p_vendor_site_id => to_number(p_vendor_site_id)
2091     ,p_proj_asgn_end => p_projected_asgn_end
2092 
2093     );
2094     hr_utility.set_location('Exiting:'||l_proc, 15);
2095 
2096 end process_save;
2097 
2098 -- This code is for applying several workflow steps of assignment data in
2099 -- one step in the database. The first time that this is called in a process, a
2100 -- new transaction step is created and all of the data are written to the
2101 -- transaction tables. When a subsequent step in the process starts, it reads
2102 -- the previous data from the previous transaction step, and overwrites only
2103 -- the fields which it supplies so that all of the data from all of the steps
2104 -- is  validated together, and then it is saved together
2105 --
2106 procedure process_save
2107 (p_save_mode                in     varchar2  default null
2108 ,p_item_type                in     wf_items.item_type%TYPE
2109 ,p_item_key                 in     wf_items.item_key%TYPE
2110 ,p_actid                    in wf_activity_attr_values.process_activity_id%type
2111 ,p_login_person_id          in     number
2112 ,p_assignment_id            in     number
2113 ,p_object_version_number    in     number
2114 ,p_effective_date           in     varchar2
2115 ,p_grade_id                 in     number   default hr_api.g_number
2116 ,p_position_id              in     number   default hr_api.g_number
2117 ,p_job_id                   in     number   default hr_api.g_number
2118 ,p_location_id              in     number   default hr_api.g_number
2119 ,p_special_ceiling_step_id  in     number   default hr_api.g_number
2120 ,p_organization_id          in     number   default hr_api.g_number
2121 ,p_employment_category      in     varchar2 default hr_api.g_varchar2
2122 ,p_supervisor_id            in     number   default hr_api.g_number
2123 ,p_manager_flag             in     varchar2 default hr_api.g_varchar2
2124 ,p_normal_hours             in     number   default hr_api.g_number
2125 ,p_frequency                in     varchar2 default hr_api.g_varchar2
2126 ,p_time_normal_finish       in     varchar2 default hr_api.g_varchar2
2127 ,p_time_normal_start        in     varchar2 default hr_api.g_varchar2
2128 ,p_bargaining_unit_code         in     varchar2 default hr_api.g_varchar2
2129 ,p_labour_union_member_flag     in     varchar2 default hr_api.g_varchar2
2130 ,p_assignment_status_type_id in    number   default hr_api.g_number
2131 ,p_change_reason            in     varchar2 default hr_api.g_varchar2
2132 ,p_ass_attribute_category   in     varchar2 default hr_api.g_varchar2
2133 ,p_ass_attribute1           in     varchar2 default hr_api.g_varchar2
2134 ,p_ass_attribute2           in     varchar2 default hr_api.g_varchar2
2135 ,p_ass_attribute3           in     varchar2 default hr_api.g_varchar2
2136 ,p_ass_attribute4           in     varchar2 default hr_api.g_varchar2
2137 ,p_ass_attribute5           in     varchar2 default hr_api.g_varchar2
2138 ,p_ass_attribute6           in     varchar2 default hr_api.g_varchar2
2139 ,p_ass_attribute7           in     varchar2 default hr_api.g_varchar2
2140 ,p_ass_attribute8           in     varchar2 default hr_api.g_varchar2
2141 ,p_ass_attribute9           in     varchar2 default hr_api.g_varchar2
2142 ,p_ass_attribute10          in     varchar2 default hr_api.g_varchar2
2143 ,p_ass_attribute11          in     varchar2 default hr_api.g_varchar2
2144 ,p_ass_attribute12          in     varchar2 default hr_api.g_varchar2
2145 ,p_ass_attribute13          in     varchar2 default hr_api.g_varchar2
2146 ,p_ass_attribute14          in     varchar2 default hr_api.g_varchar2
2147 ,p_ass_attribute15          in     varchar2 default hr_api.g_varchar2
2148 ,p_ass_attribute16          in     varchar2 default hr_api.g_varchar2
2149 ,p_ass_attribute17          in     varchar2 default hr_api.g_varchar2
2150 ,p_ass_attribute18          in     varchar2 default hr_api.g_varchar2
2151 ,p_ass_attribute19          in     varchar2 default hr_api.g_varchar2
2152 ,p_ass_attribute20          in     varchar2 default hr_api.g_varchar2
2153 ,p_ass_attribute21          in     varchar2 default hr_api.g_varchar2
2154 ,p_ass_attribute22          in     varchar2 default hr_api.g_varchar2
2155 ,p_ass_attribute23          in     varchar2 default hr_api.g_varchar2
2156 ,p_ass_attribute24          in     varchar2 default hr_api.g_varchar2
2157 ,p_ass_attribute25          in     varchar2 default hr_api.g_varchar2
2158 ,p_ass_attribute26          in     varchar2 default hr_api.g_varchar2
2159 ,p_ass_attribute27          in     varchar2 default hr_api.g_varchar2
2160 ,p_ass_attribute28          in     varchar2 default hr_api.g_varchar2
2161 ,p_ass_attribute29          in     varchar2 default hr_api.g_varchar2
2162 ,p_ass_attribute30          in     varchar2 default hr_api.g_varchar2
2163 ,p_soft_coding_keyflex_id   in     number   default hr_api.g_number
2164 ,p_people_group_id          in     number   default hr_api.g_number
2165 ,p_hrs_last_date            in     varchar2 default hr_api.g_varchar2
2166 ,p_display_pos              in     varchar2 default hr_api.g_varchar2
2167 ,p_display_org              in     varchar2 default hr_api.g_varchar2
2168 ,p_display_job              in     varchar2 default hr_api.g_varchar2
2169 ,p_display_ass_status       in     varchar2 default hr_api.g_varchar2
2170 ,p_grade_lov                in     varchar2 default hr_api.g_varchar2
2171 ,p_approver_id              in     number   default hr_api.g_number
2172 ,p_review_proc_call         in     varchar2
2173 ,p_display_grade            in     varchar2 default hr_api.g_varchar2
2174 ,p_contract_id                  in     number default hr_api.g_number
2175 ,p_establishment_id             in     number default hr_api.g_number
2176 ,p_cagr_grade_def_id            in     number default hr_api.g_number
2177 ,p_collective_agreement_id      in     number default hr_api.g_number
2178 ,p_cagr_id_flex_num             in     number default hr_api.g_number
2179 ,p_payroll_id                   in     number default hr_api.g_number
2180 ,p_pay_basis_id                 in     number default hr_api.g_number
2181 ,p_sal_review_period            in     number default hr_api.g_number
2182 ,p_sal_review_period_frequency  in     varchar2 default hr_api.g_varchar2
2183 ,p_date_probation_end       in date default hr_api.g_date
2184 ,p_probation_period         in number default hr_api.g_number
2185 ,p_probation_unit           in varchar2 default hr_api.g_varchar2
2186 ,p_notice_period            in number default hr_api.g_number
2187 ,p_notice_period_uom        in varchar2 default hr_api.g_varchar2
2188 ,p_employee_category        in varchar2 default hr_api.g_varchar2
2189 ,p_work_at_home             in varchar2 default hr_api.g_varchar2
2190 ,p_job_post_source_name     in varchar2 default hr_api.g_varchar2
2191 ,p_perf_review_period       in number default hr_api.g_number
2192 ,p_perf_review_period_frequency in varchar2 default hr_api.g_varchar2
2193 ,p_internal_address_line    in varchar2 default hr_api.g_varchar2
2194 ,p_element_changed          in out nocopy varchar2
2195 ,p_page_error               in out nocopy varchar2
2196 ,p_page_error_msg           in out nocopy varchar2
2197 ,p_page_warning             in out nocopy varchar2
2198 ,p_page_warning_msg         in out nocopy varchar2
2199 ,p_organization_error       in out nocopy varchar2
2200 ,p_organization_error_msg   in out nocopy varchar2
2201 ,p_job_error                in out nocopy varchar2
2202 ,p_job_error_msg            in out nocopy varchar2
2203 ,p_position_error           in out nocopy varchar2
2204 ,p_position_error_msg       in out nocopy varchar2
2205 ,p_grade_error              in out nocopy varchar2
2206 ,p_grade_error_msg          in out nocopy varchar2
2207 ,p_supervisor_error         in out nocopy varchar2
2208 ,p_supervisor_error_msg     in out nocopy varchar2
2209 ,p_location_error           in out nocopy varchar2
2210 ,p_location_error_msg       in out nocopy varchar2
2211 ,p_transaction_step_id      in out nocopy varchar2
2212 ,p_flow_mode                in     varchar2 default null
2213 ,p_rptg_grp_id              in     varchar2 default null
2214 ,p_plan_id                  in     varchar2 default null
2215 ,p_effective_date_option    in     varchar2 default null
2216 ,p_title                    in varchar2 default hr_api.g_varchar2
2217 ,p_default_code_comb_id     in number default hr_api.g_number
2218 ,p_set_of_books_id          in number default hr_api.g_number
2219 ,p_source_type              in varchar2 default hr_api.g_varchar2
2220 ,p_project_title            in varchar2 default hr_api.g_varchar2
2221 ,p_vendor_assignment_number in varchar2 default hr_api.g_varchar2
2222 ,p_vendor_employee_number   in varchar2 default hr_api.g_varchar2
2223 ,p_vendor_id                in number default hr_api.g_number
2224 ,p_assignment_type          in varchar2 default hr_api.g_varchar2
2225 ,p_grade_ladder_pgm_id      in number default hr_api.g_number
2226 ,p_supervisor_assignment_id in number default hr_api.g_number
2227 -- GSP change
2228 ,p_salary_change_warning    in out nocopy varchar2
2229 ,p_gsp_post_process_warning out nocopy varchar2
2230 ,p_gsp_salary_effective_date out nocopy date
2231 -- End of GSP change
2232 ,p_po_header_id in  number default hr_api.g_number
2233 ,p_po_line_id in  number default hr_api.g_number
2234 ,p_vendor_site_id in  number default hr_api.g_number
2235 ,p_proj_asgn_end in date  default g_canonical_date
2236 
2237 ) is
2238 l_assignment_id        per_all_assignments_f.assignment_id%TYPE;
2239 l_person_id            per_all_assignments_f.person_id%TYPE;
2240 l_item_type            hr_api_transaction_steps.item_type%TYPE;
2241 l_item_key             hr_api_transaction_steps.item_key%TYPE;
2242 l_activity_id          hr_api_transaction_steps.activity_id%TYPE;
2243 l_effective_date       date;
2244 l_effective_start_date date;
2245 l_effective_end_date   date;
2246 l_transaction_id       number;
2247 l_result               varchar2(100);
2248 l_transaction_step_id  number;
2249 l_count                number;
2250 l_trans_tbl            hr_transaction_ss.transaction_table;
2251 l_assignment_rec       per_all_assignments_f%rowtype;
2252 l_old_assignment_rec   per_all_assignments_f%rowtype;
2253 l_db_assignment_rec    per_all_assignments_f%rowtype;
2254 l_date_error           boolean default false;
2255 l_special_ceiling_step_id per_all_assignments_f.special_ceiling_step_id%TYPE;
2256 l_trns_object_version_number number;
2257 l_datetrack_update_mode varchar2(30);
2258 l_last_change_date     date;
2259 l_review_proc_call     varchar2(4000);
2260 l_activity_id_list     varchar2(4000);
2261 l_element_warning      boolean default TRUE;
2262 l_hrs_last_date        varchar2(30);
2263 l_display_pos          varchar2(30);
2264 l_display_org          varchar2(30);
2265 l_display_job          varchar2(30);
2266 l_display_ass_status   varchar2(30);
2267 l_grade_lov            varchar2(30);    -- Bug #1004255 fix
2268 l_approver_id          number;
2269 l_email_id             varchar2(200);
2270 l_element_changed      varchar2(1);
2271 i_changed              boolean := FALSE; --changed by current module
2272 others_changed         boolean := FALSE; --changed by other modules
2273 j_changed	varchar2(2)	:= 'N';
2274 l_term_sec_asg	  varchar(2);
2275 ln_ovn                 number;
2276 l_display_grade        varchar2(30);  -- Bug #1067636 fix
2277 l_name                 varchar2(2000);
2278 l_original_name        varchar2(2000); --ns
2279 l_proc_order 	number;    --bug 6065339
2280 
2281 l_pay_step_id  	    number;	--bug 6405208
2282 l_pay_activity_id    number;
2283 
2284 -- variables and cursor for applicant_hire
2285 l_object_version_number number;
2286 l_per_object_version_number number;
2287 l_employee_number number;
2288 l_per_effective_start_date date;
2289 l_per_effective_end_date date;
2290 l_unaccepted_asg_del_warning boolean;
2291 l_assign_payroll_warning boolean;
2292 l_new_hire_appl_hire varchar2(10);
2293 
2294 -- 04/12/02 Salary Basis Enhancement Change Begins
2295 l_legislation_code    VARCHAR2(150) default null;
2296 -- 04/12/02 Salary Basis Enhancement Change Ends
2297 dummy varchar2(5);
2298 
2299 -- GSP changes
2300   ltt_salary_data  sshr_sal_prop_tab_typ;
2301   lv_salary_change_warning  VARCHAR2(30) default null;
2302   lv_gsp_api_mode VARCHAR2(30) default null;
2303   lv_gsp_review_proc_call VARCHAR2(30) default null;
2304      -- need to changed
2305   lv_gsp_flow_mode  VARCHAR2(30) default null;
2306   ln_gsp_step_id NUMBER;
2307   --lb_grade_ladder_changed boolean default false;
2308   --lb_grade_changed boolean default false;
2309   --lb_special_ceiling_step_id_chg boolean default false;
2310   lc_temp_grade_ladder_id NUMBER;
2311 
2312   ln_gsp_activity_id NUMBER;
2313   lv_gsp_activity_id VARCHAR2(30) default null;
2314 
2315   lb_grd_ldr_exists_flag boolean default false;
2316   l_proc   varchar2(72)  := g_package||'process_save';
2317 
2318     lc_temp_upd_sal_cd    varchar2(30);
2319     ln_gsp_txn_id number;
2320     ln_gsp_update_mode    varchar2(10);
2321 
2322     -- cursor to find whether assigned grade ladder id updates
2323     -- the salary using Grade Step Progression
2324     CURSOR lc_sal_updateable_grade_ladder
2325     (p_grade_ladder_id in per_all_assignments_f.grade_ladder_pgm_id%TYPE ,
2326      p_effective_date in date
2327     ) IS
2328      select pgm_id, update_salary_cd  from ben_pgm_f
2329         where
2330          -- grade ladder does not allow update of  salary
2331          --(update_salary_cd is null or update_salary_cd = 'NO_UPDATE')
2332          -- salary updated by the  progression system should not be manually overidden
2333          --and  (gsp_allow_override_flag is null or gsp_allow_override_flag = 'N')
2334          --and
2335          pgm_id = p_grade_ladder_id
2336          and p_effective_date between effective_start_date and effective_end_date;
2337 
2338 
2339 --End of GSP changes
2340 
2341 -- cursor to get the applicant object_version_number from
2342 -- per_all_people_f
2343 cursor per_applicant_rec(p_appl_person_id in number,
2344                          p_appl_effective_date in date) is
2345 select object_version_number
2346 from per_all_people_f
2347 where person_id = p_appl_person_id
2348 and p_appl_effective_date between effective_start_date
2349 and effective_end_date;
2350 
2351 --
2352 -- cursor to get the applicant object_version_number from
2353 -- per_all_assignments_f
2354 cursor asg_applicant_rec(p_appl_assign_id in number,
2355                          p_appl_effective_date in date) is
2356 select object_version_number,
2357        assignment_status_type_id
2358 from per_all_assignments_f
2359 where assignment_id = p_appl_assign_id
2360 and p_appl_effective_date between effective_start_date
2361 and effective_end_date;
2362 
2363 --
2364 
2365 cursor last_change_date is
2366 select max(asf.effective_start_date)
2367 from per_all_assignments_f asf,
2368      per_assignment_status_types past
2369 where asf.assignment_id=l_assignment_id
2370 and asf.ASSIGNMENT_STATUS_TYPE_ID = past.ASSIGNMENT_STATUS_TYPE_ID;
2371 -- ns 10-May-03: Since termination is handled on the effective date page
2372 -- and update insert may be allowed even if future dated termination,
2373 -- we do not need this check here
2374 -- and past.PER_SYSTEM_STATUS <> 'TERM_ASSIGN';
2375 
2376 -- New cursor to see if any assignment record exist for the selected date
2377 cursor correction_date is
2378 select null
2379 from   per_all_assignments_f asf,
2380        per_assignment_status_types past
2381 where  asf.assignment_id             = l_assignment_id
2382 and    asf.assignment_status_type_id = past.assignment_status_type_id
2383 and    asf.effective_start_date      = l_effective_date;
2384 
2385 cursor csr_org_name(p_id in number) is
2386 select name
2387 from hr_organization_units
2388 where organization_id = p_id;
2389 
2390 cursor csr_job_name(p_id in number) is
2391 select name
2392 from per_jobs_vl
2393 where job_id = p_id;
2394 
2395 cursor csr_pos_name(p_id in number) is
2396 select name
2397 from hr_positions_f
2398 where position_id = p_id
2399 and to_date(p_effective_date,g_date_format)
2400 between effective_start_date
2401 and effective_end_date;
2402 
2403 cursor csr_grade_name(p_id in number) is
2404 select name
2405 from per_grades_vl
2406 where grade_id = p_id;
2407 
2408 cursor csr_assignment is
2409 select assignment_id
2410 from per_all_assignments_f
2411 where assignment_id = p_assignment_id;
2412 
2413 cursor process_order(l_item_type in varchar2,l_item_key in varchar2) is
2414 select processing_order from hr_api_transaction_steps where
2415 item_type=l_item_type and item_key=l_item_key and api_name='HR_SUPERVISOR_SS.PROCESS_API';
2416 
2417 cursor pay_step(l_item_type in varchar2,l_item_key in varchar2) is	--bug6405208
2418 select transaction_step_id,activity_id from hr_api_transaction_steps where
2419 item_type=l_item_type and item_key=l_item_key and api_name='HR_PAY_RATE_SS.PROCESS_API';
2420 
2421 cursor step_grade_step(l_item_type in varchar2,l_item_key in varchar2) is
2422 select null from hr_api_transaction_steps where
2423 item_type=l_item_type and item_key=l_item_key and api_name='HR_PROCESS_ASSIGNMENT_STEP_SS.PROCESS_API';
2424 
2425 l_re_hire_flow varchar2(25) default null;
2426 
2427   cursor csr_pgp_segments(p_people_group_id in number) is
2428   select * from pay_people_groups
2429   where people_group_id = p_people_group_id;
2430 
2431   cursor csr_scl_segments(p_soft_coding_keyflex_id in number) is
2432   select * from hr_soft_coding_keyflex
2433   where soft_coding_keyflex_id = p_soft_coding_keyflex_id;
2434 
2435   l_people_groups csr_pgp_segments%rowtype;
2436   l_soft_coding_keyflex csr_scl_segments%rowtype;
2437   all_pgp_null  varchar2(2)  := 'N';
2438   all_scl_null  varchar2(2)  := 'N';
2439 
2440 cursor csr_per_step_id is
2441 select transaction_step_id from hr_api_transaction_steps
2442   where item_type=l_item_type and item_key=l_item_key
2443   and api_name='HR_PROCESS_PERSON_SS.PROCESS_API';
2444 l_per_step_id	number;
2445 l_asgn_change_mode	varchar2(2);
2446 l_person_type_id	number;
2447 
2448 cursor csr_get_prim_asg is
2449 select *
2450 from per_all_assignments_f
2451 where person_id = l_person_id and primary_flag = 'Y' and assignment_type = 'E'
2452 and l_effective_date between effective_start_date and effective_end_date;
2453 --
2454 begin
2455 
2456   hr_utility.set_location('Entering:'||l_proc, 5);
2457   l_object_version_number := p_object_version_number;
2458 
2459 -- first check if this is being called for registration.
2460   if p_flow_mode is not null and
2461      p_flow_mode = hr_process_assignment_ss.g_new_hire_registration
2462   then
2463     hr_utility.set_location('p_flow_mode = hr_process_assignment_ss.g_new_hire_registration:'||l_proc,10);
2464     g_registration := true;
2465   end if;
2466 
2467 -- validate seesion
2468   l_assignment_id := p_assignment_id;
2469   l_item_type := p_item_type;
2470   l_item_key := p_item_key;
2471   l_activity_id := p_actid;
2472 --Code For Re-Hire
2473   if l_item_type is not null and l_item_key is not null then
2474   	l_person_id := wf_engine.GetItemAttrText(l_item_type,l_item_key,'CURRENT_PERSON_ID');
2475   	l_re_hire_flow := wf_engine.GetItemAttrText(l_item_type,l_item_key,'HR_FLOW_IDENTIFIER',true);
2476   end if;
2477   if nvl(l_re_hire_flow,'N') = 'EX_EMP' then
2478   g_exemp_hire := true;
2479   hr_new_user_reg_ss.processExEmpTransaction
2480 	(WfItemType => l_item_type
2481         ,WfItemKey => l_item_key
2482         ,PersonId => l_person_id
2483         ,AssignmentId => l_assignment_id
2484         ,p_error_message => p_page_error_msg
2485         ,p_source => 'Assignment');
2486   begin
2487 	select object_version_number into l_object_version_number from per_all_assignments_f where assignment_id = l_assignment_id;
2488   exception
2489   when others then
2490   null;
2491   end;
2492   end if;
2493 --End of ReHire Code
2494 --Validate the p_assignment_id
2495   if g_registration then
2496     hr_utility.set_location('  if g_registration then:'||l_proc,15);
2497     open csr_assignment;
2498     fetch csr_assignment into l_assignment_id;
2499     if csr_assignment%notfound then
2500       hr_utility.set_location('    if csr_assignment%notfound then:'||l_proc,20);
2501       hr_api.legislation_hooks('DISABLE');		-- bug 6405208
2502       hr_new_user_reg_ss.processNewUserTransaction
2503         (WfItemType => l_item_type
2504         ,WfItemKey => l_item_key
2505         ,PersonId => l_person_id
2506         ,AssignmentId => l_assignment_id);
2507       hr_api.legislation_hooks('ENABLE');		-- bug 6405208
2508     end if;
2509     close csr_assignment;
2510   end if;
2511 --
2512 -- get the e-mail address for error messages
2513 --
2514 --  l_email_id := wf_engine.getItemAttrText
2515 --                (itemtype => l_item_type
2516 --                ,itemkey  => l_item_key
2517 --                ,aname    => hr_assignment_util_web.gv_wf_email_id);
2518 --
2519 -- check that we have a valid date
2520 --
2521 
2522   begin
2523     l_effective_date :=to_date(p_effective_date, g_date_format);
2524   exception
2525     when others then
2526     --Should add page level error
2527     hr_utility.set_location('Exception:Others'||l_proc,555);
2528     hr_utility.raise_error;
2529     /*hr_errors_api.addErrorToTable
2530       (p_errorfield => null
2531       ,p_errorcode  => to_char(SQLCODE)
2532       ,p_errormsg   => sqlerrm
2533       );*/
2534     l_date_error:=true;
2535   end;
2536 
2537 -- GSP Changes
2538  -- set the effective salary date
2539  p_gsp_salary_effective_date := l_effective_date;
2540 -- End of GSP changes
2541 
2542 --
2543   if not l_date_error then
2544 --
2545 -- look to see if we are looking for an element warning or error
2546 --
2547    IF hr_mee_workflow_service.check_web_page_code(
2548       p_item_type => l_item_type,
2549       p_item_key  => l_item_key,
2550       p_actid     => l_activity_id,
2551       p_web_page_section_code =>
2552                 hr_process_assignment_ss.gv_ele_warning) THEN
2553       if(hr_mee_workflow_service.get_web_page_code(
2554         p_item_type => l_item_type,
2555         p_item_key  => l_item_key,
2556         p_actID     => l_activity_id,
2557         p_web_page_section_code =>hr_process_assignment_ss.gv_ele_warning)
2558                  = 'Y') then
2559         l_element_warning:=TRUE;
2560       else
2561         l_element_warning:=FALSE;
2562       end if;
2563     ELSE
2564       l_element_warning:=FALSE;
2565     END IF;
2566     l_element_changed:=p_element_changed;
2567 
2568    open csr_per_step_id;
2569    fetch csr_per_step_id into l_per_step_id;
2570    close csr_per_step_id;
2571 
2572    l_asgn_change_mode :=     hr_transaction_api.get_varchar2_value
2573                              (p_transaction_step_id =>  l_per_step_id
2574                              ,p_name                => 'P_ASGN_CHANGE_MODE');
2575 
2576 -- ----------------------------------------------------------------------------
2577 -- get original database data, we need to compare it with transaction table
2578 -- and input values to decide if any changes have been made
2579 -- ----------------------------------------------------------------------------
2580 
2581    if (l_asgn_change_mode = 'V' OR l_asgn_change_mode = 'W') then
2582       open csr_get_prim_asg;
2583       fetch csr_get_prim_asg into l_db_assignment_rec;
2584       close csr_get_prim_asg;
2585   else
2586     hr_assignment_common_save_web.get_asg_from_asg
2587                   (p_assignment_id     => l_assignment_id
2588                   ,p_effective_date    => l_effective_date
2589                   ,p_assignment_rec    => l_db_assignment_rec);
2590   end if;
2591 --
2592 -- look to see if we have already a transaction step in progress
2593 -- this check is based on the api_name and not the activity_id because
2594 -- each step will have a different activity_id.
2595 --
2596     hr_assignment_common_save_web.get_step
2597           (p_item_type           => l_item_type
2598           ,p_item_key            => l_item_key
2599           ,p_api_name            => g_api_name
2600           ,p_transaction_step_id => l_transaction_step_id
2601           ,p_transaction_id      => l_transaction_id);
2602     --IF l_transaction_step_id is null then
2603 --
2604 -- There are no pre-existing steps, so this is the first time this has been
2605 -- called
2606 --
2607 
2608    -------------------------------------------------------------------------
2609    -- get the existing data from the online tables
2610    -------------------------------------------------------------------------
2611       l_old_assignment_rec := l_db_assignment_rec;
2612 
2613 --
2614 -- look for the last change date so that we can work out what date track
2615 -- update mode we are using
2616 --
2617 
2618       open last_change_date;
2619       fetch last_change_date into l_last_change_date;
2620       if last_change_date%notfound then
2621         close last_change_date;
2622       --
2623       -- if we cannot find this assignment record then there must be an error
2624       --
2625       --Should add page level error
2626         fnd_message.set_name('PER','HR_ASG_NOT_FOUND');
2627         hr_utility.raise_error;
2628         /*hr_errors_api.addErrorToTable
2629         (p_errorfield => null
2630         ,p_errormsg   => fnd_message.get);*/
2631       else
2632         close last_change_date;
2633       end if;
2634 --
2635       if l_effective_date>l_last_change_date then
2636         --
2637         -- if the effective date is after the date of the last change then we
2638         -- are doing an update
2639         --
2640         hr_utility.set_location('l_effective_date>l_last_change_date then:'||l_proc,30);
2641         l_datetrack_update_mode:='UPDATE';
2642 
2643         --  registration always need this as Correction.
2644         if (p_flow_mode is not null and
2645            p_flow_mode = hr_process_assignment_ss.g_new_hire_registration) OR (nvl(l_re_hire_flow,'N') = 'EX_EMP')
2646         then
2647            hr_utility.set_location('p_flow_mode is not null and: NewHireReg'||l_proc,35);
2648            l_datetrack_update_mode :=  'CORRECTION';
2649         end if;
2650 
2651       else
2652            open  correction_date;
2653            fetch correction_date into dummy;
2654 
2655            if correction_date%FOUND then
2656               -- if the effective date is equal an existing assignment
2657               -- start date then we
2658               -- are doing a correction
2659               --
2660               hr_utility.set_location('if correction_date%FOUND then:'||l_proc,40);
2661               l_datetrack_update_mode:='CORRECTION';
2662            else
2663               --
2664               IF ( fnd_profile.value('PQH_DT_RULE_FUTUR_CHANGE_FOUND')
2665                  = 'APPROVE_ONLY') THEN
2666                   hr_utility.set_location('Approve only:'||l_proc,45);
2667                   l_datetrack_update_mode:='UPDATE_CHANGE_INSERT';
2668               ELSE
2669                   --Throw error if date track profile is turned off and
2670                   --future dated change is found
2671                   fnd_message.set_name('PER','HR_DATE_TOO_EARLY');
2672                   hr_utility.raise_error;
2673               END  IF;
2674               --
2675            end if;
2676 
2677            close correction_date;
2678 
2679       end if;
2680 
2681    IF l_transaction_step_id is null then
2682       hr_utility.set_location('IF l_transaction_step_id is null then:'||l_proc,50);
2683       --
2684       --since this is the first time in, we take the display pos and activity_id
2685       -- as they are.
2686       --
2687 
2688       l_review_proc_call := p_review_proc_call;
2689       l_activity_id_list := l_activity_id;
2690     else
2691       -- this is not the first time through.
2692       -- get the existing data from the transaction tables
2693       -- Bug 2365524: set the l_element_changed only if the transaction
2694       -- value is not null
2695       if hr_transaction_api.get_varchar2_value
2696            (p_transaction_step_id => l_transaction_step_id
2697            ,p_name                => 'P_ELEMENT_CHANGED') is not null
2698       then
2699         l_element_changed :=
2700           hr_transaction_api.get_varchar2_value
2701            (p_transaction_step_id => l_transaction_step_id
2702            ,p_name                => 'P_ELEMENT_CHANGED');
2703       end if;
2704       --warning has already been raised.
2705       if l_element_changed is not null then
2706         l_element_warning := TRUE;
2707       end if;
2708       get_asg_from_tt
2709         (p_transaction_step_id => l_transaction_step_id
2710          ,p_assignment_rec    => l_old_assignment_rec);
2711       -- we pick up the old review page and activity_id lists to
2712       -- append to
2713       l_review_proc_call:=    hr_transaction_api.get_varchar2_value
2714         (p_transaction_step_id => l_transaction_step_id
2715         ,p_name                => 'P_REVIEW_PROC_CALL');
2716       l_activity_id_list:= hr_transaction_api.get_varchar2_value
2717         (p_transaction_step_id => l_transaction_step_id
2718         ,p_name                => 'P_REVIEW_ACTID');
2719       -- check that effective_date and date track update mode
2720       -- have not changed
2721       if (l_effective_date<> to_date(hr_transaction_ss.get_wf_effective_date
2722                         (p_transaction_step_id => l_transaction_step_id)
2723                         ,g_date_format))
2724       then
2725         --Should add page level error
2726         fnd_message.set_name('PER','HR_EFF_DATE_CHANGED');
2727         hr_utility.raise_error;
2728         /*hr_errors_api.addErrorToTable
2729           (p_errorfield => null
2730           ,p_errormsg   => fnd_message.get);*/
2731       end if;
2732       /*l_datetrack_update_mode:=
2733          hr_transaction_api.get_varchar2_value(
2734             p_transaction_step_id => l_transaction_step_id,
2735             p_name                => 'P_DATETRACK_UPDATE_MODE'
2736             );*/
2737       if nvl(l_re_hire_flow,'N') = 'EX_EMP' then
2738 	l_datetrack_update_mode:='CORRECTION';
2739       end if;
2740     end if;
2741     i_changed := FALSE;
2742     others_changed := FALSE;
2743     -- Set the l_assignment_rec.business_group_id and person_id accordingly.
2744     -- Otherwise, we will get HR_7207_API_MANDATORY_ARG error in
2745     -- per_asg_bus1.chk_organization_id and other assignment fields
2746     -- because of the uninitialized value in the rec.
2747     l_assignment_rec.business_group_id :=
2748           l_old_assignment_rec.business_group_id;
2749     l_assignment_rec.person_id :=
2750           l_old_assignment_rec.person_id;
2751 if (p_grade_id = hr_api.g_number) then
2752   l_assignment_rec.grade_id := l_old_assignment_rec.grade_id;
2753   if nvl(l_old_assignment_rec.grade_id, hr_api.g_number)
2754      <> nvl(l_db_assignment_rec.grade_id, hr_api.g_number)
2755   then
2756        others_changed:=TRUE;
2757   end if;
2758 else
2759   l_assignment_rec.grade_id := p_grade_id;
2760   if (nvl(p_grade_id,-1) <> nvl(l_db_assignment_rec.grade_id,-1) ) then
2761     i_changed:=TRUE;
2762   end if;
2763 end if;
2764 
2765 if (p_position_id = hr_api.g_number) then
2766     l_assignment_rec.position_id :=
2767     l_old_assignment_rec.position_id;
2768     if nvl(l_old_assignment_rec.position_id, hr_api.g_number)
2769        <> nvl(l_db_assignment_rec.position_id, hr_api.g_number)
2770     then
2771        others_changed:=TRUE;
2772     end if;
2773 else
2774     l_assignment_rec.position_id := p_position_id;
2775     if (nvl(p_position_id, -1) <> nvl(l_db_assignment_rec.position_id,-1))
2776     then
2777        i_changed:=TRUE;
2778     end if;
2779 end if;
2780 
2781 if (p_job_id = hr_api.g_number) then
2782     l_assignment_rec.job_id :=
2783     l_old_assignment_rec.job_id;
2784     if nvl(l_old_assignment_rec.job_id, hr_api.g_number)
2785        <> nvl(l_db_assignment_rec.job_id, hr_api.g_number)
2786     then
2787        others_changed:=TRUE;
2788     end if;
2789 else
2790     l_assignment_rec.job_id := p_job_id;
2791     if (nvl(p_job_id, -1) <> nvl(l_db_assignment_rec.job_id,-1)) then
2792        i_changed:=TRUE;
2793     end if;
2794 end if;
2795 
2796 if (p_location_id = hr_api.g_number) then
2797     l_assignment_rec.location_id :=
2798     l_old_assignment_rec.location_id;
2799     if nvl(l_old_assignment_rec.location_id, hr_api.g_number)
2800        <> nvl(l_db_assignment_rec.location_id, hr_api.g_number)
2801     then
2802        others_changed:=TRUE;
2803     end if;
2804 else
2805     l_assignment_rec.location_id := p_location_id;
2806     if (nvl(p_location_id, -1) <> nvl(l_db_assignment_rec.location_id,-1))
2807     then
2808        i_changed:=TRUE;
2809     end if;
2810 end if;
2811 
2812 if (p_supervisor_id = hr_api.g_number) then
2813     l_assignment_rec.supervisor_id :=
2814     l_old_assignment_rec.supervisor_id;
2815     if nvl(l_old_assignment_rec.supervisor_id, hr_api.g_number)
2816        <> nvl(l_db_assignment_rec.supervisor_id, hr_api.g_number)
2817     then
2818        others_changed:=TRUE;
2819     end if;
2820 else
2821     l_assignment_rec.supervisor_id := p_supervisor_id;
2822     if (nvl(p_supervisor_id, -1) <> nvl(l_db_assignment_rec.supervisor_id,-1))
2823     then
2824        i_changed:=TRUE;
2825     end if;
2826 end if;
2827 
2828 if (p_special_ceiling_step_id = hr_api.g_number) then
2829     l_assignment_rec.special_ceiling_step_id :=
2830     l_old_assignment_rec.special_ceiling_step_id;
2831     if nvl(l_old_assignment_rec.special_ceiling_step_id, hr_api.g_number)
2832        <> nvl(l_db_assignment_rec.special_ceiling_step_id, hr_api.g_number)
2833     then
2834        others_changed:=TRUE;
2835     end if;
2836 else
2837     l_assignment_rec.special_ceiling_step_id := p_special_ceiling_step_id;
2838     if (nvl(p_special_ceiling_step_id, -1) <>
2839        nvl(l_db_assignment_rec.special_ceiling_step_id,-1))
2840     then
2841        i_changed:=TRUE;
2842     end if;
2843 end if;
2844 
2845 if (p_organization_id = hr_api.g_number) then
2846     l_assignment_rec.organization_id :=
2847     l_old_assignment_rec.organization_id;
2848     if nvl(l_old_assignment_rec.organization_id, hr_api.g_number)
2849        <> nvl(l_db_assignment_rec.organization_id, hr_api.g_number)
2850     then
2851        others_changed:=TRUE;
2852     end if;
2853 else
2854     l_assignment_rec.organization_id := p_organization_id;
2855     if (nvl(p_organization_id, -1) <>
2856        nvl(l_db_assignment_rec.organization_id,-1))
2857     then
2858        i_changed:=TRUE;
2859     end if;
2860 end if;
2861 
2862 if (p_employment_category = hr_api.g_varchar2) then
2863     l_assignment_rec.employment_category :=
2864     l_old_assignment_rec.employment_category;
2865     if nvl(l_old_assignment_rec.employment_category, hr_api.g_varchar2)
2866        <> nvl(l_db_assignment_rec.employment_category, hr_api.g_varchar2)
2867     then
2868        others_changed:=TRUE;
2869     end if;
2870 else
2871     l_assignment_rec.employment_category := p_employment_category;
2872     if (nvl(p_employment_category, hr_api.g_varchar2) <>
2873        nvl(l_db_assignment_rec.employment_category, hr_api.g_varchar2))
2874     then
2875        i_changed:=TRUE;
2876     end if;
2877 end if;
2878 
2879 if (p_manager_flag = hr_api.g_varchar2) then
2880     l_assignment_rec.manager_flag :=
2881     l_old_assignment_rec.manager_flag;
2882     if nvl(l_old_assignment_rec.manager_flag, hr_api.g_varchar2)
2883        <> nvl(l_db_assignment_rec.manager_flag, hr_api.g_varchar2)
2884     then
2885        others_changed:=TRUE;
2886     end if;
2887 else
2888     l_assignment_rec.manager_flag := p_manager_flag;
2889     if (nvl(p_manager_flag, hr_api.g_varchar2) <>
2890        nvl(l_db_assignment_rec.manager_flag, hr_api.g_varchar2))
2891     then
2892        i_changed:=TRUE;
2893     end if;
2894 end if;
2895 
2896 if (p_frequency = hr_api.g_varchar2) then
2897     l_assignment_rec.frequency :=
2898     l_old_assignment_rec.frequency;
2899     if nvl(l_old_assignment_rec.frequency, hr_api.g_varchar2)
2900        <> nvl(l_db_assignment_rec.frequency, hr_api.g_varchar2)
2901     then
2902        others_changed:=TRUE;
2903     end if;
2904 else
2905     l_assignment_rec.frequency := p_frequency;
2906     if (nvl(p_frequency, hr_api.g_varchar2) <>
2907        nvl(l_db_assignment_rec.frequency, hr_api.g_varchar2))
2908     then
2909        i_changed:=TRUE;
2910     end if;
2911 end if;
2912 
2913 if (p_normal_hours = hr_api.g_number) then
2914     l_assignment_rec.normal_hours :=
2915     l_old_assignment_rec.normal_hours;
2916     if nvl(l_old_assignment_rec.normal_hours, hr_api.g_number)
2917        <> nvl(l_db_assignment_rec.normal_hours, hr_api.g_number)
2918     then
2919        others_changed:=TRUE;
2920     end if;
2921 else
2922     l_assignment_rec.normal_hours := p_normal_hours;
2923     if (nvl(p_normal_hours, -1) <>
2924        nvl(l_db_assignment_rec.normal_hours,-1))
2925     then
2926        i_changed:=TRUE;
2927     end if;
2928 end if;
2929 
2930 if (p_time_normal_finish = hr_api.g_varchar2) then
2931     l_assignment_rec.time_normal_finish :=
2932     l_old_assignment_rec.time_normal_finish;
2933     if nvl(l_old_assignment_rec.time_normal_finish, hr_api.g_varchar2)
2934        <> nvl(l_db_assignment_rec.time_normal_finish, hr_api.g_varchar2)
2935     then
2936        others_changed:=TRUE;
2937     end if;
2938 else
2939     l_assignment_rec.time_normal_finish := p_time_normal_finish;
2940     if (nvl(p_time_normal_finish, hr_api.g_varchar2) <>
2941        nvl(l_db_assignment_rec.time_normal_finish, hr_api.g_varchar2))
2942     then
2943        i_changed:=TRUE;
2944     end if;
2945 end if;
2946 
2947 if (p_time_normal_start = hr_api.g_varchar2) then
2948     l_assignment_rec.time_normal_start :=
2949     l_old_assignment_rec.time_normal_start;
2950     if nvl(l_old_assignment_rec.time_normal_start, hr_api.g_varchar2)
2951        <> nvl(l_db_assignment_rec.time_normal_start, hr_api.g_varchar2)
2952     then
2953        others_changed:=TRUE;
2954     end if;
2955 else
2956     l_assignment_rec.time_normal_start := p_time_normal_start;
2957     if (nvl(p_time_normal_start, hr_api.g_varchar2) <>
2958        nvl(l_db_assignment_rec.time_normal_start, hr_api.g_varchar2))
2959     then
2960        i_changed:=TRUE;
2961     end if;
2962 end if;
2963 
2964 if (p_bargaining_unit_code = hr_api.g_varchar2) then
2965     l_assignment_rec.bargaining_unit_code :=
2966     l_old_assignment_rec.bargaining_unit_code;
2967     if nvl(l_old_assignment_rec.bargaining_unit_code, hr_api.g_varchar2)
2968        <> nvl(l_db_assignment_rec.bargaining_unit_code, hr_api.g_varchar2)
2969     then
2970        others_changed:=TRUE;
2971     end if;
2972 else
2973     l_assignment_rec.bargaining_unit_code := p_bargaining_unit_code;
2974     if (nvl(p_bargaining_unit_code, hr_api.g_varchar2) <>
2975        nvl(l_db_assignment_rec.bargaining_unit_code, hr_api.g_varchar2))
2976     then
2977        i_changed:=TRUE;
2978     end if;
2979 end if;
2980 
2981 if (p_labour_union_member_flag = hr_api.g_varchar2) then
2982     l_assignment_rec.labour_union_member_flag :=
2983     l_old_assignment_rec.labour_union_member_flag;
2984     if nvl(l_old_assignment_rec.labour_union_member_flag, hr_api.g_varchar2)
2985        <> nvl(l_db_assignment_rec.labour_union_member_flag, hr_api.g_varchar2)
2986     then
2987        others_changed:=TRUE;
2988     end if;
2989 else
2990     l_assignment_rec.labour_union_member_flag := p_labour_union_member_flag;
2991     if (nvl(p_labour_union_member_flag, hr_api.g_varchar2) <>
2992        nvl(l_db_assignment_rec.labour_union_member_flag, hr_api.g_varchar2))
2993     then
2994        i_changed:=TRUE;
2995     end if;
2996 end if;
2997 
2998 
2999 if (p_ass_attribute_category = hr_api.g_varchar2) then
3000     l_assignment_rec.ass_attribute_category :=
3001     l_old_assignment_rec.ass_attribute_category;
3002     if nvl(l_old_assignment_rec.ass_attribute_category, hr_api.g_varchar2)
3003        <> nvl(l_db_assignment_rec.ass_attribute_category, hr_api.g_varchar2)
3004     then
3005        others_changed:=TRUE;
3006     end if;
3007 else
3008     l_assignment_rec.ass_attribute_category := p_ass_attribute_category;
3009     if (nvl(p_ass_attribute_category, hr_api.g_varchar2) <>
3010        nvl(l_db_assignment_rec.ass_attribute_category, hr_api.g_varchar2))
3011     then
3012        i_changed:=TRUE;
3013     end if;
3014 end if;
3015 
3016 if (p_change_reason = hr_api.g_varchar2) then
3017     l_assignment_rec.change_reason :=
3018     l_old_assignment_rec.change_reason;
3019     if (nvl(l_db_assignment_rec.change_reason, hr_api.g_varchar2) <>
3020        nvl(l_old_assignment_rec.change_reason, hr_api.g_varchar2))
3021     then
3022        others_changed:=TRUE;
3023     end if;
3024 else
3025     l_assignment_rec.change_reason := p_change_reason;
3026     if (nvl(p_change_reason, hr_api.g_varchar2) <>
3027        nvl(l_db_assignment_rec.change_reason, hr_api.g_varchar2))
3028     then
3029        i_changed:=TRUE;
3030     end if;
3031 end if;
3032 
3033 if (p_ass_attribute1 = hr_api.g_varchar2) then
3034     l_assignment_rec.ass_attribute1 :=
3035     l_old_assignment_rec.ass_attribute1;
3036     if (nvl(l_db_assignment_rec.ass_attribute1, hr_api.g_varchar2) <>
3037        nvl(l_old_assignment_rec.ass_attribute1, hr_api.g_varchar2))
3038     then
3039        others_changed:=TRUE;
3040     end if;
3041 else
3042     l_assignment_rec.ass_attribute1 := p_ass_attribute1;
3043     if (nvl(p_ass_attribute1, hr_api.g_varchar2) <>
3044        nvl(l_db_assignment_rec.ass_attribute1, hr_api.g_varchar2))
3045     then
3046        i_changed:=TRUE;
3047     end if;
3048 end if;
3049 
3050 if (p_ass_attribute2 = hr_api.g_varchar2) then
3051     l_assignment_rec.ass_attribute2 :=
3052     l_old_assignment_rec.ass_attribute2;
3053     if (nvl(l_db_assignment_rec.ass_attribute2, hr_api.g_varchar2) <>
3054        nvl(l_old_assignment_rec.ass_attribute2, hr_api.g_varchar2))
3055     then
3056        others_changed:=TRUE;
3057     end if;
3058 else
3059     l_assignment_rec.ass_attribute2 := p_ass_attribute2;
3060     if (nvl(p_ass_attribute2, hr_api.g_varchar2) <>
3061        nvl(l_db_assignment_rec.ass_attribute2, hr_api.g_varchar2))
3062     then
3063        i_changed:=TRUE;
3064     end if;
3065 end if;
3066 
3067 if (p_ass_attribute3 = hr_api.g_varchar2) then
3068     l_assignment_rec.ass_attribute3 :=
3069     l_old_assignment_rec.ass_attribute3;
3070     if (nvl(l_db_assignment_rec.ass_attribute3, hr_api.g_varchar2) <>
3071        nvl(l_old_assignment_rec.ass_attribute3, hr_api.g_varchar2))
3072     then
3073        others_changed:=TRUE;
3074     end if;
3075 else
3076     l_assignment_rec.ass_attribute3 := p_ass_attribute3;
3077     if (nvl(p_ass_attribute3, hr_api.g_varchar2) <>
3078        nvl(l_db_assignment_rec.ass_attribute3, hr_api.g_varchar2))
3079     then
3080        i_changed:=TRUE;
3081     end if;
3082 end if;
3083 
3084 if (p_ass_attribute4 = hr_api.g_varchar2) then
3085     l_assignment_rec.ass_attribute4 :=
3086     l_old_assignment_rec.ass_attribute4;
3087     if (nvl(l_db_assignment_rec.ass_attribute4, hr_api.g_varchar2) <>
3088        nvl(l_old_assignment_rec.ass_attribute4, hr_api.g_varchar2))
3089     then
3090        others_changed:=TRUE;
3091     end if;
3092 else
3093     l_assignment_rec.ass_attribute4 := p_ass_attribute4;
3094     if (nvl(p_ass_attribute4, hr_api.g_varchar2) <>
3095        nvl(l_db_assignment_rec.ass_attribute4, hr_api.g_varchar2))
3096     then
3097        i_changed:=TRUE;
3098     end if;
3099 end if;
3100 
3101 if (p_ass_attribute5 = hr_api.g_varchar2) then
3102     l_assignment_rec.ass_attribute5 :=
3103     l_old_assignment_rec.ass_attribute5;
3104     if (nvl(l_db_assignment_rec.ass_attribute5, hr_api.g_varchar2) <>
3105        nvl(l_old_assignment_rec.ass_attribute5, hr_api.g_varchar2))
3106     then
3107        others_changed:=TRUE;
3108     end if;
3109 else
3110     l_assignment_rec.ass_attribute5 := p_ass_attribute5;
3111     if (nvl(p_ass_attribute5, hr_api.g_varchar2) <>
3112        nvl(l_db_assignment_rec.ass_attribute5, hr_api.g_varchar2))
3113     then
3114        i_changed:=TRUE;
3115     end if;
3116 end if;
3117 
3118 if (p_ass_attribute6 = hr_api.g_varchar2) then
3119     l_assignment_rec.ass_attribute6 :=
3120     l_old_assignment_rec.ass_attribute6;
3121     if (nvl(l_db_assignment_rec.ass_attribute6, hr_api.g_varchar2) <>
3122        nvl(l_old_assignment_rec.ass_attribute6, hr_api.g_varchar2))
3123     then
3124        others_changed:=TRUE;
3125     end if;
3126 else
3127     l_assignment_rec.ass_attribute6 := p_ass_attribute6;
3128     if (nvl(p_ass_attribute6, hr_api.g_varchar2) <>
3129        nvl(l_db_assignment_rec.ass_attribute6, hr_api.g_varchar2))
3130     then
3131        i_changed:=TRUE;
3132     end if;
3133 end if;
3134 
3135 if (p_ass_attribute7 = hr_api.g_varchar2) then
3136     l_assignment_rec.ass_attribute7 :=
3137     l_old_assignment_rec.ass_attribute7;
3138     if (nvl(l_db_assignment_rec.ass_attribute7, hr_api.g_varchar2) <>
3139        nvl(l_old_assignment_rec.ass_attribute7, hr_api.g_varchar2))
3140     then
3141        others_changed:=TRUE;
3142     end if;
3143 else
3144     l_assignment_rec.ass_attribute7 := p_ass_attribute7;
3145     if (nvl(p_ass_attribute7, hr_api.g_varchar2) <>
3146        nvl(l_db_assignment_rec.ass_attribute7, hr_api.g_varchar2))
3147     then
3148        i_changed:=TRUE;
3149     end if;
3150 end if;
3151 
3152 if (p_ass_attribute8 = hr_api.g_varchar2) then
3153     l_assignment_rec.ass_attribute8 :=
3154     l_old_assignment_rec.ass_attribute8;
3155     if (nvl(l_db_assignment_rec.ass_attribute8, hr_api.g_varchar2) <>
3156        nvl(l_old_assignment_rec.ass_attribute8, hr_api.g_varchar2))
3157     then
3158        others_changed:=TRUE;
3159     end if;
3160 else
3161     l_assignment_rec.ass_attribute8 := p_ass_attribute8;
3162     if (nvl(p_ass_attribute8, hr_api.g_varchar2) <>
3163        nvl(l_db_assignment_rec.ass_attribute8, hr_api.g_varchar2))
3164     then
3165        i_changed:=TRUE;
3166     end if;
3167 end if;
3168 
3169 if (p_ass_attribute9 = hr_api.g_varchar2) then
3170     l_assignment_rec.ass_attribute9 :=
3171     l_old_assignment_rec.ass_attribute9;
3172     if (nvl(l_db_assignment_rec.ass_attribute9, hr_api.g_varchar2) <>
3173        nvl(l_old_assignment_rec.ass_attribute9, hr_api.g_varchar2))
3174     then
3175        others_changed:=TRUE;
3176     end if;
3177 else
3178     l_assignment_rec.ass_attribute9 :=p_ass_attribute9;
3179     if (nvl(p_ass_attribute9, hr_api.g_varchar2) <>
3180        nvl(l_db_assignment_rec.ass_attribute9, hr_api.g_varchar2))
3181     then
3182        i_changed:=TRUE;
3183     end if;
3184 end if;
3185 
3186 if (p_ass_attribute10 = hr_api.g_varchar2) then
3187     l_assignment_rec.ass_attribute10 :=
3188     l_old_assignment_rec.ass_attribute10;
3189     if (nvl(l_db_assignment_rec.ass_attribute10, hr_api.g_varchar2) <>
3190        nvl(l_old_assignment_rec.ass_attribute10, hr_api.g_varchar2))
3191     then
3192        others_changed:=TRUE;
3193     end if;
3194 else
3195     l_assignment_rec.ass_attribute10 := p_ass_attribute10;
3196     if (nvl(p_ass_attribute10, hr_api.g_varchar2) <>
3197        nvl(l_db_assignment_rec.ass_attribute10, hr_api.g_varchar2))
3198     then
3199        i_changed:=TRUE;
3200     end if;
3201 end if;
3202 
3203 if (p_ass_attribute11 = hr_api.g_varchar2) then
3204     l_assignment_rec.ass_attribute11 :=
3205     l_old_assignment_rec.ass_attribute11;
3206     if (nvl(l_db_assignment_rec.ass_attribute11, hr_api.g_varchar2) <>
3207        nvl(l_old_assignment_rec.ass_attribute11, hr_api.g_varchar2))
3208     then
3209        others_changed:=TRUE;
3210     end if;
3211 else
3212     l_assignment_rec.ass_attribute11 := p_ass_attribute11;
3213     if (nvl(p_ass_attribute11, hr_api.g_varchar2) <>
3214        nvl(l_db_assignment_rec.ass_attribute11, hr_api.g_varchar2))
3215     then
3216        i_changed:=TRUE;
3217     end if;
3218 end if;
3219 
3220 if (p_ass_attribute12 = hr_api.g_varchar2) then
3221     l_assignment_rec.ass_attribute12 :=
3222     l_old_assignment_rec.ass_attribute12;
3223     if (nvl(l_db_assignment_rec.ass_attribute12, hr_api.g_varchar2) <>
3224        nvl(l_old_assignment_rec.ass_attribute12, hr_api.g_varchar2))
3225     then
3226        others_changed:=TRUE;
3227     end if;
3228 else
3229     l_assignment_rec.ass_attribute12 := p_ass_attribute12;
3230     if (nvl(p_ass_attribute12, hr_api.g_varchar2) <>
3231        nvl(l_db_assignment_rec.ass_attribute12, hr_api.g_varchar2))
3232     then
3233        i_changed:=TRUE;
3234     end if;
3235 end if;
3236 
3237 if (p_ass_attribute13 = hr_api.g_varchar2) then
3238     l_assignment_rec.ass_attribute13 :=
3239     l_old_assignment_rec.ass_attribute13;
3240     if (nvl(l_db_assignment_rec.ass_attribute13, hr_api.g_varchar2) <>
3241        nvl(l_old_assignment_rec.ass_attribute13, hr_api.g_varchar2))
3242     then
3243        others_changed:=TRUE;
3244     end if;
3245 else
3246     l_assignment_rec.ass_attribute13 := p_ass_attribute13;
3247     if (nvl(p_ass_attribute13, hr_api.g_varchar2) <>
3248        nvl(l_db_assignment_rec.ass_attribute13, hr_api.g_varchar2))
3249     then
3250        i_changed:=TRUE;
3251     end if;
3252 end if;
3253 
3254 if (p_ass_attribute14 = hr_api.g_varchar2) then
3255     l_assignment_rec.ass_attribute14 :=
3256     l_old_assignment_rec.ass_attribute14;
3257     if (nvl(l_db_assignment_rec.ass_attribute14, hr_api.g_varchar2) <>
3258        nvl(l_old_assignment_rec.ass_attribute14, hr_api.g_varchar2))
3259     then
3260        others_changed:=TRUE;
3261     end if;
3262 else
3263     l_assignment_rec.ass_attribute14 := p_ass_attribute14;
3264     if (nvl(p_ass_attribute14, hr_api.g_varchar2) <>
3265        nvl(l_db_assignment_rec.ass_attribute14, hr_api.g_varchar2))
3266     then
3267        i_changed:=TRUE;
3268     end if;
3269 end if;
3270 
3271 if (p_ass_attribute15 = hr_api.g_varchar2) then
3272     l_assignment_rec.ass_attribute15 :=
3273     l_old_assignment_rec.ass_attribute15;
3274     if (nvl(l_db_assignment_rec.ass_attribute15, hr_api.g_varchar2) <>
3275        nvl(l_old_assignment_rec.ass_attribute15, hr_api.g_varchar2))
3276     then
3277        others_changed:=TRUE;
3278     end if;
3279 else
3280     l_assignment_rec.ass_attribute15 := p_ass_attribute15;
3281     if (nvl(p_ass_attribute15, hr_api.g_varchar2) <>
3282        nvl(l_db_assignment_rec.ass_attribute15, hr_api.g_varchar2))
3283     then
3284        i_changed:=TRUE;
3285     end if;
3286 end if;
3287 
3288 if (p_ass_attribute16 = hr_api.g_varchar2) then
3289     l_assignment_rec.ass_attribute16 :=
3290     l_old_assignment_rec.ass_attribute16;
3291     if (nvl(l_db_assignment_rec.ass_attribute16, hr_api.g_varchar2) <>
3292        nvl(l_old_assignment_rec.ass_attribute16, hr_api.g_varchar2))
3293     then
3294        others_changed:=TRUE;
3295     end if;
3296 else
3297     l_assignment_rec.ass_attribute16 := p_ass_attribute16;
3298     if (nvl(p_ass_attribute16, hr_api.g_varchar2) <>
3299        nvl(l_db_assignment_rec.ass_attribute16, hr_api.g_varchar2))
3300     then
3301        i_changed:=TRUE;
3302     end if;
3303 end if;
3304 
3305 if (p_ass_attribute17 = hr_api.g_varchar2) then
3306     l_assignment_rec.ass_attribute17 :=
3307     l_old_assignment_rec.ass_attribute17;
3308     if (nvl(l_db_assignment_rec.ass_attribute17, hr_api.g_varchar2) <>
3309        nvl(l_old_assignment_rec.ass_attribute17, hr_api.g_varchar2))
3310     then
3311        others_changed:=TRUE;
3312     end if;
3313 else
3314     l_assignment_rec.ass_attribute17 := p_ass_attribute17;
3315     if (nvl(p_ass_attribute17, hr_api.g_varchar2) <>
3316        nvl(l_db_assignment_rec.ass_attribute17, hr_api.g_varchar2))
3317     then
3318        i_changed:=TRUE;
3319     end if;
3320 end if;
3321 
3322 if (p_ass_attribute18 = hr_api.g_varchar2) then
3323     l_assignment_rec.ass_attribute18 :=
3324     l_old_assignment_rec.ass_attribute18;
3325     if (nvl(l_db_assignment_rec.ass_attribute18, hr_api.g_varchar2) <>
3326        nvl(l_old_assignment_rec.ass_attribute18, hr_api.g_varchar2))
3327     then
3328        others_changed:=TRUE;
3329     end if;
3330 else
3331     l_assignment_rec.ass_attribute18 := p_ass_attribute18;
3332     if (nvl(p_ass_attribute18, hr_api.g_varchar2) <>
3333        nvl(l_db_assignment_rec.ass_attribute18, hr_api.g_varchar2))
3334     then
3335        i_changed:=TRUE;
3336     end if;
3337 end if;
3338 
3339 if (p_ass_attribute19 = hr_api.g_varchar2) then
3340     l_assignment_rec.ass_attribute19 :=
3341     l_old_assignment_rec.ass_attribute19;
3342     if (nvl(l_db_assignment_rec.ass_attribute19, hr_api.g_varchar2) <>
3343        nvl(l_old_assignment_rec.ass_attribute19, hr_api.g_varchar2))
3344     then
3345        others_changed:=TRUE;
3346     end if;
3347 else
3348     l_assignment_rec.ass_attribute19 := p_ass_attribute19;
3349     if (nvl(p_ass_attribute19, hr_api.g_varchar2) <>
3350        nvl(l_db_assignment_rec.ass_attribute19, hr_api.g_varchar2))
3351     then
3352        i_changed:=TRUE;
3353     end if;
3354 end if;
3355 
3356 if (p_ass_attribute20 = hr_api.g_varchar2) then
3357     l_assignment_rec.ass_attribute20 :=
3358     l_old_assignment_rec.ass_attribute20;
3359     if (nvl(l_db_assignment_rec.ass_attribute20, hr_api.g_varchar2) <>
3360        nvl(l_old_assignment_rec.ass_attribute20, hr_api.g_varchar2))
3361     then
3362        others_changed:=TRUE;
3363     end if;
3364 else
3365     l_assignment_rec.ass_attribute20 := p_ass_attribute20;
3366     if (nvl(p_ass_attribute20, hr_api.g_varchar2) <>
3367        nvl(l_db_assignment_rec.ass_attribute20, hr_api.g_varchar2))
3368     then
3369        i_changed:=TRUE;
3370     end if;
3371 end if;
3372 
3373 if (p_ass_attribute21 = hr_api.g_varchar2) then
3374     l_assignment_rec.ass_attribute21 :=
3375     l_old_assignment_rec.ass_attribute21;
3376     if (nvl(l_db_assignment_rec.ass_attribute21, hr_api.g_varchar2) <>
3377        nvl(l_old_assignment_rec.ass_attribute21, hr_api.g_varchar2))
3378     then
3379        others_changed:=TRUE;
3380     end if;
3381 else
3382     l_assignment_rec.ass_attribute21 := p_ass_attribute21;
3383     if (nvl(p_ass_attribute21, hr_api.g_varchar2) <>
3384        nvl(l_db_assignment_rec.ass_attribute21, hr_api.g_varchar2))
3385     then
3386        i_changed:=TRUE;
3387     end if;
3388 end if;
3389 
3390 if (p_ass_attribute22 = hr_api.g_varchar2) then
3391     l_assignment_rec.ass_attribute22 :=
3392     l_old_assignment_rec.ass_attribute22;
3393     if (nvl(l_db_assignment_rec.ass_attribute22, hr_api.g_varchar2) <>
3394        nvl(l_old_assignment_rec.ass_attribute22, hr_api.g_varchar2))
3395     then
3396        others_changed:=TRUE;
3397     end if;
3398 else
3399     l_assignment_rec.ass_attribute22 := p_ass_attribute22;
3400     if (nvl(p_ass_attribute22, hr_api.g_varchar2) <>
3401        nvl(l_db_assignment_rec.ass_attribute22, hr_api.g_varchar2))
3402     then
3403        i_changed:=TRUE;
3404     end if;
3405 end if;
3406 
3407 if (p_ass_attribute23 = hr_api.g_varchar2) then
3408     l_assignment_rec.ass_attribute23 :=
3409     l_old_assignment_rec.ass_attribute23;
3410     if (nvl(l_db_assignment_rec.ass_attribute23, hr_api.g_varchar2) <>
3411        nvl(l_old_assignment_rec.ass_attribute23, hr_api.g_varchar2))
3412     then
3413        others_changed:=TRUE;
3414     end if;
3415 else
3416     l_assignment_rec.ass_attribute23 := p_ass_attribute23;
3417     if (nvl(p_ass_attribute23, hr_api.g_varchar2) <>
3418        nvl(l_db_assignment_rec.ass_attribute23, hr_api.g_varchar2))
3419     then
3420        i_changed:=TRUE;
3421     end if;
3422 end if;
3423 
3424 if (p_ass_attribute24 = hr_api.g_varchar2) then
3425     l_assignment_rec.ass_attribute24 :=
3426     l_old_assignment_rec.ass_attribute24;
3427     if (nvl(l_db_assignment_rec.ass_attribute24, hr_api.g_varchar2) <>
3428        nvl(l_old_assignment_rec.ass_attribute24, hr_api.g_varchar2))
3429     then
3430        others_changed:=TRUE;
3431     end if;
3432 else
3433     l_assignment_rec.ass_attribute24 := p_ass_attribute24;
3434     if (nvl(p_ass_attribute24, hr_api.g_varchar2) <>
3435        nvl(l_db_assignment_rec.ass_attribute24, hr_api.g_varchar2))
3436     then
3437        i_changed:=TRUE;
3438     end if;
3439 end if;
3440 
3441 if (p_ass_attribute25 = hr_api.g_varchar2) then
3442     l_assignment_rec.ass_attribute25 :=
3443     l_old_assignment_rec.ass_attribute25;
3444     if (nvl(l_db_assignment_rec.ass_attribute25, hr_api.g_varchar2) <>
3445        nvl(l_old_assignment_rec.ass_attribute25, hr_api.g_varchar2))
3446     then
3447        others_changed:=TRUE;
3448     end if;
3449 else
3450     l_assignment_rec.ass_attribute25 := p_ass_attribute25;
3451     if (nvl(p_ass_attribute25, hr_api.g_varchar2) <>
3452        nvl(l_db_assignment_rec.ass_attribute25, hr_api.g_varchar2))
3453     then
3454        i_changed:=TRUE;
3455     end if;
3456 end if;
3457 
3458 if (p_ass_attribute26 = hr_api.g_varchar2) then
3459     l_assignment_rec.ass_attribute26 :=
3460     l_old_assignment_rec.ass_attribute26;
3461     if (nvl(l_db_assignment_rec.ass_attribute26, hr_api.g_varchar2) <>
3462        nvl(l_old_assignment_rec.ass_attribute26, hr_api.g_varchar2))
3463     then
3464        others_changed:=TRUE;
3465     end if;
3466 else
3467     l_assignment_rec.ass_attribute26 := p_ass_attribute26;
3468     if (nvl(p_ass_attribute26, hr_api.g_varchar2) <>
3469        nvl(l_db_assignment_rec.ass_attribute26, hr_api.g_varchar2))
3470     then
3471        i_changed:=TRUE;
3472     end if;
3473 end if;
3474 
3475 if (p_ass_attribute27 = hr_api.g_varchar2) then
3476     l_assignment_rec.ass_attribute27 :=
3477     l_old_assignment_rec.ass_attribute27;
3478     if (nvl(l_db_assignment_rec.ass_attribute27, hr_api.g_varchar2) <>
3479        nvl(l_old_assignment_rec.ass_attribute27, hr_api.g_varchar2))
3480     then
3481        others_changed:=TRUE;
3482     end if;
3483 else
3484     l_assignment_rec.ass_attribute27 := p_ass_attribute27;
3485     if (nvl(p_ass_attribute27, hr_api.g_varchar2) <>
3486        nvl(l_db_assignment_rec.ass_attribute27, hr_api.g_varchar2))
3487     then
3488        i_changed:=TRUE;
3489     end if;
3490 end if;
3491 
3492 if (p_ass_attribute28 = hr_api.g_varchar2) then
3493     l_assignment_rec.ass_attribute28 :=
3494     l_old_assignment_rec.ass_attribute28;
3495     if (nvl(l_db_assignment_rec.ass_attribute28, hr_api.g_varchar2) <>
3496        nvl(l_old_assignment_rec.ass_attribute28, hr_api.g_varchar2))
3497     then
3498        others_changed:=TRUE;
3499     end if;
3500 else
3501     l_assignment_rec.ass_attribute28 := p_ass_attribute28;
3502     if (nvl(p_ass_attribute28, hr_api.g_varchar2) <>
3503        nvl(l_db_assignment_rec.ass_attribute28, hr_api.g_varchar2))
3504     then
3505        i_changed:=TRUE;
3506     end if;
3507 end if;
3508 
3509 if (p_ass_attribute29 = hr_api.g_varchar2) then
3510     l_assignment_rec.ass_attribute29 :=
3511     l_old_assignment_rec.ass_attribute29;
3512     if (nvl(l_db_assignment_rec.ass_attribute29, hr_api.g_varchar2) <>
3513        nvl(l_old_assignment_rec.ass_attribute29, hr_api.g_varchar2))
3514     then
3515        others_changed:=TRUE;
3516     end if;
3517 else
3518     l_assignment_rec.ass_attribute29 := p_ass_attribute29;
3519     if (nvl(p_ass_attribute29, hr_api.g_varchar2) <>
3520        nvl(l_db_assignment_rec.ass_attribute29, hr_api.g_varchar2))
3521     then
3522        i_changed:=TRUE;
3523     end if;
3524 end if;
3525 
3526 if (p_ass_attribute30 = hr_api.g_varchar2) then
3527     l_assignment_rec.ass_attribute30 :=
3528     l_old_assignment_rec.ass_attribute30;
3529     if (nvl(l_db_assignment_rec.ass_attribute30, hr_api.g_varchar2) <>
3530        nvl(l_old_assignment_rec.ass_attribute30, hr_api.g_varchar2))
3531     then
3532        others_changed:=TRUE;
3533     end if;
3534 else
3535     l_assignment_rec.ass_attribute30 := p_ass_attribute30;
3536     if (nvl(p_ass_attribute30, hr_api.g_varchar2) <>
3537        nvl(l_db_assignment_rec.ass_attribute30, hr_api.g_varchar2))
3538     then
3539        i_changed:=TRUE;
3540     end if;
3541 end if;
3542 
3543 open csr_pgp_segments(l_db_assignment_rec.people_group_id);
3544 fetch csr_pgp_segments into l_people_groups;
3545 close csr_pgp_segments;
3546 
3547 if (l_people_groups.segment1 is null and l_people_groups.segment2 is null and
3548     l_people_groups.segment3 is null and l_people_groups.segment4 is null and
3549     l_people_groups.segment5 is null and l_people_groups.segment6 is null and
3550     l_people_groups.segment7 is null and l_people_groups.segment8 is null and
3551     l_people_groups.segment9 is null and l_people_groups.segment10 is null and
3552     l_people_groups.segment11 is null and l_people_groups.segment12 is null and
3553     l_people_groups.segment13 is null and l_people_groups.segment14 is null and
3554     l_people_groups.segment15 is null and l_people_groups.segment16 is null and
3555     l_people_groups.segment17 is null and l_people_groups.segment18 is null and
3556     l_people_groups.segment19 is null and l_people_groups.segment20 is null and
3557     l_people_groups.segment21 is null and l_people_groups.segment22 is null and
3558     l_people_groups.segment23 is null and l_people_groups.segment24 is null and
3559     l_people_groups.segment25 is null and l_people_groups.segment26 is null and
3560     l_people_groups.segment27 is null and l_people_groups.segment28 is null and
3561     l_people_groups.segment29 is null and l_people_groups.segment30 is null) then
3562   all_pgp_null := 'Y';
3563 end if;
3564 
3565 if (p_people_group_id = hr_api.g_number) then
3566     l_assignment_rec.people_group_id :=
3567     l_old_assignment_rec.people_group_id;
3568   if (l_old_assignment_rec.people_group_id is not null OR all_pgp_null = 'N') then
3569     if nvl(l_old_assignment_rec.people_group_id, hr_api.g_number)
3570        <> nvl(l_db_assignment_rec.people_group_id, hr_api.g_number)
3571     then
3572        others_changed:=TRUE;
3573     end if;
3574   end if;
3575 else
3576     l_assignment_rec.people_group_id := p_people_group_id;
3577   if (p_people_group_id is not null OR all_pgp_null = 'N') then
3578     if (nvl(p_people_group_id, -1)
3579        <> nvl(l_db_assignment_rec.people_group_id,-1))
3580     then
3581        i_changed:=TRUE;
3582     end if;
3583   end if;
3584 end if;
3585 
3586 open csr_scl_segments(l_db_assignment_rec.soft_coding_keyflex_id);
3587 fetch csr_scl_segments into l_soft_coding_keyflex;
3588 close csr_scl_segments;
3589 
3590 if (l_soft_coding_keyflex.segment1 is null and l_soft_coding_keyflex.segment2 is null and
3591     l_soft_coding_keyflex.segment3 is null and l_soft_coding_keyflex.segment4 is null and
3592     l_soft_coding_keyflex.segment5 is null and l_soft_coding_keyflex.segment6 is null and
3593     l_soft_coding_keyflex.segment7 is null and l_soft_coding_keyflex.segment8 is null and
3594     l_soft_coding_keyflex.segment9 is null and l_soft_coding_keyflex.segment10 is null and
3595     l_soft_coding_keyflex.segment11 is null and l_soft_coding_keyflex.segment12 is null and
3596     l_soft_coding_keyflex.segment13 is null and l_soft_coding_keyflex.segment14 is null and
3597     l_soft_coding_keyflex.segment15 is null and l_soft_coding_keyflex.segment16 is null and
3598     l_soft_coding_keyflex.segment17 is null and l_soft_coding_keyflex.segment18 is null and
3599     l_soft_coding_keyflex.segment19 is null and l_soft_coding_keyflex.segment20 is null and
3600     l_soft_coding_keyflex.segment21 is null and l_soft_coding_keyflex.segment22 is null and
3601     l_soft_coding_keyflex.segment23 is null and l_soft_coding_keyflex.segment24 is null and
3602     l_soft_coding_keyflex.segment25 is null and l_soft_coding_keyflex.segment26 is null and
3603     l_soft_coding_keyflex.segment27 is null and l_soft_coding_keyflex.segment28 is null and
3604     l_soft_coding_keyflex.segment29 is null and l_soft_coding_keyflex.segment30 is null) then
3605   all_scl_null := 'Y';
3606 end if;
3607 
3608 if (p_soft_coding_keyflex_id = hr_api.g_number) then
3609     l_assignment_rec.soft_coding_keyflex_id :=
3610     l_old_assignment_rec.soft_coding_keyflex_id;
3611   if (l_old_assignment_rec.soft_coding_keyflex_id is not null OR all_scl_null = 'N') then
3612     if nvl(l_old_assignment_rec.soft_coding_keyflex_id, hr_api.g_number)
3613        <> nvl(l_db_assignment_rec.soft_coding_keyflex_id, hr_api.g_number)
3614     then
3615        others_changed:=TRUE;
3616     end if;
3617   end if;
3618 else
3619     l_assignment_rec.soft_coding_keyflex_id := p_soft_coding_keyflex_id;
3620   if (p_soft_coding_keyflex_id is not null OR all_scl_null = 'N') then
3621     if (nvl(p_soft_coding_keyflex_id, -1)
3622        <> nvl(l_db_assignment_rec.soft_coding_keyflex_id,-1))
3623     then
3624        i_changed:=TRUE;
3625     end if;
3626   end if;
3627 end if;
3628 
3629 if (p_sal_review_period_frequency = hr_api.g_varchar2) then
3630     l_assignment_rec.sal_review_period_frequency :=
3631     l_old_assignment_rec.sal_review_period_frequency;
3632     if (nvl(l_db_assignment_rec.sal_review_period_frequency, hr_api.g_varchar2)
3633        <>
3634        nvl(l_old_assignment_rec.sal_review_period_frequency, hr_api.g_varchar2))
3635     then
3636        others_changed:=TRUE;
3637     end if;
3638 else
3639     l_assignment_rec.sal_review_period_frequency :=
3640                 p_sal_review_period_frequency;
3641     if (nvl(p_sal_review_period_frequency, hr_api.g_varchar2) <>
3642        nvl(l_db_assignment_rec.sal_review_period_frequency, hr_api.g_varchar2))
3643     then
3644        i_changed:=TRUE;
3645     end if;
3646 end if;
3647 
3648 if (p_sal_review_period = hr_api.g_number) then
3649     l_assignment_rec.sal_review_period :=
3650     l_old_assignment_rec.sal_review_period;
3651     if nvl(l_old_assignment_rec.sal_review_period, hr_api.g_number)
3652        <> nvl(l_db_assignment_rec.sal_review_period, hr_api.g_number)
3653     then
3654        others_changed:=TRUE;
3655     end if;
3656 else
3657     l_assignment_rec.sal_review_period := p_sal_review_period;
3658     if (nvl(p_sal_review_period, -1) <>
3659          nvl(l_db_assignment_rec.sal_review_period,-1))
3660     then
3661        i_changed:=TRUE;
3662     end if;
3663 end if;
3664 
3665 if (p_probation_period = hr_api.g_number) then
3666     l_assignment_rec.probation_period :=
3667     l_old_assignment_rec.probation_period;
3668     if nvl(l_old_assignment_rec.probation_period, hr_api.g_number)
3669        <> nvl(l_db_assignment_rec.probation_period, hr_api.g_number)
3670     then
3671        others_changed:=TRUE;
3672     end if;
3673 else
3674     l_assignment_rec.probation_period := p_probation_period;
3675     if (nvl(p_probation_period, -1) <>
3676          nvl(l_db_assignment_rec.probation_period,-1))
3677     then
3678        i_changed:=TRUE;
3679     end if;
3680 end if;
3681 
3682 if (to_char(p_date_probation_end) = to_char(hr_api.g_date)) then
3683     l_assignment_rec.date_probation_end :=
3684     l_old_assignment_rec.date_probation_end;
3685 
3686     if (nvl(l_db_assignment_rec.date_probation_end, hr_api.g_date)
3687        <>
3688        nvl(l_old_assignment_rec.date_probation_end, hr_api.g_date))
3689     then
3690        others_changed:=TRUE;
3691     end if;
3692 else
3693     l_assignment_rec.date_probation_end :=
3694                 p_date_probation_end;
3695     if (nvl(p_date_probation_end, hr_api.g_date) <>
3696        nvl(l_db_assignment_rec.date_probation_end, hr_api.g_date))
3697     then
3698        i_changed:=TRUE;
3699     end if;
3700 end if;
3701 
3702 if (p_probation_unit = hr_api.g_varchar2) then
3703     l_assignment_rec.probation_unit :=
3704     l_old_assignment_rec.probation_unit;
3705     if (nvl(l_db_assignment_rec.probation_unit, hr_api.g_varchar2)
3706        <>
3707        nvl(l_old_assignment_rec.probation_unit, hr_api.g_varchar2))
3708     then
3709        others_changed:=TRUE;
3710     end if;
3711 else
3712     l_assignment_rec.probation_unit :=
3713                 p_probation_unit;
3714     if (nvl(p_probation_unit, hr_api.g_varchar2) <>
3715        nvl(l_db_assignment_rec.probation_unit, hr_api.g_varchar2))
3716     then
3717        i_changed:=TRUE;
3718     end if;
3719 end if;
3720 
3721 if (p_notice_period = hr_api.g_number) then
3722     l_assignment_rec.notice_period :=
3723     l_old_assignment_rec.notice_period;
3724     if nvl(l_old_assignment_rec.notice_period, hr_api.g_number)
3725        <> nvl(l_db_assignment_rec.notice_period, hr_api.g_number)
3726     then
3727        others_changed:=TRUE;
3728     end if;
3729 else
3730     l_assignment_rec.notice_period := p_notice_period;
3731     if (nvl(p_notice_period, -1) <>
3732          nvl(l_db_assignment_rec.notice_period,-1))
3733     then
3734        i_changed:=TRUE;
3735     end if;
3736 end if;
3737 
3738 if (p_notice_period_uom = hr_api.g_varchar2) then
3739     l_assignment_rec.notice_period_uom :=
3740     l_old_assignment_rec.notice_period_uom;
3741     if (nvl(l_db_assignment_rec.notice_period_uom, hr_api.g_varchar2)
3742        <>
3743        nvl(l_old_assignment_rec.notice_period_uom, hr_api.g_varchar2))
3744     then
3745        others_changed:=TRUE;
3746     end if;
3747 else
3748     l_assignment_rec.notice_period_uom :=
3749                 p_notice_period_uom;
3750     if (nvl(p_notice_period_uom, hr_api.g_varchar2) <>
3751        nvl(l_db_assignment_rec.notice_period_uom, hr_api.g_varchar2))
3752     then
3753        i_changed:=TRUE;
3754     end if;
3755 end if;
3756 
3757 if (p_employee_category = hr_api.g_varchar2) then
3758     l_assignment_rec.employee_category :=
3759     l_old_assignment_rec.employee_category;
3760     if (nvl(l_db_assignment_rec.employee_category, hr_api.g_varchar2)
3761        <>
3762        nvl(l_old_assignment_rec.employee_category, hr_api.g_varchar2))
3763     then
3764        others_changed:=TRUE;
3765     end if;
3766 else
3767     l_assignment_rec.employee_category :=
3768                 p_employee_category;
3769     if (nvl(p_employee_category, hr_api.g_varchar2) <>
3770        nvl(l_db_assignment_rec.employee_category, hr_api.g_varchar2))
3771     then
3772        i_changed:=TRUE;
3773     end if;
3774 end if;
3775 
3776 if (p_work_at_home = hr_api.g_varchar2) then
3777     l_assignment_rec.work_at_home :=
3778     l_old_assignment_rec.work_at_home;
3779     if (nvl(l_db_assignment_rec.work_at_home, hr_api.g_varchar2)
3780        <>
3781        nvl(l_old_assignment_rec.work_at_home, hr_api.g_varchar2))
3782     then
3783        others_changed:=TRUE;
3784     end if;
3785 else
3786     l_assignment_rec.work_at_home :=
3787                 p_work_at_home;
3788     if (nvl(p_work_at_home, hr_api.g_varchar2) <>
3789        nvl(l_db_assignment_rec.work_at_home, hr_api.g_varchar2))
3790     then
3791        i_changed:=TRUE;
3792     end if;
3793 end if;
3794 
3795 if (p_job_post_source_name = hr_api.g_varchar2) then
3796     l_assignment_rec.job_post_source_name :=
3797     l_old_assignment_rec.job_post_source_name;
3798     if (nvl(l_db_assignment_rec.job_post_source_name, hr_api.g_varchar2)
3799        <>
3800        nvl(l_old_assignment_rec.job_post_source_name, hr_api.g_varchar2))
3801     then
3802        others_changed:=TRUE;
3803     end if;
3804 else
3805     l_assignment_rec.job_post_source_name :=
3806                 p_job_post_source_name;
3807     if (nvl(p_job_post_source_name, hr_api.g_varchar2) <>
3808        nvl(l_db_assignment_rec.job_post_source_name, hr_api.g_varchar2))
3809     then
3810        i_changed:=TRUE;
3811     end if;
3812 end if;
3813 
3814 if (p_title = hr_api.g_varchar2) then
3815     l_assignment_rec.title :=
3816     l_old_assignment_rec.title;
3817     if nvl(l_old_assignment_rec.title, hr_api.g_varchar2)
3818        <> nvl(l_db_assignment_rec.title, hr_api.g_varchar2)
3819     then
3820        others_changed:=TRUE;
3821     end if;
3822 else
3823     l_assignment_rec.title := p_title;
3824     if (nvl(p_title, -1) <>
3825          nvl(l_db_assignment_rec.title,-1))
3826     then
3827        i_changed:=TRUE;
3828     end if;
3829 end if;
3830 
3831 if (p_project_title = hr_api.g_varchar2) then
3832     l_assignment_rec.project_title :=
3833     l_old_assignment_rec.project_title;
3834     if nvl(l_old_assignment_rec.project_title, hr_api.g_varchar2)
3835        <> nvl(l_db_assignment_rec.project_title, hr_api.g_varchar2)
3836     then
3837        others_changed:=TRUE;
3838     end if;
3839 else
3840     l_assignment_rec.project_title := p_project_title;
3841     if (nvl(p_project_title, -1) <>
3842          nvl(l_db_assignment_rec.project_title,-1))
3843     then
3844        i_changed:=TRUE;
3845     end if;
3846 end if;
3847 
3848 if (p_source_type = hr_api.g_varchar2) then
3849     l_assignment_rec.source_type :=
3850     l_old_assignment_rec.source_type;
3851     if nvl(l_old_assignment_rec.source_type, hr_api.g_varchar2)
3852        <> nvl(l_db_assignment_rec.source_type, hr_api.g_varchar2)
3853     then
3854        others_changed:=TRUE;
3855     end if;
3856 else
3857     l_assignment_rec.source_type := p_source_type;
3858     if (nvl(p_source_type, -1) <>
3859          nvl(l_db_assignment_rec.source_type,-1))
3860     then
3861        i_changed:=TRUE;
3862     end if;
3863 end if;
3864 
3865 if (p_vendor_assignment_number = hr_api.g_varchar2) then
3866     l_assignment_rec.vendor_assignment_number :=
3867     l_old_assignment_rec.vendor_assignment_number;
3868     if nvl(l_old_assignment_rec.vendor_assignment_number, hr_api.g_varchar2)
3869        <> nvl(l_db_assignment_rec.vendor_assignment_number, hr_api.g_varchar2)
3870     then
3871        others_changed:=TRUE;
3872     end if;
3873 else
3874     l_assignment_rec.vendor_assignment_number := p_vendor_assignment_number;
3875     if (nvl(p_vendor_assignment_number, -1) <>
3876          nvl(l_db_assignment_rec.vendor_assignment_number,-1))
3877     then
3878        i_changed:=TRUE;
3879     end if;
3880 end if;
3881 
3882 if (p_vendor_employee_number = hr_api.g_varchar2) then
3883     l_assignment_rec.vendor_employee_number :=
3884     l_old_assignment_rec.vendor_employee_number;
3885     if nvl(l_old_assignment_rec.vendor_employee_number, hr_api.g_varchar2)
3886        <> nvl(l_db_assignment_rec.vendor_employee_number, hr_api.g_varchar2)
3887     then
3888        others_changed:=TRUE;
3889     end if;
3890 else
3891     l_assignment_rec.vendor_employee_number := p_vendor_employee_number;
3892     if (nvl(p_vendor_employee_number, -1) <>
3893          nvl(l_db_assignment_rec.vendor_employee_number,-1))
3894     then
3895        i_changed:=TRUE;
3896     end if;
3897 end if;
3898 
3899 if (p_default_code_comb_id = hr_api.g_number) then
3900     l_assignment_rec.default_code_comb_id :=
3901     l_old_assignment_rec.default_code_comb_id;
3902     if nvl(l_old_assignment_rec.default_code_comb_id, hr_api.g_number)
3903        <> nvl(l_db_assignment_rec.default_code_comb_id, hr_api.g_number)
3904     then
3905        others_changed:=TRUE;
3906     end if;
3907 else
3908     l_assignment_rec.default_code_comb_id := p_default_code_comb_id;
3909     if (nvl(p_default_code_comb_id, -1) <>
3910          nvl(l_db_assignment_rec.default_code_comb_id,-1))
3911     then
3912        i_changed:=TRUE;
3913     end if;
3914 end if;
3915 
3916 if (p_set_of_books_id = hr_api.g_number) then
3917     l_assignment_rec.set_of_books_id :=
3918     l_old_assignment_rec.set_of_books_id;
3919     if nvl(l_old_assignment_rec.set_of_books_id, hr_api.g_number)
3920        <> nvl(l_db_assignment_rec.set_of_books_id, hr_api.g_number)
3921     then
3922        others_changed:=TRUE;
3923     end if;
3924 else
3925     l_assignment_rec.set_of_books_id := p_set_of_books_id;
3926     if (nvl(p_set_of_books_id, -1) <>
3927          nvl(l_db_assignment_rec.set_of_books_id,-1))
3928     then
3929        i_changed:=TRUE;
3930     end if;
3931 end if;
3932 
3933 if (p_vendor_id = hr_api.g_number) then
3934     l_assignment_rec.vendor_id :=
3935     l_old_assignment_rec.vendor_id;
3936     if nvl(l_old_assignment_rec.vendor_id, hr_api.g_number)
3937        <> nvl(l_db_assignment_rec.vendor_id, hr_api.g_number)
3938     then
3939        others_changed:=TRUE;
3940     end if;
3941 else
3942     l_assignment_rec.vendor_id := p_vendor_id;
3943     if (nvl(p_vendor_id, -1) <>
3944          nvl(l_db_assignment_rec.vendor_id,-1))
3945     then
3946        i_changed:=TRUE;
3947     end if;
3948 end if;
3949 
3950 
3951 if (p_po_header_id = hr_api.g_number) then
3952     l_assignment_rec.po_header_id :=
3953     l_old_assignment_rec.po_header_id;
3954     if nvl(l_old_assignment_rec.po_header_id, hr_api.g_number)
3955        <> nvl(l_db_assignment_rec.po_header_id, hr_api.g_number)
3956     then
3957        others_changed:=TRUE;
3958     end if;
3959 else
3960     l_assignment_rec.po_header_id := p_po_header_id;
3961     if (nvl(p_po_header_id, -1) <>
3962          nvl(l_db_assignment_rec.po_header_id,-1))
3963     then
3964        i_changed:=TRUE;
3965     end if;
3966 end if;
3967 
3968 if (p_po_line_id = hr_api.g_number) then
3969     l_assignment_rec.po_line_id :=
3970     l_old_assignment_rec.po_line_id;
3971     if nvl(l_old_assignment_rec.po_line_id, hr_api.g_number)
3972        <> nvl(l_db_assignment_rec.po_line_id, hr_api.g_number)
3973     then
3974        others_changed:=TRUE;
3975     end if;
3976 else
3977     l_assignment_rec.po_line_id := p_po_line_id;
3978     if (nvl(p_po_line_id, -1) <>
3979          nvl(l_db_assignment_rec.po_line_id,-1))
3980     then
3981        i_changed:=TRUE;
3982     end if;
3983 end if;
3984 
3985 if (p_vendor_site_id = hr_api.g_number) then
3986     l_assignment_rec.vendor_site_id :=
3987     l_old_assignment_rec.vendor_site_id;
3988     if nvl(l_old_assignment_rec.vendor_site_id, hr_api.g_number)
3989        <> nvl(l_db_assignment_rec.vendor_site_id, hr_api.g_number)
3990     then
3991        others_changed:=TRUE;
3992     end if;
3993 else
3994     l_assignment_rec.vendor_site_id := p_vendor_site_id;
3995     if (nvl(p_vendor_site_id, -1) <>
3996          nvl(l_db_assignment_rec.vendor_site_id,-1))
3997     then
3998        i_changed:=TRUE;
3999     end if;
4000 end if;
4001 
4002 
4003 if (p_proj_asgn_end = g_canonical_date) then
4004     l_assignment_rec.projected_assignment_end :=
4005     l_old_assignment_rec.projected_assignment_end;
4006     if (nvl(l_db_assignment_rec.projected_assignment_end, g_canonical_date)
4007        <>
4008        nvl(l_old_assignment_rec.projected_assignment_end, g_canonical_date))
4009     then
4010        others_changed:=TRUE;
4011     end if;
4012 else
4013     l_assignment_rec.projected_assignment_end :=
4014                 p_proj_asgn_end;
4015     if (nvl(p_proj_asgn_end,g_canonical_date) <>
4016        nvl(l_db_assignment_rec.projected_assignment_end,g_canonical_date))
4017     then
4018        i_changed:=TRUE;
4019     end if;
4020 end if;
4021 
4022 -- the following 2 fields are planed for sshr 5.2.
4023 -- We will enable it later.
4024 
4025 -- GSP change
4026 if (p_grade_ladder_pgm_id = hr_api.g_number) then
4027     l_assignment_rec.grade_ladder_pgm_id :=
4028     l_old_assignment_rec.grade_ladder_pgm_id;
4029     if nvl(l_old_assignment_rec.grade_ladder_pgm_id, hr_api.g_number)
4030        <> nvl(l_db_assignment_rec.grade_ladder_pgm_id, hr_api.g_number)
4031     then
4032        --lb_grade_ladder_changed := true;
4033        others_changed:=TRUE;
4034     end if;
4035 else
4036     l_assignment_rec.grade_ladder_pgm_id := p_grade_ladder_pgm_id;
4037     if (nvl(p_grade_ladder_pgm_id, -1) <>
4038          nvl(l_db_assignment_rec.grade_ladder_pgm_id,-1))
4039     then
4040        --lb_grade_ladder_changed := true;
4041        i_changed:=TRUE;
4042     end if;
4043 end if;
4044 --End of GSP change
4045 
4046 --if (p_supervisor_assignment_id = hr_api.g_number) then
4047 --    l_assignment_rec.supervisor_assignment_id :=
4048 --    l_old_assignment_rec.supervisor_assignment_id;
4049 --    if nvl(l_old_assignment_rec.supervisor_assignment_id, hr_api.g_number)
4050 --       <> nvl(l_db_assignment_rec.supervisor_assignment_id, hr_api.g_number)
4051 --    then
4052 --       others_changed:=TRUE;
4053 --    end if;
4054 --else
4055 --    l_assignment_rec.supervisor_assignment_id := p_supervisor_assignment_id;
4056 --    if (nvl(p_supervisor_assignment_id, -1) <>
4057 --         nvl(l_db_assignment_rec.supervisor_assignment_id,-1))
4058 --    then
4059 --       i_changed:=TRUE;
4060 --    end if;
4061 --end if;
4062 
4063 if (p_assignment_type = hr_api.g_varchar2) then
4064     l_assignment_rec.assignment_type :=
4065     l_old_assignment_rec.assignment_type;
4066     if nvl(l_old_assignment_rec.assignment_type, hr_api.g_varchar2)
4067        <> nvl(l_db_assignment_rec.assignment_type, hr_api.g_varchar2)
4068     then
4069        others_changed:=TRUE;
4070     end if;
4071 else
4072     l_assignment_rec.assignment_type := p_assignment_type;
4073     if (nvl(p_assignment_type, -1) <>
4074          nvl(l_db_assignment_rec.assignment_type,-1))
4075     then
4076        i_changed:=TRUE;
4077     end if;
4078 end if;
4079 
4080 if (p_perf_review_period = hr_api.g_number) then
4081     l_assignment_rec.perf_review_period :=
4082     l_old_assignment_rec.perf_review_period;
4083     if nvl(l_old_assignment_rec.perf_review_period, hr_api.g_number)
4084        <> nvl(l_db_assignment_rec.perf_review_period, hr_api.g_number)
4085     then
4086        others_changed:=TRUE;
4087     end if;
4088 else
4089     l_assignment_rec.perf_review_period := p_perf_review_period;
4090     if (nvl(p_perf_review_period, -1) <>
4091          nvl(l_db_assignment_rec.perf_review_period,-1))
4092     then
4093        i_changed:=TRUE;
4094     end if;
4095 end if;
4096 
4097 if (p_perf_review_period_frequency = hr_api.g_varchar2) then
4098     l_assignment_rec.perf_review_period_frequency :=
4099     l_old_assignment_rec.perf_review_period_frequency;
4100     if (nvl(l_db_assignment_rec.perf_review_period_frequency, hr_api.g_varchar2)
4101        <>
4102       nvl(l_old_assignment_rec.perf_review_period_frequency, hr_api.g_varchar2))
4103     then
4104        others_changed:=TRUE;
4105     end if;
4106 else
4107     l_assignment_rec.perf_review_period_frequency :=
4108                 p_perf_review_period_frequency;
4109     if (nvl(p_perf_review_period_frequency, hr_api.g_varchar2) <>
4110        nvl(l_db_assignment_rec.perf_review_period_frequency, hr_api.g_varchar2))
4111     then
4112        i_changed:=TRUE;
4113     end if;
4114 end if;
4115 
4116 if (p_internal_address_line = hr_api.g_varchar2) then
4117     l_assignment_rec.internal_address_line :=
4118     l_old_assignment_rec.internal_address_line;
4119     if (nvl(l_db_assignment_rec.internal_address_line, hr_api.g_varchar2)
4120        <>
4121        nvl(l_old_assignment_rec.internal_address_line, hr_api.g_varchar2))
4122     then
4123        others_changed:=TRUE;
4124     end if;
4125 else
4126     l_assignment_rec.internal_address_line :=
4127                 p_internal_address_line;
4128     if (nvl(p_internal_address_line, hr_api.g_varchar2) <>
4129        nvl(l_db_assignment_rec.internal_address_line, hr_api.g_varchar2))
4130     then
4131        i_changed:=TRUE;
4132     end if;
4133 end if;
4134 
4135 if (p_payroll_id = hr_api.g_number) then
4136     l_assignment_rec.payroll_id :=
4137     l_old_assignment_rec.payroll_id;
4138     if nvl(l_old_assignment_rec.payroll_id, hr_api.g_number)
4139        <> nvl(l_db_assignment_rec.payroll_id, hr_api.g_number)
4140     then
4141        others_changed:=TRUE;
4142     end if;
4143 else
4144     l_assignment_rec.payroll_id := p_payroll_id;
4145     if (nvl(p_payroll_id, -1) <> nvl(l_db_assignment_rec.payroll_id,-1))
4146     then
4147        i_changed:=TRUE;
4148     end if;
4149 end if;
4150 
4151 -- 04/12/02 Salary Basis Enhancement Change Begins
4152 -- IF payroll is installed and the payroll_id is null, we need to issue an
4153 -- error message when a salary basis is changed because we cannot derive the
4154 -- mid pay period which needs the payroll_id to access the per_time_periods
4155 -- table.
4156 l_legislation_code := hr_misc_web.get_legislation_code
4157                        (p_assignment_id => l_assignment_id);
4158 
4159 if (p_pay_basis_id = hr_api.g_number) then
4160     l_assignment_rec.pay_basis_id :=
4161     l_old_assignment_rec.pay_basis_id;
4162     if nvl(l_old_assignment_rec.pay_basis_id, hr_api.g_number)
4163        <> nvl(l_db_assignment_rec.pay_basis_id, hr_api.g_number)
4164     then
4165        -- 05/14/02 - Bug 2374140 Fix Begins
4166        -- Removed the code to set the WF item attribute HR_MID_PAY_PERIOD_CHANGE
4167        -- here.  Instead, we'll set it in the Approvals process when a trans
4168        -- is submitted.
4169        -- The reason is that if we set it here, in a Save For Later transaction
4170        -- where the user stopped at the Pay Rate page and change the effective
4171        -- date on re-entry of the SFL transaction, this item attribute will not
4172        -- be reset because the Assignment page will not be relaunched.  Only the
4173        -- Pay Rate page will be relaunched.  Yet, we cannot set it in the
4174        -- Pay Rate page because if there is any module comes after Pay Rate
4175        -- in the chained process, this same problem will occur in a SFL if the
4176        -- user last stopped at the page which comes after Pay Rate and changes
4177        -- the effective date on a reentry of the SFL transaction.
4178 
4179        others_changed:=TRUE;
4180     end if;
4181 else
4182     l_assignment_rec.pay_basis_id := p_pay_basis_id;
4183     if (nvl(p_pay_basis_id, -1) <> nvl(l_db_assignment_rec.pay_basis_id,-1))
4184     then
4185        -- 05/14/02 - Bug 2374140 Fix Begins
4186        -- Removed the code to set the WF item attribute HR_MID_PAY_PERIOD_CHANGE
4187        -- here.  Instead, we'll set it in the Approvals process when a trans
4188        -- is submitted.
4189        -- The reason is that if we set it here, in a Save For Later transaction
4190        -- where the user stopped at the Pay Rate page and change the effective
4191        -- date on re-entry of the SFL transaction, this item attribute will not
4192        -- be reset because the Assignment page will not be relaunched.  Only the
4193        -- Pay Rate page will be relaunched.  Yet, we cannot set it in the
4194        -- Pay Rate page because if there is any module comes after Pay Rate
4195        -- in the chained process, this same problem will occur in a SFL if the
4196        -- user last stopped at the page which comes after Pay Rate and changes
4197        -- the effective date on a reentry of the SFL transaction.
4198 
4199        i_changed:=TRUE;
4200     end if;
4201 
4202     -- 05/14/02 - Bug 2374140 Fix Ends
4203 end if;
4204 
4205 
4206 if (p_contract_id = hr_api.g_number) then
4207     l_assignment_rec.contract_id :=
4208     l_old_assignment_rec.contract_id;
4209     if nvl(l_old_assignment_rec.contract_id, hr_api.g_number)
4210        <> nvl(l_db_assignment_rec.contract_id, hr_api.g_number)
4211     then
4212        others_changed:=TRUE;
4213     end if;
4214 else
4215     l_assignment_rec.contract_id := p_contract_id;
4216     if (nvl(p_contract_id, -1) <> nvl(l_db_assignment_rec.contract_id,-1))
4217     then
4218        i_changed:=TRUE;
4219     end if;
4220 end if;
4221 
4222 if (p_establishment_id = hr_api.g_number) then
4223     l_assignment_rec.establishment_id :=
4224     l_old_assignment_rec.establishment_id;
4225     if nvl(l_old_assignment_rec.establishment_id, hr_api.g_number)
4226        <> nvl(l_db_assignment_rec.establishment_id, hr_api.g_number)
4227     then
4228        others_changed:=TRUE;
4229     end if;
4230 else
4231     l_assignment_rec.establishment_id := p_establishment_id;
4232     if (nvl(p_establishment_id, -1) <>
4233         nvl(l_db_assignment_rec.establishment_id,-1))
4234     then
4235        i_changed:=TRUE;
4236     end if;
4237 end if;
4238 
4239 if (p_cagr_grade_def_id = hr_api.g_number) then
4240     l_assignment_rec.cagr_grade_def_id :=
4241     l_old_assignment_rec.cagr_grade_def_id;
4242     if nvl(l_old_assignment_rec.cagr_grade_def_id, hr_api.g_number)
4243        <> nvl(l_db_assignment_rec.cagr_grade_def_id, hr_api.g_number)
4244     then
4245        others_changed:=TRUE;
4246     end if;
4247 else
4248     l_assignment_rec.cagr_grade_def_id := p_cagr_grade_def_id;
4249     if (nvl(p_cagr_grade_def_id, -1) <>
4250         nvl(l_db_assignment_rec.cagr_grade_def_id,-1))
4251     then
4252        i_changed:=TRUE;
4253     end if;
4254 end if;
4255 
4256 if (p_cagr_id_flex_num = hr_api.g_number) then
4257     l_assignment_rec.cagr_id_flex_num :=
4258     l_old_assignment_rec.cagr_id_flex_num;
4259     if nvl(l_old_assignment_rec.cagr_id_flex_num, hr_api.g_number)
4260        <> nvl(l_db_assignment_rec.cagr_id_flex_num, hr_api.g_number)
4261     then
4262        others_changed:=TRUE;
4263     end if;
4264 else
4265     l_assignment_rec.cagr_id_flex_num := p_cagr_id_flex_num;
4266     if (nvl(p_cagr_id_flex_num, -1) <>
4267         nvl(l_db_assignment_rec.cagr_id_flex_num,-1))
4268     then
4269        i_changed:=TRUE;
4270     end if;
4271 end if;
4272 
4273 if (p_collective_agreement_id = hr_api.g_number) then
4274     l_assignment_rec.collective_agreement_id :=
4275     l_old_assignment_rec.collective_agreement_id;
4276     if nvl(l_old_assignment_rec.collective_agreement_id, hr_api.g_number)
4277        <> nvl(l_db_assignment_rec.collective_agreement_id, hr_api.g_number)
4278     then
4279        others_changed:=TRUE;
4280     end if;
4281 else
4282     l_assignment_rec.collective_agreement_id := p_collective_agreement_id;
4283     if (nvl(p_collective_agreement_id, -1) <>
4284         nvl(l_db_assignment_rec.collective_agreement_id,-1))
4285     then
4286        i_changed:=TRUE;
4287     end if;
4288 end if;
4289 
4290 if (p_assignment_status_type_id = hr_api.g_number) then
4291     l_assignment_rec.assignment_status_type_id :=
4292     l_old_assignment_rec.assignment_status_type_id;
4293     if nvl(l_old_assignment_rec.assignment_status_type_id, hr_api.g_number)
4294        <> nvl(l_db_assignment_rec.assignment_status_type_id, hr_api.g_number)
4295     then
4296        if i_changed or others_changed then
4297           j_changed := 'Y';
4298        end if;
4299        others_changed:=TRUE;
4300     end if;
4301 else
4302     l_assignment_rec.assignment_status_type_id := p_assignment_status_type_id;
4303     if (nvl(p_assignment_status_type_id, -1) <>
4304        nvl(l_db_assignment_rec.assignment_status_type_id, -1))
4305     then
4306        if i_changed or others_changed then
4307           j_changed := 'Y';
4308        end if;
4309        i_changed:=TRUE;
4310     end if;
4311 end if;
4312 
4313 l_term_sec_asg := wf_engine.getitemattrtext(p_item_type, p_item_key,
4314                                                 'HR_TERM_SEC_ASG',true);
4315 
4316 if (l_term_sec_asg is null OR l_term_sec_asg <> 'Y') then
4317   j_changed := 'Y';
4318 end if;
4319 
4320 if ( p_hrs_last_date= hr_api.g_varchar2) then
4321     l_hrs_last_date :=
4322     null;
4323 else
4324     l_hrs_last_date := p_hrs_last_date;
4325 end if;
4326 if ( p_display_pos= hr_api.g_varchar2) then
4327     l_display_pos :=
4328     null;
4329 else
4330     l_display_pos := p_display_pos;
4331 end if;
4332 
4333 if ( p_display_org= hr_api.g_varchar2) then
4334     l_display_org :=
4335     null;
4336 else
4337     l_display_org := p_display_org;
4338 end if;
4339 if ( p_display_ass_status= hr_api.g_varchar2) then
4340     l_display_ass_status :=
4341     null;
4342 else
4343     l_display_ass_status := p_display_ass_status;
4344 end if;
4345 if ( p_display_job= hr_api.g_varchar2) then
4346     l_display_job :=
4347     null;
4348 else
4349     l_display_job := p_display_job;
4350 end if;
4351 -- Bug #1067636 fix begins
4352 if ( p_display_grade = hr_api.g_varchar2) then
4353     l_display_grade :=
4354     null;
4355 else
4356     l_display_grade := p_display_grade;
4357 end if;
4358 -- Bug #1067636 fix ends
4359 
4360 -- Bug #1004255 fix
4361 if ( p_grade_lov = hr_api.g_varchar2) then
4362     l_grade_lov := null;
4363 else
4364     l_grade_lov := p_grade_lov;
4365 end if;
4366 
4367 if ( p_approver_id= hr_api.g_number) then
4368     l_approver_id :=
4369     null;
4370 else
4371     l_approver_id := p_approver_id;
4372 end if;
4373 
4374 -- This is added for registration to support the Browser Back issues which was prohibiting the
4375 -- commit to the transaction tables if the data is not changed and in turn was not letting the
4376 -- rollback call to execute .
4377 
4378 if p_flow_mode is not null and
4379    p_flow_mode = hr_process_assignment_ss.g_new_hire_registration
4380 then
4381 i_changed := TRUE;
4382 end if;
4383 -- Code end for registration.
4384 
4385 if i_changed or others_changed
4386 then
4387 if p_save_mode <> 'SAVE_FOR_LATER' then
4388 --
4389 -- To support applicant hire in New Hire process, we need to convert the applicant
4390 -- to employee then update the assignment and rollback the employee to applicant
4391 
4392 l_person_type_id :=     hr_transaction_api.get_number_value
4393 			(p_transaction_step_id =>  l_per_step_id
4394 			,p_name                => 'P_PERSON_TYPE_ID');
4395 
4396 if(l_db_assignment_rec.assignment_type = 'A' AND (l_asgn_change_mode is null OR
4397      l_asgn_change_mode = 'N' OR l_asgn_change_mode = 'Y') ) then
4398    g_applicant_hire := true;
4399    -- first get the object_version_number for the applicant from
4400    -- per_all_people_f
4401    open per_applicant_rec(l_old_assignment_rec.person_id, l_effective_date);
4402    fetch per_applicant_rec into l_per_object_version_number;
4403    close per_applicant_rec;
4404 
4405    SAVEPOINT applicant_hire;
4406 
4407    -- get the employee number from Basic Details Step
4408    /*hr_person_info_util_ss.get_trns_employee_number(
4409                         p_item_type => p_item_type
4410                        ,p_item_key => p_item_key
4411                        ,p_employee_number => l_employee_number);
4412 
4413    --call the hr_applicant_api.hire_applicant
4414    hr_applicant_api.hire_applicant(
4415       p_validate => false
4416      ,p_hire_date => l_effective_date
4417      ,p_person_id => l_db_assignment_rec.person_id
4418      ,p_per_object_version_number => l_per_object_version_number
4419      ,p_assignment_id => l_db_assignment_rec.assignment_id
4420      ,p_employee_number => l_employee_number
4421      ,p_per_effective_start_date => l_per_effective_start_date
4422      ,p_per_effective_end_date => l_per_effective_end_date
4423      ,p_unaccepted_asg_del_warning  => l_unaccepted_asg_del_warning
4424      ,p_assign_payroll_warning => l_assign_payroll_warning);*/
4425 
4426 -- Also we need to call the Primay Address Step as the primary address needs to be
4427 -- created for the applicant, incase payroll is entered
4428    -- we need to call the HR_PROCESS_PERSON_SS.PROCESS_API
4429    -- to update the person's info first
4430    -- before update the assignment. Such as birthday is required for
4431    -- payroll.
4432    hr_new_user_reg_ss.process_selected_transaction(p_item_type => l_item_type,
4433                                                    p_item_key => l_item_key
4434                          ,p_api_name => 'HR_PROCESS_PERSON_SS.PROCESS_API');
4435    hr_new_user_reg_ss.process_selected_transaction(p_item_type => l_item_type,
4436                                                    p_item_key => l_item_key
4437 			 ,p_api_name => 'HR_PROCESS_ADDRESS_SS.PROCESS_API');
4438 
4439 -- Need to use the latest object version number and also assginment_status_type_id
4440 -- before calling the update_assignment as the above api call will change the object
4441 -- version number and update the assignment record in correction mode
4442 -- first get the object_version_number for the applicant from
4443 -- per_all_assignments_f
4444    open asg_applicant_rec(l_assignment_id, l_effective_date);
4445    fetch asg_applicant_rec into l_object_version_number
4446                                ,l_assignment_rec.assignment_status_type_id;
4447    close asg_applicant_rec;
4448 
4449    l_datetrack_update_mode :=  'CORRECTION';
4450 
4451 end if;
4452 
4453 if (l_asgn_change_mode = 'V' or l_asgn_change_mode = 'W') then
4454    open per_applicant_rec(l_old_assignment_rec.person_id, l_effective_date);
4455    fetch per_applicant_rec into l_per_object_version_number;
4456    close per_applicant_rec;
4457    g_applicant_hire := true;
4458    SAVEPOINT applicant_hire;
4459 end if;
4460 
4461   if (l_asgn_change_mode = 'Y') then
4462     l_assignment_rec.primary_flag := 'Y';
4463   else
4464     l_assignment_rec.primary_flag := l_db_assignment_rec.primary_flag;
4465   end if;
4466 
4467 --
4468 -- the data has changed, so we call the api --
4469 --
4470 --update_assignment will check default gre when l_new_hire_appl_hire is 'Y'
4471 if p_flow_mode is not null or g_applicant_hire then
4472   l_new_hire_appl_hire := 'Y';
4473 else
4474   l_new_hire_appl_hire := 'N';
4475 end if;
4476 
4477 -- GSP Support code
4478  -- check whether grade/step/ got changed based on Grade Ladder setup,
4479  -- then only I need to store Pay Rate Txn data
4480   hr_pay_rate_gsp_ss.check_grade_ladder_exists(
4481                    p_business_group_id =>  l_assignment_rec.organization_id,
4482                    p_effective_date =>  l_effective_date,
4483                    p_grd_ldr_exists_flag => lb_grd_ldr_exists_flag);
4484 
4485  if(lb_grd_ldr_exists_flag) then
4486 --     and (lb_special_ceiling_step_id_chg or lb_grade_changed) ) then
4487 
4488    -- check whether grade ladder won't allow salary update
4489    open lc_sal_updateable_grade_ladder(p_grade_ladder_id =>
4490                               l_assignment_rec.grade_ladder_pgm_id,
4491                               p_effective_date => l_effective_date
4492                               );
4493    fetch lc_sal_updateable_grade_ladder into lc_temp_grade_ladder_id, lc_temp_upd_sal_cd;
4494    if (lc_sal_updateable_grade_ladder%FOUND) THEN
4495     -- initializing local salary data table type to pass to store into txn
4496     ltt_salary_data := sshr_sal_prop_tab_typ(sshr_sal_prop_obj_typ(
4497                 null,-- pay_proposal_id       NUMBER,
4498                 l_assignment_id,-- assignment_id         NUMBER,
4499                 l_assignment_rec.business_group_id,--business_group_id   NUMBER,
4500                 l_effective_date,--effective_date        DATE,
4501                 null,--comments              VARCHAR2(2000),
4502                 null,--next_sal_review_date  DATE,
4503                 null,--salary_change_amount  NUMBER ,
4504                 null,--salary_change_percent NUMBER ,
4505                 null,--annual_change         NUMBER ,
4506                 null,--proposed_salary       NUMBER ,
4507                 null,--proposed_percent      NUMBER ,
4508                 null,--proposal_reason       VARCHAR2(30),
4509                 null,--ranking               NUMBER,
4510                 null,--current_salary        NUMBER,
4511                 null,--performance_review_id NUMBER,
4512                 null,--multiple_components   VARCHAR2(1),
4513                 null,--element_entry_id      NUMBER ,
4514                 null,--selection_mode        VARCHAR2(1),
4515                 null,--ovn                   NUMBER,
4516                 null,--currency              VARCHAR2(15),
4517                 null,--pay_basis_name        VARCHAR2(80),
4518                 null,--annual_equivalent     NUMBER ,
4519                 null,--total_percent        NUMBER ,
4520                 null,--quartile              NUMBER ,
4521                 null,--comparatio            NUMBER ,
4522                 null,--lv_selection_mode     VARCHAR2(1),
4523                 null,--attribute_category           VARCHAR2(150),
4524                 null,--attribute1            VARCHAR2(150),
4525                 null,--attribute2            VARCHAR2(150),
4526                 null,--attribute3            VARCHAR2(150),
4527                 null,--attribute4            VARCHAR2(150),
4528                 null,--attribute5            VARCHAR2(150),
4529                 null,--attribute6            VARCHAR2(150),
4530                 null,--attribute7            VARCHAR2(150),
4531                 null,--attribute8            VARCHAR2(150),
4532                 null,--attribute9            VARCHAR2(150),
4533                 null,--attribute10           VARCHAR2(150),
4534                 null,--attribute11           VARCHAR2(150),
4535                 null,--attribute12           VARCHAR2(150),
4536                 null,--attribute13           VARCHAR2(150),
4537                 null,--attribute14           VARCHAR2(150),
4538                 null,--attribute15           VARCHAR2(150),
4539                 null,--attribute16           VARCHAR2(150),
4540                 null,--attribute17           VARCHAR2(150),
4541                 null,--attribute18           VARCHAR2(150),
4542                 null,--attribute19           VARCHAR2(150),
4543                 null,--attribute20           VARCHAR2(150),
4544                 null, --no_of_components       NUMBER,
4545                 -- 04/12/02 Salary Basis Enhancement Begins
4546                 null,  -- salary_basis_change_type varchar2(30)
4547                 null,  -- default_date           date
4548                 null,  -- default_bg_id          number
4549                 null,  -- default_currency       VARCHAR2(15)
4550                 null,  -- default_format_string  VARCHAR2(40)
4551                 null,  -- default_salary_basis_name  varchar2(30)
4552                 null,  -- default_pay_basis_name     varchar2(80)
4553                 null,  -- default_pay_basis      varchar2(30)
4554                 null,  -- default_pay_annual_factor  number
4555                 null,  -- default_grade          VARCHAR2(240)
4556                 null,  -- default_grade_annual_factor number
4557                 null,  -- default_minimum_salary      number
4558                 null,  -- default_maximum_salary      number
4559                 null,  -- default_midpoint_salary     number
4560                 null,  -- default_prev_salary         number
4561                 null,  -- default_last_change_date    date
4562                 null,  -- default_element_entry_id    number
4563                 null,  -- default_basis_changed       number
4564                 null,  -- default_uom                 VARCHAR2(30)
4565                 null,  -- default_grade_uom           VARCHAR2(30)
4566                 null,  -- default_change_amount       number
4567                 null,  -- default_change_percent      number
4568                 null,  -- default_quartile            number
4569                 null,  -- default_comparatio          number
4570                 null,  -- default_last_pay_change     varchar2(200)
4571                 null,  -- default_flsa_status         varchar2(80)
4572                 null,  -- default_currency_symbol     varchar2(4)
4573                 null,   -- default_precision           number
4574                 -- 04/12/02 Salary Basis Enhancement Ends
4575                 -- GSP
4576                 null,    -- salary_effective_date    date
4577                 null,    -- gsp_dummy_txn            varchar2(30)
4578                 -- End of GSP
4579                 null,
4580                 null,
4581                 null,
4582                 null,
4583                 null
4584           ));
4585       -- store the current salary in the ltt_salary_data
4586       hr_pay_rate_gsp_ss.get_employee_current_salary(
4587                             p_assignment_id =>  l_assignment_id,
4588                             P_effective_date => l_effective_date,
4589                             p_ltt_salary_data => ltt_salary_data);
4590       -- In case of SFL for new hire, we are getting new salary
4591       -- so we are setting current salary to zero
4592       if p_flow_mode is not null and
4593          p_flow_mode = hr_process_assignment_ss.g_new_hire_registration
4594       then
4595            ltt_salary_data(1).current_salary := 0;
4596       end if;
4597       -- end of fix
4598      end if;
4599      close lc_sal_updateable_grade_ladder;
4600   end if;
4601   -- End of GSP support change
4602 
4603 if (l_asgn_change_mode is null OR l_asgn_change_mode = 'N' OR
4604       l_asgn_change_mode = 'Y') then
4605 update_assignment
4606 (p_validate                 =>     true
4607 ,p_login_person_id          =>     p_login_person_id
4608 ,p_new_hire_appl_hire       =>     l_new_hire_appl_hire
4609 ,p_assignment_id            =>     l_assignment_id
4610 ,p_object_version_number    =>     l_object_version_number
4611 ,p_effective_date           =>     l_effective_date
4612 ,p_datetrack_update_mode    =>     l_datetrack_update_mode
4613 ,p_organization_id          =>     l_assignment_rec.organization_id
4614 ,p_position_id              =>     l_assignment_rec.position_id
4615 ,p_job_id                   =>     l_assignment_rec.job_id
4616 ,p_grade_id                 =>     l_assignment_rec.grade_id
4617 ,p_location_id              =>     l_assignment_rec.location_id
4618 ,p_employment_category      =>     l_assignment_rec.employment_category
4619 ,p_supervisor_id            =>     l_assignment_rec.supervisor_id
4620 ,p_manager_flag             =>     l_assignment_rec.manager_flag
4621 ,p_frequency                =>     l_assignment_rec.frequency
4622 ,p_normal_hours             =>     l_assignment_rec.normal_hours
4623 ,p_time_normal_finish       =>     l_assignment_rec.time_normal_finish
4624 ,p_time_normal_start        =>     l_assignment_rec.time_normal_start
4625 ,p_bargaining_unit_code     =>     l_assignment_rec.bargaining_unit_code
4626 ,p_labour_union_member_flag =>     l_assignment_rec.labour_union_member_flag
4627 ,p_assignment_status_type_id=>     l_assignment_rec.assignment_status_type_id
4628 ,p_change_reason            =>     l_assignment_rec.change_reason
4629 ,p_special_ceiling_step_id  =>     l_assignment_rec.special_ceiling_step_id
4630 ,p_ass_attribute_category   =>     l_assignment_rec.ass_attribute_category
4631 ,p_ass_attribute1           =>     l_assignment_rec.ass_attribute1
4632 ,p_ass_attribute2           =>     l_assignment_rec.ass_attribute2
4633 ,p_ass_attribute3           =>     l_assignment_rec.ass_attribute3
4634 ,p_ass_attribute4           =>     l_assignment_rec.ass_attribute4
4635 ,p_ass_attribute5           =>     l_assignment_rec.ass_attribute5
4636 ,p_ass_attribute6           =>     l_assignment_rec.ass_attribute6
4637 ,p_ass_attribute7           =>     l_assignment_rec.ass_attribute7
4638 ,p_ass_attribute8           =>     l_assignment_rec.ass_attribute8
4639 ,p_ass_attribute9           =>     l_assignment_rec.ass_attribute9
4640 ,p_ass_attribute10          =>     l_assignment_rec.ass_attribute10
4641 ,p_ass_attribute11          =>     l_assignment_rec.ass_attribute11
4642 ,p_ass_attribute12          =>     l_assignment_rec.ass_attribute12
4643 ,p_ass_attribute13          =>     l_assignment_rec.ass_attribute13
4644 ,p_ass_attribute14          =>     l_assignment_rec.ass_attribute14
4645 ,p_ass_attribute15          =>     l_assignment_rec.ass_attribute15
4646 ,p_ass_attribute16          =>     l_assignment_rec.ass_attribute16
4647 ,p_ass_attribute17          =>     l_assignment_rec.ass_attribute17
4648 ,p_ass_attribute18          =>     l_assignment_rec.ass_attribute18
4649 ,p_ass_attribute19          =>     l_assignment_rec.ass_attribute19
4650 ,p_ass_attribute20          =>     l_assignment_rec.ass_attribute20
4651 ,p_ass_attribute21          =>     l_assignment_rec.ass_attribute21
4652 ,p_ass_attribute22          =>     l_assignment_rec.ass_attribute22
4653 ,p_ass_attribute23          =>     l_assignment_rec.ass_attribute23
4654 ,p_ass_attribute24          =>     l_assignment_rec.ass_attribute24
4655 ,p_ass_attribute25          =>     l_assignment_rec.ass_attribute25
4656 ,p_ass_attribute26          =>     l_assignment_rec.ass_attribute26
4657 ,p_ass_attribute27          =>     l_assignment_rec.ass_attribute27
4658 ,p_ass_attribute28          =>     l_assignment_rec.ass_attribute28
4659 ,p_ass_attribute29          =>     l_assignment_rec.ass_attribute29
4660 ,p_ass_attribute30          =>     l_assignment_rec.ass_attribute30
4661 ,p_soft_coding_keyflex_id   =>     l_assignment_rec.soft_coding_keyflex_id
4662 ,p_people_group_id          =>     l_assignment_rec.people_group_id
4663 ,p_contract_id              =>     l_assignment_rec.contract_id
4664 ,p_establishment_id         =>     l_assignment_rec.establishment_id
4665 ,p_cagr_grade_def_id        =>     l_assignment_rec.cagr_grade_def_id
4666 ,p_collective_agreement_id  =>     l_assignment_rec.collective_agreement_id
4667 ,p_cagr_id_flex_num         =>     l_assignment_rec.cagr_id_flex_num
4668 ,p_payroll_id               =>     l_assignment_rec.payroll_id
4669 ,p_pay_basis_id             =>     l_assignment_rec.pay_basis_id
4670 ,p_sal_review_period        =>     l_assignment_rec.sal_review_period
4671 ,p_sal_review_period_frequency => l_assignment_rec.sal_review_period_frequency
4672 ,p_date_probation_end       =>     l_assignment_rec.date_probation_end
4673 ,p_probation_period         =>      l_assignment_rec.probation_period
4674 ,p_probation_unit           =>     l_assignment_rec.probation_unit
4675 ,p_notice_period            =>     l_assignment_rec.notice_period
4676 ,p_notice_period_uom        =>     l_assignment_rec.notice_period_uom
4677 ,p_employee_category        =>     l_assignment_rec.employee_category
4678 ,p_work_at_home             =>     l_assignment_rec.work_at_home
4679 ,p_job_post_source_name     =>     l_assignment_rec.job_post_source_name
4680 ,p_perf_review_period       =>     l_assignment_rec.perf_review_period
4681 ,p_perf_review_period_frequency => l_assignment_rec.perf_review_period_frequency
4682 ,p_internal_address_line    =>     l_assignment_rec.internal_address_line
4683 ,p_business_group_id        =>     l_assignment_rec.business_group_id
4684 -- GSP change
4685 ,p_grade_ladder_pgm_id      =>     l_assignment_rec.grade_ladder_pgm_id
4686 -- End of GSP change
4687 ,p_assignment_type          =>     l_assignment_rec.assignment_type
4688 --,p_supervisor_assignment_id =>     l_assignment_rec.supervisor_assignment_id
4689 ,p_vacancy_id               =>     l_assignment_rec.vacancy_id
4690 ,p_primary_flag             =>     l_assignment_rec.primary_flag
4691 ,p_person_id                =>     l_assignment_rec.person_id
4692 ,p_default_code_comb_id     =>     l_assignment_rec.default_code_comb_id
4693 ,p_project_title            =>     l_assignment_rec.project_title
4694 ,p_set_of_books_id          =>     l_assignment_rec.set_of_books_id
4695 ,p_source_type              =>     l_assignment_rec.source_type
4696 ,p_title                    =>     l_assignment_rec.title
4697 ,p_vendor_assignment_number =>     l_assignment_rec.vendor_assignment_number
4698 ,p_vendor_employee_number   =>     l_assignment_rec.vendor_employee_number
4699 ,p_vendor_id                =>     l_assignment_rec.vendor_id
4700 ,p_effective_start_date     =>     l_effective_start_date
4701 ,p_effective_end_date       =>     l_effective_end_date
4702 ,p_element_warning          =>     l_element_warning
4703 ,p_element_changed          =>     l_element_changed
4704 ,p_email_id                 =>     l_email_id
4705 ,p_page_error => p_page_error
4706 ,p_page_error_msg => p_page_error_msg
4707 ,p_page_warning => p_page_warning
4708 ,p_page_warning_msg => p_page_warning_msg
4709 ,p_organization_error => p_organization_error
4710 ,p_organization_error_msg => p_organization_error_msg
4711 ,p_job_error => p_job_error
4712 ,p_job_error_msg => p_job_error_msg
4713 ,p_position_error => p_position_error
4714 ,p_position_error_msg => p_position_error_msg
4715 ,p_grade_error => p_grade_error
4716 ,p_grade_error_msg => p_grade_error_msg
4717 ,p_supervisor_error => p_supervisor_error
4718 ,p_supervisor_error_msg => p_supervisor_error_msg
4719 ,p_location_error => p_location_error
4720 ,p_location_error_msg => p_location_error_msg
4721 -- GSP change
4722 ,p_ltt_salary_data => ltt_salary_data
4723 ,p_gsp_post_process_warning => p_gsp_post_process_warning
4724 -- End of GSP change
4725 ,p_po_header_id => p_po_header_id
4726 ,p_po_line_id  => p_po_line_id
4727 ,p_vendor_site_id  => p_vendor_site_id
4728 ,p_projected_asgn_end => p_proj_asgn_end
4729 ,p_j_changed => j_changed
4730 );
4731 else
4732 l_assignment_rec.object_version_number := l_object_version_number;
4733 l_assignment_rec.assignment_id := l_assignment_id;
4734 
4735 update_apl_assignment(
4736 p_assignment_rec => l_assignment_rec
4737 ,p_validate	=>	true
4738 ,p_effective_date  =>	l_effective_date
4739 ,p_person_id	=>	l_assignment_rec.person_id
4740 ,p_appl_assignment_id  =>	l_assignment_id
4741 ,p_person_type_id  =>	l_person_type_id
4742 ,p_overwrite_primary  =>	l_asgn_change_mode
4743 ,p_ovn	=> l_per_object_version_number);
4744 end if;
4745 p_element_changed:=l_element_changed;
4746 
4747 
4748 else --end p_save_mode = 'SAVE_FOR_LATER'
4749   if(l_db_assignment_rec.assignment_type = 'A') then
4750     l_datetrack_update_mode :=  'CORRECTION';
4751   end if;
4752 end if; --end p_save_mode <> 'SAVE_FOR_LATER'
4753 --
4754 -- if there were errors, handle them
4755 --
4756 --start registration
4757 -- This is to rollback the dummy person created during the process request phase of the assignment page
4758 -- the new user registration.
4759 if p_flow_mode is not null and
4760    p_flow_mode = hr_process_assignment_ss.g_new_hire_registration
4761 then
4762 rollback;
4763 end if;
4764 --end registration
4765 --
4766 
4767 -- applicant_hire
4768 if (g_applicant_hire) then
4769    rollback to applicant_hire;
4770 end if;
4771 
4772 if g_exemp_hire then
4773 rollback;
4774 end if;
4775 
4776 if NVL(p_element_changed,'X') <> 'W'  OR
4777    p_save_mode = 'SAVE_FOR_LATER' then
4778   --
4779   -- no error or save for later, so save to transaction table
4780   --
4781   if l_transaction_step_id is null then
4782     --
4783     -- first of all check if this transaction is already in progress
4784     --
4785     l_transaction_id:=hr_transaction_ss.get_transaction_id
4786                       (p_item_type   =>   l_item_type
4787                       ,p_item_key    =>   l_item_key);
4788     --
4789     -- if the transaction is not already in progress, create a new one
4790     --
4791     if l_transaction_id is null then
4792       hr_transaction_ss.start_transaction
4793       (itemtype    =>    l_item_type
4794       ,itemkey     =>    l_item_key
4795       ,actid       =>    l_activity_id
4796       ,funmode     =>    'RUN'
4797       ,p_login_person_id => p_login_person_id
4798       ,p_plan_id   =>    p_plan_id
4799       ,p_rptg_grp_id    =>  p_rptg_grp_id
4800       ,p_effective_date_option  => p_effective_date_option
4801       ,result      =>    l_result);
4802     --
4803       l_transaction_id:=hr_transaction_ss.get_transaction_id
4804                         (p_item_type   =>   l_item_type
4805                         ,p_item_key    =>   l_item_key);
4806       if l_transaction_id is null then
4807         fnd_message.set_name('PER', 'HR_CREATE_TRANSACTION_ID_ERR');
4808         hr_utility.raise_error;
4809       end if;
4810     end if;
4811     --
4812     -- create a transaction step
4813     --
4814 
4815   if (l_asgn_change_mode ='V' OR l_asgn_change_mode ='W') then
4816     hr_transaction_api.create_trans_step
4817       (p_validate              => false
4818       ,p_creator_person_id     => p_login_person_id
4819       ,p_transaction_id        => l_transaction_id
4820       ,p_api_name              => g_api_name
4821       ,p_item_type             => l_item_type
4822       ,p_item_key              => l_item_key
4823       ,p_activity_id           => l_activity_id
4824       ,p_transaction_step_id   => l_transaction_step_id
4825       ,p_processing_order      => 1
4826       ,p_object_version_number => l_trns_object_version_number
4827       );
4828   else
4829     open process_order(l_item_type,l_item_key);
4830     fetch process_order into l_proc_order;
4831     if process_order%found then
4832     hr_transaction_api.create_trans_step
4833       (p_validate              => false
4834       ,p_creator_person_id     => p_login_person_id
4835       ,p_transaction_id        => l_transaction_id
4836       ,p_api_name              => g_api_name
4837       ,p_item_type             => l_item_type
4838       ,p_item_key              => l_item_key
4839       ,p_activity_id           => l_activity_id
4840       ,p_transaction_step_id   => l_transaction_step_id
4841       ,p_processing_order      => l_proc_order - 1
4842       ,p_object_version_number => l_trns_object_version_number
4843       );
4844     else
4845     hr_transaction_api.create_transaction_step
4846       (p_validate              => false
4847       ,p_creator_person_id     => p_login_person_id
4848       ,p_transaction_id        => l_transaction_id
4849       ,p_api_name              => g_api_name
4850       ,p_item_type             => l_item_type
4851       ,p_item_key              => l_item_key
4852       ,p_activity_id           => l_activity_id
4853       ,p_transaction_step_id   => l_transaction_step_id
4854       ,p_object_version_number => l_trns_object_version_number
4855       );
4856      end if;
4857      close process_order;
4858   end if;
4859   --
4860   end if;
4861   --p_transaction_step_id := to_char(l_transaction_step_id);
4862 
4863   -- save the parameters to the temporary tables
4864   --
4865   l_count:=1;
4866   l_trans_tbl(l_count).param_name      := 'P_ASSIGNMENT_ID';
4867   l_trans_tbl(l_count).param_value     :=  l_assignment_id;
4868   l_trans_tbl(l_count).param_original_value := l_assignment_id;  --ns
4869   l_trans_tbl(l_count).param_data_type := 'NUMBER';
4870   --
4871   l_count:=l_count+1;
4872   l_trans_tbl(l_count).param_name      := 'P_OBJECT_VERSION_NUMBER';
4873   l_trans_tbl(l_count).param_value     :=  p_object_version_number;
4874   l_trans_tbl(l_count).param_original_value := p_object_version_number;  --ns
4875   l_trans_tbl(l_count).param_data_type := 'NUMBER';
4876   --
4877   l_count:=l_count+1;
4878   l_trans_tbl(l_count).param_name      := 'P_EFFECTIVE_DATE';
4879   l_trans_tbl(l_count).param_value     :=  p_effective_date;
4880   l_trans_tbl(l_count).param_original_value := p_effective_date; --ns
4881   l_trans_tbl(l_count).param_data_type := 'DATE';
4882   --
4883   --ns start
4884   l_count:=l_count+1;
4885   l_trans_tbl(l_count).param_name      := 'P_EFFECTIVE_DATE_OPTION';
4886   l_trans_tbl(l_count).param_value     :=  p_effective_date_option;
4887   l_trans_tbl(l_count).param_original_value := p_effective_date_option;
4888   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
4889   --ns end
4890   --
4891   l_count:=l_count+1;
4892   l_trans_tbl(l_count).param_name      := 'P_ELEMENT_CHANGED';
4893   l_trans_tbl(l_count).param_value     :=  p_element_changed;
4894   l_trans_tbl(l_count).param_original_value := p_element_changed; --ns
4895   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
4896   --
4897   l_count:=l_count+1;
4898   l_trans_tbl(l_count).param_name      := 'P_DATETRACK_UPDATE_MODE';
4899   l_trans_tbl(l_count).param_value     :=  l_datetrack_update_mode;
4900   l_trans_tbl(l_count).param_original_value := l_datetrack_update_mode; --ns
4901   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
4902   --
4903   l_count:=l_count+1;
4904   l_trans_tbl(l_count).param_name      := 'P_ORGANIZATION_ID';
4905   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.organization_id;
4906   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.organization_id;  --ns
4907   l_trans_tbl(l_count).param_data_type := 'NUMBER';
4908   --
4909   l_count:=l_count+1;
4910   l_trans_tbl(l_count).param_name      := 'P_BUSINESS_GROUP_ID';
4911   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.business_group_id;
4912   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.business_group_id;  --ns
4913   l_trans_tbl(l_count).param_data_type := 'NUMBER';
4914   --
4915   l_count:=l_count+1;
4916   l_trans_tbl(l_count).param_name      := 'P_PERSON_ID';
4917   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.person_id;
4918   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.person_id;  --ns
4919   l_trans_tbl(l_count).param_data_type := 'NUMBER';
4920   --
4921   l_count:=l_count+1;
4922   l_trans_tbl(l_count).param_name      := 'P_LOGIN_PERSON_ID';
4923   l_trans_tbl(l_count).param_value     :=  p_login_person_id;
4924   l_trans_tbl(l_count).param_data_type := 'NUMBER';
4925   --
4926   l_name := null;
4927   open csr_org_name(l_assignment_rec.organization_id);
4928   fetch csr_org_name into l_name;
4929   close csr_org_name;
4930 
4931   --ns start
4932   l_original_name := null;
4933   open csr_org_name(l_db_assignment_rec.organization_id);
4934   fetch csr_org_name into l_original_name;
4935   close csr_org_name;
4936   --ns end
4937 
4938   l_count:=l_count+1;
4939   l_trans_tbl(l_count).param_name      := 'P_ORG_NAME';
4940   l_trans_tbl(l_count).param_value     :=  l_name;
4941   l_trans_tbl(l_count).param_original_value := l_original_name ;  --ns
4942   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
4943   --
4944   l_count:=l_count+1;
4945   l_trans_tbl(l_count).param_name      := 'P_POSITION_ID';
4946   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.position_id;
4947   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.position_id;  --ns
4948   l_trans_tbl(l_count).param_data_type := 'NUMBER';
4949   --
4950   l_name := null;
4951   open csr_pos_name(l_assignment_rec.position_id);
4952   fetch csr_pos_name into l_name;
4953   close csr_pos_name;
4954 
4955   --ns start
4956   l_original_name := null;
4957   open csr_pos_name(l_db_assignment_rec.position_id);
4958   fetch csr_pos_name into l_original_name;
4959   close csr_pos_name;
4960   --ns end
4961 
4962   l_count:=l_count+1;
4963   l_trans_tbl(l_count).param_name      := 'P_POS_NAME';
4964   l_trans_tbl(l_count).param_value     :=  l_name;
4965   l_trans_tbl(l_count).param_original_value := l_original_name ;  --ns
4966   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
4967   --
4968   l_count:=l_count+1;
4969   l_trans_tbl(l_count).param_name      := 'P_JOB_ID';
4970   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.job_id;
4971   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.job_id;  --ns
4972   l_trans_tbl(l_count).param_data_type := 'NUMBER';
4973   --
4974   l_name := null;
4975   open csr_job_name(l_assignment_rec.job_id);
4976   fetch csr_job_name into l_name;
4977   close csr_job_name;
4978 
4979   --ns start
4980   l_original_name := null;
4981   open csr_job_name(l_db_assignment_rec.job_id);
4982   fetch csr_job_name into l_original_name;
4983   close csr_job_name;
4984   --ns end
4985 
4986   l_count:=l_count+1;
4987   l_trans_tbl(l_count).param_name      := 'P_JOB_NAME';
4988   l_trans_tbl(l_count).param_value     :=  l_name;
4989   l_trans_tbl(l_count).param_original_value := l_original_name ;  --ns
4990   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
4991   --
4992   l_count:=l_count+1;
4993   l_trans_tbl(l_count).param_name      := 'P_GRADE_ID';
4994   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.grade_id;
4995   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.grade_id;  --ns
4996   l_trans_tbl(l_count).param_data_type := 'NUMBER';
4997   --
4998   l_name := null;
4999   open csr_grade_name(l_assignment_rec.grade_id);
5000   fetch csr_grade_name into l_name;
5001   close csr_grade_name;
5002 
5003   --ns start
5004   l_original_name := null;
5005   open csr_grade_name(l_db_assignment_rec.grade_id);
5006   fetch csr_grade_name into l_original_name;
5007   close csr_grade_name;
5008   --ns end
5009 
5010   l_count:=l_count+1;
5011   l_trans_tbl(l_count).param_name      := 'P_GRADE_NAME';
5012   l_trans_tbl(l_count).param_value     :=  l_name;
5013   l_trans_tbl(l_count).param_original_value := l_original_name ;  --ns
5014   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5015   --
5016   l_count:=l_count+1;
5017   l_trans_tbl(l_count).param_name      := 'P_LOCATION_ID';
5018   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.location_id;
5019   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.location_id;  --ns
5020   l_trans_tbl(l_count).param_data_type := 'NUMBER';
5021   --
5022   l_count:=l_count+1;
5023   l_trans_tbl(l_count).param_name      := 'P_EMPLOYMENT_CATEGORY';
5024   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.employment_category;
5025   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.employment_category;  --ns
5026   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5027   --
5028   l_count:=l_count+1;
5029   l_trans_tbl(l_count).param_name      := 'P_SUPERVISOR_ID';
5030   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.supervisor_id;
5031   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.supervisor_id;  --ns
5032   l_trans_tbl(l_count).param_data_type := 'NUMBER';
5033   --
5034   l_count:=l_count+1;
5035   l_trans_tbl(l_count).param_name      := 'P_MANAGER_FLAG';
5036   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.manager_flag;
5037   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.manager_flag;  --ns
5038   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5039   --
5040   l_count:=l_count+1;
5041   l_trans_tbl(l_count).param_name      := 'P_NORMAL_HOURS';
5042   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.normal_hours;
5043   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.normal_hours;  --ns
5044   l_trans_tbl(l_count).param_data_type := 'NUMBER';
5045   --
5046   l_count:=l_count+1;
5047   l_trans_tbl(l_count).param_name      := 'P_FREQUENCY';
5048   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.frequency;
5049   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.frequency;  --ns
5050   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5051   --
5052   l_count:=l_count+1;
5053   l_trans_tbl(l_count).param_name      := 'P_TIME_NORMAL_FINISH';
5054   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.time_normal_finish;
5055   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.time_normal_finish;  --ns
5056   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5057   --
5058   l_count:=l_count+1;
5059   l_trans_tbl(l_count).param_name      := 'P_TIME_NORMAL_START';
5060   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.time_normal_start;
5061   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.time_normal_start;  --ns
5062   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5063   --
5064   l_count:=l_count+1;
5065   l_trans_tbl(l_count).param_name      := 'P_BARGAINING_UNIT_CODE';
5066   l_trans_tbl(l_count).param_value  :=  l_assignment_rec.bargaining_unit_code;
5067   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.bargaining_unit_code;  --ns
5068   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5069   --
5070   l_count:=l_count+1;
5071   l_trans_tbl(l_count).param_name      := 'P_LABOUR_UNION_MEMBER_FLAG';
5072   l_trans_tbl(l_count).param_value := l_assignment_rec.labour_union_member_flag;
5073   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.labour_union_member_flag;  --ns
5074   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5075   --
5076   l_count:=l_count+1;
5077   l_trans_tbl(l_count).param_name      := 'P_SPECIAL_CEILING_STEP_ID';
5078   l_trans_tbl(l_count).param_value
5079     := l_assignment_rec.special_ceiling_step_id;
5080   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.special_ceiling_step_id;  --ns
5081   l_trans_tbl(l_count).param_data_type := 'NUMBER';
5082   --
5083   l_count:=l_count+1;
5084   l_trans_tbl(l_count).param_name      := 'P_ASSIGNMENT_STATUS_TYPE_ID';
5085   l_trans_tbl(l_count).param_value
5086     := l_assignment_rec.assignment_status_type_id;
5087   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.assignment_status_type_id;  --ns
5088   l_trans_tbl(l_count).param_data_type := 'NUMBER';
5089   --
5090   l_count:=l_count+1;
5091   l_trans_tbl(l_count).param_name      := 'P_CHANGE_REASON';
5092   l_trans_tbl(l_count).param_value
5093     :=  l_assignment_rec.change_reason;
5094   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.change_reason;  --ns
5095   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5096 --
5097   l_count:=l_count+1;
5098   l_trans_tbl(l_count).param_name      := 'P_ASS_ATTRIBUTE_CATEGORY';
5099   l_trans_tbl(l_count).param_value
5100     :=  l_assignment_rec.ass_attribute_category;
5101   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.ass_attribute_category;  --ns
5102   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5103   --
5104   l_count:=l_count+1;
5105   l_trans_tbl(l_count).param_name      := 'P_ASS_ATTRIBUTE1';
5106   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.ass_attribute1;
5107   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.ass_attribute1;  --ns
5108   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5109   --
5110   l_count:=l_count+1;
5111   l_trans_tbl(l_count).param_name      := 'P_ASS_ATTRIBUTE2';
5112   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.ass_attribute2;
5113   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.ass_attribute2;  --ns
5114   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5115   --
5116   l_count:=l_count+1;
5117   l_trans_tbl(l_count).param_name      := 'P_ASS_ATTRIBUTE3';
5118   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.ass_attribute3;
5119   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.ass_attribute3;  --ns
5120   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5121   --
5122   l_count:=l_count+1;
5123   l_trans_tbl(l_count).param_name      := 'P_ASS_ATTRIBUTE4';
5124   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.ass_attribute4;
5125   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.ass_attribute4;  --ns
5126   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5127   --
5128   l_count:=l_count+1;
5129   l_trans_tbl(l_count).param_name      := 'P_ASS_ATTRIBUTE5';
5130   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.ass_attribute5;
5131   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.ass_attribute5;  --ns
5132   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5133   --
5134   l_count:=l_count+1;
5135   l_trans_tbl(l_count).param_name      := 'P_ASS_ATTRIBUTE6';
5136   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.ass_attribute6;
5137   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.ass_attribute6;  --ns
5138   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5139   --
5140   l_count:=l_count+1;
5141   l_trans_tbl(l_count).param_name      := 'P_ASS_ATTRIBUTE7';
5142   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.ass_attribute7;
5143   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.ass_attribute7;  --ns
5144   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5145   --
5146   l_count:=l_count+1;
5147   l_trans_tbl(l_count).param_name      := 'P_ASS_ATTRIBUTE8';
5148   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.ass_attribute8;
5149   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.ass_attribute8;  --ns
5150   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5151   --
5152   l_count:=l_count+1;
5153   l_trans_tbl(l_count).param_name      := 'P_ASS_ATTRIBUTE9';
5154   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.ass_attribute9;
5155   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.ass_attribute9;  --ns
5156   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5157   --
5158   l_count:=l_count+1;
5159   l_trans_tbl(l_count).param_name      := 'P_ASS_ATTRIBUTE10';
5160   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.ass_attribute10;
5161   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.ass_attribute10;  --ns
5162   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5163   --
5164   l_count:=l_count+1;
5165   l_trans_tbl(l_count).param_name      := 'P_ASS_ATTRIBUTE11';
5166   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.ass_attribute11;
5167   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.ass_attribute11;  --ns
5168   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5169   --
5170   l_count:=l_count+1;
5171   l_trans_tbl(l_count).param_name      := 'P_ASS_ATTRIBUTE12';
5172   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.ass_attribute12;
5173   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.ass_attribute12;  --ns
5174   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5175   --
5176   l_count:=l_count+1;
5177   l_trans_tbl(l_count).param_name      := 'P_ASS_ATTRIBUTE13';
5178   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.ass_attribute13;
5179   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.ass_attribute13;  --ns
5180   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5181   --
5182   l_count:=l_count+1;
5183   l_trans_tbl(l_count).param_name      := 'P_ASS_ATTRIBUTE14';
5184   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.ass_attribute14;
5185   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.ass_attribute14;  --ns
5186   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5187   --
5188   l_count:=l_count+1;
5189   l_trans_tbl(l_count).param_name      := 'P_ASS_ATTRIBUTE15';
5190   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.ass_attribute15;
5191   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.ass_attribute15;  --ns
5192   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5193   --
5194   l_count:=l_count+1;
5195   l_trans_tbl(l_count).param_name      := 'P_ASS_ATTRIBUTE16';
5196   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.ass_attribute16;
5197   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.ass_attribute16;  --ns
5198   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5199   --
5200   l_count:=l_count+1;
5201   l_trans_tbl(l_count).param_name      := 'P_ASS_ATTRIBUTE17';
5202   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.ass_attribute17;
5203   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.ass_attribute17;  --ns
5204   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5205   --
5206   l_count:=l_count+1;
5207   l_trans_tbl(l_count).param_name      := 'P_ASS_ATTRIBUTE18';
5208   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.ass_attribute18;
5209   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.ass_attribute18;  --ns
5210   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5211   --
5212   l_count:=l_count+1;
5213   l_trans_tbl(l_count).param_name      := 'P_ASS_ATTRIBUTE19';
5214   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.ass_attribute19;
5215   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.ass_attribute19;  --ns
5216   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5217   --
5218   l_count:=l_count+1;
5219   l_trans_tbl(l_count).param_name      := 'P_ASS_ATTRIBUTE20';
5220   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.ass_attribute20;
5221   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.ass_attribute20;  --ns
5222   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5223   --
5224   l_count:=l_count+1;
5225   l_trans_tbl(l_count).param_name      := 'P_ASS_ATTRIBUTE21';
5226   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.ass_attribute21;
5227   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.ass_attribute21;  --ns
5228   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5229   --
5230   l_count:=l_count+1;
5231   l_trans_tbl(l_count).param_name      := 'P_ASS_ATTRIBUTE22';
5232   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.ass_attribute22;
5233   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.ass_attribute22;  --ns
5234   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5235   --
5236   l_count:=l_count+1;
5237   l_trans_tbl(l_count).param_name      := 'P_ASS_ATTRIBUTE23';
5238   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.ass_attribute23;
5239   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.ass_attribute23;  --ns
5240   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5241   --
5242   l_count:=l_count+1;
5243   l_trans_tbl(l_count).param_name      := 'P_ASS_ATTRIBUTE24';
5244   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.ass_attribute24;
5245   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.ass_attribute24;  --ns
5246   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5247   --
5248   l_count:=l_count+1;
5249   l_trans_tbl(l_count).param_name      := 'P_ASS_ATTRIBUTE25';
5250   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.ass_attribute25;
5251   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.ass_attribute25;  --ns
5252   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5253   --
5254   l_count:=l_count+1;
5255   l_trans_tbl(l_count).param_name      := 'P_ASS_ATTRIBUTE26';
5256   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.ass_attribute26;
5257   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.ass_attribute26;  --ns
5258   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5259   --
5260   l_count:=l_count+1;
5261   l_trans_tbl(l_count).param_name      := 'P_ASS_ATTRIBUTE27';
5262   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.ass_attribute27;
5263   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.ass_attribute27;  --ns
5264   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5265   --
5266   l_count:=l_count+1;
5267   l_trans_tbl(l_count).param_name      := 'P_ASS_ATTRIBUTE28';
5268   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.ass_attribute28;
5269   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.ass_attribute28;  --ns
5270   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5271   --
5272   l_count:=l_count+1;
5273   l_trans_tbl(l_count).param_name      := 'P_ASS_ATTRIBUTE29';
5274   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.ass_attribute29;
5275   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.ass_attribute29;  --ns
5276   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5277   --
5278   l_count:=l_count+1;
5279   l_trans_tbl(l_count).param_name      := 'P_ASS_ATTRIBUTE30';
5280   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.ass_attribute30;
5281   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.ass_attribute30;  --ns
5282   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5283   --
5284   l_count:=l_count+1;
5285   l_trans_tbl(l_count).param_name      := 'P_PEOPLE_GROUP_ID';
5286   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.people_group_id;
5287   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.people_group_id;  --ns
5288   l_trans_tbl(l_count).param_data_type := 'NUMBER';
5289   --
5290   l_count:=l_count+1;
5291   l_trans_tbl(l_count).param_name      := 'P_SOFT_CODING_KEYFLEX_ID';
5292   l_trans_tbl(l_count).param_value :=  l_assignment_rec.soft_coding_keyflex_id;
5293   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.soft_coding_keyflex_id;  --ns
5294   l_trans_tbl(l_count).param_data_type := 'NUMBER';
5295   --
5296   l_count:=l_count+1;
5297   l_trans_tbl(l_count).param_name      := 'P_PAYROLL_ID';
5298   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.payroll_id;
5299   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.payroll_id;  --ns
5300   l_trans_tbl(l_count).param_data_type := 'NUMBER';
5301  --
5302   l_count:=l_count+1;
5303   l_trans_tbl(l_count).param_name      := 'P_PAY_BASIS_ID';
5304   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.pay_basis_id;
5305   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.pay_basis_id;  --ns
5306   l_trans_tbl(l_count).param_data_type := 'NUMBER';
5307 --
5308   l_count:=l_count+1;
5309   l_trans_tbl(l_count).param_name      := 'P_SAL_REVIEW_PERIOD';
5310   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.sal_review_period;
5311   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.sal_review_period;  --ns
5312   l_trans_tbl(l_count).param_data_type := 'NUMBER';
5313 --
5314   l_count:=l_count+1;
5315   l_trans_tbl(l_count).param_name      := 'P_SAL_REVIEW_PERIOD_FREQUENCY';
5316   l_trans_tbl(l_count).param_value     :=
5317          l_assignment_rec.sal_review_period_frequency;
5318   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.sal_review_period_frequency;  --ns
5319   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5320   --
5321 --
5322   l_count:=l_count+1;
5323   l_trans_tbl(l_count).param_name      := 'P_DATE_PROBATION_END';
5324   l_trans_tbl(l_count).param_value     :=
5325          to_char(l_assignment_rec.date_probation_end,g_date_format);
5326   l_trans_tbl(l_count).param_original_value := to_char(l_db_assignment_rec.date_probation_end,g_date_format);  --ns
5327   l_trans_tbl(l_count).param_data_type := 'DATE';
5328 --
5329   l_count:=l_count+1;
5330   l_trans_tbl(l_count).param_name      := 'P_PROBATION_PERIOD';
5331   l_trans_tbl(l_count).param_value     :=
5332          l_assignment_rec.probation_period;
5333   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.probation_period;  --ns
5334   l_trans_tbl(l_count).param_data_type := 'NUMBER';
5335 --
5336   l_count:=l_count+1;
5337   l_trans_tbl(l_count).param_name      := 'P_PROBATION_UNIT';
5338   l_trans_tbl(l_count).param_value     :=
5339          l_assignment_rec.probation_unit;
5340   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.probation_unit;  --ns
5341   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5342 --
5343   l_count:=l_count+1;
5344   l_trans_tbl(l_count).param_name      := 'P_NOTICE_PERIOD';
5345   l_trans_tbl(l_count).param_value     :=
5346          l_assignment_rec.notice_period;
5347   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.notice_period;  --ns
5348   l_trans_tbl(l_count).param_data_type := 'NUMBER';
5349 --
5350   l_count:=l_count+1;
5351   l_trans_tbl(l_count).param_name      := 'P_NOTICE_PERIOD_UOM';
5352   l_trans_tbl(l_count).param_value     :=
5353          l_assignment_rec.notice_period_uom;
5354   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.notice_period_uom;  --ns
5355   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5356 --
5357   l_count:=l_count+1;
5358   l_trans_tbl(l_count).param_name      := 'P_EMPLOYEE_CATEGORY';
5359   l_trans_tbl(l_count).param_value     :=
5360          l_assignment_rec.employee_category;
5361   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.employee_category;  --ns
5362   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5363 --
5364   l_count:=l_count+1;
5365   l_trans_tbl(l_count).param_name      := 'P_WORK_AT_HOME';
5366   l_trans_tbl(l_count).param_value     :=
5367          l_assignment_rec.work_at_home;
5368   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.work_at_home;  --ns
5369   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5370 --
5371   l_count:=l_count+1;
5372   l_trans_tbl(l_count).param_name      := 'P_JOB_POST_SOURCE_NAME';
5373   l_trans_tbl(l_count).param_value     :=
5374          l_assignment_rec.job_post_source_name;
5375   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.job_post_source_name;  --ns
5376   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5377 --
5378   l_count:=l_count+1;
5379   l_trans_tbl(l_count).param_name      := 'P_PERF_REVIEW_PERIOD';
5380   l_trans_tbl(l_count).param_value     :=
5381          l_assignment_rec.perf_review_period;
5382   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.perf_review_period;  --ns
5383   l_trans_tbl(l_count).param_data_type := 'NUMBER';
5384 --
5385   l_count:=l_count+1;
5386   l_trans_tbl(l_count).param_name      := 'P_PERF_REVIEW_PERIOD_FREQUENCY';
5387   l_trans_tbl(l_count).param_value     :=
5388          l_assignment_rec.perf_review_period_frequency;
5389   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.perf_review_period_frequency;  --ns
5390   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5391 --
5392   l_count:=l_count+1;
5393   l_trans_tbl(l_count).param_name      := 'P_INTERNAL_ADDRESS_LINE';
5394   l_trans_tbl(l_count).param_value     :=
5395          l_assignment_rec.internal_address_line;
5396   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.internal_address_line;  --ns
5397   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5398 
5399   l_count:=l_count+1;
5400   l_trans_tbl(l_count).param_name      := 'P_CONTRACT_ID';
5401   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.contract_id;
5402   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.contract_id;  --ns
5403   l_trans_tbl(l_count).param_data_type := 'NUMBER';
5404   --
5405   l_count:=l_count+1;
5406   l_trans_tbl(l_count).param_name      := 'P_ESTABLISHMENT_ID';
5407   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.establishment_id;
5408   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.establishment_id;  --ns
5409   l_trans_tbl(l_count).param_data_type := 'NUMBER';
5410   --
5411   l_count:=l_count+1;
5412   l_trans_tbl(l_count).param_name      := 'P_COLLECTIVE_AGREEMENT_ID';
5413   l_trans_tbl(l_count).param_value :=  l_assignment_rec.collective_agreement_id;
5414   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.collective_agreement_id;  --ns
5415   l_trans_tbl(l_count).param_data_type := 'NUMBER';
5416   --
5417   l_count:=l_count+1;
5418   l_trans_tbl(l_count).param_name      := 'P_CAGR_ID_FLEX_NUM';
5419   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.cagr_id_flex_num;
5420   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.cagr_id_flex_num;  --ns
5421   l_trans_tbl(l_count).param_data_type := 'NUMBER';
5422   --
5423   l_count:=l_count+1;
5424   l_trans_tbl(l_count).param_name      := 'P_CAGR_GRADE_DEF_ID';
5425   l_trans_tbl(l_count).param_value     :=  l_assignment_rec.cagr_grade_def_id;
5426   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.cagr_grade_def_id;      --ns
5427   l_trans_tbl(l_count).param_data_type := 'NUMBER';
5428   --
5429   l_count:=l_count+1;
5430   l_trans_tbl(l_count).param_name      := 'P_LABOUR_UNION_MEMBER_FLAG';
5431   l_trans_tbl(l_count).param_value := l_assignment_rec.labour_union_member_flag;
5432   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.labour_union_member_flag;  --ns
5433   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5434   --
5435   l_count:=l_count+1;
5436   l_trans_tbl(l_count).param_name      := 'P_BARGAINING_UNIT_CODE';
5437   l_trans_tbl(l_count).param_value := l_assignment_rec.bargaining_unit_code;
5438   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.bargaining_unit_code;  --ns
5439   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5440   --
5441   l_count:=l_count+1;
5442   l_trans_tbl(l_count).param_name      := 'P_DEFAULT_CODE_COMB_ID';
5443   l_trans_tbl(l_count).param_value := l_assignment_rec.default_code_comb_id;
5444   l_trans_tbl(l_count).param_original_value :=
5445          l_db_assignment_rec.default_code_comb_id;  --ns
5446   l_trans_tbl(l_count).param_data_type := 'NUMBER';
5447 
5448   --
5449   l_count:=l_count+1;
5450   l_trans_tbl(l_count).param_name      := 'P_SET_OF_BOOKS_ID';
5451   l_trans_tbl(l_count).param_value := l_assignment_rec.set_of_books_id;
5452   l_trans_tbl(l_count).param_original_value :=
5453          l_db_assignment_rec.set_of_books_id;  --ns
5454   l_trans_tbl(l_count).param_data_type := 'NUMBER';
5455 
5456   --
5457   l_count:=l_count+1;
5458   l_trans_tbl(l_count).param_name      := 'P_VENDOR_ID';
5459   l_trans_tbl(l_count).param_value := l_assignment_rec.vendor_id;
5460   l_trans_tbl(l_count).param_original_value :=
5461          l_db_assignment_rec.vendor_id;  --ns
5462   l_trans_tbl(l_count).param_data_type := 'NUMBER';
5463 
5464   --
5465   l_count:=l_count+1;
5466   l_trans_tbl(l_count).param_name      := 'P_ASSIGNMENT_TYPE';
5467   l_trans_tbl(l_count).param_value := l_assignment_rec.assignment_type;
5468   l_trans_tbl(l_count).param_original_value :=
5469          l_db_assignment_rec.assignment_type;  --ns
5470   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5471 
5472   --
5473   --l_count:=l_count+1;
5474   --l_trans_tbl(l_count).param_name      := 'P_SUPERVISOR_ASSIGNMENT_ID';
5475   --l_trans_tbl(l_count).param_value := l_assignment_rec.supervisor_assignment_id;
5476   --l_trans_tbl(l_count).param_original_value :=
5477   --       l_db_assignment_rec.supervisor_assignment_id;  --ns
5478   --l_trans_tbl(l_count).param_data_type := 'NUMBER';
5479   --
5480   l_count:=l_count+1;
5481   l_trans_tbl(l_count).param_name      := 'P_TITLE';
5482   l_trans_tbl(l_count).param_value := l_assignment_rec.title;
5483   l_trans_tbl(l_count).param_original_value :=
5484          l_db_assignment_rec.title;  --ns
5485   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5486 
5487   --
5488   l_count:=l_count+1;
5489   l_trans_tbl(l_count).param_name      := 'P_PROJECT_TITLE';
5490   l_trans_tbl(l_count).param_value := l_assignment_rec.project_title;
5491   l_trans_tbl(l_count).param_original_value :=
5492          l_db_assignment_rec.project_title;  --ns
5493   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5494 
5495   --
5496   l_count:=l_count+1;
5497   l_trans_tbl(l_count).param_name      := 'P_SOURCE_TYPE';
5498   l_trans_tbl(l_count).param_value := l_assignment_rec.source_type;
5499   l_trans_tbl(l_count).param_original_value :=
5500          l_db_assignment_rec.source_type;  --ns
5501   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5502 
5503   --
5504   l_count:=l_count+1;
5505   l_trans_tbl(l_count).param_name      := 'P_VENDOR_ASSIGNMENT_NUMBER';
5506   l_trans_tbl(l_count).param_value := l_assignment_rec.vendor_assignment_number;
5507   l_trans_tbl(l_count).param_original_value :=
5508          l_db_assignment_rec.vendor_assignment_number;  --ns
5509   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5510 
5511   --
5512   l_count:=l_count+1;
5513   l_trans_tbl(l_count).param_name      := 'P_VENDOR_EMPLOYEE_NUMBER';
5514   l_trans_tbl(l_count).param_value := l_assignment_rec.vendor_employee_number;
5515   l_trans_tbl(l_count).param_original_value :=
5516          l_db_assignment_rec.vendor_employee_number;  --ns
5517   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5518 
5519   --
5520   l_count:=l_count+1;
5521   l_trans_tbl(l_count).param_name      := 'P_SAVE_MODE';
5522   l_trans_tbl(l_count).param_value     :=  p_save_mode;
5523   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5524   --
5525   -- look to see if the review page is already in the list
5526   --
5527   l_count:=l_count+1;
5528   l_trans_tbl(l_count).param_name      := 'P_REVIEW_PROC_CALL';
5529 
5530   -- Bug 1043890 fix
5531   if i_changed
5532   then
5533     if(instr(l_review_proc_call,p_review_proc_call)>0) then
5534       --
5535       -- it is in the list already so just write the list
5536       --
5537       l_trans_tbl(l_count).param_value     :=  l_review_proc_call;
5538     else
5539       --
5540       -- it is not in the list, so add the delimiter and write the value
5541       --
5542       l_trans_tbl(l_count).param_value     :=  l_review_proc_call
5543                                            || '|!|'|| p_review_proc_call;
5544     end if;
5545   else
5546     -- if I am not changed, delete my review proc call from list
5547     if (instr(l_review_proc_call, '|!|'|| p_review_proc_call)>0)
5548     then
5549       l_trans_tbl(l_count).param_value :=
5550         replace(l_review_proc_call, '|!|'|| p_review_proc_call);
5551     elsif (instr(l_review_proc_call, p_review_proc_call)>0)
5552     then
5553       l_trans_tbl(l_count).param_value :=
5554         ltrim(replace(l_review_proc_call, p_review_proc_call),'|!|');
5555     else
5556       l_trans_tbl(l_count).param_value := l_review_proc_call;
5557     end if;
5558   end if;
5559 
5560   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5561   --
5562   -- look to see if the activity_id is already in the list
5563   --
5564   l_count:=l_count+1;
5565   l_trans_tbl(l_count).param_name      := 'P_REVIEW_ACTID';
5566 
5567   if i_changed
5568   then
5569     if(instr(l_activity_id_list,to_char(l_activity_id))>0) then
5570       --
5571       -- it is in the list already so just write the list
5572       --
5573       l_trans_tbl(l_count).param_value     :=  l_activity_id_list;
5574     else
5575       --
5576       -- it is not in the list, so add the delimiter and write the value
5577       --
5578       l_trans_tbl(l_count).param_value     :=  l_activity_id_list
5579                                              ||'|!|'||to_char(l_activity_id);
5580     end if;
5581 
5582   else
5583     -- if I am not changed, delete my activity id from list
5584     if (instr(l_activity_id_list, '|!|'|| to_char(l_activity_id))>0)
5585     then -- fixed for bug 3047196
5586       l_trans_tbl(l_count).param_value :=
5587         replace(l_activity_id_list, '|!|'|| to_char(l_activity_id));
5588     elsif (instr(l_activity_id_list, to_char(l_activity_id)||'|!|')>0)
5589     then
5590       l_trans_tbl(l_count).param_value :=
5591         ltrim(replace(l_activity_id_list, to_char(l_activity_id)||'|!|'));
5592     else
5593       l_trans_tbl(l_count).param_value     := l_activity_id_list;
5594     end if;
5595 
5596   end if;
5597 
5598   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5599  --
5600   l_count:=l_count+1;
5601   l_trans_tbl(l_count).param_name      := 'P_HRS_LAST_DATE';
5602   l_trans_tbl(l_count).param_value     :=  l_hrs_last_date;
5603 -- fix for bug # 1255275
5604   l_trans_tbl(l_count).param_data_type := 'DATE';
5605   --
5606   l_count:=l_count+1;
5607   l_trans_tbl(l_count).param_name      := 'P_DISPLAY_POS';
5608   l_trans_tbl(l_count).param_value     :=  l_display_pos;
5609   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5610   --
5611   l_count:=l_count+1;
5612   l_trans_tbl(l_count).param_name      := 'P_DISPLAY_ORG';
5613   l_trans_tbl(l_count).param_value     :=  l_display_org;
5614   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5615   --
5616   l_count:=l_count+1;
5617   l_trans_tbl(l_count).param_name      := 'P_DISPLAY_JOB';
5618   l_trans_tbl(l_count).param_value     :=  l_display_job;
5619   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5620   --
5621   l_count:=l_count+1;
5622   l_trans_tbl(l_count).param_name      := 'P_DISPLAY_ASS_STATUS';
5623   l_trans_tbl(l_count).param_value     :=  l_display_ass_status;
5624   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5625   --
5626   -- Bug #1067636 fix begins
5627   l_count:=l_count+1;
5628   l_trans_tbl(l_count).param_name      := 'P_DISPLAY_GRADE';
5629   l_trans_tbl(l_count).param_value     :=  l_display_grade;
5630   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5631   -- Bug #1067636 fix ends
5632   --
5633   -- Bug #1004255 fix
5634   l_count:=l_count+1;
5635   l_trans_tbl(l_count).param_name      := 'P_GRADE_LOV';
5636   l_trans_tbl(l_count).param_value     :=  l_grade_lov;
5637   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5638   --
5639   l_count:=l_count+1;
5640   l_trans_tbl(l_count).param_name      := 'P_APPROVER_ID';
5641   l_trans_tbl(l_count).param_value     :=  l_approver_id;
5642   l_trans_tbl(l_count).param_data_type := 'NUMBER';
5643 
5644   --
5645   -- GSP change
5646   l_count:=l_count+1;
5647   l_trans_tbl(l_count).param_name      := 'P_GRADE_LADDER_PGM_ID';
5648   l_trans_tbl(l_count).param_value := l_assignment_rec.grade_ladder_pgm_id;
5649   l_trans_tbl(l_count).param_original_value :=
5650          l_db_assignment_rec.grade_ladder_pgm_id;  --ns
5651   l_trans_tbl(l_count).param_data_type := 'NUMBER';
5652  -- End of GSP change
5653 
5654 
5655 
5656   l_count:=l_count+1;
5657   l_trans_tbl(l_count).param_name      := 'P_PO_HEADER_ID';
5658   l_trans_tbl(l_count).param_value := l_assignment_rec.po_header_id;
5659   l_trans_tbl(l_count).param_original_value :=
5660          l_db_assignment_rec.po_header_id;  --ns
5661   l_trans_tbl(l_count).param_data_type := 'NUMBER';
5662 
5663   l_count:=l_count+1;
5664   l_trans_tbl(l_count).param_name      := 'P_PO_LINE_ID';
5665   l_trans_tbl(l_count).param_value := l_assignment_rec.po_line_id;
5666   l_trans_tbl(l_count).param_original_value :=
5667          l_db_assignment_rec.po_line_id;  --ns
5668   l_trans_tbl(l_count).param_data_type := 'NUMBER';
5669 
5670   l_count:=l_count+1;
5671   l_trans_tbl(l_count).param_name      := 'P_VENDOR_SITE_ID';
5672   l_trans_tbl(l_count).param_value := l_assignment_rec.vendor_site_id;
5673   l_trans_tbl(l_count).param_original_value :=
5674          l_db_assignment_rec.vendor_site_id;  --ns
5675   l_trans_tbl(l_count).param_data_type := 'NUMBER';
5676 
5677   l_count:=l_count+1;
5678   l_trans_tbl(l_count).param_name      := 'P_PROJ_ASGN_END';
5679   l_trans_tbl(l_count).param_value := to_char(l_assignment_rec.projected_assignment_end, g_date_format);
5680     if(l_db_assignment_rec.projected_assignment_end is not null) then
5681       l_trans_tbl(l_count).param_original_value :=
5682              to_char(l_db_assignment_rec.projected_assignment_end, g_date_format);  --ns
5683     else
5684       l_trans_tbl(l_count).param_original_value :=
5685              l_db_assignment_rec.projected_assignment_end;  --ns
5686     end if;
5687   l_trans_tbl(l_count).param_data_type := 'DATE';
5688 
5689   l_count:=l_count+1;
5690   l_trans_tbl(l_count).param_name      := 'P_PRIMARY_FLAG';
5691   l_trans_tbl(l_count).param_value :=  l_assignment_rec.primary_flag;
5692   l_trans_tbl(l_count).param_original_value := l_db_assignment_rec.primary_flag;  --ns
5693   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5694 
5695   l_count:=l_count+1;
5696   l_trans_tbl(l_count).param_name      := 'P_J_CHANGED';
5697   l_trans_tbl(l_count).param_value := j_changed;
5698   l_trans_tbl(l_count).param_data_type := 'VARCHAR2';
5699   --
5700   -- save the transaction step
5701   --
5702   hr_transaction_ss.save_transaction_step
5703     (p_item_type             => l_item_type
5704     ,p_item_key              => l_item_key
5705     ,p_actid                 => l_activity_id
5706     ,p_login_person_id     => p_login_person_id
5707     ,p_transaction_step_id   => l_transaction_step_id
5708     ,p_transaction_data      => l_trans_tbl
5709     ,p_plan_id    => p_plan_id
5710     ,p_rptg_grp_id        => p_rptg_grp_id
5711     ,p_effective_date_option  => p_effective_date_option
5712     );
5713 
5714     open pay_step(l_item_type,l_item_key);		--bug6405208
5715     fetch pay_step into l_pay_step_id,l_pay_activity_id;
5716     if (pay_step%found and l_pay_activity_id <> -1 and
5717                                     l_assignment_rec.pay_basis_id is null) then
5718         hr_transaction_ss.delete_transaction_step
5719                 (p_transaction_step_id => l_pay_step_id
5720                  ,p_login_person_id => p_login_person_id);
5721     end if;
5722     close pay_step;
5723 
5724   -- GSP
5725   -- Check whether grade/step changed and Grade Ladder setup is done
5726   -- for the business group
5727 
5728   open step_grade_step(l_item_type,l_item_key);
5729   fetch step_grade_step into dummy;
5730 
5731   if(lb_grd_ldr_exists_flag and step_grade_step%notfound) then
5732 --     and ( lb_special_ceiling_step_id_chg or lb_grade_changed) ) then
5733 
5734    -- check whether grade ladder won't allow salary update
5735    open lc_sal_updateable_grade_ladder(p_grade_ladder_id =>
5736            l_assignment_rec.grade_ladder_pgm_id,
5737            p_effective_date => l_effective_date
5738            );
5739    fetch lc_sal_updateable_grade_ladder into lc_temp_grade_ladder_id, lc_temp_upd_sal_cd;
5740 
5741    -- if there is any salary change , then only it should create
5742    -- PayRate GSP Txn
5743    if ((lc_sal_updateable_grade_ladder%FOUND) and
5744         ( (ltt_salary_data(1).salary_change_amount < 0)
5745         or  (ltt_salary_data(1).salary_change_amount > 0))) THEN
5746      lv_gsp_review_proc_call := 'HrPayRate';
5747      lv_gsp_flow_mode := p_flow_mode ;
5748      ln_gsp_activity_id := -1;
5749 
5750      -- increment the process order for displaying pay rate page
5751      -- in review page
5752      hr_transaction_api.Set_Process_Order_String(p_item_type => l_item_type
5753                       ,p_item_key  => l_item_key
5754                       ,p_actid => ln_gsp_activity_id);
5755 
5756      -- display warning only once, thats next time onwards
5757      -- ignore salary change warning
5758 
5759      if(p_salary_change_warning <> 'IGNORE') then
5760        p_salary_change_warning := 'WARNING';
5761        hr_utility.trace('p_salary_change_warning' || p_salary_change_warning);
5762      end if;
5763 
5764      p_gsp_salary_effective_date := ltt_salary_data(1).salary_effective_date;
5765 
5766      -- Save the Pay Rate GSP Txn
5767      if (lc_temp_upd_sal_cd = 'SALARY_BASIS') then
5768         PER_SSHR_CHANGE_PAY.get_transaction_step(
5769              p_item_type          =>    l_item_type,
5770              p_item_key           => l_item_key,
5771              p_activity_id         => -1,
5772              p_login_person_id    => p_login_person_id,
5773              p_api_name           => 'PER_SSHR_CHANGE_PAY.PROCESS_API',
5774              p_transaction_id      =>    ln_gsp_txn_id,
5775              p_transaction_step_id   => ln_gsp_step_id,
5776              p_update_mode           => ln_gsp_update_mode,
5777              p_effective_date_option   =>    p_effective_date_option);
5778 
5779         hr_pay_rate_gsp_ss.create_pay_txn(
5780             p_ltt_salary_data =>  ltt_salary_data,
5781             p_transaction_id    =>  ln_gsp_txn_id,
5782             p_transaction_step_id   =>  ln_gsp_step_id,
5783             p_item_type         =>  l_item_type,
5784             p_item_key          =>  l_item_key,
5785             p_assignment_id     =>  l_assignment_id,
5786             p_effective_date    =>  l_effective_date,
5787             p_pay_basis_id      =>  l_assignment_rec.pay_basis_id,
5788             p_old_pay_basis_id  =>  l_db_assignment_rec.pay_basis_id,
5789             p_business_group_id =>  l_assignment_rec.business_group_id
5790             );
5791      else
5792      hr_pay_rate_gsp_ss.save_gsp_txn(
5793         p_item_type             => l_item_type,
5794         p_item_key              => l_item_key,
5795         p_act_id                 => ln_gsp_activity_id,
5796         p_ltt_salary_data      => ltt_salary_data,
5797         --p_api_mode             => lv_gsp_api_mode,
5798         p_review_proc_call     => lv_gsp_review_proc_call,
5799         --p_save_mode            => p_save_mode,
5800         p_flow_mode            => lv_gsp_flow_mode,
5801         p_step_id              => ln_gsp_step_id,
5802         p_rptg_grp_id        => p_rptg_grp_id,
5803         p_plan_id    => p_plan_id,
5804         p_effective_date_option  => p_effective_date_option
5805        );
5806      end if;
5807 
5808 --    end if;
5809 --    close lc_sal_updateable_grade_ladder;
5810    else
5811 
5812         -- there is no change in grade or step and no change in salary
5813         -- then remove the existing PayRate Transaction if any with
5814         -- activityId = -1
5815 
5816         -- Need to see if an asg txn step id exists or not.
5817         hr_assignment_common_save_web.get_step
5818          (p_item_type           => p_item_type
5819          ,p_item_key            => p_item_key
5820          ,p_api_name            => 'PER_SSHR_CHANGE_PAY.PROCESS_API'
5821          ,p_transaction_step_id => ln_gsp_step_id
5822          ,p_transaction_id      => l_transaction_id);
5823 
5824      if (ln_gsp_step_id is null) then
5825         hr_assignment_common_save_web.get_step
5826          (p_item_type           => p_item_type
5827          ,p_item_key            => p_item_key
5828          ,p_api_name            => 'HR_PAY_RATE_SS.PROCESS_API'
5829          ,p_transaction_step_id => ln_gsp_step_id
5830          ,p_transaction_id      => l_transaction_id);
5831      end if;
5832 
5833          IF (ln_gsp_step_id IS NOT NULL)
5834          THEN
5835            lv_gsp_activity_id := hr_transaction_api.get_varchar2_value
5836                (p_transaction_step_id => ln_gsp_step_id
5837               ,p_name                => 'P_REVIEW_ACTID');
5838            -- for Pay Rate GSP Txn, Review Activity Id  is -1
5839            if((lv_gsp_activity_id is not null) and (to_number(lv_gsp_activity_id) = -1))
5840            THEN
5841             hr_transaction_ss.delete_transaction_step
5842                 (p_transaction_step_id => ln_gsp_step_id
5843                  ,p_login_person_id => p_login_person_id);
5844             delete from per_pay_transactions where TRANSACTION_STEP_ID=ln_gsp_step_id;
5845            end if;
5846          END IF;
5847     end if;
5848     close lc_sal_updateable_grade_ladder;
5849   end if;
5850   close step_grade_step;
5851 -- End of GSP
5852   p_transaction_step_id := l_transaction_step_id;
5853 end if; -- this any element changed if statemenet
5854 else
5855   -- Bug 1043890 fix
5856   p_transaction_step_id := null;
5857   IF l_transaction_step_id IS NOT NULL
5858   THEN
5859     hr_transaction_ss.delete_transaction_step
5860      (p_transaction_step_id => l_transaction_step_id
5861      ,p_login_person_id => p_login_person_id);
5862   END IF;
5863   -- GSP Change
5864   -- delete the existing PayRate Transaction if any
5865   -- Need to see if an asg txn step id exists or not.
5866    hr_assignment_common_save_web.get_step
5867     (p_item_type           => p_item_type
5868     ,p_item_key            => p_item_key
5869     ,p_api_name            => 'PER_SSHR_CHANGE_PAY.PROCESS_API'
5870     ,p_transaction_step_id => ln_gsp_step_id
5871     ,p_transaction_id      => l_transaction_id);
5872 
5873 if (ln_gsp_step_id is null) then
5874   hr_assignment_common_save_web.get_step
5875      (p_item_type           => p_item_type
5876       ,p_item_key            => p_item_key
5877       ,p_api_name            => 'HR_PAY_RATE_SS.PROCESS_API'
5878       ,p_transaction_step_id => ln_gsp_step_id
5879       ,p_transaction_id      => l_transaction_id);
5880 end if;
5881 
5882   IF (ln_gsp_step_id IS NOT NULL)
5883    THEN
5884        lv_gsp_activity_id := hr_transaction_api.get_number_value
5885                (p_transaction_step_id => ln_gsp_step_id
5886                ,p_name                => 'P_REVIEW_ACTID');
5887          if((lv_gsp_activity_id is not null) and (to_number(lv_gsp_activity_id) = -1))
5888          THEN
5889             hr_transaction_ss.delete_transaction_step
5890                 (p_transaction_step_id => ln_gsp_step_id
5891                  ,p_login_person_id => p_login_person_id);
5892             delete from per_pay_transactions where TRANSACTION_STEP_ID=ln_gsp_step_id;
5893         end if;
5894   END IF;
5895   -- End of GSP change code
5896 end if;
5897   end if;
5898 
5899 -- only for registration
5900   if(g_registration) then
5901    -- set it back to false to avoid global variable problems with SS connection pooling
5902     g_registration := false;
5903   end if;
5904 
5905 -- applicant_hire
5906   if (g_applicant_hire) then
5907     g_applicant_hire := false;
5908   end if;
5909 
5910    if (hr_utility.check_warning) then
5911          p_page_warning_msg := hr_utility.get_message;
5912    end if;
5913 
5914 EXCEPTION
5915   when hr_utility.hr_error then
5916     hr_message.provide_error;
5917     p_page_error := hr_message.last_message_app;
5918     --p_page_error_msg := hr_message.last_message_name;
5919     p_page_error_msg := hr_message.get_message_text;
5920      -- If its registration then roll back the dummy person
5921       if(g_registration) then
5922          rollback;
5923      -- set it back to false to avoid global variable problems with SS connection pooling
5924           g_registration:= false;
5925       end if;
5926 -- applicant_hire
5927     if (g_applicant_hire) then
5928        rollback to applicant_hire;
5929        g_applicant_hire := false;
5930     end if;
5931   when others then
5932       if(g_registration) then
5933          rollback;
5934          g_registration:= false;
5935       end if;
5936 -- applicant_hire
5937     if (g_applicant_hire) then
5938        rollback to applicant_hire;
5939        g_applicant_hire := false;
5940     end if;
5941     raise;
5942 hr_utility.set_location('Exiting:'||l_proc, 40);
5943 end process_save;
5944 
5945 procedure update_object_version
5946   (p_transaction_step_id in     number
5947   ,p_login_person_id in number) is
5948 
5949   cursor csr_new_object_number(p_asg_id in number) is
5950   select object_version_number
5951     from per_all_assignments_f
5952    where assignment_id = p_asg_id
5953      and assignment_type = 'E'
5954    order by object_version_number desc;
5955 
5956   l_old_object_number number;
5957   l_assignment_id number;
5958   l_new_object_number number;
5959   l_proc   varchar2(72)  := g_package||'update_object_version';
5960 
5961 begin
5962 
5963   hr_utility.set_location('Entering:'||l_proc, 5);
5964   l_assignment_id :=
5965       hr_transaction_api.get_number_value
5966       (p_transaction_step_id =>  p_transaction_step_id
5967       ,p_name                => 'P_ASSIGNMENT_ID');
5968 
5969     open csr_new_object_number(l_assignment_id);
5970     fetch csr_new_object_number into l_new_object_number;
5971     close csr_new_object_number;
5972 
5973   l_old_object_number :=
5974     hr_transaction_api.get_number_value
5975     (p_transaction_step_id =>  p_transaction_step_id
5976     ,p_name                => 'P_OBJECT_VERSION_NUMBER');
5977 
5978   if l_old_object_number <> l_new_object_number then
5979     hr_utility.set_location('if l_old_object_number <> l_new_object_number then:'||l_proc,10);
5980     hr_transaction_api.set_number_value
5981     (p_transaction_step_id =>  p_transaction_step_id
5982     ,p_person_id           => p_login_person_id
5983     ,p_name                => 'P_OBJECT_VERSION_NUMBER'
5984     ,p_value               => l_new_object_number);
5985   end if;
5986 
5987 hr_utility.set_location('Exiting:'||l_proc, 15);
5988 end update_object_version;
5989 --
5990 --This procedure is to recover all of the assignment data from the transaction
5991 -- tables and save the data into database.
5992 procedure process_api
5993 (p_validate                 in     boolean default false
5994 ,p_transaction_step_id      in     number
5995 ,p_effective_date           in     varchar2 default null
5996 ) is
5997 
5998 l_assignment_rec             per_all_assignments_f%rowtype;
5999 l_effective_date             date;
6000 l_datetrack_update_mode      varchar2(30);
6001 l_j_changed	varchar2(2)	:= 'N';
6002 --
6003 l_special_ceiling_step_id    per_all_assignments_f.special_ceiling_step_id%TYPE;
6004 l_effective_start_date       date;
6005 l_effective_end_date         date;
6006 l_people_group_id            per_all_assignments_f.people_group_id%TYPE;
6007 l_group_name                 VARCHAR2(2000);
6008 l_org_now_no_manager_warning boolean;
6009 l_other_manager_warning      boolean;
6010 l_spp_delete_warning         boolean;
6011 l_entries_changed_warning    VARCHAR2(30);
6012 l_tax_district_changed_warning boolean;
6013 l_soft_coding_keyflex_id     per_all_assignments_f.soft_coding_keyflex_id%TYPE;
6014 l_comment_id                 per_all_assignments_f.comment_id%TYPE;
6015 l_concatenated_segments      VARCHAR2(2000);
6016 l_element_changed            VARCHAR2(1) default 'W';
6017 
6018 l_page_error               varchar2(2000);
6019 l_page_error_msg           varchar2(2000);
6020 l_page_warning             varchar2(2000);
6021 l_page_warning_msg         varchar2(2000);
6022 l_organization_error       varchar2(2000);
6023 l_organization_error_msg   varchar2(2000);
6024 l_job_error                varchar2(2000);
6025 l_job_error_msg            varchar2(2000);
6026 l_position_error           varchar2(2000);
6027 l_position_error_msg       varchar2(2000);
6028 l_grade_error              varchar2(2000);
6029 l_grade_error_msg          varchar2(2000);
6030 l_supervisor_error         varchar2(2000);
6031 l_supervisor_error_msg     varchar2(2000);
6032 l_location_error           varchar2(2000);
6033 l_location_error_msg       varchar2(2000);
6034 
6035 -- variables and cursors for applicant_hire
6036 l_appl_assignment_type per_all_assignments_f.assignment_type%type;
6037 l_new_hire_appl_hire       varchar2(10);
6038 l_login_person_id          number;
6039 
6040 -- GSP
6041   ltt_salary_data  sshr_sal_prop_tab_typ;
6042   lv_gsp_post_process_warning  varchar2(2000);
6043   l_proc   varchar2(72)  := g_package||'process_api';
6044 -- End of GSP
6045 
6046 -- cursor to get the applicant object_version_number from
6047 -- per_all_assignments_f
6048 cursor asg_applicant_rec(p_appl_assign_id in number,
6049                          p_appl_effective_date in date) is
6050 select object_version_number,
6051        assignment_type,
6052        assignment_status_type_id
6053 from per_all_assignments_f
6054 where assignment_id = p_appl_assign_id
6055 and p_appl_effective_date between effective_start_date
6056 and effective_end_date;
6057 
6058 CURSOR cur_txnStep (c_txnStepId NUMBER ) IS
6059 SELECT item_type,item_key
6060 FROM   hr_api_transaction_steps
6061 WHERE  transaction_step_id = c_txnStepId;
6062 
6063 l_item_type varchar2(50);
6064 l_item_key varchar2(50);
6065 l_rehire_flow varchar2(10) default null;
6066 
6067 cursor csr_per_step_id is
6068 select transaction_step_id from hr_api_transaction_steps
6069   where item_type=l_item_type and item_key=l_item_key
6070   and api_name='HR_PROCESS_PERSON_SS.PROCESS_API';
6071 l_per_step_id	number;
6072 l_asgn_change_mode	varchar2(2);
6073 l_person_type_id	number;
6074 
6075 cursor per_applicant_rec(p_appl_person_id in number,
6076                          	                p_appl_effective_date in date) is
6077 select object_version_number
6078 from per_all_people_f
6079 where person_id = p_appl_person_id
6080 and p_appl_effective_date between effective_start_date
6081 and effective_end_date;
6082 
6083 l_per_object_version_number	number;
6084 
6085 begin
6086 --
6087 -- recover all of the assignment values
6088 --
6089 --
6090   hr_utility.set_location('Entering:'||l_proc, 5);
6091   if (p_effective_date is not null) then
6092     hr_utility.set_location('  if (p_effective_date is not null) then:'||l_proc,10);
6093     l_effective_date:= to_date(p_effective_date,g_date_format);
6094   else
6095     l_effective_date:= to_date(
6096       hr_transaction_ss.get_wf_effective_date
6097         (p_transaction_step_id => p_transaction_step_id),g_date_format);
6098   end if;
6099 --
6100   l_datetrack_update_mode:=
6101     hr_transaction_api.get_varchar2_value
6102     (p_transaction_step_id => p_transaction_step_id
6103     ,p_name                => 'P_DATETRACK_UPDATE_MODE');
6104 
6105   l_j_changed:=
6106     hr_transaction_api.get_varchar2_value
6107     (p_transaction_step_id => p_transaction_step_id
6108     ,p_name                => 'P_J_CHANGED');
6109 
6110     OPEN  cur_txnStep (p_transaction_step_id);
6111     FETCH cur_txnStep INTO l_item_type,l_item_key;
6112     CLOSE cur_txnStep;
6113 
6114     if l_item_type is not null and l_item_key is not null then
6115   	l_rehire_flow := wf_engine.GetItemAttrText(l_item_type,l_item_key,'HR_FLOW_IDENTIFIER',true);
6116     end if;
6117 
6118     if nvl(l_rehire_flow,'N') = 'EX_EMP' then
6119 	l_datetrack_update_mode :=  'CORRECTION';
6120     end if;
6121 
6122 open csr_per_step_id;
6123 fetch csr_per_step_id into l_per_step_id;
6124 close csr_per_step_id;
6125 
6126 l_asgn_change_mode :=     hr_transaction_api.get_varchar2_value
6127     	                   (p_transaction_step_id =>  l_per_step_id
6128 	                   ,p_name                => 'P_ASGN_CHANGE_MODE');
6129 
6130 l_person_type_id :=     hr_transaction_api.get_number_value
6131     	          (p_transaction_step_id =>  l_per_step_id
6132 	          ,p_name                => 'P_PERSON_TYPE_ID');
6133 --
6134   get_asg_from_tt
6135     (p_transaction_step_id => p_transaction_step_id
6136     ,p_assignment_rec      => l_assignment_rec);
6137 --
6138    open per_applicant_rec(l_assignment_rec.person_id, l_effective_date);
6139    fetch per_applicant_rec into l_per_object_version_number;
6140    close	per_applicant_rec;
6141 
6142   l_special_ceiling_step_id:=l_assignment_rec.special_ceiling_step_id;
6143 
6144 -- start registration
6145 -- If its a new user registration flow then the assignmentId which is coming
6146 -- from transaction table will not be valid because the person has just been
6147 -- created by the process_api of the hr_process_person_ss.process_api.
6148 -- We can get that person Id and assignment id by making a call
6149 -- to the global parameters but we need to branch out the code.
6150 -- We also need the latest Object version Number not the one on transaction tbl
6151 
6152 -- adding the session id check to avoid connection pooling problems.
6153   if (( hr_process_person_ss.g_assignment_id is not null) and
6154                 (hr_process_person_ss.g_session_id= ICX_SEC.G_SESSION_ID))
6155   then
6156     hr_utility.set_location('session id is ICX_SEC.G_SESSION_ID:'||l_proc,15);
6157     l_assignment_rec.person_id := hr_process_person_ss.g_person_id;
6158     l_assignment_rec.assignment_id := hr_process_person_ss.g_assignment_id;
6159     l_assignment_rec.object_version_number:=hr_process_person_ss.g_asg_object_version_number;
6160     -- Hard code ovn to 1 for the new user registration process
6161     --l_assignment_rec.object_version_number:=1;
6162     l_new_hire_appl_hire := 'Y';
6163  end if;
6164 
6165 -- end registration
6166 --
6167 
6168    -- applicant_hire
6169    -- check if we are updating applicant, if yes we need to get the
6170    -- latest object version
6171    -- number of the applicant who has became employee in BD page
6172    if (hr_process_person_ss.g_is_applicant  and
6173       (hr_process_person_ss.g_session_id= ICX_SEC.G_SESSION_ID)) then
6174       hr_utility.set_location('Applicaant  ICX_SEC.G_SESSION_ID:'||l_proc,20);
6175       open asg_applicant_rec(l_assignment_rec.assignment_id, l_effective_date);
6176       fetch asg_applicant_rec into l_assignment_rec.object_version_number
6177                                ,l_appl_assignment_type
6178                                ,l_assignment_rec.assignment_status_type_id;
6179       close asg_applicant_rec;
6180       l_new_hire_appl_hire := 'Y';
6181    end if;
6182   -- end registration
6183 
6184   if l_new_hire_appl_hire = 'Y' then
6185     hr_utility.set_location('if l_new_hire_appl_hire = Y then:'||l_proc,25);
6186     l_login_person_id:=
6187       hr_transaction_api.get_number_value
6188        (p_transaction_step_id => p_transaction_step_id
6189        ,p_name                => 'P_LOGIN_PERSON_ID');
6190   end if;
6191 
6192   -- GSP support code
6193     -- initializing local salary data table type to pass as a parameter
6194     ltt_salary_data := sshr_sal_prop_tab_typ(sshr_sal_prop_obj_typ(
6195                 null,-- pay_proposal_id       NUMBER,
6196                 null,-- assignment_id         NUMBER,
6197                 null,--business_group_id     NUMBER,
6198                 null,--effective_date        DATE,
6199                 null,--comments              VARCHAR2(2000),
6200                 null,--next_sal_review_date  DATE,
6201                 null,--salary_change_amount  NUMBER ,
6202                 null,--salary_change_percent NUMBER ,
6203                 null,--annual_change         NUMBER ,
6204                 null,--proposed_salary       NUMBER ,
6205                 null,--proposed_percent      NUMBER ,
6206                 null,--proposal_reason       VARCHAR2(30),
6207                 null,--ranking               NUMBER,
6208                 null,--current_salary        NUMBER,
6209                 null,--performance_review_id NUMBER,
6210                 null,--multiple_components   VARCHAR2(1),
6211                 null,--element_entry_id      NUMBER ,
6212                 null,--selection_mode        VARCHAR2(1),
6213                 null,--ovn                   NUMBER,
6214                 null,--currency              VARCHAR2(15),
6215                 null,--pay_basis_name        VARCHAR2(80),
6216                 null,--annual_equivalent     NUMBER ,
6217                 null,--total_percent        NUMBER ,
6218                 null,--quartile              NUMBER ,
6219                 null,--comparatio            NUMBER ,
6220                 null,--lv_selection_mode     VARCHAR2(1),
6221                 null,--attribute_category           VARCHAR2(150),
6222                 null,--attribute1            VARCHAR2(150),
6223                 null,--attribute2            VARCHAR2(150),
6224                 null,--attribute3            VARCHAR2(150),
6225                 null,--attribute4            VARCHAR2(150),
6226                 null,--attribute5            VARCHAR2(150),
6227                 null,--attribute6            VARCHAR2(150),
6228                 null,--attribute7            VARCHAR2(150),
6229                 null,--attribute8            VARCHAR2(150),
6230                 null,--attribute9            VARCHAR2(150),
6231                 null,--attribute10           VARCHAR2(150),
6232                 null,--attribute11           VARCHAR2(150),
6233                 null,--attribute12           VARCHAR2(150),
6234                 null,--attribute13           VARCHAR2(150),
6235                 null,--attribute14           VARCHAR2(150),
6236                 null,--attribute15           VARCHAR2(150),
6237                 null,--attribute16           VARCHAR2(150),
6238                 null,--attribute17           VARCHAR2(150),
6239                 null,--attribute18           VARCHAR2(150),
6240                 null,--attribute19           VARCHAR2(150),
6241                 null,--attribute20           VARCHAR2(150),
6242                 null, --no_of_components       NUMBER,
6243                 -- 04/12/02 Salary Basis Enhancement Begins
6244                 null,  -- salary_basis_change_type varchar2(30)
6245                 null,  -- default_date           date
6246                 null,  -- default_bg_id          number
6247                 null,  -- default_currency       VARCHAR2(15)
6248                 null,  -- default_format_string  VARCHAR2(40)
6249                 null,  -- default_salary_basis_name  varchar2(30)
6250                 null,  -- default_pay_basis_name     varchar2(80)
6251                 null,  -- default_pay_basis      varchar2(30)
6252                 null,  -- default_pay_annual_factor  number
6253                 null,  -- default_grade          VARCHAR2(240)
6254                 null,  -- default_grade_annual_factor number
6255                 null,  -- default_minimum_salary      number
6256                 null,  -- default_maximum_salary      number
6257                 null,  -- default_midpoint_salary     number
6258                 null,  -- default_prev_salary         number
6259                 null,  -- default_last_change_date    date
6260                 null,  -- default_element_entry_id    number
6261                 null,  -- default_basis_changed       number
6262                 null,  -- default_uom                 VARCHAR2(30)
6263                 null,  -- default_grade_uom           VARCHAR2(30)
6264                 null,  -- default_change_amount       number
6265                 null,  -- default_change_percent      number
6266                 null,  -- default_quartile            number
6267                 null,  -- default_comparatio          number
6268                 null,  -- default_last_pay_change     varchar2(200)
6269                 null,  -- default_flsa_status         varchar2(80)
6270                 null,  -- default_currency_symbol     varchar2(4)
6271                 null,   -- default_precision           number
6272                 -- 04/12/02 Salary Basis Enhancement Ends
6273                 -- GSP
6274                 null,    -- salary_effective_date    date
6275                 null,    -- gsp_dummy_txn            varchar2(30)
6276                 -- End of GSP
6277                 null,
6278                 null,
6279                 null,
6280                 null,
6281                 null
6282                 ));
6283 
6284   --END of GSP
6285 if (l_asgn_change_mode is null OR l_asgn_change_mode = 'Y' OR
6286        l_asgn_change_mode = 'N') then
6287   update_assignment(
6288     p_validate                 =>     p_validate
6289    ,p_login_person_id          =>     l_login_person_id
6290    ,p_new_hire_appl_hire       =>     l_new_hire_appl_hire
6291    ,p_assignment_id            =>     l_assignment_rec.assignment_id
6292    ,p_object_version_number    =>     l_assignment_rec.object_version_number
6293    ,p_effective_date           =>     l_effective_date
6294    ,p_datetrack_update_mode    =>     l_datetrack_update_mode
6295    ,p_organization_id          =>     l_assignment_rec.organization_id
6296    ,p_position_id              =>     l_assignment_rec.position_id
6297    ,p_job_id                   =>     l_assignment_rec.job_id
6298    ,p_grade_id                 =>     l_assignment_rec.grade_id
6299    ,p_location_id              =>     l_assignment_rec.location_id
6300    ,p_employment_category      =>     l_assignment_rec.employment_category
6301    ,p_supervisor_id            =>     l_assignment_rec.supervisor_id
6302    ,p_manager_flag             =>     l_assignment_rec.manager_flag
6303    ,p_normal_hours             =>     l_assignment_rec.normal_hours
6304    ,p_frequency                =>     l_assignment_rec.frequency
6305    ,p_time_normal_finish       =>     l_assignment_rec.time_normal_finish
6306    ,p_time_normal_start        =>     l_assignment_rec.time_normal_start
6307    ,p_bargaining_unit_code     =>     l_assignment_rec.bargaining_unit_code
6308    ,p_labour_union_member_flag =>     l_assignment_rec.labour_union_member_flag
6309    ,p_assignment_status_type_id=>     l_assignment_rec.assignment_status_type_id
6310    ,p_change_reason            =>     l_assignment_rec.change_reason
6311    ,p_ass_attribute_category   =>     l_assignment_rec.ass_attribute_category
6312    ,p_ass_attribute1           =>     l_assignment_rec.ass_attribute1
6313    ,p_ass_attribute2           =>     l_assignment_rec.ass_attribute2
6314    ,p_ass_attribute3           =>     l_assignment_rec.ass_attribute3
6315    ,p_ass_attribute4           =>     l_assignment_rec.ass_attribute4
6316    ,p_ass_attribute5           =>     l_assignment_rec.ass_attribute5
6317    ,p_ass_attribute6           =>     l_assignment_rec.ass_attribute6
6318    ,p_ass_attribute7           =>     l_assignment_rec.ass_attribute7
6319    ,p_ass_attribute8           =>     l_assignment_rec.ass_attribute8
6320    ,p_ass_attribute9           =>     l_assignment_rec.ass_attribute9
6321    ,p_ass_attribute10          =>     l_assignment_rec.ass_attribute10
6322    ,p_ass_attribute11          =>     l_assignment_rec.ass_attribute11
6323    ,p_ass_attribute12          =>     l_assignment_rec.ass_attribute12
6324    ,p_ass_attribute13          =>     l_assignment_rec.ass_attribute13
6325    ,p_ass_attribute14          =>     l_assignment_rec.ass_attribute14
6326    ,p_ass_attribute15          =>     l_assignment_rec.ass_attribute15
6327    ,p_ass_attribute16          =>     l_assignment_rec.ass_attribute16
6328    ,p_ass_attribute17          =>     l_assignment_rec.ass_attribute17
6329    ,p_ass_attribute18          =>     l_assignment_rec.ass_attribute18
6330    ,p_ass_attribute19          =>     l_assignment_rec.ass_attribute19
6331    ,p_ass_attribute20          =>     l_assignment_rec.ass_attribute20
6332    ,p_ass_attribute21          =>     l_assignment_rec.ass_attribute21
6333    ,p_ass_attribute22          =>     l_assignment_rec.ass_attribute22
6334    ,p_ass_attribute23          =>     l_assignment_rec.ass_attribute23
6335    ,p_ass_attribute24          =>     l_assignment_rec.ass_attribute24
6336    ,p_ass_attribute25          =>     l_assignment_rec.ass_attribute25
6337    ,p_ass_attribute26          =>     l_assignment_rec.ass_attribute26
6338    ,p_ass_attribute27          =>     l_assignment_rec.ass_attribute27
6339    ,p_ass_attribute28          =>     l_assignment_rec.ass_attribute28
6340    ,p_ass_attribute29          =>     l_assignment_rec.ass_attribute29
6341    ,p_ass_attribute30          =>     l_assignment_rec.ass_attribute30
6342    ,p_soft_coding_keyflex_id   =>     l_assignment_rec.soft_coding_keyflex_id
6343    ,p_people_group_id          =>     l_assignment_rec.people_group_id
6344    ,p_payroll_id               =>     l_assignment_rec.payroll_id
6345    ,p_pay_basis_id             =>     l_assignment_rec.pay_basis_id
6346    ,p_sal_review_period        =>     l_assignment_rec.sal_review_period
6347   ,p_sal_review_period_frequency => l_assignment_rec.sal_review_period_frequency
6348    ,p_date_probation_end       =>     l_assignment_rec.date_probation_end
6349    ,p_probation_period         =>     l_assignment_rec.probation_period
6350    ,p_probation_unit           =>     l_assignment_rec.probation_unit
6351    ,p_notice_period            =>     l_assignment_rec.notice_period
6352    ,p_notice_period_uom        =>     l_assignment_rec.notice_period_uom
6353    ,p_employee_category        =>     l_assignment_rec.employee_category
6354    ,p_work_at_home             =>     l_assignment_rec.work_at_home
6355    ,p_job_post_source_name     =>     l_assignment_rec.job_post_source_name
6356    ,p_perf_review_period       =>     l_assignment_rec.perf_review_period
6357    ,p_perf_review_period_frequency =>
6358                   l_assignment_rec.perf_review_period_frequency
6359    ,p_internal_address_line    =>     l_assignment_rec.internal_address_line
6360    ,p_contract_id              =>     l_assignment_rec.contract_id
6361    ,p_establishment_id         =>     l_assignment_rec.establishment_id
6362    ,p_cagr_grade_def_id        =>     l_assignment_rec.cagr_grade_def_id
6363    ,p_collective_agreement_id  =>     l_assignment_rec.collective_agreement_id
6364    ,p_cagr_id_flex_num         =>     l_assignment_rec.cagr_id_flex_num
6365    ,p_business_group_id        =>     l_assignment_rec.business_group_id
6366    ,p_grade_ladder_pgm_id      =>     l_assignment_rec.grade_ladder_pgm_id
6367    ,p_assignment_type          =>     l_assignment_rec.assignment_type
6368    --,p_supervisor_assignment_id =>     l_assignment_rec.supervisor_assignment_id
6369    ,p_vacancy_id               =>     l_assignment_rec.vacancy_id
6370    ,p_special_ceiling_step_id  =>     l_special_ceiling_step_id
6371    ,p_primary_flag             =>     l_assignment_rec.primary_flag
6372    ,p_person_id                =>     l_assignment_rec.person_id
6373    ,p_default_code_comb_id     =>     l_assignment_rec.default_code_comb_id
6374    ,p_project_title            =>     l_assignment_rec.project_title
6375    ,p_set_of_books_id          =>     l_assignment_rec.set_of_books_id
6376    ,p_source_type              =>     l_assignment_rec.source_type
6377    ,p_title                    =>     l_assignment_rec.title
6378    ,p_vendor_assignment_number =>     l_assignment_rec.vendor_assignment_number
6379    ,p_vendor_employee_number   =>     l_assignment_rec.vendor_employee_number
6380    ,p_vendor_id                =>     l_assignment_rec.vendor_id
6381    ,p_effective_start_date     =>     l_effective_start_date
6382    ,p_effective_end_date       =>     l_effective_end_date
6383    ,p_element_warning          =>     TRUE
6384    ,p_element_changed          =>     l_element_changed
6385    ,p_page_error => l_page_error
6386    ,p_page_error_msg => l_page_error_msg
6387    ,p_page_warning => l_page_warning
6388    ,p_page_warning_msg => l_page_warning_msg
6389    ,p_organization_error => l_organization_error
6390    ,p_organization_error_msg => l_organization_error_msg
6391    ,p_job_error => l_job_error
6392    ,p_job_error_msg => l_job_error_msg
6393    ,p_position_error => l_position_error
6394    ,p_position_error_msg => l_position_error_msg
6395    ,p_grade_error => l_grade_error
6396    ,p_grade_error_msg => l_grade_error_msg
6397    ,p_supervisor_error => l_supervisor_error
6398    ,p_supervisor_error_msg => l_supervisor_error_msg
6399    ,p_location_error => l_location_error
6400    ,p_location_error_msg => l_location_error_msg
6401    -- GSP change
6402    ,p_ltt_salary_data => ltt_salary_data
6403    ,p_gsp_post_process_warning => lv_gsp_post_process_warning
6404   -- End of GSP change
6405    ,p_po_header_id => l_assignment_rec.po_header_id
6406    ,p_po_line_id => l_assignment_rec.po_line_id
6407    ,p_vendor_site_id => l_assignment_rec.vendor_site_id
6408    ,p_projected_asgn_end => l_assignment_rec.projected_assignment_end
6409    ,p_j_changed	=>  l_j_changed
6410 );
6411 else
6412 update_apl_assignment(
6413 p_assignment_rec => l_assignment_rec
6414 ,p_validate	=>	p_validate
6415 ,p_effective_date  =>	l_effective_date
6416 ,p_person_id	=>	l_assignment_rec.person_id
6417 ,p_appl_assignment_id  =>	l_assignment_rec.assignment_id
6418 ,p_person_type_id  =>	l_person_type_id
6419 ,p_overwrite_primary  =>	l_asgn_change_mode
6420 ,p_ovn	=> l_per_object_version_number);
6421 end if;
6422 
6423  hr_transaction_swi.set_person_context(l_assignment_rec.person_id
6424                                       ,l_assignment_rec.assignment_id
6425                                       ,l_effective_date);
6426 
6427 
6428 --bug 5032032 fix begin
6429 if l_new_hire_appl_hire = 'Y' then
6430 update_salary_proposal(l_assignment_rec.assignment_id,l_effective_date);
6431 end if;
6432 --bug 5032032 fix end
6433 
6434 end process_api;
6435 
6436 procedure update_apl_assignment
6437 (p_validate	in boolean default false,
6438 p_assignment_rec in out nocopy per_all_assignments_f%rowtype,
6439 p_effective_date  in date,
6440 p_person_id	in number,
6441 p_appl_assignment_id  in number,
6442 p_person_type_id  in number,
6443 p_overwrite_primary  in varchar2,
6444 p_ovn  in number
6445 ) is
6446 l_per_effective_start_date	date;
6447 l_per_effective_end_date	date;
6448 l_unaccepted_asg_del_warning	boolean;
6449 l_assign_payroll_warning	boolean;
6450 l_oversubscribed_vacancy_id	number;
6451 l_ovn  number	:=  p_ovn;
6452 l_assignment_rec	per_all_assignments_f%rowtype := p_assignment_rec;
6453 
6454 cursor csr_prim_asg is
6455 select assignment_id from per_all_assignments_f where
6456 person_id = p_person_id and primary_flag='Y' and assignment_type='E' and
6457 p_effective_date between effective_start_date and effective_end_date;
6458 
6459 l_prim_asgid	number;
6460 -- Fix for the BUG13595937 starts
6461 l_supervisor_assignment_id        per_all_assignments_f.supervisor_assignment_id%TYPE;
6462 CURSOR csr_get_sup_Ass_id(p_assignment_id in number) is
6463   select supervisor_assignment_id from per_all_assignments_f
6464 	where assignment_id = p_assignment_id;
6465 -- Fix for the BUG13595937 ends
6466 
6467 begin
6468 -- Fix for the BUG13595937 starts
6469 if (p_overwrite_primary = 'W') then
6470 	open csr_get_sup_Ass_id(p_appl_assignment_id);
6471 	fetch csr_get_sup_Ass_id into l_supervisor_assignment_id;
6472 	close csr_get_sup_Ass_id;
6473 	l_assignment_rec.supervisor_assignment_id :=
6474 	l_supervisor_assignment_id;
6475 end if;
6476 -- Fix for the BUG13595937 ends
6477    hr_employee_applicant_api.hire_employee_applicant
6478       (p_validate          =>	p_validate,
6479        p_hire_date         =>       p_effective_date,
6480        p_asg_rec	=> l_assignment_rec,
6481        p_person_id         => 	p_person_id,
6482        p_primary_assignment_id     => p_appl_assignment_id,
6483        p_person_type_id    =>	p_person_type_id,
6484        p_overwrite_primary     =>   p_overwrite_primary,
6485        p_per_object_version_number	=> l_ovn,
6486        p_per_effective_start_date   =>  l_per_effective_start_date,
6487        p_per_effective_end_date     =>  l_per_effective_end_date,
6488        p_unaccepted_asg_del_warning =>  l_unaccepted_asg_del_warning,
6489        p_assign_payroll_warning     =>  l_assign_payroll_warning,
6490        p_oversubscribed_vacancy_id  =>  l_oversubscribed_vacancy_id,
6491        p_called_from => 'SSHR'
6492      );
6493 
6494         p_assignment_rec	:=	l_assignment_rec;
6495 end;
6496 
6497 --This is the procedure to update the assignment data, including
6498 --   the People Group and Soft Coded Key Flexfields
6499 --
6500 procedure update_assignment
6501 (p_validate                 in     boolean default false
6502 ,p_login_person_id          in     number default null
6503 ,p_new_hire_appl_hire       in     varchar2 default 'N'
6504 ,p_assignment_id            in     number
6505 ,p_object_version_number    in     number
6506 ,p_effective_date           in     date
6507 ,p_datetrack_update_mode    in     varchar2
6508 ,p_organization_id          in     number
6509 ,p_position_id              in     number   default null
6510 ,p_job_id                   in     number   default null
6511 ,p_grade_id                 in     number   default null
6512 ,p_location_id              in     number   default null
6513 ,p_employment_category      in     varchar2 default null
6514 ,p_supervisor_id            in     number   default null
6515 ,p_manager_flag             in     varchar2 default null
6516 ,p_normal_hours             in     number   default null
6517 ,p_frequency                in     varchar2 default null
6518 ,p_time_normal_finish       in     varchar2 default null
6519 ,p_time_normal_start        in     varchar2 default null
6520 ,p_bargaining_unit_code     in     varchar2 default null
6521 ,p_labour_union_member_flag in     varchar2 default null
6522 ,p_assignment_status_type_id in    number   default null
6523 ,p_change_reason            in     varchar2 default null
6524 ,p_ass_attribute_category   in     varchar2 default null
6525 ,p_ass_attribute1           in     varchar2 default null
6526 ,p_ass_attribute2           in     varchar2 default null
6527 ,p_ass_attribute3           in     varchar2 default null
6528 ,p_ass_attribute4           in     varchar2 default null
6529 ,p_ass_attribute5           in     varchar2 default null
6530 ,p_ass_attribute6           in     varchar2 default null
6531 ,p_ass_attribute7           in     varchar2 default null
6532 ,p_ass_attribute8           in     varchar2 default null
6533 ,p_ass_attribute9           in     varchar2 default null
6534 ,p_ass_attribute10          in     varchar2 default null
6535 ,p_ass_attribute11          in     varchar2 default null
6536 ,p_ass_attribute12          in     varchar2 default null
6537 ,p_ass_attribute13          in     varchar2 default null
6538 ,p_ass_attribute14          in     varchar2 default null
6539 ,p_ass_attribute15          in     varchar2 default null
6540 ,p_ass_attribute16          in     varchar2 default null
6541 ,p_ass_attribute17          in     varchar2 default null
6542 ,p_ass_attribute18          in     varchar2 default null
6543 ,p_ass_attribute19          in     varchar2 default null
6544 ,p_ass_attribute20          in     varchar2 default null
6545 ,p_ass_attribute21          in     varchar2 default null
6546 ,p_ass_attribute22          in     varchar2 default null
6547 ,p_ass_attribute23          in     varchar2 default null
6548 ,p_ass_attribute24          in     varchar2 default null
6549 ,p_ass_attribute25          in     varchar2 default null
6550 ,p_ass_attribute26          in     varchar2 default null
6551 ,p_ass_attribute27          in     varchar2 default null
6552 ,p_ass_attribute28          in     varchar2 default null
6553 ,p_ass_attribute29          in     varchar2 default null
6554 ,p_ass_attribute30          in     varchar2 default null
6555 ,p_soft_coding_keyflex_id   in out nocopy    number
6556 ,p_people_group_id          in     number   default null
6557 ,p_contract_id                  in     number default null
6558 ,p_establishment_id             in     number default null
6559 ,p_cagr_grade_def_id            in     number default null
6560 ,p_collective_agreement_id      in     number default null
6561 ,p_cagr_id_flex_num             in     number default null
6562 ,p_payroll_id                   in     number default null
6563 ,p_pay_basis_id                 in     number default null
6564 ,p_sal_review_period            in     number default null
6565 ,p_sal_review_period_frequency  in     varchar2 default null
6566 ,p_date_probation_end       in date default null
6567 ,p_probation_period         in number default null
6568 ,p_probation_unit           in varchar2 default null
6569 ,p_notice_period            in number default null
6570 ,p_notice_period_uom        in varchar2 default null
6571 ,p_employee_category        in varchar2 default null
6572 ,p_work_at_home             in varchar2 default null
6573 ,p_job_post_source_name     in varchar2 default null
6574 ,p_perf_review_period       in number default null
6575 ,p_perf_review_period_frequency in varchar2 default null
6576 ,p_internal_address_line    in varchar2 default null
6577 ,p_business_group_id        in     per_all_assignments_f.business_group_id%TYPE
6578 -- GSP change
6579 ,p_grade_ladder_pgm_id      in    per_all_assignments_f.grade_ladder_pgm_id%TYPE
6580 -- GSP change
6581 ,p_assignment_type          in     per_all_assignments_f.assignment_type%TYPE
6582 --,p_supervisor_assignment_id in per_all_assignments_f.supervisor_assignment_id%TYPE
6583 ,p_vacancy_id               in     per_all_assignments_f.vacancy_id%TYPE
6584 ,p_special_ceiling_step_id  in out nocopy per_all_assignments_f.special_ceiling_step_id%TYPE
6585 ,p_primary_flag             in     per_all_assignments_f.primary_flag%TYPE
6586 ,p_person_id                in     per_all_assignments_f.person_id%TYPE
6587 ,p_effective_start_date        out nocopy date
6588 ,p_effective_end_date          out nocopy date
6589 ,p_element_warning          in     boolean
6590 ,p_element_changed          in out nocopy varchar2
6591 ,p_email_id                 in     varchar2 default null
6592 ,p_page_error               in out nocopy varchar2
6593 ,p_page_error_msg           in out nocopy varchar2
6594 ,p_page_warning             in out nocopy varchar2
6595 ,p_page_warning_msg         in out nocopy varchar2
6596 ,p_organization_error       in out nocopy varchar2
6597 ,p_organization_error_msg   in out nocopy varchar2
6598 ,p_job_error                in out nocopy varchar2
6599 ,p_job_error_msg            in out nocopy varchar2
6600 ,p_position_error           in out nocopy varchar2
6601 ,p_position_error_msg       in out nocopy varchar2
6602 ,p_grade_error              in out nocopy varchar2
6603 ,p_grade_error_msg          in out nocopy varchar2
6604 ,p_supervisor_error         in out nocopy varchar2
6605 ,p_supervisor_error_msg     in out nocopy varchar2
6606 ,p_location_error           in out nocopy varchar2
6607 ,p_location_error_msg       in out nocopy varchar2
6608 ,p_title                    in varchar2 default null
6609 ,p_default_code_comb_id     in number default null
6610 ,p_set_of_books_id          in number default null
6611 ,p_source_type              in varchar2 default null
6612 ,p_project_title            in varchar2 default null
6613 ,p_vendor_assignment_number in varchar2 default null
6614 ,p_vendor_employee_number   in varchar2 default null
6615 ,p_vendor_id                in number default null
6616 --GSP populates salary information from Grade Ladder assignment
6617 ,p_ltt_salary_data    IN OUT NOCOPY  sshr_sal_prop_tab_typ
6618 ,p_gsp_post_process_warning out nocopy varchar2
6619 -- End of GSP
6620 ,p_po_header_id                in number default null
6621 ,p_po_line_id                in number default null
6622 ,p_vendor_site_id                in number default null
6623 ,p_projected_asgn_end        in date default null
6624 ,p_j_changed	in varchar2   default 'Y'
6625 ) is
6626 --
6627 
6628 l_effective_date             date;
6629 l_object_version_number      per_all_assignments_f.object_version_number%TYPE;
6630 l_effective_start_date       date;
6631 l_effective_end_date         date;
6632 -- Fix for 3633612 to pass new people group flx ccid to hr_assignment_api, so that these
6633 -- hr_assignment_api's  won't validate the old segment values.
6634 l_people_group_id            per_all_assignments_f.people_group_id%TYPE
6635                               := p_people_group_id;
6636 l_group_name                 VARCHAR2(2000);
6637 l_org_now_no_manager_warning boolean;
6638 l_other_manager_warning      boolean;
6639 l_spp_delete_warning         boolean;
6640 l_entries_changed_warning    VARCHAR2(30);
6641 l_tax_district_changed_warning boolean;
6642 l_soft_coding_keyflex_id     per_all_assignments_f.soft_coding_keyflex_id%TYPE;
6643 l_cagr_grade_def_id          per_all_assignments_f.cagr_grade_def_id%TYPE;
6644 l_cagr_concatenated_segments varchar2(2000);
6645 l_comment_id                 per_all_assignments_f.comment_id%TYPE;
6646 l_concatenated_segments      VARCHAR2(2000);
6647 l_hourly_salaried_warning    boolean default false;
6648 l_validation_start_date      per_assignments_f.effective_start_date%TYPE;
6649 l_validation_end_date        per_assignments_f.effective_end_date%TYPE;
6650 l_validate                   boolean;
6651 l_inv_pos_grade_warning      boolean;
6652 l_org_error                  boolean default false;
6653 l_job_error                  boolean default false;
6654 l_pos_error                  boolean default false;
6655 l_old_wc_code                number;
6656 l_old_job_id                 number;
6657 l_new_wc_code                number;
6658 l_assignment_status_type     varchar2(30);
6659 
6660 -- for disabling the descriptive flex field
6661 l_add_struct_d hr_dflex_utility.l_ignore_dfcode_varray :=
6662                            hr_dflex_utility.l_ignore_dfcode_varray();
6663 -- for disabling the key flex field
6664 l_add_struct_k hr_kflex_utility.l_ignore_kfcode_varray :=
6665                            hr_kflex_utility.l_ignore_kfcode_varray();
6666 --
6667 -- GSP changes
6668  lb_grd_ldr_exists_flag  boolean default false;
6669 -- End of GSP changes
6670 l_proc   varchar2(72)  := g_package||'update_assignment';
6671 --
6672 cursor current_job_id is
6673 select job_id
6674 from per_all_assignments_f
6675 where assignment_id=p_assignment_id
6676 and l_effective_date between effective_start_date and effective_end_date;
6677 
6678 --
6679 cursor wc_code(pc_job_id number) is
6680 select jwc.wc_code
6681 from pay_job_wc_code_usages jwc,
6682 hr_locations_all hl
6683 where jwc.job_id = pc_job_id
6684 and hl.location_id = p_location_id
6685 and jwc.state_code = hl.region_2;
6686 --
6687 cursor status_type is
6688 select per_system_status
6689 from per_assignment_status_types
6690 where assignment_status_type_id=p_assignment_status_type_id;
6691 --
6692 
6693   cursor csr_pgp_segments is
6694   select *
6695   from pay_people_groups
6696   where people_group_id = p_people_group_id;
6697 
6698   cursor csr_scl_segments is
6699   select *
6700   from hr_soft_coding_keyflex
6701   where soft_coding_keyflex_id = p_soft_coding_keyflex_id;
6702 
6703   cursor csr_cag_segments is
6704   select *
6705   from per_cagr_grades_def
6706   where cagr_grade_def_id = p_cagr_grade_def_id;
6707 
6708   cursor csr_default_work_schedule(leg_code  in varchar2) is
6709   select to_char(user_column_id)
6710   from pay_user_columns puc, hr_organization_information hoi
6711   WHERE (HOI.org_information1 = to_char(PUC.user_table_id)
6712        OR HOI.org_information1 is null )
6713   AND  HOI.org_information_context  = 'Work Schedule'
6714   AND  HOI.organization_id  = p_organization_id
6715   AND  (puc.business_group_id is null or
6716         puc.business_group_id = p_business_group_id)
6717   AND  (puc.legislation_code is null or
6718         puc.legislation_code = leg_code)
6719   and puc.user_column_name = hoi.org_information2;
6720 
6721   /*cursor csr_validate_work_schedule(leg_code  in varchar2,
6722                                    segment4 in number) is
6723   select to_char(user_column_id)
6724   from pay_user_columns puc, hr_organization_information hoi
6725   WHERE (HOI.org_information1 = to_char(PUC.user_table_id)
6726        OR HOI.org_information1 is null )
6727   AND  HOI.org_information_context  = 'Work Schedule'
6728   AND  HOI.organization_id  = p_organization_id
6729   AND  (puc.business_group_id is null or
6730         puc.business_group_id = p_business_group_id)
6731   AND  (puc.legislation_code is null or
6732         puc.legislation_code = leg_code)
6733   and  puc.user_column_id = segment4;*/
6734 
6735   cursor csr_default_gre is
6736   select scl.segment1
6737   from hr_soft_coding_keyflex scl,
6738        per_all_assignments_f asg
6739   where asg.person_id = p_login_person_id
6740   and asg.business_group_id = p_business_group_id --the new hire business group
6741   and asg.primary_flag = 'Y'
6742   and trunc(sysdate) between asg.effective_start_date
6743       and asg.effective_end_date
6744   and asg.soft_coding_keyflex_id = scl.soft_coding_keyflex_id;
6745 
6746  -- Fix for Bug # 3116369
6747    cursor csr_cwk_scl_idsel(leg_code  in varchar2) is
6748     select rule_mode
6749     from   pay_legislation_rules    plr
6750     where  plr.legislation_code  = leg_code
6751     and    plr.rule_type         = 'CWK_S'
6752     and    exists
6753           (select null
6754            from   fnd_segment_attribute_values fsav
6755            where  fsav.id_flex_num             = plr.rule_mode
6756            and    fsav.application_id          = 800
6757            and    fsav.id_flex_code            = 'SCL'
6758            and    fsav.segment_attribute_type  = 'ASSIGNMENT'
6759            and    fsav.attribute_value         = 'Y')
6760     and    exists
6761           (select null
6762            from   pay_legislation_rules        plr2
6763            where  plr2.legislation_code        = plr.legislation_code
6764            and    plr2.rule_type               = 'CWK_SDL'
6765            and    plr2.rule_mode               = 'A') ;
6766 
6767 
6768   cursor csr_emp_scl_idsel(leg_code  in varchar2) is
6769     select rule_mode
6770        from   pay_legislation_rules
6771        where  legislation_code = leg_code
6772        and    rule_type        = 'S'
6773        and    exists
6774            (select null
6775             from   fnd_segment_attribute_values
6776             where  id_flex_num = rule_mode
6777             and    application_id = 800
6778             and    id_flex_code = 'SCL'
6779             and    segment_attribute_type = 'ASSIGNMENT'
6780             and    attribute_value = 'Y')
6781        and    exists
6782            (select null
6783             from   pay_legislation_rules
6784             where  legislation_code  = leg_code
6785             and    rule_type = 'SDL'
6786             and    rule_mode = 'A');
6787 
6788 cursor check_payroll_scl is
6789     select asg.assignment_id,
6790                asg.payroll_id,
6791                asg.soft_coding_keyflex_id
6792       from per_all_assignments_f asg
6793      where asg.person_id                 = p_person_id
6794        and l_effective_date between asg.effective_start_date
6795                                        and asg.effective_end_date
6796        and asg.assignment_type = 'E'
6797        and assignment_id <> p_assignment_id
6798        and asg.payroll_id is not null
6799        and asg.soft_coding_keyflex_id is null
6800        order by asg.assignment_id;
6801   --
6802   l_flex_num               fnd_id_flex_segments.id_flex_num%TYPE;
6803   l_scl_hide_flag varchar2(1);
6804 
6805   l_people_groups csr_pgp_segments%rowtype;
6806   l_soft_coding_keyflex csr_scl_segments%rowtype;
6807   l_cagr_grades_def csr_cag_segments%rowtype;
6808   l_legislation_code   per_business_groups.legislation_code%TYPE;
6809   l_new_hire_default  varchar2(10);
6810 
6811   l_old_payroll_id number;
6812   l_validate_start_date date;
6813   l_validate_end_date date;
6814   l_entries_changed varchar2(250);
6815 
6816   l_asg_future_changes_warning	boolean;
6817   l_pay_proposal_warning	boolean;
6818   l_old_conc_segments  hr_soft_coding_keyflex.concatenated_segments%TYPE;
6819 
6820 begin
6821 
6822   hr_utility.set_location('Entering:'||l_proc, 5);
6823   l_effective_date :=trunc(p_effective_date);
6824 
6825   l_validate_start_date := p_effective_start_date;
6826   l_validate_end_date := p_effective_end_date;
6827 
6828   open csr_pgp_segments;
6829   fetch csr_pgp_segments into l_people_groups;
6830   close csr_pgp_segments;
6831 
6832   open csr_scl_segments;
6833   fetch csr_scl_segments into l_soft_coding_keyflex;
6834   close csr_scl_segments;
6835 
6836   open csr_cag_segments;
6837   fetch csr_cag_segments into l_cagr_grades_def;
6838   close csr_cag_segments;
6839 --
6840 -- get the current job_id for wc_validation
6841 --
6842   open current_job_id;
6843   fetch current_job_id into l_old_job_id;
6844   if current_job_id%found then
6845     close current_job_id;
6846   else
6847     close current_job_id;
6848   end if;
6849 
6850   -- Set default SCL for new hire and applicant hire only
6851   -- for US legislation.
6852   -- if p_soft_coding_keyflex_id is null, the GRE region must be turned off
6853   -- for the new hire flow or the applicant hire flow.
6854   -- we need to set the GRE and Work Schedule default values. Otherwise,
6855   -- core hr api will raise error HR_50001_EMP_ASS_NO_GRE.
6856   -- The default GRE and Work Schedule values are set when the p_login_person_id
6857   -- is not null (update_assignment is called by the process_save).
6858   -- The login_person_id is null when update_assignment is called by
6859   -- process_api. The default values should not be set when called by
6860   -- process_api because the default values are already in transation table.
6861   -- if p_soft_coding_keyflex_id is null, then it must be a new hire or
6862   -- applicant hire.
6863   l_legislation_code := hr_misc_web.get_legislation_code
6864                   (p_assignment_id => p_assignment_id,
6865                    p_effective_date => l_effective_date);
6866   l_new_hire_default := fnd_profile.value('HR_SSHR_NEW_HIRE_DEFAULTS');
6867 
6868   -- Bug Fix for 3116369
6869   -- find the scl hide flag logic in order to set the default values for gre and
6870   -- workschedule segments Bug fix for 3116369
6871   l_scl_hide_flag := 'N';
6872   if p_assignment_type = 'C' then
6873         hr_utility.set_location('if p_assignment_type = C then:'||l_proc,25);
6874         OPEN csr_cwk_scl_idsel(l_legislation_code);
6875         FETCH csr_cwk_scl_idsel INTO l_flex_num;
6876         IF csr_cwk_scl_idsel%NOTFOUND THEN
6877           l_scl_hide_flag := 'Y';
6878         END IF;
6879         CLOSE csr_cwk_scl_idsel;
6880   else
6881         OPEN csr_emp_scl_idsel(l_legislation_code);
6882         FETCH csr_emp_scl_idsel INTO l_flex_num;
6883         IF csr_emp_scl_idsel%NOTFOUND THEN
6884           l_scl_hide_flag := 'Y';
6885         END IF;
6886         CLOSE csr_emp_scl_idsel;
6887   end if;
6888 
6889   if (p_login_person_id is not null and
6890      p_new_hire_appl_hire = 'Y' and
6891      p_soft_coding_keyflex_id is null and
6892      (l_new_hire_default is null or l_new_hire_default = 'Y') and
6893      l_scl_hide_flag = 'N')
6894   then
6895     if l_legislation_code = 'US' then
6896       -- set default GRE
6897       open csr_default_gre;
6898       fetch csr_default_gre into l_soft_coding_keyflex.segment1;
6899       close csr_default_gre;
6900     end if;
6901     -- set default work schedule
6902     open csr_default_work_schedule(l_legislation_code);
6903     fetch csr_default_work_schedule into l_soft_coding_keyflex.segment4;
6904     close csr_default_work_schedule;
6905 
6906 	--Bug fix 13888505
6907     /* When SCL is not rendered in Assignment page we get p_soft_coding_keyflex_id	as null
6908 	   But while calling hr_assignment_api.update_emp_asg_criteria we have to pass a proper
6909 	   scl_id so that no error appears.*/
6910 
6911 	hr_kflex_utility.upd_or_sel_keyflex_comb
6912               (p_appl_short_name        => 'PER'
6913               ,p_flex_code              => 'SCL'
6914               ,p_flex_num               => l_flex_num
6915               ,p_segment1               => l_soft_coding_keyflex.segment1
6916               ,p_segment2               => l_soft_coding_keyflex.segment2
6917               ,p_segment3               => l_soft_coding_keyflex.segment3
6918               ,p_segment4               => l_soft_coding_keyflex.segment4
6919               ,p_segment5               => l_soft_coding_keyflex.segment5
6920               ,p_segment6               => l_soft_coding_keyflex.segment6
6921               ,p_segment7               => l_soft_coding_keyflex.segment7
6922               ,p_segment8               => l_soft_coding_keyflex.segment8
6923               ,p_segment9               => l_soft_coding_keyflex.segment9
6924               ,p_segment10              => l_soft_coding_keyflex.segment10
6925               ,p_segment11              => l_soft_coding_keyflex.segment11
6926               ,p_segment12              => l_soft_coding_keyflex.segment12
6927               ,p_segment13              => l_soft_coding_keyflex.segment13
6928               ,p_segment14              => l_soft_coding_keyflex.segment14
6929               ,p_segment15              => l_soft_coding_keyflex.segment15
6930               ,p_segment16              => l_soft_coding_keyflex.segment16
6931               ,p_segment17              => l_soft_coding_keyflex.segment17
6932               ,p_segment18              => l_soft_coding_keyflex.segment18
6933               ,p_segment19              => l_soft_coding_keyflex.segment19
6934               ,p_segment20              => l_soft_coding_keyflex.segment20
6935               ,p_segment21              => l_soft_coding_keyflex.segment21
6936               ,p_segment22              => l_soft_coding_keyflex.segment22
6937               ,p_segment23              => l_soft_coding_keyflex.segment23
6938               ,p_segment24              => l_soft_coding_keyflex.segment24
6939               ,p_segment25              => l_soft_coding_keyflex.segment25
6940               ,p_segment26              => l_soft_coding_keyflex.segment26
6941               ,p_segment27              => l_soft_coding_keyflex.segment27
6942               ,p_segment28              => l_soft_coding_keyflex.segment28
6943               ,p_segment29              => l_soft_coding_keyflex.segment29
6944               ,p_segment30              => l_soft_coding_keyflex.segment30
6945               ,p_concat_segments_in     => l_old_conc_segments
6946               ,p_ccid                   => l_soft_coding_keyflex_id
6947               ,p_concat_segments_out    => l_concatenated_segments
6948               );
6949 
6950   end if;
6951 
6952 if (p_new_hire_appl_hire = 'Y' and l_legislation_code = 'US') then
6953    for c in check_payroll_scl loop
6954       update per_all_assignments_f set soft_coding_keyflex_id = p_soft_coding_keyflex_id
6955        where assignment_id = c.assignment_id and l_effective_date between
6956        effective_start_date and effective_end_date;
6957    end loop;
6958 end if;
6959 
6960   -- validate the work schedule segment4 when not new hire.
6961   -- this could be invalid if the SCL is truned off in the web page
6962   -- and organization has been changed.
6963 
6964   /*if p_login_person_id is not null and
6965      p_new_hire_appl_hire = 'N'and
6966      l_soft_coding_keyflex.segment4 is not null and
6967      l_legislation_code = 'US' then
6968     begin
6969     open csr_validate_work_schedule
6970       (l_legislation_code, to_number(l_soft_coding_keyflex.segment4));
6971     fetch csr_validate_work_schedule into l_soft_coding_keyflex.segment4;
6972     if csr_validate_work_schedule%notfound then
6973       --not a valid work_schedule
6974       -- set default work schedule
6975       open csr_default_work_schedule(l_legislation_code);
6976       fetch csr_default_work_schedule into l_soft_coding_keyflex.segment4;
6977       if csr_default_work_schedule%notfound then
6978         l_soft_coding_keyflex.segment4 := null;
6979       end if;
6980       close csr_default_work_schedule;
6981     end if;
6982     close csr_validate_work_schedule;
6983     exception
6984       when others then
6985         null;
6986     end;
6987   end if;*/
6988 --
6989 -- since we are calling more than one api, we must issue our own
6990 -- savepoint and manage the rollback ourselves.
6991 --
6992   savepoint validate_assignment;
6993 --
6994   l_object_version_number:=p_object_version_number;
6995   l_validate := p_validate;
6996 
6997 if (p_j_changed = 'Y' or p_j_changed is null) then
6998   if p_assignment_type = 'C' then
6999     hr_utility.set_location('if p_assignment_type = C then:'||l_proc,30);
7000     l_add_struct_k.extend(1);
7001     l_add_struct_k(l_add_struct_k.count) := 'SCL';
7002     hr_kflex_utility.create_ignore_kf_validation(p_rec => l_add_struct_k);
7003     --
7004     -- code for disabling the descriptive flex field
7005     l_add_struct_d.extend(1);
7006     l_add_struct_d(l_add_struct_d.count) := 'PER_ASSIGNMENTS';
7007 
7008     hr_dflex_utility.create_ignore_df_validation(p_rec => l_add_struct_d);
7009 
7010     hr_assignment_api.update_cwk_asg_criteria
7011       (p_effective_date               => l_effective_date
7012       ,p_datetrack_update_mode        => p_datetrack_update_mode
7013       ,p_assignment_id                => p_assignment_id
7014       ,p_object_version_number        => l_object_version_number
7015       ,p_grade_id                     => p_grade_id
7016       ,p_position_id                  => p_position_id
7017       ,p_job_id                       => p_job_id
7018       ,p_location_id                  => p_location_id
7019       ,p_organization_id              => p_organization_id
7020       ,p_pay_basis_id                 => p_pay_basis_id
7021 
7022      -- Fix for Bug #3083706 for updating people grp for CWK
7023       ,p_segment1                     => l_people_groups.segment1
7024       ,p_segment2                     => l_people_groups.segment2
7025       ,p_segment3                     => l_people_groups.segment3
7026       ,p_segment4                     => l_people_groups.segment4
7027       ,p_segment5                     => l_people_groups.segment5
7028       ,p_segment6                     => l_people_groups.segment6
7029       ,p_segment7                     => l_people_groups.segment7
7030       ,p_segment8                     => l_people_groups.segment8
7031       ,p_segment9                     => l_people_groups.segment9
7032       ,p_segment10                    => l_people_groups.segment10
7033       ,p_segment11                    => l_people_groups.segment11
7034       ,p_segment12                    => l_people_groups.segment12
7035       ,p_segment13                    => l_people_groups.segment13
7036       ,p_segment14                    => l_people_groups.segment14
7037       ,p_segment15                    => l_people_groups.segment15
7038       ,p_segment16                    => l_people_groups.segment16
7039       ,p_segment17                    => l_people_groups.segment17
7040       ,p_segment18                    => l_people_groups.segment18
7041       ,p_segment19                    => l_people_groups.segment19
7042       ,p_segment20                    => l_people_groups.segment20
7043       ,p_segment21                    => l_people_groups.segment21
7044       ,p_segment22                    => l_people_groups.segment22
7045       ,p_segment23                    => l_people_groups.segment23
7046       ,p_segment24                    => l_people_groups.segment24
7047       ,p_segment25                    => l_people_groups.segment25
7048       ,p_segment26                    => l_people_groups.segment26
7049       ,p_segment27                    => l_people_groups.segment27
7050       ,p_segment28                    => l_people_groups.segment28
7051       ,p_segment29                    => l_people_groups.segment29
7052       ,p_segment30                    => l_people_groups.segment30
7053     -- end of the bug Fix for #3083706
7054 
7055       ,p_people_group_name            => l_group_name
7056       ,p_effective_start_date         => l_effective_start_date
7057       ,p_effective_end_date           => l_effective_end_date
7058       ,p_people_group_id              => l_people_group_id
7059       ,p_org_now_no_manager_warning   => l_org_now_no_manager_warning
7060       ,p_other_manager_warning        => l_other_manager_warning
7061       ,p_spp_delete_warning           => l_spp_delete_warning
7062       ,p_entries_changed_warning      => l_entries_changed_warning
7063       ,p_tax_district_changed_warning => l_tax_district_changed_warning
7064       );
7065 
7066     hr_dflex_utility.remove_ignore_df_validation;
7067     hr_kflex_utility.remove_ignore_kf_validation;
7068     --
7069 
7070     l_soft_coding_keyflex_id := p_soft_coding_keyflex_id;
7071 
7072     hr_assignment_api.update_cwk_asg
7073       (p_effective_date               => l_effective_date
7074       ,p_datetrack_update_mode        => 'CORRECTION'
7075       ,p_assignment_id                => p_assignment_id
7076       ,p_object_version_number        => l_object_version_number
7077       -- Fix for updating assignment_category for CWK , fix for Bug #3083776
7078       ,p_assignment_category          => p_employment_category
7079       ,p_change_reason                => p_change_reason
7080       --,p_comments                     => p_comments
7081       ,p_default_code_comb_id         => p_default_code_comb_id
7082       ,p_establishment_id             => p_establishment_id
7083       ,p_frequency                    => p_frequency
7084       ,p_internal_address_line        => p_internal_address_line
7085       ,p_labour_union_member_flag     => p_labour_union_member_flag
7086       ,p_manager_flag                 => p_manager_flag
7087       ,p_normal_hours                 => p_normal_hours
7088       ,p_project_title                => p_project_title
7089       ,p_set_of_books_id              => p_set_of_books_id
7090       ,p_source_type                  => p_source_type
7091       ,p_supervisor_id                => p_supervisor_id
7092       ,p_time_normal_finish           => p_time_normal_finish
7093       ,p_time_normal_start            => p_time_normal_start
7094       ,p_title                        => p_title
7095       ,p_vendor_assignment_number     => p_vendor_assignment_number
7096       ,p_vendor_employee_number       => p_vendor_employee_number
7097       ,p_vendor_id                    => p_vendor_id
7098       ,p_po_header_id                 => p_po_header_id
7099       ,p_po_line_id                   => p_po_line_id
7100       ,p_vendor_site_id               => p_vendor_site_id
7101       ,p_projected_assignment_end     => p_projected_asgn_end
7102       --,p_assignment_status_type_id    => p_assignment_status_type_id --3262804
7103       ,p_attribute_category       => p_ass_attribute_category
7104       ,p_attribute1               => p_ass_attribute1
7105       ,p_attribute2               => p_ass_attribute2
7106       ,p_attribute3               => p_ass_attribute3
7107       ,p_attribute4               => p_ass_attribute4
7108       ,p_attribute5               => p_ass_attribute5
7109       ,p_attribute6               => p_ass_attribute6
7110       ,p_attribute7               => p_ass_attribute7
7111       ,p_attribute8               => p_ass_attribute8
7112       ,p_attribute9               => p_ass_attribute9
7113       ,p_attribute10              => p_ass_attribute10
7114       ,p_attribute11              => p_ass_attribute11
7115       ,p_attribute12              => p_ass_attribute12
7116       ,p_attribute13              => p_ass_attribute13
7117       ,p_attribute14              => p_ass_attribute14
7118       ,p_attribute15              => p_ass_attribute15
7119       ,p_attribute16              => p_ass_attribute16
7120       ,p_attribute17              => p_ass_attribute17
7121       ,p_attribute18              => p_ass_attribute18
7122       ,p_attribute19              => p_ass_attribute19
7123       ,p_attribute20              => p_ass_attribute20
7124       ,p_attribute21              => p_ass_attribute21
7125       ,p_attribute22              => p_ass_attribute22
7126       ,p_attribute23              => p_ass_attribute23
7127       ,p_attribute24              => p_ass_attribute24
7128       ,p_attribute25              => p_ass_attribute25
7129       ,p_attribute26              => p_ass_attribute26
7130       ,p_attribute27              => p_ass_attribute27
7131       ,p_attribute28              => p_ass_attribute28
7132       ,p_attribute29              => p_ass_attribute29
7133       ,p_attribute30              => p_ass_attribute30
7134       ,p_scl_segment1             => l_soft_coding_keyflex.segment1
7135       ,p_scl_segment2             => l_soft_coding_keyflex.segment2
7136       ,p_scl_segment3             => l_soft_coding_keyflex.segment3
7137       ,p_scl_segment4             => l_soft_coding_keyflex.segment4
7138       ,p_scl_segment5             => l_soft_coding_keyflex.segment5
7139       ,p_scl_segment6             => l_soft_coding_keyflex.segment6
7140       ,p_scl_segment7             => l_soft_coding_keyflex.segment7
7141       ,p_scl_segment8             => l_soft_coding_keyflex.segment8
7142       ,p_scl_segment9             => l_soft_coding_keyflex.segment9
7143       ,p_scl_segment10            => l_soft_coding_keyflex.segment10
7144       ,p_scl_segment11            => l_soft_coding_keyflex.segment11
7145       ,p_scl_segment12            => l_soft_coding_keyflex.segment12
7146       ,p_scl_segment13            => l_soft_coding_keyflex.segment13
7147       ,p_scl_segment14            => l_soft_coding_keyflex.segment14
7148       ,p_scl_segment15            => l_soft_coding_keyflex.segment15
7149       ,p_scl_segment16            => l_soft_coding_keyflex.segment16
7150       ,p_scl_segment17            => l_soft_coding_keyflex.segment17
7151       ,p_scl_segment18            => l_soft_coding_keyflex.segment18
7152       ,p_scl_segment19            => l_soft_coding_keyflex.segment19
7153       ,p_scl_segment20            => l_soft_coding_keyflex.segment20
7154       ,p_scl_segment21            => l_soft_coding_keyflex.segment21
7155       ,p_scl_segment22            => l_soft_coding_keyflex.segment22
7156       ,p_scl_segment23            => l_soft_coding_keyflex.segment23
7157       ,p_scl_segment24            => l_soft_coding_keyflex.segment24
7158       ,p_scl_segment25            => l_soft_coding_keyflex.segment25
7159       ,p_scl_segment26            => l_soft_coding_keyflex.segment26
7160       ,p_scl_segment27            => l_soft_coding_keyflex.segment27
7161       ,p_scl_segment28            => l_soft_coding_keyflex.segment28
7162       ,p_scl_segment29            => l_soft_coding_keyflex.segment29
7163       ,p_scl_segment30            => l_soft_coding_keyflex.segment30
7164       ,p_org_now_no_manager_warning   => l_org_now_no_manager_warning
7165       ,p_effective_start_date         => l_effective_start_date
7166       ,p_effective_end_date           => l_effective_end_date
7167       ,p_comment_id                   => l_comment_id
7168       ,p_no_managers_warning          => l_org_now_no_manager_warning
7169       ,p_other_manager_warning        => l_other_manager_warning
7170       ,p_soft_coding_keyflex_id       => l_soft_coding_keyflex_id
7171       ,p_concatenated_segments        => l_concatenated_segments
7172       ,p_hourly_salaried_warning      => l_hourly_salaried_warning
7173       );
7174       p_soft_coding_keyflex_id := l_soft_coding_keyflex_id;
7175   else
7176 -- perform field level validation first to obtain as much error information
7177 -- as possible
7178 --
7179 -- call the assignment criteria api
7180 -- this enters all of the data which have element link dependencies
7181 --
7182   -- Added for turn off key flex field validation
7183   l_add_struct_k.extend(1);
7184   l_add_struct_k(l_add_struct_k.count) := 'SCL';
7185   l_add_struct_k.extend(1);
7186   l_add_struct_k(l_add_struct_k.count) := 'CAGR';
7187 
7188   hr_kflex_utility.create_ignore_kf_validation(p_rec => l_add_struct_k);
7189   --
7190   -- code for disabling the descriptive flex field
7191   l_add_struct_d.extend(1);
7192   l_add_struct_d(l_add_struct_d.count) := 'PER_ASSIGNMENTS';
7193 
7194   hr_dflex_utility.create_ignore_df_validation(p_rec => l_add_struct_d);
7195 if (p_soft_coding_keyflex_id is not null) then
7196   l_soft_coding_keyflex_id := p_soft_coding_keyflex_id;
7197 end if;
7198 
7199     --
7200     hr_assignment_api.update_emp_asg_criteria
7201       (p_effective_date               => l_effective_date
7202       ,p_datetrack_update_mode        => p_datetrack_update_mode
7203       ,p_assignment_id                => p_assignment_id
7204       ,p_object_version_number        => l_object_version_number
7205       ,p_grade_id                     => p_grade_id
7206       ,p_position_id                  => p_position_id
7207       ,p_job_id                       => p_job_id
7208       ,p_location_id                  => p_location_id
7209       ,p_special_ceiling_step_id      => p_special_ceiling_step_id
7210       ,p_organization_id              => p_organization_id
7211       ,p_employment_category          => p_employment_category
7212       ,p_payroll_id                   => p_payroll_id
7213       ,p_grade_ladder_pgm_id          => p_grade_ladder_pgm_id
7214       --,p_supervisor_assignment_id     => p_supervisor_assignment_id
7215       ,p_pay_basis_id                 => p_pay_basis_id
7216       ,p_segment1                     => l_people_groups.segment1
7217       ,p_segment2                     => l_people_groups.segment2
7218       ,p_segment3                     => l_people_groups.segment3
7219       ,p_segment4                     => l_people_groups.segment4
7220       ,p_segment5                     => l_people_groups.segment5
7221       ,p_segment6                     => l_people_groups.segment6
7222       ,p_segment7                     => l_people_groups.segment7
7223       ,p_segment8                     => l_people_groups.segment8
7224       ,p_segment9                     => l_people_groups.segment9
7225       ,p_segment10                    => l_people_groups.segment10
7226       ,p_segment11                    => l_people_groups.segment11
7227       ,p_segment12                    => l_people_groups.segment12
7228       ,p_segment13                    => l_people_groups.segment13
7229       ,p_segment14                    => l_people_groups.segment14
7230       ,p_segment15                    => l_people_groups.segment15
7231       ,p_segment16                    => l_people_groups.segment16
7232       ,p_segment17                    => l_people_groups.segment17
7233       ,p_segment18                    => l_people_groups.segment18
7234       ,p_segment19                    => l_people_groups.segment19
7235       ,p_segment20                    => l_people_groups.segment20
7236       ,p_segment21                    => l_people_groups.segment21
7237       ,p_segment22                    => l_people_groups.segment22
7238       ,p_segment23                    => l_people_groups.segment23
7239       ,p_segment24                    => l_people_groups.segment24
7240       ,p_segment25                    => l_people_groups.segment25
7241       ,p_segment26                    => l_people_groups.segment26
7242       ,p_segment27                    => l_people_groups.segment27
7243       ,p_segment28                    => l_people_groups.segment28
7244       ,p_segment29                    => l_people_groups.segment29
7245       ,p_segment30                    => l_people_groups.segment30
7246       ,p_contract_id                  => p_contract_id
7247       ,p_establishment_id             => p_establishment_id
7248       ,p_soft_coding_keyflex_id       => l_soft_coding_keyflex_id
7249       ,p_concatenated_segments        => l_concatenated_segments
7250       ,p_effective_start_date         => l_effective_start_date
7251       ,p_effective_end_date           => l_effective_end_date
7252       ,p_people_group_id              => l_people_group_id
7253       ,p_group_name                   => l_group_name
7254       ,p_org_now_no_manager_warning   => l_org_now_no_manager_warning
7255       ,p_other_manager_warning        => l_other_manager_warning
7256       ,p_spp_delete_warning           => l_spp_delete_warning
7257       ,p_entries_changed_warning      => l_entries_changed_warning
7258       ,p_tax_district_changed_warning => l_tax_district_changed_warning
7259       ,p_gsp_post_process_warning     => p_gsp_post_process_warning
7260       );
7261 --
7262    -- bug 5547271
7263    if (hr_process_person_ss.g_is_applicant) then
7264    begin
7265     select PAYROLL_ID into l_old_payroll_id
7266     from per_all_assignments_f
7267     where assignment_id = p_assignment_id and p_effective_date between EFFECTIVE_START_DATE and EFFECTIVE_END_DATE;
7268    end;
7269     hrentmnt.maintain_entries_asg
7270     (p_assignment_id                => p_assignment_id
7271     ,p_old_payroll_id               => l_old_payroll_id
7272     ,p_new_payroll_id               => p_payroll_id
7273     ,p_business_group_id            => p_business_group_id
7274     ,p_operation                    => 'HIRE_APPL'
7275     ,p_actual_term_date             => null
7276     ,p_last_standard_date           => null
7277     ,p_final_process_date           => null
7278     ,p_dt_mode                      => p_datetrack_update_mode ---check??
7279     ,p_validation_start_date        => l_validate_start_date
7280     ,p_validation_end_date          => l_validate_end_date
7281     ,p_entries_changed              => l_entries_changed
7282     ,p_old_people_group_id          => -1
7283     ,p_new_people_group_id          => p_people_group_id
7284     );
7285     if l_entries_changed_warning <> 'S' then
7286     l_entries_changed_warning := nvl(l_entries_changed, 'N');
7287     end if;
7288 
7289     end if;
7290 
7291     -- bug 5547271
7292 
7293 -- look to see if the elements have changed
7294 --
7295   if (l_entries_changed_warning<>'N') then
7296   --
7297   -- if the elements have changed, look to see if we want a
7298   -- warning or an error
7299   --
7300     if p_element_warning then
7301     --
7302     -- we want a warning, so look to see if the warning has already been
7303     -- raised and this is the second time through the process
7304     --
7305       if p_element_changed is null then
7306       --
7307       -- since p_element_changed is null, the warning has not already been
7308       -- raised, so raise it
7309       --
7310         hr_utility.set_location('if p_element_changed is null then:'||l_proc,35);
7311         p_element_changed:='W';
7312         --fnd_message.set_name('PER', 'HR_ELEMENT_CHANGED_WARNING_WEB');
7313         --hr_utility.raise_error;
7314         -- Should add page level warning
7315         /*hr_errors_api.addErrorToTable
7316         (p_errorfield   => null
7317         ,p_errorcode    => to_char(SQLCODE)
7318         ,p_errormsg     => hr_util_misc_web.return_msg_text
7319                            (p_message_name =>'HR_ELEMENT_CHANGED_WARNING_WEB'
7320                            ,p_application_id => 'PER')
7321         ,p_warningflag  => true
7322         );*/
7323       else
7324         --warning already raised. will not raise it again.
7325         p_element_changed:='X';
7326       end if;
7327     --
7328     else
7329       --
7330       -- we want a error, so raise one.
7331       --
7332       -- Should add page level warning
7333       fnd_message.set_name('PER', 'HR_ELEMENT_CHANGED_WEB');
7334       hr_utility.raise_error;
7335       /*hr_errors_api.addErrorToTable
7336       (p_errorfield => null
7337       ,p_errorcode  => to_char(SQLCODE)
7338       ,p_errormsg   => hr_util_misc_web.return_msg_text
7339                        (p_message_name   => 'HR_ELEMENT_CHANGED_WEB'
7340                        ,p_application_id => 'PER')
7341       ,p_email_id   => p_email_id
7342       ,p_email_msg  => hr_util_misc_web.return_msg_text
7343                        (p_message_name => 'HR_ELEMENT_CHANGE_EMAILTXT_WEB'
7344                        ,p_application_id => 'PER')
7345       );*/
7346       l_validate:=TRUE;
7347     end if;
7348   end if;
7349 --  if hr_misc_web.get_legislation_code(p_assignment_id=>p_assignment_id) = 'US'
7350 --  then
7351 --
7352 -- look to see if the wc code has changed
7353 --
7354 -- get the WC code for the new job
7355 --
7356 -- Bug 2610926: do not check wc error.
7357 --  open wc_code(p_job_id);
7358 --  fetch wc_code into l_new_wc_code;
7359 --  if wc_code%found then
7360 --    close wc_code;
7361 --  else
7362     -- if there is no appropriate WC code for this job set the code to -1
7363 --    close wc_code;
7364 --    l_new_wc_code:=-1;
7365 --  end if;
7366 --
7367 -- get the WC code for the new job
7368 --
7369 --  open wc_code(l_old_job_id);
7370 --  fetch wc_code into l_old_wc_code;
7371 --  if wc_code%found then
7372 --    close wc_code;
7373 --  else
7374     -- if there is no appropriate WC code for this job set the code to -1
7375 --    close wc_code;
7376 --    l_old_wc_code:=-1;
7377 --  end if;
7378 --
7379 -- if the WC code has changed then always raise an error.
7380 -- this will not happen in non-US legislations as both codes will have been
7381 -- read as to -1, so will match
7382 --
7383 --  if(l_old_wc_code<>l_new_wc_code) then
7384     --Should add page level error
7385     /*hr_errors_api.addErrorToTable
7386       (p_errorfield => null
7387       ,p_errorcode  => to_char(SQLCODE)
7388       ,p_errormsg   => hr_util_misc_web.return_msg_text
7389                        (p_message_name   => 'HR_JOB_CHANGES_WC_RATE_WEB'
7390                        ,p_application_id => 'PER')
7391       ,p_email_id   => p_email_id
7392       ,p_email_msg  => hr_util_misc_web.return_msg_text
7393                        (p_message_name   => 'HR_WC_RATE_CHG_EMAILTXT_WEB'
7394                        ,p_application_id => 'PER')
7395       );*/
7396 --      l_validate:=TRUE;
7397 --      fnd_message.set_name('PER', 'HR_JOB_CHANGES_WC_RATE_WEB');
7398 --      hr_utility.raise_error;
7399 --  end if;
7400 --  end if; --end check wc_code
7401 --
7402 -- if there is no manager in the organization now then raise a warning
7403 --
7404   /*if (l_org_now_no_manager_warning) then
7405     --Should add page level warning
7406     fnd_message.set_name('PER','HR_51124_MMV_NO_MGR_EXIST_ORG');
7407     hr_utility.raise_error;
7408     hr_errors_api.addErrorToTable
7409       (p_errorfield => null
7410       ,p_errormsg   => fnd_message.get
7411       ,p_warningflag => TRUE);
7412   end if;*/
7413 --
7414 -- if there are other managers then raise a warning
7415 --
7416   /*if (l_other_manager_warning) then
7417     --Should add page level warning
7418     fnd_message.set_name('PER','HR_51125_MMV_MRE_MRG_EXIST_ORG');
7419     hr_utility.raise_error;
7420     hr_errors_api.addErrorToTable
7421       (p_errorfield => null
7422       ,p_errormsg   => fnd_message.get
7423       ,p_warningflag => TRUE);
7424   end if;*/
7425 --
7426 -- if there are no errors from the previous api call then call the
7427 -- assignment information api.
7428 -- This is always called in CORRECTION mode because once we have made an UPDATE
7429 -- to the row to make another change to it will be a correction.
7430 
7431   --First remove the remove_ignore_df_validation
7432   -- and remove_ignore_kf_validation
7433 
7434   hr_dflex_utility.remove_ignore_df_validation;
7435   hr_kflex_utility.remove_ignore_kf_validation;
7436   --
7437 
7438     l_soft_coding_keyflex_id := p_soft_coding_keyflex_id;
7439 
7440     hr_assignment_api.update_emp_asg
7441       (p_effective_date               => l_effective_date
7442       ,p_datetrack_update_mode        => 'CORRECTION'
7443       ,p_assignment_id                => p_assignment_id
7444       ,p_object_version_number        => l_object_version_number
7445       ,p_supervisor_id                => p_supervisor_id
7446       ,p_manager_flag                 => p_manager_flag
7447       ,p_normal_hours                 => p_normal_hours
7448       ,p_frequency                    => p_frequency
7449       ,p_time_normal_finish           => p_time_normal_finish
7450       ,p_time_normal_start            => p_time_normal_start
7451       ,p_bargaining_unit_code         => p_bargaining_unit_code
7452       ,p_labour_union_member_flag     => p_labour_union_member_flag
7453       ,p_sal_review_period            => p_sal_review_period
7454       ,p_sal_review_period_frequency  => p_sal_review_period_frequency
7455       ,p_date_probation_end           => p_date_probation_end
7456       ,p_probation_period             => p_probation_period
7457       ,p_probation_unit               => p_probation_unit
7458       ,p_notice_period                => p_notice_period
7459       ,p_notice_period_uom            => p_notice_period_uom
7460       ,p_employee_category            => p_employee_category
7461       ,p_work_at_home                 => p_work_at_home
7462       ,p_job_post_source_name         => p_job_post_source_name
7463       ,p_perf_review_period           => p_perf_review_period
7464       ,p_perf_review_period_frequency => p_perf_review_period_frequency
7465       ,p_internal_address_line        => p_internal_address_line
7466       ,p_ass_attribute_category       => p_ass_attribute_category
7467       ,p_ass_attribute1               => p_ass_attribute1
7468       ,p_ass_attribute2               => p_ass_attribute2
7469       ,p_ass_attribute3               => p_ass_attribute3
7470       ,p_ass_attribute4               => p_ass_attribute4
7471       ,p_ass_attribute5               => p_ass_attribute5
7472       ,p_ass_attribute6               => p_ass_attribute6
7473       ,p_ass_attribute7               => p_ass_attribute7
7474       ,p_ass_attribute8               => p_ass_attribute8
7475       ,p_ass_attribute9               => p_ass_attribute9
7476       ,p_ass_attribute10              => p_ass_attribute10
7477       ,p_ass_attribute11              => p_ass_attribute11
7478       ,p_ass_attribute12              => p_ass_attribute12
7479       ,p_ass_attribute13              => p_ass_attribute13
7480       ,p_ass_attribute14              => p_ass_attribute14
7481       ,p_ass_attribute15              => p_ass_attribute15
7482       ,p_ass_attribute16              => p_ass_attribute16
7483       ,p_ass_attribute17              => p_ass_attribute17
7484       ,p_ass_attribute18              => p_ass_attribute18
7485       ,p_ass_attribute19              => p_ass_attribute19
7486       ,p_ass_attribute20              => p_ass_attribute20
7487       ,p_ass_attribute21              => p_ass_attribute21
7488       ,p_ass_attribute22              => p_ass_attribute22
7489       ,p_ass_attribute23              => p_ass_attribute23
7490       ,p_ass_attribute24              => p_ass_attribute24
7491       ,p_ass_attribute25              => p_ass_attribute25
7492       ,p_ass_attribute26              => p_ass_attribute26
7493       ,p_ass_attribute27              => p_ass_attribute27
7494       ,p_ass_attribute28              => p_ass_attribute28
7495       ,p_ass_attribute29              => p_ass_attribute29
7496       ,p_ass_attribute30              => p_ass_attribute30
7497       ,p_segment1                     => l_SOFt_coding_keyflex.segment1
7498       ,p_segment2                     => l_soft_coding_keyflex.segment2
7499       ,p_segment3                     => l_soft_coding_keyflex.segment3
7500       ,p_segment4                     => l_soft_coding_keyflex.segment4
7501       ,p_segment5                     => l_soft_coding_keyflex.segment5
7502       ,p_segment6                     => l_soft_coding_keyflex.segment6
7503       ,p_segment7                     => l_soft_coding_keyflex.segment7
7504       ,p_segment8                     => l_soft_coding_keyflex.segment8
7505       ,p_segment9                     => l_soft_coding_keyflex.segment9
7506       ,p_segment10                    => l_soft_coding_keyflex.segment10
7507       ,p_segment11                    => l_soft_coding_keyflex.segment11
7508       ,p_segment12                    => l_soft_coding_keyflex.segment12
7509       ,p_segment13                    => l_soft_coding_keyflex.segment13
7510       ,p_segment14                    => l_soft_coding_keyflex.segment14
7511       ,p_segment15                    => l_soft_coding_keyflex.segment15
7512       ,p_segment16                    => l_soft_coding_keyflex.segment16
7513       ,p_segment17                    => l_soft_coding_keyflex.segment17
7514       ,p_segment18                    => l_soft_coding_keyflex.segment18
7515       ,p_segment19                    => l_soft_coding_keyflex.segment19
7516       ,p_segment20                    => l_soft_coding_keyflex.segment20
7517       ,p_segment21                    => l_soft_coding_keyflex.segment21
7518       ,p_segment22                    => l_soft_coding_keyflex.segment22
7519       ,p_segment23                    => l_soft_coding_keyflex.segment23
7520       ,p_segment24                    => l_soft_coding_keyflex.segment24
7521       ,p_segment25                    => l_soft_coding_keyflex.segment25
7522       ,p_segment26                    => l_soft_coding_keyflex.segment26
7523       ,p_segment27                    => l_soft_coding_keyflex.segment27
7524       ,p_segment28                    => l_soft_coding_keyflex.segment28
7525       ,p_segment29                    => l_soft_coding_keyflex.segment29
7526       ,p_segment30                    => l_soft_coding_keyflex.segment30
7527       ,p_cag_segment1                 => l_cagr_grades_def.segment1
7528       ,p_cag_segment2                 => l_cagr_grades_def.segment2
7529       ,p_cag_segment3                 => l_cagr_grades_def.segment3
7530       ,p_cag_segment4                 => l_cagr_grades_def.segment4
7531       ,p_cag_segment5                 => l_cagr_grades_def.segment5
7532       ,p_cag_segment6                 => l_cagr_grades_def.segment6
7533       ,p_cag_segment7                 => l_cagr_grades_def.segment7
7534       ,p_cag_segment8                 => l_cagr_grades_def.segment8
7535       ,p_cag_segment9                 => l_cagr_grades_def.segment9
7536       ,p_cag_segment10                => l_cagr_grades_def.segment10
7537       ,p_cag_segment11                 => l_cagr_grades_def.segment11
7538       ,p_cag_segment12                 => l_cagr_grades_def.segment12
7539       ,p_cag_segment13                 => l_cagr_grades_def.segment13
7540       ,p_cag_segment14                 => l_cagr_grades_def.segment14
7541       ,p_cag_segment15                 => l_cagr_grades_def.segment15
7542       ,p_cag_segment16                 => l_cagr_grades_def.segment16
7543       ,p_cag_segment17                 => l_cagr_grades_def.segment17
7544       ,p_cag_segment18                 => l_cagr_grades_def.segment18
7545       ,p_cag_segment19                 => l_cagr_grades_def.segment19
7546       ,p_cag_segment20                => l_cagr_grades_def.segment20
7547       --,p_contract_id                  => p_contract_id
7548       --,p_establishment_id             => p_establishment_id
7549       ,p_collective_agreement_id      => p_collective_agreement_id
7550       ,p_cagr_id_flex_num             => p_cagr_id_flex_num
7551       ,p_cagr_grade_def_id            => l_cagr_grade_def_id
7552       ,p_cagr_concatenated_segments   => l_cagr_concatenated_segments
7553       ,p_soft_coding_keyflex_id       => l_soft_coding_keyflex_id
7554       ,p_comment_id                   => l_comment_id
7555       ,p_effective_start_date         => l_effective_start_date
7556       ,p_effective_end_date           => l_effective_end_date
7557       ,p_concatenated_segments        => l_concatenated_segments
7558       ,p_no_managers_warning          => l_org_now_no_manager_warning
7559       ,p_other_manager_warning        => l_other_manager_warning
7560       ,p_title                        => p_title
7561       );
7562 
7563    p_soft_coding_keyflex_id := l_soft_coding_keyflex_id;
7564 
7565 --
7566 -- check the warning flags again
7567 --
7568     /*if(l_org_now_no_manager_warning) then
7569       --Should add page level warning
7570       --fnd_message.set_name('PER','HR_51124_MMV_NO_MGR_EXIST_ORG');
7571       --hr_utility.raise_error;
7572       hr_errors_api.addErrorToTable
7573       (p_errorfield => null
7574       ,p_errormsg   => fnd_message.get
7575       ,p_warningflag => TRUE);
7576     end if;
7577     if(l_other_manager_warning) then
7578       --Should add page level warning
7579       --fnd_message.set_name('PER','HR_51125_MMV_MRE_MRG_EXIST_ORG');
7580       --hr_utility.raise_error;
7581       hr_errors_api.addErrorToTable
7582       (p_errorfield => null
7583       ,p_errormsg   => fnd_message.get
7584       ,p_warningflag => TRUE);
7585     end if;*/
7586 
7587     --update_emp_asg_criteria again. this is a work around of bug 2493923.
7588     /*hr_assignment_api.update_emp_asg_criteria
7589       (p_effective_date               => l_effective_date
7590       ,p_datetrack_update_mode        => 'CORRECTION'
7591       ,p_assignment_id                => p_assignment_id
7592       ,p_object_version_number        => l_object_version_number
7593       ,p_grade_id                     => p_grade_id
7594       ,p_special_ceiling_step_id      => p_special_ceiling_step_id
7595       ,p_payroll_id                   => p_payroll_id
7596       ,p_effective_start_date         => l_effective_start_date
7597       ,p_effective_end_date           => l_effective_end_date
7598       ,p_soft_coding_keyflex_id       => l_soft_coding_keyflex_id
7599       ,p_concatenated_segments        => l_concatenated_segments
7600       ,p_people_group_id              => l_people_group_id
7601       ,p_group_name                   => l_group_name
7602       ,p_org_now_no_manager_warning   => l_org_now_no_manager_warning
7603       ,p_other_manager_warning        => l_other_manager_warning
7604       ,p_spp_delete_warning           => l_spp_delete_warning
7605       ,p_entries_changed_warning      => l_entries_changed_warning
7606       ,p_tax_district_changed_warning => l_tax_district_changed_warning
7607       ,p_gsp_post_process_warning     => p_gsp_post_process_warning
7608       );*/
7609    end if;
7610 end if;
7611     --
7612     -- update the assignment status type
7613     --
7614     --
7615     -- chack to see what type of status the new id corresponds to.
7616     --
7617     open status_type;
7618     fetch status_type into l_assignment_status_type;
7619     if status_type%notfound then
7620       close status_type;
7621     else
7622       close status_type;
7623 
7624       --
7625       -- if we have an active assignment type then use the activate_emp_asg api
7626       if l_assignment_status_type='ACTIVE_ASSIGN' then
7627       --
7628       -- active emp assignment
7629       --
7630         hr_utility.set_location('if l_assignment_status_type=ACTIVE_ASSIGN then:'||l_proc,40);
7631         hr_assignment_api.activate_emp_asg
7632         (p_effective_date               => l_effective_date
7633         ,p_datetrack_update_mode        => 'CORRECTION'
7634         ,p_assignment_id                => p_assignment_id
7635         ,p_object_version_number        => l_object_version_number
7636         ,p_assignment_status_type_id    => p_assignment_status_type_id
7637         ,p_change_reason                => p_change_reason
7638         ,p_effective_start_date         => l_effective_start_date
7639         ,p_effective_end_date           => l_effective_end_date);
7640       elsif l_assignment_status_type='ACTIVE_CWK' then
7641       --
7642       --active cwk assignment
7643       --
7644         hr_assignment_api.activate_cwk_asg
7645         (p_effective_date               => l_effective_date
7646         ,p_datetrack_update_mode        => 'CORRECTION'
7647         ,p_assignment_id                => p_assignment_id
7648         ,p_object_version_number        => l_object_version_number
7649         ,p_assignment_status_type_id    => p_assignment_status_type_id
7650         ,p_change_reason                => p_change_reason
7651         ,p_effective_start_date         => l_effective_start_date
7652         ,p_effective_end_date           => l_effective_end_date);
7653       elsif l_assignment_status_type='SUSP_ASSIGN' then
7654       --
7655       -- suspend emp assignment
7656       --
7657         hr_assignment_api.suspend_emp_asg
7658         (p_effective_date               => l_effective_date
7659         ,p_datetrack_update_mode        => 'CORRECTION'
7660         ,p_assignment_id                => p_assignment_id
7661         ,p_object_version_number        => l_object_version_number
7662         ,p_assignment_status_type_id    => p_assignment_status_type_id
7663         ,p_change_reason                => p_change_reason
7664         ,p_effective_start_date         => l_effective_start_date
7665         ,p_effective_end_date           => l_effective_end_date);
7666       elsif l_assignment_status_type='SUSP_CWK_ASG' then
7667       --
7668       -- suspend cwk assignment
7669       --
7670         hr_assignment_api.suspend_cwk_asg
7671         (p_effective_date               => l_effective_date
7672         ,p_datetrack_update_mode        => 'CORRECTION'
7673         ,p_assignment_id                => p_assignment_id
7674         ,p_object_version_number        => l_object_version_number
7675         ,p_assignment_status_type_id    => p_assignment_status_type_id
7676         ,p_change_reason                => p_change_reason
7677         ,p_effective_start_date         => l_effective_start_date
7678         ,p_effective_end_date           => l_effective_end_date);
7679 
7680       elsif l_assignment_status_type = 'TERM_ASSIGN' then
7681          hr_assignment_api.actual_termination_emp_asg
7682          (p_assignment_id                => p_assignment_id
7683          ,p_object_version_number        => l_object_version_number
7684          ,p_actual_termination_date      => l_effective_date - 1
7685         ,p_assignment_status_type_id    => p_assignment_status_type_id
7686         ,p_effective_start_date         => l_effective_start_date
7687         ,p_effective_end_date           => l_effective_end_date
7688          ,p_asg_future_changes_warning	=> l_asg_future_changes_warning
7689          ,p_entries_changed_warning	=> l_entries_changed_warning
7690          ,p_pay_proposal_warning	=> l_pay_proposal_warning);
7691 
7692       elsif p_assignment_type = 'E' and l_assignment_status_type = 'END' then
7693           hr_assignment_api.actual_termination_emp_asg
7694          (p_assignment_id                => p_assignment_id
7695          ,p_object_version_number        => l_object_version_number
7696          ,p_actual_termination_date      => l_effective_date
7697         ,p_effective_start_date         => l_effective_start_date
7698         ,p_effective_end_date           => l_effective_end_date
7699          ,p_asg_future_changes_warning	=> l_asg_future_changes_warning
7700          ,p_entries_changed_warning	=> l_entries_changed_warning
7701          ,p_pay_proposal_warning	=> l_pay_proposal_warning);
7702 
7703            hr_assignment_api.final_process_emp_asg
7704           (p_assignment_id                => p_assignment_id
7705          ,p_object_version_number        => l_object_version_number
7706          ,p_final_process_date      => l_effective_date
7707         ,p_effective_start_date         => l_effective_start_date
7708         ,p_effective_end_date           => l_effective_end_date
7709          ,p_asg_future_changes_warning	=> l_asg_future_changes_warning
7710          ,p_entries_changed_warning	=> l_entries_changed_warning
7711          ,p_org_now_no_manager_warning	=> l_org_now_no_manager_warning);
7712 
7713      elsif p_assignment_type = 'C' and l_assignment_status_type = 'END' then
7714 
7715          hr_assignment_api.actual_termination_cwk_asg
7716          (p_assignment_id                => p_assignment_id
7717          ,p_object_version_number        => l_object_version_number
7718          ,p_actual_termination_date      => l_effective_date
7719         ,p_effective_start_date         => l_effective_start_date
7720         ,p_effective_end_date           => l_effective_end_date
7721          ,p_asg_future_changes_warning	=> l_asg_future_changes_warning
7722          ,p_entries_changed_warning	=> l_entries_changed_warning
7723          ,p_pay_proposal_warning	=> l_pay_proposal_warning);
7724 
7725            hr_assignment_api.final_process_cwk_asg
7726           (p_assignment_id                => p_assignment_id
7727          ,p_object_version_number        => l_object_version_number
7728          ,p_final_process_date      => l_effective_date
7729         ,p_effective_start_date         => l_effective_start_date
7730         ,p_effective_end_date           => l_effective_end_date
7731          ,p_asg_future_changes_warning	=> l_asg_future_changes_warning
7732          ,p_entries_changed_warning	=> l_entries_changed_warning
7733          ,p_org_now_no_manager_warning	=> l_org_now_no_manager_warning);
7734       end if;
7735     end if;
7736     --
7737     p_effective_start_date:=l_effective_start_date;
7738     p_effective_end_date:=l_effective_end_date;
7739 
7740     -- GSP changes
7741      -- get salary information in to ltt_salary_data
7742      hr_pay_rate_gsp_ss.check_grade_ladder_exists(
7743                    p_business_group_id =>  p_organization_id,
7744                    p_effective_date =>  l_effective_date,
7745                    p_grd_ldr_exists_flag => lb_grd_ldr_exists_flag);
7746      -- may be required to add grade or step or ladder change condition
7747      if(lb_grd_ldr_exists_flag) then
7748        hr_utility.set_location('if(lb_grd_ldr_exists_flag) then:'||l_proc,45);
7749        hr_pay_rate_gsp_ss.get_employee_salary(
7750                             p_assignment_id =>  p_assignment_id,
7751                             P_effective_date => l_effective_date,
7752                             p_ltt_salary_data => p_ltt_salary_data);
7753      end if;
7754     -- End of GSP changes
7755  --bug 5032032 fix begin
7756 if p_new_hire_appl_hire = 'Y' then
7757 update_salary_proposal(p_assignment_id,l_effective_date);
7758 end if;
7759 --bug 5032032 fix end
7760   --
7761   -- if we are in validate only mode, rollback
7762   --
7763   if l_validate=TRUE then
7764     hr_utility.set_location('if l_validate=TRUE then:rollback'||l_proc,50);
7765     rollback to validate_assignment;
7766   end if;
7767 
7768 --
7769 -- handle any errors that are raised.
7770 --
7771 exception
7772 when others then
7773   hr_utility.set_location('Exception:Others'||l_proc,555);
7774   rollback to validate_assignment;
7775   --hr_utility.raise_error;
7776   raise;
7777   --hr_message.provide_error;
7778   --Should add page level error
7779   /*hr_errors_api.addErrorToTable
7780   (p_errorfield => null
7781   ,p_errorcode  => hr_message.last_message_number
7782   ,p_errormsg   => hr_message.get_message_text);*/
7783 end update_assignment;
7784 
7785 --
7786 FUNCTION get_assignment(p_transaction_step_id in number)
7787   RETURN ref_cursor IS
7788     csr ref_cursor;
7789 
7790 asgRec hr_transaction_ss.transaction_data;
7791 l_proc   varchar2(72)  := g_package||'get_assignment';
7792 l_old_mgr_flag varchar2(10);
7793 l_old_labour_union_flag varchar2(10);
7794 l_old_organization_id number;
7795 l_old_pay_basis_id    number;
7796 l_old_grade_id           number;
7797 l_primary_flag	varchar2(4);
7798 l_assignment_id number;
7799 l_effective_date date;
7800 
7801 cursor csr_prim_flag is
7802     select primary_flag into l_primary_flag from per_all_assignments_f
7803     where assignment_id = l_assignment_id and trunc(l_effective_date)
7804     between effective_start_date and effective_end_date;
7805 
7806 begin
7807 hr_utility.set_location('Entering:'||l_proc, 5);
7808 
7809  -- Fetch Original Manager Flag
7810  l_old_mgr_flag := hr_transaction_api.get_original_varchar2_value(p_transaction_step_id,'P_MANAGER_FLAG');
7811  -- Fetch Original Labour Union Flag
7812  l_old_labour_union_flag := hr_transaction_api.get_original_varchar2_value(p_transaction_step_id,'P_LABOUR_UNION_MEMBER_FLAG');
7813  l_old_organization_id := hr_transaction_api.get_number_value(p_transaction_step_id,'P_ORGANIZATION_ID');
7814  l_old_pay_basis_id := hr_transaction_api.get_original_number_value(p_transaction_step_id,'P_PAY_BASIS_ID');
7815  l_old_grade_id := hr_transaction_api.get_original_number_value(p_transaction_step_id,'P_GRADE_ID');
7816  l_primary_flag := hr_transaction_api.get_varchar2_value(p_transaction_step_id,'P_PRIMARY_FLAG');
7817  l_assignment_id := hr_transaction_api.get_number_value(p_transaction_step_id,'P_ASSIGNMENT_ID');
7818  l_effective_date := hr_transaction_api.get_date_value(p_transaction_step_id,'P_EFFECTIVE_DATE');
7819 
7820  if l_primary_flag is null then
7821     open csr_prim_flag;
7822     fetch csr_prim_flag into l_primary_flag;
7823     close csr_prim_flag;
7824     if l_primary_flag is null then
7825        l_primary_flag := 'Y';
7826     end if;
7827   end if;
7828 
7829 hr_transaction_ss.get_transaction_data
7830   (p_transaction_step_id => p_transaction_step_id
7831   ,p_transaction_data    => asgRec);
7832 
7833   IF (asgRec.name.count < 108) THEN
7834   hr_utility.set_location('IF (asgRec.name.count < 108) THEN:'||l_proc,10);
7835   BEGIN
7836     hr_utility.set_location('Entering For Loop:'||l_proc,15);
7837     FOR I in asgRec.name.count+1 .. 108 LOOP
7838         asgRec.name(I) := null;
7839         asgRec.number_value(I) := null;
7840         asgRec.varchar2_value(I) := null;
7841         asgRec.date_value(I) := null;
7842     END LOOP;
7843     hr_utility.set_location('Exiting For Loop:'||l_proc,15);
7844   END;
7845   END IF;
7846 
7847 open csr for
7848 SELECT
7849              asgRec.number_value(1) assignment_id,
7850              asgRec.number_value(8) business_group_id,
7851              asgRec.number_value(7) organization_id,
7852              org.name organization_name,
7853              asgRec.number_value(2) object_version_number,
7854              asgRec.number_value(12) position_id,
7855              pos.name position_name,
7856              asgRec.number_value(14) job_id,
7857              job.name job_name,
7858              asgRec.number_value(16) grade_id,
7859              grade.name grade_name,
7860              asgRec.number_value(18) location_id,
7861              asgRec.varchar2_value(19) employment_category,
7862              asgRec.number_value(20) supervisor_id,
7863              asgRec.varchar2_value(21) manager_flag,
7864              asgRec.number_value(22) normal_hours,
7865              asgRec.varchar2_value(23) frequency,
7866              asgRec.varchar2_value(24) time_normal_finish,
7867              asgRec.varchar2_value(25) time_normal_start,
7868              asgRec.number_value(28) special_ceiling_step_id,
7869              asgRec.number_value(29) assignment_status_type_id,
7870              asgRec.varchar2_value(30) change_reason,
7871              asgRec.varchar2_value(31) ass_attribute_category,
7872              asgRec.varchar2_value(32) ass_attribute1,
7873              asgRec.varchar2_value(33) ass_attribute2,
7874              asgRec.varchar2_value(34) ass_attribute3,
7875              asgRec.varchar2_value(35) ass_attribute4,
7876              asgRec.varchar2_value(36) ass_attribute5,
7877              asgRec.varchar2_value(37) ass_attribute6,
7878              asgRec.varchar2_value(38) ass_attribute7,
7879              asgRec.varchar2_value(39) ass_attribute8,
7880              asgRec.varchar2_value(40) ass_attribute9,
7881              asgRec.varchar2_value(41) ass_attribute10,
7882              asgRec.varchar2_value(42) ass_attribute11,
7883              asgRec.varchar2_value(43) ass_attribute12,
7884              asgRec.varchar2_value(44) ass_attribute13,
7885              asgRec.varchar2_value(45) ass_attribute14,
7886              asgRec.varchar2_value(46) ass_attribute15,
7887              asgRec.varchar2_value(47) ass_attribute16,
7888              asgRec.varchar2_value(48) ass_attribute17,
7889              asgRec.varchar2_value(49) ass_attribute18,
7890              asgRec.varchar2_value(50) ass_attribute19,
7891              asgRec.varchar2_value(51) ass_attribute20,
7892              asgRec.varchar2_value(52) ass_attribute21,
7893              asgRec.varchar2_value(53) ass_attribute22,
7894              asgRec.varchar2_value(54) ass_attribute23,
7895              asgRec.varchar2_value(55) ass_attribute24,
7896              asgRec.varchar2_value(56) ass_attribute25,
7897              asgRec.varchar2_value(57) ass_attribute26,
7898              asgRec.varchar2_value(58) ass_attribute27,
7899              asgRec.varchar2_value(59) ass_attribute28,
7900              asgRec.varchar2_value(60) ass_attribute29,
7901              asgRec.varchar2_value(61) ass_attribute30,
7902              asgRec.number_value(62) people_group_id,
7903              asgRec.number_value(63) soft_coding_keyflex_id,
7904              asgRec.number_value(66) sal_review_period,
7905              asgRec.varchar2_value(67) sal_review_period_frequency,
7906              asgRec.number_value(71) notice_period,
7907              asgRec.varchar2_value(73) employee_category,
7908              asgRec.varchar2_value(74) work_at_home,
7909              asgRec.varchar2_value(75) job_post_source_name,
7910              asgRec.number_value(76) perf_review_period,
7911              asgRec.varchar2_value(77) perf_review_period_frequency,
7912              asgRec.number_value(64) payroll_id,
7913              asgRec.number_value(65) pay_basis_id,
7914              asgRec.number_value(80) establishment_id,
7915              asgRec.varchar2_value(88) title,
7916              asgRec.varchar2_value(89) project_title,
7917              asgRec.varchar2_value(90) source_type,
7918              asgRec.varchar2_value(91) vendor_assignment_number,
7919              asgRec.varchar2_value(92) vendor_employee_number,
7920              asgRec.number_value(84) default_code_comb_id,
7921              asgRec.number_value(85) set_of_books_id,
7922              asgRec.number_value(86) vendor_id,
7923              vendor.vendor_name vendor_name,
7924              asgRec.varchar2_value(87) assignment_type,
7925              asgRec.number_value(104) grade_ladder_id,
7926              pgm.name grade_ladder_name,
7927              asgRec.number_value(105) po_header_id,
7928              asgRec.number_value(106) po_line_id,
7929              asgRec.number_value(107) vendor_site_id,
7930              po_heads.segment1 po_number,
7931              po_lines.line_num po_line_number,
7932              vend_sits.vendor_site_code vendor_site_name,
7933              asgRec.DATE_VALUE(108) projected_assignment_end,
7934              ---  Position Defaulting changes
7935              asgRec.number_value(69) probation_period,
7936              asgRec.varchar2_value(70) probation_unit,
7937              asgRec.DATE_VALUE(68) date_probation_end,
7938              asgRec.varchar2_value(72) notice_period_uom,
7939              asgRec.varchar2_value(26) bargaining_unit_code,
7940              hl_bargaining_unit.meaning bargaining_unit_name,
7941              asgRec.varchar2_value(27) labour_union_member_flag,
7942              l_old_mgr_flag          old_manager_flag,
7943              l_old_labour_union_flag old_labour_union_flag,
7944              l_old_organization_id     old_organization_id,
7945              l_old_pay_basis_id        old_pay_basis_id,
7946              l_old_grade_id	old_grade_id,
7947              l_primary_flag                 primary_flag
7948              from
7949                   hr_api_transaction_steps ts
7950                  ,hr_api_transaction_values otv, hr_all_organization_units_tl  org
7951                  ,hr_api_transaction_values jtv, per_jobs_tl job
7952                  ,hr_api_transaction_values ptv, hr_all_positions_f_tl pos
7953                  ,hr_api_transaction_values gtv, per_grades_tl  grade
7954                  ,hr_api_transaction_values vtv, po_vendors vendor
7955                  ,hr_api_transaction_values gltv, ben_pgm_f pgm
7956                  ,hr_api_transaction_values htv, po_headers_all po_heads
7957                  ,hr_api_transaction_values ltv, po_lines_all po_lines
7958                  ,hr_api_transaction_values stv, po_vendor_sites_all vend_sits
7959                  ,hr_api_transaction_values btv, hr_lookups hl_bargaining_unit
7960 
7961              where
7962 
7963                   ts.transaction_step_id = p_transaction_step_id
7964                   and otv.transaction_step_id(+) = ts.transaction_step_id
7965                   and otv.name(+) = 'P_ORGANIZATION_ID'
7966                   and otv.number_value = org.organization_id(+)
7967                   and org.language(+) = userenv('LANG')
7968 
7969                   and jtv.transaction_step_id(+) = ts.transaction_step_id
7970                   and jtv.name(+) = 'P_JOB_ID'
7971                   and jtv.number_value = job.job_id(+)
7972                   and job.language(+) = userenv('LANG')
7973 
7974                   and ptv.transaction_step_id(+) = ts.transaction_step_id
7975                   and ptv.name(+) = 'P_POSITION_ID'
7976                   and ptv.number_value = pos.position_id(+)
7977                   and pos.language(+) = userenv('LANG')
7978 
7979                   and gtv.transaction_step_id(+) = ts.transaction_step_id
7980                   and gtv.name(+) = 'P_GRADE_ID'
7981                   and gtv.number_value = grade.grade_id(+)
7982                   and grade.language(+) = userenv('LANG')
7983 
7984                   and vtv.transaction_step_id(+) = ts.transaction_step_id
7985                   and vtv.name(+) = 'P_VENDOR_ID'
7986                   and vtv.number_value = vendor.vendor_id(+)
7987 
7988                   and gltv.transaction_step_id(+) = ts.transaction_step_id
7989                   and gltv.name(+) = 'P_GRADE_LADDER_PGM_ID'
7990                   and gltv.number_value = pgm.pgm_id(+)
7991 
7992                   and htv.transaction_step_id(+) = ts.transaction_step_id
7993                   and htv.name(+) = 'P_PO_HEADER_ID'
7994                   and htv.number_value = po_heads.po_header_id(+)
7995 
7996                   and ltv.transaction_step_id(+) = ts.transaction_step_id
7997                   and ltv.name(+) = 'P_PO_LINE_ID'
7998                   and ltv.number_value = po_lines.po_line_id(+)
7999 
8000                   and stv.transaction_step_id(+) = ts.transaction_step_id
8001                   and stv.name(+) = 'P_VENDOR_SITE_ID'
8002                   and stv.number_value = vend_sits.vendor_site_id(+)
8003 
8004                   and btv.transaction_step_id(+) = ts.transaction_step_id
8005                   and btv.name(+) = 'P_BARGAINING_UNIT_CODE'
8006                   and btv.varchar2_value =  hl_bargaining_unit.lookup_code(+) -- Bug 7603539
8007                   and hl_bargaining_unit.lookup_type(+) = 'BARGAINING_UNIT_CODE'
8008                   and hl_bargaining_unit.enabled_flag(+) = 'Y'
8009                   and (trunc(sysdate) between nvl(hl_bargaining_unit.start_date_active(+), trunc(sysdate))
8010                   and nvl(hl_bargaining_unit.end_date_active(+), trunc(sysdate)));
8011 
8012 
8013   hr_utility.set_location('Exiting:'||l_proc, 20);
8014   return csr;
8015 END;
8016 
8017 FUNCTION get_rec_cnt
8018   RETURN NUMBER IS
8019   Cnt NUMBER:= 1;
8020 BEGIN
8021   hr_utility.set_location('Entering:get_rec_cnt', 5);
8022   hr_utility.set_location('Exiting:get_rec_cnt', 10);
8023   RETURN Cnt;
8024 END;
8025 --
8026 
8027 FUNCTION get_po_number(p_po_header_id in number)
8028    RETURN VARCHAR2 is
8029 cursor csr_po_number(p_id in number) is
8030 -- 4894113: R12 performance repository related fix
8031 -- ISSUE : Shared memory size 2,413,494
8032 -- RESOLUTION:
8033 -- 1.Since we are interested only in  poh.segment1 we can
8034 -- drop the rest of the columns and unwanted WHERE clauses from the
8035 -- view po_temp_labor_headers_v
8036 -- 2. The SQL below we have retained all the WHERE clauses
8037 -- dealing with the table po_headers_all, but dropped the rest
8038 -- which are not required in this case.
8039 
8040 SELECT poh.segment1 po_number
8041 FROM
8042     po_headers_all poh
8043 WHERE
8044     poh.po_header_id = p_id
8045     AND poh.type_lookup_code = 'STANDARD'
8046     AND poh.authorization_status IN ('APPROVED', 'PRE-APPROVED')
8047     AND poh.approved_flag = 'Y'
8048     AND poh.enabled_flag = 'Y'
8049     AND NVL(poh.cancel_flag, 'N') <> 'Y'
8050     AND NVL(poh.frozen_flag, 'N') <> 'Y'
8051     AND poh.org_id IS NOT NULL
8052     AND EXISTS
8053     (
8054     SELECT
8055         NULL
8056     FROM po_lines_all pol ,
8057         po_line_types_b polt
8058     WHERE pol.po_header_id = poh.po_header_id
8059         AND NVL(pol.cancel_flag, 'N') <> 'Y'
8060         AND pol.line_type_id = polt.line_type_id
8061         AND polt.purchase_basis = 'TEMP LABOR'
8062     );
8063 
8064 --select po_number
8065 --from po_temp_labor_headers_v
8066 --where po_header_id = p_id;
8067 
8068 
8069 l_po_number po_temp_labor_headers_v.po_number%TYPE;
8070 l_proc   varchar2(72)  := g_package||'get_po_number';
8071 
8072 BEGIN
8073   hr_utility.set_location('Entering:'||l_proc, 5);
8074   open csr_po_number(p_po_header_id);
8075   fetch csr_po_number into l_po_number;
8076   close csr_po_number;
8077 
8078   hr_utility.set_location('Exiting:'||l_proc, 15);
8079   return l_po_number;
8080 END;
8081 
8082 FUNCTION get_po_line_nuber(p_po_line_id in number)
8083    RETURN number is
8084 cursor csr_po_line_number(p_id in number) is
8085 select line_number
8086 from po_temp_labor_lines_v
8087 where po_line_id = p_id;
8088 
8089 l_po_line_number number;
8090 l_proc   varchar2(72)  := g_package||'get_po_line_nuber';
8091 
8092 BEGIN
8093   hr_utility.set_location('Entering:'||l_proc, 5);
8094   open csr_po_line_number(p_po_line_id);
8095   fetch csr_po_line_number into l_po_line_number;
8096   close csr_po_line_number;
8097 
8098 
8099   hr_utility.set_location('Exiting:'||l_proc, 15);
8100   return l_po_line_number;
8101 END;
8102 
8103 FUNCTION get_vend_site_name(p_vendor_site_id in number)
8104    RETURN VARCHAR2 is
8105 cursor csr_vendor_site_name(p_id in number) is
8106 select vendor_site_code
8107 from po_vendor_sites_all
8108 where vendor_site_id  = p_id;
8109 
8110 l_vendor_site_name po_vendor_sites_all.vendor_site_code%TYPE;
8111 l_proc   varchar2(72)  := g_package||'get_vend_site_name';
8112 
8113 BEGIN
8114   hr_utility.set_location('Entering:'||l_proc, 5);
8115   open csr_vendor_site_name(p_vendor_site_id);
8116   fetch csr_vendor_site_name into l_vendor_site_name;
8117   close csr_vendor_site_name;
8118 
8119 
8120   hr_utility.set_location('Exiting:'||l_proc, 15);
8121   return l_vendor_site_name;
8122 END;
8123 
8124 -- End of NTF change
8125 
8126 -- Decode funtion for probation_end_date to display it in user
8127 -- preference format
8128 FUNCTION get_probation_end_date(p_probation_end_date in varchar2)
8129    RETURN varchar2 is
8130 l_dateformat   VARCHAR2(30);
8131 BEGIN
8132 
8133  fnd_profile.get('ICX_DATE_FORMAT_MASK',l_dateformat);
8134  return to_char(to_date(p_probation_end_date, l_dateformat),l_dateformat);
8135  Exception
8136  WHEN OTHERS THEN
8137    return to_char(to_date(p_probation_end_date,'RRRR/MM/DD'), l_dateformat);
8138 END;
8139 
8140 --
8141 end hr_process_assignment_ss;