DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_ASSIGNMENT_SWI

Source


1 Package Body hr_assignment_swi As
2 /* $Header: hrasgswi.pkb 120.3.12020000.2 2013/05/07 12:20:15 shkant ship $ */
3 --
4 -- Package variables
5 --
6 g_package  varchar2(33) := 'hr_assignment_swi.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |-------------------< chg_in_sys_status_to_term_apl >----------------------|
10 -- ----------------------------------------------------------------------------
11 function chg_in_sys_status_to_term_apl
12   (p_effective_date            in       date
13   ,p_datetrack_update_mode     in out nocopy   varchar2
14   ,p_assignment_status_type_id in       number
15   ,p_assignment_id             in       number
16   ,p_change_reason             in       varchar2  default hr_api.g_varchar2
17   ,p_status_change_comments    in       varchar2  default null
18   ,p_object_version_number     in out nocopy   number
19   ,p_effective_start_date         out nocopy   date
20   ,p_effective_end_date           out nocopy   date
21   ) RETURN BOOLEAN is
22 --
23 -- Internal variables
24 --
25   l_proc        varchar2(72) := g_package ||'chg_in_sys_status_to_term_apl';
26   l_old_per_system_status
27              per_assignment_status_types.per_system_status%type;
28   l_new_per_system_status
29              per_assignment_status_types.per_system_status%type;
30   l_assignment_status_type_id
31              per_assignment_status_types.assignment_status_type_id%type;
32   l_person_id per_all_people_f.person_id%TYPE;
33   l_ovn      per_all_people_f.object_version_number%TYPE;
34   l_effective_date       date;
35   l_num_asg              number;
36   l_ias_status_id        irc_assignment_statuses.assignment_status_id%TYPE;
37   l_ias_ovn              irc_assignment_statuses.object_version_number%TYPE;
38   l_ias_date             irc_assignment_statuses.status_change_date%TYPE;
39   L_ACTIVATE_APL_ASG   constant  varchar2(30) := 'ACTIVE_APL';
40   L_OFFER_APL_ASG      constant  varchar2(30) := 'OFFER';
41   L_ACCEPT_APL_ASG     constant  varchar2(30) := 'ACCEPTED';
42   L_INTERVIEW1_APL_ASG constant  varchar2(30) := 'INTERVIEW1';
43   L_INTERVIEW2_APL_ASG constant  varchar2(30) := 'INTERVIEW2';
44   L_TERM_APL           constant  varchar2(30) := 'TERM_APL';
45   l_warning            boolean; -- 4066579
46 --
47 -- Local cursors
48 --
49   Cursor csr_sys_status is
50     select olds.per_system_status
51           ,news.per_system_status
52           ,olds.assignment_status_type_id
53           ,asg.person_id
54     from   per_assignment_status_types olds
55           ,per_assignment_status_types news
56           ,per_all_assignments_f       asg
57     where asg.assignment_id=p_assignment_id
58     and   p_effective_date between
59           asg.effective_start_date and asg.effective_end_date
60     and   olds.assignment_status_type_id=asg.assignment_status_type_id
61     and   news.assignment_status_type_id=p_assignment_status_type_id;
62 
63 
64 -- count the number of applicant assignments tomorrow, i.e. the number
65 -- that have not been terminated yet.
66 
67   Cursor csr_count(p_person_id per_all_people_f.person_id%type) is
68     SELECT count(*)
69     FROM per_all_assignments_f asg
70     WHERE asg.person_id=p_person_id
71     AND asg.assignment_type='A'
72     AND (
73                 trunc (SYSDATE) + 1
74                 BETWEEN asg.effective_start_date
75                 AND     asg.effective_end_date
76         OR      asg.effective_start_date > trunc (SYSDATE)
77         );
78 
79   Cursor csr_ovn_person is
80     Select object_version_number
81       from per_people_f
82      where person_id = l_person_id
83        and l_effective_date between
84            effective_start_date and effective_end_date;
85 
86   cursor csr_last_irc_assignment is
87    select ias.assignment_status_id
88          ,ias.object_version_number
89 	 ,ias.status_change_date
90      from irc_assignment_statuses ias
91     where ias.assignment_id = p_assignment_id
92       and not exists(select null
93                        from irc_assignment_statuses
94                       where assignment_id = p_assignment_id
95                         and assignment_status_id > ias.assignment_status_id
96                  );
97 --
98 Begin
99   hr_utility.set_location(' Entering:' || l_proc,10);
100   --
101   -- Initialise local variable
102   --
103   l_effective_date := trunc(p_effective_date);
104   --
105   open csr_sys_status;
106   --
107   fetch csr_sys_status into
108      l_old_per_system_status
109     ,l_new_per_system_status
110     ,l_assignment_status_type_id
111     ,l_person_id;
112   --
113   close csr_sys_status;
114   --
115   if l_old_per_system_status <> l_new_per_system_status  then
116   --
117   --
118 
119   open csr_count(l_person_id);
120   fetch csr_count into l_num_asg;
121   close csr_count;
122 
123   open csr_ovn_person;
124   fetch csr_ovn_person into l_ovn;
125   close csr_ovn_person;
126   --
127     IF l_new_per_system_status = L_TERM_APL THEN
128       If l_num_asg = 1 Then
129         hr_applicant_api.terminate_applicant
130           (p_effective_date              => p_effective_date
131           ,p_person_id                   => l_person_id
132           ,p_object_version_number       => l_ovn
133           ,p_effective_start_date        => p_effective_start_date
134           ,p_effective_end_date          => p_effective_end_date
135           ,p_assignment_status_type_id   => p_assignment_status_type_id --7228702
136 	  ,p_change_reason               => p_change_reason --4066579
137           ,p_remove_fut_asg_warning      => l_warning -- 4066579
138           ,p_status_change_comments      => p_status_change_comments
139           );
140         -- Fix for bug 3308428. This is a work round fix until
141         -- hr_applicant_api.terminate_applicant is modified to
142         -- accept assginment_status_type_id as parameter
143        -- open csr_last_irc_assignment;
144        -- fetch csr_last_irc_assignment into
145 	--     l_ias_status_id
146 	 --   ,l_ias_ovn
147 	  --  ,l_ias_date;
148         --close csr_last_irc_assignment;
149         --irc_ias_upd.upd
150         --(
151          --p_assignment_status_id       => l_ias_status_id
152         --,p_object_version_number      => l_ias_ovn
153         --,p_assignment_status_type_id  => p_assignment_status_type_id
154         --,p_status_change_date         => l_ias_date
155         --);
156       Else
157         hr_assignment_api.terminate_apl_asg
158           (p_effective_date               => p_effective_date
159           ,p_assignment_id                => p_assignment_id
160           ,p_assignment_status_type_id    => p_assignment_status_type_id
161           ,p_object_version_number        => p_object_version_number
162           ,p_effective_start_date         => p_effective_start_date
163           ,p_effective_end_date           => p_effective_end_date
164 	  ,p_change_reason                => p_change_reason -- 4066579
165 	  ,p_status_change_comments       => p_status_change_comments
166           );
167       End if;
168       hr_utility.set_location(' Leaving:' || l_proc,15);
169       Return TRUE;
170     END IF;
171   --
172     If l_new_per_system_status = L_ACTIVATE_APL_ASG then
173         hr_assignment_api.activate_apl_asg
174           (p_effective_date               => l_effective_date
175           ,p_datetrack_update_mode        => p_datetrack_update_mode
176           ,p_assignment_id                => p_assignment_id
177           ,p_object_version_number        => p_object_version_number
178           ,p_assignment_status_type_id    => p_assignment_status_type_id
179           ,p_change_reason                => p_change_reason
180           ,p_effective_start_date         => p_effective_start_date
181           ,p_effective_end_date           => p_effective_end_date
182           );
183           p_datetrack_update_mode := 'CORRECTION';
184     elsif l_new_per_system_status = L_OFFER_APL_ASG then
185           hr_assignment_api.offer_apl_asg
186             (p_effective_date               => l_effective_date
187             ,p_datetrack_update_mode        => p_datetrack_update_mode
188             ,p_assignment_id                => p_assignment_id
189             ,p_object_version_number        => p_object_version_number
190             ,p_assignment_status_type_id    => p_assignment_status_type_id
191             ,p_change_reason                => p_change_reason
192             ,p_effective_start_date         => p_effective_start_date
193             ,p_effective_end_date           => p_effective_end_date
194             );
195           p_datetrack_update_mode := 'CORRECTION';
196     elsif l_new_per_system_status = L_ACCEPT_APL_ASG then
197           hr_assignment_api.accept_apl_asg
198             (p_effective_date               => l_effective_date
199             ,p_datetrack_update_mode        => p_datetrack_update_mode
200             ,p_assignment_id                => p_assignment_id
201             ,p_object_version_number        => p_object_version_number
202             ,p_assignment_status_type_id    => p_assignment_status_type_id
203             ,p_change_reason                => p_change_reason
204             ,p_effective_start_date         => p_effective_start_date
205             ,p_effective_end_date           => p_effective_end_date
206             );
207           p_datetrack_update_mode := 'CORRECTION';
208     elsif l_new_per_system_status = L_INTERVIEW1_APL_ASG then
209           hr_assignment_api.interview1_apl_asg
210             (p_effective_date               => l_effective_date
211             ,p_datetrack_update_mode        => p_datetrack_update_mode
212             ,p_assignment_id                => p_assignment_id
213             ,p_object_version_number        => p_object_version_number
214             ,p_assignment_status_type_id    => p_assignment_status_type_id
215             ,p_change_reason                => p_change_reason
216             ,p_effective_start_date         => p_effective_start_date
217             ,p_effective_end_date           => p_effective_end_date
218             );
219           p_datetrack_update_mode := 'CORRECTION';
220     elsif l_new_per_system_status = L_INTERVIEW2_APL_ASG then
221           hr_assignment_api.interview2_apl_asg
222             (p_effective_date               => l_effective_date
223             ,p_datetrack_update_mode        => p_datetrack_update_mode
224             ,p_assignment_id                => p_assignment_id
225             ,p_object_version_number        => p_object_version_number
226             ,p_assignment_status_type_id    => p_assignment_status_type_id
227             ,p_change_reason                => p_change_reason
228             ,p_effective_start_date         => p_effective_start_date
229             ,p_effective_end_date           => p_effective_end_date
230             );
231           p_datetrack_update_mode := 'CORRECTION';
232     end if;
233   --
234     hr_utility.set_location(' Leaving:' || l_proc,18);
235     RETURN FALSE;
236   --
237   end if;
238   --
239   hr_utility.set_location(' Leaving:' || l_proc,20);
240   RETURN FALSE;
241 End chg_in_sys_status_to_term_apl;
242 --
243 -- ----------------------------------------------------------------------------
244 -- |-----------------------< create_secondary_apl_asg >-----------------------|
245 -- ----------------------------------------------------------------------------
246 PROCEDURE create_secondary_apl_asg
247   (p_validate                     in     number    default hr_api.g_false_num
248   ,p_effective_date               in     date
249   ,p_person_id                    in     number
250   ,p_organization_id              in     number
251   ,p_recruiter_id                 in     number    default null
252   ,p_grade_id                     in     number    default null
253   ,p_position_id                  in     number    default null
254   ,p_job_id                       in     number    default null
255   ,p_assignment_status_type_id    in     number    default null
256   ,p_payroll_id                   in     number    default null
257   ,p_location_id                  in     number    default null
258   ,p_person_referred_by_id        in     number    default null
259   ,p_supervisor_id                in     number    default null
260   ,p_special_ceiling_step_id      in     number    default null
261   ,p_recruitment_activity_id      in     number    default null
262   ,p_source_organization_id       in     number    default null
263   ,p_vacancy_id                   in     number    default null
264   ,p_pay_basis_id                 in     number    default null
265   ,p_change_reason                in     varchar2  default null
266   ,p_comments                     in     varchar2  default null
267   ,p_date_probation_end           in     date      default null
268   ,p_default_code_comb_id         in     number    default null
269   ,p_employment_category          in     varchar2  default null
270   ,p_frequency                    in     varchar2  default null
271   ,p_internal_address_line        in     varchar2  default null
272   ,p_manager_flag                 in     varchar2  default null
273   ,p_normal_hours                 in     number    default null
274   ,p_perf_review_period           in     number    default null
275   ,p_perf_review_period_frequency in     varchar2  default null
276   ,p_probation_period             in     number    default null
277   ,p_probation_unit               in     varchar2  default null
278   ,p_sal_review_period            in     number    default null
279   ,p_sal_review_period_frequency  in     varchar2  default null
280   ,p_set_of_books_id              in     number    default null
281   ,p_source_type                  in     varchar2  default null
282   ,p_time_normal_finish           in     varchar2  default null
283   ,p_time_normal_start            in     varchar2  default null
284   ,p_bargaining_unit_code         in     varchar2  default null
285   ,p_ass_attribute_category       in     varchar2  default null
286   ,p_ass_attribute1               in     varchar2  default null
287   ,p_ass_attribute2               in     varchar2  default null
288   ,p_ass_attribute3               in     varchar2  default null
289   ,p_ass_attribute4               in     varchar2  default null
290   ,p_ass_attribute5               in     varchar2  default null
291   ,p_ass_attribute6               in     varchar2  default null
292   ,p_ass_attribute7               in     varchar2  default null
293   ,p_ass_attribute8               in     varchar2  default null
294   ,p_ass_attribute9               in     varchar2  default null
295   ,p_ass_attribute10              in     varchar2  default null
296   ,p_ass_attribute11              in     varchar2  default null
297   ,p_ass_attribute12              in     varchar2  default null
298   ,p_ass_attribute13              in     varchar2  default null
299   ,p_ass_attribute14              in     varchar2  default null
300   ,p_ass_attribute15              in     varchar2  default null
301   ,p_ass_attribute16              in     varchar2  default null
302   ,p_ass_attribute17              in     varchar2  default null
303   ,p_ass_attribute18              in     varchar2  default null
304   ,p_ass_attribute19              in     varchar2  default null
305   ,p_ass_attribute20              in     varchar2  default null
306   ,p_ass_attribute21              in     varchar2  default null
307   ,p_ass_attribute22              in     varchar2  default null
308   ,p_ass_attribute23              in     varchar2  default null
309   ,p_ass_attribute24              in     varchar2  default null
310   ,p_ass_attribute25              in     varchar2  default null
311   ,p_ass_attribute26              in     varchar2  default null
312   ,p_ass_attribute27              in     varchar2  default null
313   ,p_ass_attribute28              in     varchar2  default null
314   ,p_ass_attribute29              in     varchar2  default null
315   ,p_ass_attribute30              in     varchar2  default null
316   ,p_title                        in     varchar2  default null
317   ,p_concatenated_segments           out nocopy varchar2
318   ,p_contract_id                  in     number    default null
319   ,p_establishment_id             in     number    default null
320   ,p_collective_agreement_id      in     number    default null
321   ,p_notice_period                in     number    default null
322   ,p_notice_period_uom            in     varchar2  default null
323   ,p_employee_category            in     varchar2  default null
324   ,p_work_at_home                 in     varchar2  default null
325   ,p_job_post_source_name         in     varchar2  default null
326   ,p_applicant_rank               in     number    default null
327   ,p_posting_content_id           in     number    default null
328   ,p_cagr_grade_def_id            in out nocopy number
329   ,p_cagr_concatenated_segments      out nocopy varchar2
330   ,p_group_name                      out nocopy varchar2
331   ,p_assignment_id                in     number
332   ,p_people_group_id              in out nocopy number
333   ,p_soft_coding_keyflex_id       in out nocopy number
334   ,p_comment_id                      out nocopy number
335   ,p_object_version_number           out nocopy number
336   ,p_effective_start_date            out nocopy date
337   ,p_effective_end_date              out nocopy date
338   ,p_assignment_sequence             out nocopy number
339   ,p_return_status                   out nocopy varchar2
340   ) is
341   --
342   -- Variables for API Boolean parameters
343   l_validate                      boolean;
344   --
345   -- Variables for IN/OUT parameters
346   l_cagr_grade_def_id             number;
347   l_people_group_id               number;
348   l_soft_coding_keyflex_id        number;
349   --
350   -- Other variables
351   l_assignment_id                number;
352   l_proc    varchar2(72) := g_package ||'create_secondary_apl_asg';
353 Begin
354   hr_utility.set_location(' Entering:' || l_proc,10);
355   --
356   -- Issue a savepoint
357   --
358   savepoint create_secondary_apl_asg_swi;
359   --
360   -- Initialise Multiple Message Detection
361   --
362   hr_multi_message.enable_message_list;
363   --
364   -- Remember IN OUT parameter IN values
365   --
366   l_cagr_grade_def_id             := p_cagr_grade_def_id;
367   l_people_group_id               := p_people_group_id;
368   l_soft_coding_keyflex_id        := p_soft_coding_keyflex_id;
369   --
370   -- Convert constant values to their corresponding boolean value
371   --
372   l_validate :=
373     hr_api.constant_to_boolean
374       (p_constant_value => p_validate);
375   --
376   -- Register Surrogate ID or user key values
377   --
378   per_asg_ins.set_base_key_value
379     (p_assignment_id => p_assignment_id
380     );
381   --
382   -- Call API
383   --
384   hr_assignment_api.create_secondary_apl_asg
385     (p_validate                     => l_validate
386     ,p_effective_date               => p_effective_date
387     ,p_person_id                    => p_person_id
388     ,p_organization_id              => p_organization_id
389     ,p_recruiter_id                 => p_recruiter_id
390     ,p_grade_id                     => p_grade_id
391     ,p_position_id                  => p_position_id
392     ,p_job_id                       => p_job_id
393     ,p_assignment_status_type_id    => p_assignment_status_type_id
394     ,p_payroll_id                   => p_payroll_id
395     ,p_location_id                  => p_location_id
396     ,p_person_referred_by_id        => p_person_referred_by_id
397     ,p_supervisor_id                => p_supervisor_id
398     ,p_special_ceiling_step_id      => p_special_ceiling_step_id
399     ,p_recruitment_activity_id      => p_recruitment_activity_id
400     ,p_source_organization_id       => p_source_organization_id
401     ,p_vacancy_id                   => p_vacancy_id
402     ,p_pay_basis_id                 => p_pay_basis_id
403     ,p_change_reason                => p_change_reason
404     ,p_comments                     => p_comments
405     ,p_date_probation_end           => p_date_probation_end
406     ,p_default_code_comb_id         => p_default_code_comb_id
407     ,p_employment_category          => p_employment_category
408     ,p_frequency                    => p_frequency
409     ,p_internal_address_line        => p_internal_address_line
410     ,p_manager_flag                 => p_manager_flag
411     ,p_normal_hours                 => p_normal_hours
412     ,p_perf_review_period           => p_perf_review_period
413     ,p_perf_review_period_frequency => p_perf_review_period_frequency
414     ,p_probation_period             => p_probation_period
415     ,p_probation_unit               => p_probation_unit
416     ,p_sal_review_period            => p_sal_review_period
417     ,p_sal_review_period_frequency  => p_sal_review_period_frequency
418     ,p_set_of_books_id              => p_set_of_books_id
419     ,p_source_type                  => p_source_type
420     ,p_time_normal_finish           => p_time_normal_finish
421     ,p_time_normal_start            => p_time_normal_start
422     ,p_bargaining_unit_code         => p_bargaining_unit_code
423     ,p_ass_attribute_category       => p_ass_attribute_category
424     ,p_ass_attribute1               => p_ass_attribute1
425     ,p_ass_attribute2               => p_ass_attribute2
426     ,p_ass_attribute3               => p_ass_attribute3
427     ,p_ass_attribute4               => p_ass_attribute4
428     ,p_ass_attribute5               => p_ass_attribute5
429     ,p_ass_attribute6               => p_ass_attribute6
430     ,p_ass_attribute7               => p_ass_attribute7
431     ,p_ass_attribute8               => p_ass_attribute8
432     ,p_ass_attribute9               => p_ass_attribute9
433     ,p_ass_attribute10              => p_ass_attribute10
434     ,p_ass_attribute11              => p_ass_attribute11
435     ,p_ass_attribute12              => p_ass_attribute12
436     ,p_ass_attribute13              => p_ass_attribute13
437     ,p_ass_attribute14              => p_ass_attribute14
438     ,p_ass_attribute15              => p_ass_attribute15
439     ,p_ass_attribute16              => p_ass_attribute16
440     ,p_ass_attribute17              => p_ass_attribute17
441     ,p_ass_attribute18              => p_ass_attribute18
442     ,p_ass_attribute19              => p_ass_attribute19
443     ,p_ass_attribute20              => p_ass_attribute20
444     ,p_ass_attribute21              => p_ass_attribute21
445     ,p_ass_attribute22              => p_ass_attribute22
446     ,p_ass_attribute23              => p_ass_attribute23
447     ,p_ass_attribute24              => p_ass_attribute24
448     ,p_ass_attribute25              => p_ass_attribute25
449     ,p_ass_attribute26              => p_ass_attribute26
450     ,p_ass_attribute27              => p_ass_attribute27
451     ,p_ass_attribute28              => p_ass_attribute28
452     ,p_ass_attribute29              => p_ass_attribute29
453     ,p_ass_attribute30              => p_ass_attribute30
454     ,p_title                        => p_title
455     ,p_concatenated_segments        => p_concatenated_segments
456     ,p_contract_id                  => p_contract_id
457     ,p_establishment_id             => p_establishment_id
458     ,p_collective_agreement_id      => p_collective_agreement_id
459     ,p_notice_period                => p_notice_period
460     ,p_notice_period_uom            => p_notice_period_uom
461     ,p_employee_category            => p_employee_category
462     ,p_work_at_home                 => p_work_at_home
463     ,p_job_post_source_name         => p_job_post_source_name
464     ,p_applicant_rank               => p_applicant_rank
465     ,p_posting_content_id           => p_posting_content_id
466     ,p_cagr_grade_def_id            => p_cagr_grade_def_id
467     ,p_cagr_concatenated_segments   => p_cagr_concatenated_segments
468     ,p_group_name                   => p_group_name
469     ,p_assignment_id                => l_assignment_id
470     ,p_people_group_id              => p_people_group_id
471     ,p_soft_coding_keyflex_id       => p_soft_coding_keyflex_id
472     ,p_comment_id                   => p_comment_id
473     ,p_object_version_number        => p_object_version_number
474     ,p_effective_start_date         => p_effective_start_date
475     ,p_effective_end_date           => p_effective_end_date
476     ,p_assignment_sequence          => p_assignment_sequence
477     );
478   --
479   -- Convert API warning boolean parameter values to specific
480   -- messages and add them to Multiple Message List
481   --
482   --
483   -- Convert API non-warning boolean parameter values
484   --
485   --
486   -- Derive the API return status value based on whether
487   -- messages of any type exist in the Multiple Message List.
488   -- Also disable Multiple Message Detection.
489   --
490   p_return_status := hr_multi_message.get_return_status_disable;
491   hr_utility.set_location(' Leaving:' || l_proc,20);
492   --
493 exception
494   when hr_multi_message.error_message_exist then
495     --
496     -- Catch the Multiple Message List exception which
497     -- indicates API processing has been aborted because
498     -- at least one message exists in the list.
499     --
500     rollback to create_secondary_apl_asg_swi;
501     --
502     -- Reset IN OUT parameters and set OUT parameters
503     --
504     p_concatenated_segments        := null;
505     p_cagr_grade_def_id            := l_cagr_grade_def_id;
506     p_cagr_concatenated_segments   := null;
507     p_group_name                   := null;
508     p_people_group_id              := l_people_group_id;
509     p_soft_coding_keyflex_id       := l_soft_coding_keyflex_id;
510     p_comment_id                   := null;
511     p_object_version_number        := null;
512     p_effective_start_date         := null;
513     p_effective_end_date           := null;
514     p_assignment_sequence          := null;
515     p_return_status := hr_multi_message.get_return_status_disable;
516     hr_utility.set_location(' Leaving:' || l_proc, 30);
517   when others then
518     --
519     -- When Multiple Message Detection is enabled catch
520     -- any Application specific or other unexpected
521     -- exceptions.  Adding appropriate details to the
522     -- Multiple Message List.  Otherwise re-raise the
523     -- error.
524     --
525     rollback to create_secondary_apl_asg_swi;
526     if hr_multi_message.unexpected_error_add(l_proc) then
527        hr_utility.set_location(' Leaving:' || l_proc,40);
528        raise;
529     end if;
530     --
531     -- Reset IN OUT and set OUT parameters
532     --
533     p_concatenated_segments        := null;
534     p_cagr_grade_def_id            := l_cagr_grade_def_id;
535     p_cagr_concatenated_segments   := null;
536     p_group_name                   := null;
537     p_people_group_id              := l_people_group_id;
538     p_soft_coding_keyflex_id       := l_soft_coding_keyflex_id;
539     p_comment_id                   := null;
540     p_object_version_number        := null;
541     p_effective_start_date         := null;
542     p_effective_end_date           := null;
543     p_assignment_sequence          := null;
544     p_return_status := hr_multi_message.get_return_status_disable;
545     hr_utility.set_location(' Leaving:' || l_proc,50);
546 end create_secondary_apl_asg;
547 -- ----------------------------------------------------------------------------
548 -- |----------------------------< accept_apl_asg >----------------------------|
549 -- ----------------------------------------------------------------------------
550 PROCEDURE accept_apl_asg
551   (p_validate                     in     number    default hr_api.g_false_num
552   ,p_effective_date               in     date
553   ,p_datetrack_update_mode        in     varchar2
554   ,p_assignment_id                in     number
555   ,p_object_version_number        in out nocopy number
556   ,p_assignment_status_type_id    in     number    default hr_api.g_number
557   ,p_change_reason                in     varchar2  default hr_api.g_varchar2
558   ,p_effective_start_date            out nocopy date
559   ,p_effective_end_date              out nocopy date
560   ,p_return_status                   out nocopy varchar2
561   ) is
562   --
563   -- Variables for API Boolean parameters
564   l_validate                      boolean;
565   --
566   -- Variables for IN/OUT parameters
567   l_object_version_number         number;
568   --
569   -- Other variables
570   l_proc    varchar2(72) := g_package ||'accept_apl_asg';
571 Begin
572   hr_utility.set_location(' Entering:' || l_proc,10);
573   --
574   -- Issue a savepoint
575   --
576   savepoint accept_apl_asg_swi;
577   --
578   -- Initialise Multiple Message Detection
579   --
580   hr_multi_message.enable_message_list;
581   --
582   -- Remember IN OUT parameter IN values
583   --
584   l_object_version_number         := p_object_version_number;
585   --
586   -- Convert constant values to their corresponding boolean value
587   --
588   l_validate :=
589     hr_api.constant_to_boolean
590       (p_constant_value => p_validate);
591   --
592   -- Register Surrogate ID or user key values
593   --
594   --
595   -- Call API
596   --
597   hr_assignment_api.accept_apl_asg
598     (p_validate                     => l_validate
599     ,p_effective_date               => p_effective_date
600     ,p_datetrack_update_mode        => p_datetrack_update_mode
601     ,p_assignment_id                => p_assignment_id
602     ,p_object_version_number        => p_object_version_number
603     ,p_assignment_status_type_id    => p_assignment_status_type_id
604     ,p_change_reason                => p_change_reason
605     ,p_effective_start_date         => p_effective_start_date
606     ,p_effective_end_date           => p_effective_end_date
607     );
608   --
609   -- Convert API warning boolean parameter values to specific
610   -- messages and add them to Multiple Message List
611   --
612   --
613   -- Convert API non-warning boolean parameter values
614   --
615   --
616   -- Derive the API return status value based on whether
617   -- messages of any type exist in the Multiple Message List.
618   -- Also disable Multiple Message Detection.
619   --
620   p_return_status := hr_multi_message.get_return_status_disable;
621   hr_utility.set_location(' Leaving:' || l_proc,20);
622   --
623 exception
624   when hr_multi_message.error_message_exist then
625     --
626     -- Catch the Multiple Message List exception which
627     -- indicates API processing has been aborted because
628     -- at least one message exists in the list.
629     --
630     rollback to accept_apl_asg_swi;
631     --
632     -- Reset IN OUT parameters and set OUT parameters
633     --
634     p_object_version_number        := l_object_version_number;
635     p_effective_start_date         := null;
636     p_effective_end_date           := null;
637     p_return_status := hr_multi_message.get_return_status_disable;
638     hr_utility.set_location(' Leaving:' || l_proc, 30);
639   when others then
640     --
641     -- When Multiple Message Detection is enabled catch
642     -- any Application specific or other unexpected
643     -- exceptions.  Adding appropriate details to the
644     -- Multiple Message List.  Otherwise re-raise the
645     -- error.
646     --
647     rollback to accept_apl_asg_swi;
648     if hr_multi_message.unexpected_error_add(l_proc) then
649        hr_utility.set_location(' Leaving:' || l_proc,40);
650        raise;
651     end if;
652     --
653     -- Reset IN OUT and set OUT parameters
654     --
655     p_object_version_number        := l_object_version_number;
656     p_effective_start_date         := null;
657     p_effective_end_date           := null;
658     p_return_status := hr_multi_message.get_return_status_disable;
659     hr_utility.set_location(' Leaving:' || l_proc,50);
660 end accept_apl_asg;
661 -- ----------------------------------------------------------------------------
662 -- |---------------------------< activate_apl_asg >---------------------------|
663 -- ----------------------------------------------------------------------------
664 PROCEDURE activate_apl_asg
665   (p_validate                     in     number    default hr_api.g_false_num
666   ,p_effective_date               in     date
667   ,p_datetrack_update_mode        in     varchar2
668   ,p_assignment_id                in     number
669   ,p_object_version_number        in out nocopy number
670   ,p_assignment_status_type_id    in     number    default hr_api.g_number
671   ,p_change_reason                in     varchar2  default hr_api.g_varchar2
672   ,p_effective_start_date            out nocopy date
673   ,p_effective_end_date              out nocopy date
674   ,p_return_status                   out nocopy varchar2
675   ) is
676   --
677   -- Variables for API Boolean parameters
678   l_validate                      boolean;
679   --
680   -- Variables for IN/OUT parameters
681   l_object_version_number         number;
682   --
683   -- Other variables
684   l_proc    varchar2(72) := g_package ||'activate_apl_asg';
685 Begin
686   hr_utility.set_location(' Entering:' || l_proc,10);
687   --
688   -- Issue a savepoint
689   --
690   savepoint activate_apl_asg_swi;
691   --
692   -- Initialise Multiple Message Detection
693   --
694   hr_multi_message.enable_message_list;
695   --
696   -- Remember IN OUT parameter IN values
697   --
698   l_object_version_number         := p_object_version_number;
699   --
700   -- Convert constant values to their corresponding boolean value
701   --
702   l_validate :=
703     hr_api.constant_to_boolean
704       (p_constant_value => p_validate);
705   --
706   -- Register Surrogate ID or user key values
707   --
708   --
709   -- Call API
710   --
711   hr_assignment_api.activate_apl_asg
712     (p_validate                     => l_validate
713     ,p_effective_date               => p_effective_date
714     ,p_datetrack_update_mode        => p_datetrack_update_mode
715     ,p_assignment_id                => p_assignment_id
716     ,p_object_version_number        => p_object_version_number
717     ,p_assignment_status_type_id    => p_assignment_status_type_id
718     ,p_change_reason                => p_change_reason
719     ,p_effective_start_date         => p_effective_start_date
720     ,p_effective_end_date           => p_effective_end_date
721     );
722   --
723   -- Convert API warning boolean parameter values to specific
724   -- messages and add them to Multiple Message List
725   --
726   --
727   -- Convert API non-warning boolean parameter values
728   --
729   --
730   -- Derive the API return status value based on whether
731   -- messages of any type exist in the Multiple Message List.
732   -- Also disable Multiple Message Detection.
733   --
734   p_return_status := hr_multi_message.get_return_status_disable;
735   hr_utility.set_location(' Leaving:' || l_proc,20);
736   --
737 exception
738   when hr_multi_message.error_message_exist then
739     --
740     -- Catch the Multiple Message List exception which
741     -- indicates API processing has been aborted because
742     -- at least one message exists in the list.
743     --
744     rollback to activate_apl_asg_swi;
745     --
746     -- Reset IN OUT parameters and set OUT parameters
747     --
748     p_object_version_number        := l_object_version_number;
749     p_effective_start_date         := null;
750     p_effective_end_date           := null;
751     p_return_status := hr_multi_message.get_return_status_disable;
752     hr_utility.set_location(' Leaving:' || l_proc, 30);
753   when others then
754     --
755     -- When Multiple Message Detection is enabled catch
756     -- any Application specific or other unexpected
757     -- exceptions.  Adding appropriate details to the
758     -- Multiple Message List.  Otherwise re-raise the
759     -- error.
760     --
761     rollback to activate_apl_asg_swi;
762     if hr_multi_message.unexpected_error_add(l_proc) then
763        hr_utility.set_location(' Leaving:' || l_proc,40);
764        raise;
765     end if;
766     --
767     -- Reset IN OUT and set OUT parameters
768     --
769     p_object_version_number        := l_object_version_number;
770     p_effective_start_date         := null;
771     p_effective_end_date           := null;
772     p_return_status := hr_multi_message.get_return_status_disable;
773     hr_utility.set_location(' Leaving:' || l_proc,50);
774 end activate_apl_asg;
775 -- ----------------------------------------------------------------------------
776 -- |-----------------------------< offer_apl_asg >----------------------------|
777 -- ----------------------------------------------------------------------------
778 PROCEDURE offer_apl_asg
779   (p_validate                     in     number    default hr_api.g_false_num
780   ,p_effective_date               in     date
781   ,p_datetrack_update_mode        in     varchar2
782   ,p_assignment_id                in     number
783   ,p_object_version_number        in out nocopy number
784   ,p_assignment_status_type_id    in     number    default hr_api.g_number
785   ,p_change_reason                in     varchar2  default hr_api.g_varchar2
786   ,p_effective_start_date            out nocopy date
787   ,p_effective_end_date              out nocopy date
788   ,p_return_status                   out nocopy varchar2
789   ) is
790   --
791   -- Variables for API Boolean parameters
792   l_validate                      boolean;
793   --
794   -- Variables for IN/OUT parameters
795   l_object_version_number         number;
796   --
797   -- Other variables
798   l_proc    varchar2(72) := g_package ||'offer_apl_asg';
799 Begin
800   hr_utility.set_location(' Entering:' || l_proc,10);
801   --
802   -- Issue a savepoint
803   --
804   savepoint offer_apl_asg_swi;
805   --
806   -- Initialise Multiple Message Detection
807   --
808   hr_multi_message.enable_message_list;
809   --
810   -- Remember IN OUT parameter IN values
811   --
812   l_object_version_number         := p_object_version_number;
813   --
814   -- Convert constant values to their corresponding boolean value
815   --
816   l_validate :=
817     hr_api.constant_to_boolean
818       (p_constant_value => p_validate);
819   --
820   -- Register Surrogate ID or user key values
821   --
822   --
823   -- Call API
824   --
825   hr_assignment_api.offer_apl_asg
826     (p_validate                     => l_validate
827     ,p_effective_date               => p_effective_date
828     ,p_datetrack_update_mode        => p_datetrack_update_mode
829     ,p_assignment_id                => p_assignment_id
830     ,p_object_version_number        => p_object_version_number
831     ,p_assignment_status_type_id    => p_assignment_status_type_id
832     ,p_change_reason                => p_change_reason
833     ,p_effective_start_date         => p_effective_start_date
834     ,p_effective_end_date           => p_effective_end_date
835     );
836   --
837   -- Convert API warning boolean parameter values to specific
838   -- messages and add them to Multiple Message List
839   --
840   --
841   -- Convert API non-warning boolean parameter values
842   --
843   --
844   -- Derive the API return status value based on whether
845   -- messages of any type exist in the Multiple Message List.
846   -- Also disable Multiple Message Detection.
847   --
848   p_return_status := hr_multi_message.get_return_status_disable;
849   hr_utility.set_location(' Leaving:' || l_proc,20);
850   --
851 exception
852   when hr_multi_message.error_message_exist then
853     --
854     -- Catch the Multiple Message List exception which
855     -- indicates API processing has been aborted because
856     -- at least one message exists in the list.
857     --
858     rollback to offer_apl_asg_swi;
859     --
860     -- Reset IN OUT parameters and set OUT parameters
861     --
862     p_object_version_number        := l_object_version_number;
863     p_effective_start_date         := null;
864     p_effective_end_date           := null;
865     p_return_status := hr_multi_message.get_return_status_disable;
866     hr_utility.set_location(' Leaving:' || l_proc, 30);
867   when others then
868     --
869     -- When Multiple Message Detection is enabled catch
870     -- any Application specific or other unexpected
871     -- exceptions.  Adding appropriate details to the
872     -- Multiple Message List.  Otherwise re-raise the
873     -- error.
874     --
875     rollback to offer_apl_asg_swi;
876     if hr_multi_message.unexpected_error_add(l_proc) then
877        hr_utility.set_location(' Leaving:' || l_proc,40);
878        raise;
879     end if;
880     --
881     -- Reset IN OUT and set OUT parameters
882     --
883     p_object_version_number        := l_object_version_number;
884     p_effective_start_date         := null;
885     p_effective_end_date           := null;
886     p_return_status := hr_multi_message.get_return_status_disable;
887     hr_utility.set_location(' Leaving:' || l_proc,50);
888 end offer_apl_asg;
889 -- ----------------------------------------------------------------------------
890  -- |---------------------------< terminate_apl_asg >--------------------------|
891 -- ----------------------------------------------------------------------------
892 PROCEDURE terminate_apl_asg
893   (p_validate                     in     number    default hr_api.g_false_num
894   ,p_effective_date               in     date
895   ,p_assignment_id                in     number
896   ,p_object_version_number        in out nocopy number
897   ,p_effective_start_date            out nocopy date
898   ,p_effective_end_date              out nocopy date
899   ,p_return_status                   out nocopy varchar2
900   ) is
901   --
902   -- Variables for API Boolean parameters
903   l_validate                      boolean;
904   --
905   -- Variables for IN/OUT parameters
906   l_object_version_number         number;
907   --
908   -- Other variables
909   l_proc    varchar2(72) := g_package ||'terminate_apl_asg';
910 Begin
911   hr_utility.set_location(' Entering:' || l_proc,10);
912   --
913   -- Issue a savepoint
914   --
915   savepoint terminate_apl_asg_swi;
916   --
917   -- Initialise Multiple Message Detection
918   --
919   hr_multi_message.enable_message_list;
920   --
921   -- Remember IN OUT parameter IN values
922   --
923   l_object_version_number         := p_object_version_number;
924   --
925   -- Convert constant values to their corresponding boolean value
926   --
927   l_validate :=
928     hr_api.constant_to_boolean
929       (p_constant_value => p_validate);
930   --
931   -- Register Surrogate ID or user key values
932   --
933   --
934   -- Call API
935   --
936   hr_assignment_api.terminate_apl_asg
937     (p_validate                     => l_validate
938     ,p_effective_date               => p_effective_date
939     ,p_assignment_id                => p_assignment_id
940     ,p_object_version_number        => p_object_version_number
941     ,p_effective_start_date         => p_effective_start_date
942     ,p_effective_end_date           => p_effective_end_date
943     );
944   --
945   -- Convert API warning boolean parameter values to specific
946   -- messages and add them to Multiple Message List
947   --
948   --
949   -- Convert API non-warning boolean parameter values
950   --
951   --
952   -- Derive the API return status value based on whether
953   -- messages of any type exist in the Multiple Message List.
954   -- Also disable Multiple Message Detection.
955   --
956   p_return_status := hr_multi_message.get_return_status_disable;
957   hr_utility.set_location(' Leaving:' || l_proc,20);
958   --
959 exception
960   when hr_multi_message.error_message_exist then
961     --
962     -- Catch the Multiple Message List exception which
963     -- indicates API processing has been aborted because
964     -- at least one message exists in the list.
965     --
966     rollback to terminate_apl_asg_swi;
967     --
968     -- Reset IN OUT parameters and set OUT parameters
969     --
970     p_object_version_number        := l_object_version_number;
971     p_effective_start_date         := null;
972     p_effective_end_date           := null;
973     p_return_status := hr_multi_message.get_return_status_disable;
974     hr_utility.set_location(' Leaving:' || l_proc, 30);
975   when others then
976     --
977     -- When Multiple Message Detection is enabled catch
978     -- any Application specific or other unexpected
979     -- exceptions.  Adding appropriate details to the
980     -- Multiple Message List.  Otherwise re-raise the
981     -- error.
982     --
983     rollback to terminate_apl_asg_swi;
984     if hr_multi_message.unexpected_error_add(l_proc) then
985        hr_utility.set_location(' Leaving:' || l_proc,40);
986        raise;
987     end if;
988     --
989     -- Reset IN OUT and set OUT parameters
990     --
991     p_object_version_number        := l_object_version_number;
992     p_effective_start_date         := null;
993     p_effective_end_date           := null;
994     p_return_status := hr_multi_message.get_return_status_disable;
995     hr_utility.set_location(' Leaving:' || l_proc,50);
996 end terminate_apl_asg;
997 -- ----------------------------------------------------------------------------
998 -- |----------------------------< update_apl_asg >----------------------------|
999 -- ----------------------------------------------------------------------------
1000 PROCEDURE update_apl_asg
1001   (p_validate                     in     number    default hr_api.g_false_num
1002   ,p_effective_date               in     date
1003   ,p_datetrack_update_mode        in     varchar2
1004   ,p_assignment_id                in     number
1005   ,p_object_version_number        in out nocopy number
1006   ,p_recruiter_id                 in     number    default hr_api.g_number
1007   ,p_grade_id                     in     number    default hr_api.g_number
1008   ,p_position_id                  in     number    default hr_api.g_number
1009   ,p_job_id                       in     number    default hr_api.g_number
1010   ,p_payroll_id                   in     number    default hr_api.g_number
1011   ,p_location_id                  in     number    default hr_api.g_number
1012   ,p_person_referred_by_id        in     number    default hr_api.g_number
1013   ,p_supervisor_id                in     number    default hr_api.g_number
1014   ,p_special_ceiling_step_id      in     number    default hr_api.g_number
1015   ,p_recruitment_activity_id      in     number    default hr_api.g_number
1016   ,p_source_organization_id       in     number    default hr_api.g_number
1017   ,p_organization_id              in     number    default hr_api.g_number
1018   ,p_vacancy_id                   in     number    default hr_api.g_number
1019   ,p_pay_basis_id                 in     number    default hr_api.g_number
1020   ,p_application_id               in     number    default hr_api.g_number
1021   ,p_change_reason                in     varchar2  default hr_api.g_varchar2
1022   ,p_assignment_status_type_id    in     number    default hr_api.g_number
1023   ,p_comments                     in     varchar2  default hr_api.g_varchar2
1024   ,p_date_probation_end           in     date      default hr_api.g_date
1025   ,p_default_code_comb_id         in     number    default hr_api.g_number
1026   ,p_employment_category          in     varchar2  default hr_api.g_varchar2
1027   ,p_frequency                    in     varchar2  default hr_api.g_varchar2
1028   ,p_internal_address_line        in     varchar2  default hr_api.g_varchar2
1029   ,p_manager_flag                 in     varchar2  default hr_api.g_varchar2
1030   ,p_normal_hours                 in     number    default hr_api.g_number
1031   ,p_perf_review_period           in     number    default hr_api.g_number
1032   ,p_perf_review_period_frequency in     varchar2  default hr_api.g_varchar2
1033   ,p_probation_period             in     number    default hr_api.g_number
1034   ,p_probation_unit               in     varchar2  default hr_api.g_varchar2
1035   ,p_sal_review_period            in     number    default hr_api.g_number
1036   ,p_sal_review_period_frequency  in     varchar2  default hr_api.g_varchar2
1037   ,p_set_of_books_id              in     number    default hr_api.g_number
1038   ,p_source_type                  in     varchar2  default hr_api.g_varchar2
1039   ,p_time_normal_finish           in     varchar2  default hr_api.g_varchar2
1040   ,p_time_normal_start            in     varchar2  default hr_api.g_varchar2
1041   ,p_bargaining_unit_code         in     varchar2  default hr_api.g_varchar2
1042   ,p_ass_attribute_category       in     varchar2  default hr_api.g_varchar2
1043   ,p_ass_attribute1               in     varchar2  default hr_api.g_varchar2
1044   ,p_ass_attribute2               in     varchar2  default hr_api.g_varchar2
1045   ,p_ass_attribute3               in     varchar2  default hr_api.g_varchar2
1046   ,p_ass_attribute4               in     varchar2  default hr_api.g_varchar2
1047   ,p_ass_attribute5               in     varchar2  default hr_api.g_varchar2
1048   ,p_ass_attribute6               in     varchar2  default hr_api.g_varchar2
1049   ,p_ass_attribute7               in     varchar2  default hr_api.g_varchar2
1050   ,p_ass_attribute8               in     varchar2  default hr_api.g_varchar2
1051   ,p_ass_attribute9               in     varchar2  default hr_api.g_varchar2
1052   ,p_ass_attribute10              in     varchar2  default hr_api.g_varchar2
1053   ,p_ass_attribute11              in     varchar2  default hr_api.g_varchar2
1054   ,p_ass_attribute12              in     varchar2  default hr_api.g_varchar2
1055   ,p_ass_attribute13              in     varchar2  default hr_api.g_varchar2
1056   ,p_ass_attribute14              in     varchar2  default hr_api.g_varchar2
1057   ,p_ass_attribute15              in     varchar2  default hr_api.g_varchar2
1058   ,p_ass_attribute16              in     varchar2  default hr_api.g_varchar2
1059   ,p_ass_attribute17              in     varchar2  default hr_api.g_varchar2
1060   ,p_ass_attribute18              in     varchar2  default hr_api.g_varchar2
1061   ,p_ass_attribute19              in     varchar2  default hr_api.g_varchar2
1062   ,p_ass_attribute20              in     varchar2  default hr_api.g_varchar2
1063   ,p_ass_attribute21              in     varchar2  default hr_api.g_varchar2
1064   ,p_ass_attribute22              in     varchar2  default hr_api.g_varchar2
1065   ,p_ass_attribute23              in     varchar2  default hr_api.g_varchar2
1066   ,p_ass_attribute24              in     varchar2  default hr_api.g_varchar2
1067   ,p_ass_attribute25              in     varchar2  default hr_api.g_varchar2
1068   ,p_ass_attribute26              in     varchar2  default hr_api.g_varchar2
1069   ,p_ass_attribute27              in     varchar2  default hr_api.g_varchar2
1070   ,p_ass_attribute28              in     varchar2  default hr_api.g_varchar2
1071   ,p_ass_attribute29              in     varchar2  default hr_api.g_varchar2
1072   ,p_ass_attribute30              in     varchar2  default hr_api.g_varchar2
1073   ,p_title                        in     varchar2  default hr_api.g_varchar2
1074   ,p_concatenated_segments           out nocopy varchar2
1075   ,p_contract_id                  in     number    default hr_api.g_number
1076   ,p_establishment_id             in     number    default hr_api.g_number
1077   ,p_collective_agreement_id      in     number    default hr_api.g_number
1078   ,p_notice_period                in     number    default hr_api.g_number
1079   ,p_notice_period_uom            in     varchar2  default hr_api.g_varchar2
1080   ,p_employee_category            in     varchar2  default hr_api.g_varchar2
1081   ,p_work_at_home                 in     varchar2  default hr_api.g_varchar2
1082   ,p_job_post_source_name         in     varchar2  default hr_api.g_varchar2
1083   ,p_posting_content_id           in     number    default hr_api.g_number
1084   ,p_applicant_rank               in     number    default hr_api.g_number
1085   ,p_status_change_comments       in     varchar2  default null
1086   ,p_cagr_grade_def_id            in out nocopy number
1087   ,p_cagr_concatenated_segments      out nocopy varchar2
1088   ,p_group_name                      out nocopy varchar2
1089   ,p_comment_id                      out nocopy number
1090   ,p_people_group_id              in out nocopy number
1091   ,p_soft_coding_keyflex_id       in out nocopy number
1092   ,p_effective_start_date            out nocopy date
1093   ,p_effective_end_date              out nocopy date
1094   ,p_return_status                   out nocopy varchar2
1095   ) is
1096   --
1097   -- Variables for API Boolean parameters
1098   l_validate                      boolean;
1099   --
1100   -- Added for turn off key flex field validation
1101   l_add_struct hr_kflex_utility.l_ignore_kfcode_varray :=
1102                            hr_kflex_utility.l_ignore_kfcode_varray();
1103   --
1104   -- Variables for IN/OUT parameters
1105   l_object_version_number         number;
1106   l_cagr_grade_def_id             number;
1107   l_people_group_id               number;
1108   l_soft_coding_keyflex_id        number;
1109   l_datetrack_update_mode varchar2(30) := p_datetrack_update_mode;
1110   --
1111   -- Other variables
1112   l_effective_date             date;
1113   l_proc    varchar2(72) := g_package ||'update_apl_asg';
1114 Begin
1115   hr_utility.set_location(' Entering:' || l_proc,10);
1116   --
1117   -- Initialise local variable
1118   --
1119   l_effective_date := trunc(p_effective_date);
1120   --
1121   -- Issue a savepoint
1122   --
1123   savepoint update_apl_asg_swi;
1124   --
1125   -- Initialise Multiple Message Detection
1126   --
1127   hr_multi_message.enable_message_list;
1128   --
1129   -- Remember IN OUT parameter IN values
1130   --
1131   l_object_version_number         := p_object_version_number;
1132   l_cagr_grade_def_id             := p_cagr_grade_def_id;
1133   l_people_group_id               := p_people_group_id;
1134   l_soft_coding_keyflex_id        := p_soft_coding_keyflex_id;
1135   --
1136   -- Convert constant values to their corresponding boolean value
1137   --
1138   l_validate :=
1139     hr_api.constant_to_boolean
1140       (p_constant_value => p_validate);
1141   --
1142   -- Added for turn off key flex field validation
1143   l_add_struct.extend(1);
1144   l_add_struct(l_add_struct.count) := 'GRP';
1145   --
1146   hr_kflex_utility.create_ignore_kf_validation(p_rec => l_add_struct);
1147   --
1148   -- Register Surrogate ID or user key values
1149   --
1150   --
1151   -- Call API
1152   --
1153   IF NOT hr_assignment_swi.chg_in_sys_status_to_term_apl
1154            ( p_effective_date              => l_effective_date
1155            , p_datetrack_update_mode       => l_datetrack_update_mode
1156            , p_assignment_status_type_id   => p_assignment_status_type_id
1157            , p_assignment_id               => p_assignment_id
1158            , p_change_reason               => p_change_reason
1159            , p_object_version_number       => p_object_version_number
1160            , p_effective_start_date        => p_effective_start_date
1161            , p_effective_end_date          => p_effective_end_date
1162            , p_status_change_comments      => p_status_change_comments
1163            ) THEN
1164               hr_assignment_api.update_apl_asg
1165                 (p_validate                     => l_validate
1166                 ,p_effective_date               => p_effective_date
1167                 ,p_datetrack_update_mode        => l_datetrack_update_mode
1168                 ,p_assignment_id                => p_assignment_id
1169                 ,p_object_version_number        => p_object_version_number
1170                 ,p_recruiter_id                 => p_recruiter_id
1171                 ,p_grade_id                     => p_grade_id
1172                 ,p_position_id                  => p_position_id
1173                 ,p_job_id                       => p_job_id
1174                 ,p_payroll_id                   => p_payroll_id
1175                 ,p_location_id                  => p_location_id
1176                 ,p_person_referred_by_id        => p_person_referred_by_id
1177                 ,p_supervisor_id                => p_supervisor_id
1178                 ,p_special_ceiling_step_id      => p_special_ceiling_step_id
1179                 ,p_recruitment_activity_id      => p_recruitment_activity_id
1180                 ,p_source_organization_id       => p_source_organization_id
1181                 ,p_organization_id              => p_organization_id
1182                 ,p_vacancy_id                   => p_vacancy_id
1183                 ,p_pay_basis_id                 => p_pay_basis_id
1184                 ,p_application_id               => p_application_id
1185                 ,p_change_reason                => p_change_reason
1186                 ,p_assignment_status_type_id    => p_assignment_status_type_id
1187                 ,p_comments                     => p_comments
1188                 ,p_date_probation_end           => p_date_probation_end
1189                 ,p_default_code_comb_id         => p_default_code_comb_id
1190                 ,p_employment_category          => p_employment_category
1191                 ,p_frequency                    => p_frequency
1192                 ,p_internal_address_line        => p_internal_address_line
1193                 ,p_manager_flag                 => p_manager_flag
1194                 ,p_normal_hours                 => p_normal_hours
1195                 ,p_perf_review_period           => p_perf_review_period
1196                 ,p_perf_review_period_frequency => p_perf_review_period_frequency
1197                 ,p_probation_period             => p_probation_period
1198                 ,p_probation_unit               => p_probation_unit
1199                 ,p_sal_review_period            => p_sal_review_period
1200                 ,p_sal_review_period_frequency  => p_sal_review_period_frequency
1201                 ,p_set_of_books_id              => p_set_of_books_id
1202                 ,p_source_type                  => p_source_type
1203                 ,p_time_normal_finish           => p_time_normal_finish
1204                 ,p_time_normal_start            => p_time_normal_start
1205                 ,p_bargaining_unit_code         => p_bargaining_unit_code
1206                 ,p_ass_attribute_category       => p_ass_attribute_category
1207                 ,p_ass_attribute1               => p_ass_attribute1
1208                 ,p_ass_attribute2               => p_ass_attribute2
1209                 ,p_ass_attribute3               => p_ass_attribute3
1210                 ,p_ass_attribute4               => p_ass_attribute4
1211                 ,p_ass_attribute5               => p_ass_attribute5
1212                 ,p_ass_attribute6               => p_ass_attribute6
1213                 ,p_ass_attribute7               => p_ass_attribute7
1214                 ,p_ass_attribute8               => p_ass_attribute8
1215                 ,p_ass_attribute9               => p_ass_attribute9
1216                 ,p_ass_attribute10              => p_ass_attribute10
1217                 ,p_ass_attribute11              => p_ass_attribute11
1218                 ,p_ass_attribute12              => p_ass_attribute12
1219                 ,p_ass_attribute13              => p_ass_attribute13
1220                 ,p_ass_attribute14              => p_ass_attribute14
1221                 ,p_ass_attribute15              => p_ass_attribute15
1222                 ,p_ass_attribute16              => p_ass_attribute16
1223                 ,p_ass_attribute17              => p_ass_attribute17
1224                 ,p_ass_attribute18              => p_ass_attribute18
1225                 ,p_ass_attribute19              => p_ass_attribute19
1226                 ,p_ass_attribute20              => p_ass_attribute20
1227                 ,p_ass_attribute21              => p_ass_attribute21
1228                 ,p_ass_attribute22              => p_ass_attribute22
1229                 ,p_ass_attribute23              => p_ass_attribute23
1230                 ,p_ass_attribute24              => p_ass_attribute24
1231                 ,p_ass_attribute25              => p_ass_attribute25
1232                 ,p_ass_attribute26              => p_ass_attribute26
1233                 ,p_ass_attribute27              => p_ass_attribute27
1234                 ,p_ass_attribute28              => p_ass_attribute28
1235                 ,p_ass_attribute29              => p_ass_attribute29
1236                 ,p_ass_attribute30              => p_ass_attribute30
1237                 ,p_title                        => p_title
1238                 ,p_concatenated_segments        => p_concatenated_segments
1239                 ,p_contract_id                  => p_contract_id
1240                 ,p_establishment_id             => p_establishment_id
1241                 ,p_collective_agreement_id      => p_collective_agreement_id
1242                 ,p_notice_period                => p_notice_period
1243                 ,p_notice_period_uom            => p_notice_period_uom
1244                 ,p_employee_category            => p_employee_category
1245                 ,p_work_at_home                 => p_work_at_home
1246                 ,p_job_post_source_name         => p_job_post_source_name
1247                 ,p_posting_content_id           => p_posting_content_id
1248                 ,p_applicant_rank               => p_applicant_rank
1249                 ,p_cagr_grade_def_id            => p_cagr_grade_def_id
1250                 ,p_cagr_concatenated_segments   => p_cagr_concatenated_segments
1251                 ,p_group_name                   => p_group_name
1252                 ,p_comment_id                   => p_comment_id
1253                 ,p_people_group_id              => p_people_group_id
1254                 ,p_soft_coding_keyflex_id       => p_soft_coding_keyflex_id
1255                 ,p_effective_start_date         => p_effective_start_date
1256                 ,p_effective_end_date           => p_effective_end_date
1257                 );
1258   END IF;
1259   --
1260   -- Convert API warning boolean parameter values to specific
1261   -- messages and add them to Multiple Message List
1262   --
1263   --
1264   -- Convert API non-warning boolean parameter values
1265   --
1266   --
1267   -- Derive the API return status value based on whether
1268   -- messages of any type exist in the Multiple Message List.
1269   -- Also disable Multiple Message Detection.
1270   --
1271   p_return_status := hr_multi_message.get_return_status_disable;
1272   hr_utility.set_location(' Leaving:' || l_proc,20);
1273   --
1274 exception
1275   when hr_multi_message.error_message_exist then
1276     --
1277     -- Catch the Multiple Message List exception which
1278     -- indicates API processing has been aborted because
1279     -- at least one message exists in the list.
1280     --
1281     rollback to update_apl_asg_swi;
1282     --
1283     -- Reset IN OUT parameters and set OUT parameters
1284     --
1285     p_object_version_number        := l_object_version_number;
1286     p_concatenated_segments        := null;
1287     p_cagr_grade_def_id            := l_cagr_grade_def_id;
1288     p_cagr_concatenated_segments   := null;
1289     p_group_name                   := null;
1290     p_comment_id                   := null;
1291     p_people_group_id              := l_people_group_id;
1292     p_soft_coding_keyflex_id       := l_soft_coding_keyflex_id;
1293     p_effective_start_date         := null;
1294     p_effective_end_date           := null;
1295     p_return_status := hr_multi_message.get_return_status_disable;
1296     hr_utility.set_location(' Leaving:' || l_proc, 30);
1297   when others then
1298     --
1299     -- When Multiple Message Detection is enabled catch
1300     -- any Application specific or other unexpected
1301     -- exceptions.  Adding appropriate details to the
1302     -- Multiple Message List.  Otherwise re-raise the
1303     -- error.
1304     --
1305     rollback to update_apl_asg_swi;
1306     if hr_multi_message.unexpected_error_add(l_proc) then
1307        hr_utility.set_location(' Leaving:' || l_proc,40);
1308        raise;
1309     end if;
1310     --
1311     -- Reset IN OUT and set OUT parameters
1312     --
1313     p_object_version_number        := l_object_version_number;
1314     p_concatenated_segments        := null;
1315     p_cagr_grade_def_id            := l_cagr_grade_def_id;
1316     p_cagr_concatenated_segments   := null;
1317     p_group_name                   := null;
1318     p_comment_id                   := null;
1319     p_people_group_id              := l_people_group_id;
1320     p_soft_coding_keyflex_id       := l_soft_coding_keyflex_id;
1321     p_effective_start_date         := null;
1322     p_effective_end_date           := null;
1323     p_return_status := hr_multi_message.get_return_status_disable;
1324     hr_utility.set_location(' Leaving:' || l_proc,50);
1325 end update_apl_asg;
1326 --
1327 -- ----------------------------------------------------------------------------
1328 -- |----------------------------< update_emp_asg >----------------------------|
1329 -- ----------------------------------------------------------------------------
1330 PROCEDURE update_emp_asg
1331   (p_validate                     in     number    default hr_api.g_false_num
1332   ,p_effective_date               in     date
1333   ,p_datetrack_update_mode        in     varchar2
1334   ,p_assignment_id                in     number
1335   ,p_object_version_number        in out nocopy number
1336   ,p_supervisor_id                in     number    default hr_api.g_number
1337   ,p_assignment_number            in     varchar2  default hr_api.g_varchar2
1338   ,p_change_reason                in     varchar2  default hr_api.g_varchar2
1339   ,p_assignment_status_type_id    in     number    default hr_api.g_number
1340   ,p_comments                     in     varchar2  default hr_api.g_varchar2
1341   ,p_date_probation_end           in     date      default hr_api.g_date
1342   ,p_default_code_comb_id         in     number    default hr_api.g_number
1343   ,p_frequency                    in     varchar2  default hr_api.g_varchar2
1344   ,p_internal_address_line        in     varchar2  default hr_api.g_varchar2
1345   ,p_manager_flag                 in     varchar2  default hr_api.g_varchar2
1346   ,p_normal_hours                 in     number    default hr_api.g_number
1347   ,p_perf_review_period           in     number    default hr_api.g_number
1348   ,p_perf_review_period_frequency in     varchar2  default hr_api.g_varchar2
1349   ,p_probation_period             in     number    default hr_api.g_number
1350   ,p_probation_unit               in     varchar2  default hr_api.g_varchar2
1351   ,p_sal_review_period            in     number    default hr_api.g_number
1352   ,p_sal_review_period_frequency  in     varchar2  default hr_api.g_varchar2
1353   ,p_set_of_books_id              in     number    default hr_api.g_number
1354   ,p_source_type                  in     varchar2  default hr_api.g_varchar2
1355   ,p_time_normal_finish           in     varchar2  default hr_api.g_varchar2
1356   ,p_time_normal_start            in     varchar2  default hr_api.g_varchar2
1357   ,p_bargaining_unit_code         in     varchar2  default hr_api.g_varchar2
1358   ,p_labour_union_member_flag     in     varchar2  default hr_api.g_varchar2
1359   ,p_hourly_salaried_code         in     varchar2  default hr_api.g_varchar2
1360   ,p_ass_attribute_category       in     varchar2  default hr_api.g_varchar2
1361   ,p_ass_attribute1               in     varchar2  default hr_api.g_varchar2
1362   ,p_ass_attribute2               in     varchar2  default hr_api.g_varchar2
1363   ,p_ass_attribute3               in     varchar2  default hr_api.g_varchar2
1364   ,p_ass_attribute4               in     varchar2  default hr_api.g_varchar2
1365   ,p_ass_attribute5               in     varchar2  default hr_api.g_varchar2
1366   ,p_ass_attribute6               in     varchar2  default hr_api.g_varchar2
1367   ,p_ass_attribute7               in     varchar2  default hr_api.g_varchar2
1368   ,p_ass_attribute8               in     varchar2  default hr_api.g_varchar2
1369   ,p_ass_attribute9               in     varchar2  default hr_api.g_varchar2
1370   ,p_ass_attribute10              in     varchar2  default hr_api.g_varchar2
1371   ,p_ass_attribute11              in     varchar2  default hr_api.g_varchar2
1372   ,p_ass_attribute12              in     varchar2  default hr_api.g_varchar2
1373   ,p_ass_attribute13              in     varchar2  default hr_api.g_varchar2
1374   ,p_ass_attribute14              in     varchar2  default hr_api.g_varchar2
1375   ,p_ass_attribute15              in     varchar2  default hr_api.g_varchar2
1376   ,p_ass_attribute16              in     varchar2  default hr_api.g_varchar2
1377   ,p_ass_attribute17              in     varchar2  default hr_api.g_varchar2
1378   ,p_ass_attribute18              in     varchar2  default hr_api.g_varchar2
1379   ,p_ass_attribute19              in     varchar2  default hr_api.g_varchar2
1380   ,p_ass_attribute20              in     varchar2  default hr_api.g_varchar2
1381   ,p_ass_attribute21              in     varchar2  default hr_api.g_varchar2
1382   ,p_ass_attribute22              in     varchar2  default hr_api.g_varchar2
1383   ,p_ass_attribute23              in     varchar2  default hr_api.g_varchar2
1384   ,p_ass_attribute24              in     varchar2  default hr_api.g_varchar2
1385   ,p_ass_attribute25              in     varchar2  default hr_api.g_varchar2
1386   ,p_ass_attribute26              in     varchar2  default hr_api.g_varchar2
1387   ,p_ass_attribute27              in     varchar2  default hr_api.g_varchar2
1388   ,p_ass_attribute28              in     varchar2  default hr_api.g_varchar2
1389   ,p_ass_attribute29              in     varchar2  default hr_api.g_varchar2
1390   ,p_ass_attribute30              in     varchar2  default hr_api.g_varchar2
1391   ,p_title                        in     varchar2  default hr_api.g_varchar2
1392   ,p_segment1                     in     varchar2  default hr_api.g_varchar2
1393   ,p_segment2                     in     varchar2  default hr_api.g_varchar2
1394   ,p_segment3                     in     varchar2  default hr_api.g_varchar2
1395   ,p_segment4                     in     varchar2  default hr_api.g_varchar2
1396   ,p_segment5                     in     varchar2  default hr_api.g_varchar2
1397   ,p_segment6                     in     varchar2  default hr_api.g_varchar2
1398   ,p_segment7                     in     varchar2  default hr_api.g_varchar2
1399   ,p_segment8                     in     varchar2  default hr_api.g_varchar2
1400   ,p_segment9                     in     varchar2  default hr_api.g_varchar2
1401   ,p_segment10                    in     varchar2  default hr_api.g_varchar2
1402   ,p_segment11                    in     varchar2  default hr_api.g_varchar2
1403   ,p_segment12                    in     varchar2  default hr_api.g_varchar2
1404   ,p_segment13                    in     varchar2  default hr_api.g_varchar2
1405   ,p_segment14                    in     varchar2  default hr_api.g_varchar2
1406   ,p_segment15                    in     varchar2  default hr_api.g_varchar2
1407   ,p_segment16                    in     varchar2  default hr_api.g_varchar2
1408   ,p_segment17                    in     varchar2  default hr_api.g_varchar2
1409   ,p_segment18                    in     varchar2  default hr_api.g_varchar2
1410   ,p_segment19                    in     varchar2  default hr_api.g_varchar2
1411   ,p_segment20                    in     varchar2  default hr_api.g_varchar2
1412   ,p_segment21                    in     varchar2  default hr_api.g_varchar2
1413   ,p_segment22                    in     varchar2  default hr_api.g_varchar2
1414   ,p_segment23                    in     varchar2  default hr_api.g_varchar2
1415   ,p_segment24                    in     varchar2  default hr_api.g_varchar2
1416   ,p_segment25                    in     varchar2  default hr_api.g_varchar2
1417   ,p_segment26                    in     varchar2  default hr_api.g_varchar2
1418   ,p_segment27                    in     varchar2  default hr_api.g_varchar2
1419   ,p_segment28                    in     varchar2  default hr_api.g_varchar2
1420   ,p_segment29                    in     varchar2  default hr_api.g_varchar2
1421   ,p_segment30                    in     varchar2  default hr_api.g_varchar2
1422   ,p_concat_segments              in     varchar2  default hr_api.g_varchar2
1423   ,p_contract_id                  in     number    default hr_api.g_number
1424   ,p_establishment_id             in     number    default hr_api.g_number
1425   ,p_collective_agreement_id      in     number    default hr_api.g_number
1426   ,p_cagr_id_flex_num             in     number    default hr_api.g_number
1427   ,p_cag_segment1                 in     varchar2  default hr_api.g_varchar2
1428   ,p_cag_segment2                 in     varchar2  default hr_api.g_varchar2
1429   ,p_cag_segment3                 in     varchar2  default hr_api.g_varchar2
1430   ,p_cag_segment4                 in     varchar2  default hr_api.g_varchar2
1431   ,p_cag_segment5                 in     varchar2  default hr_api.g_varchar2
1432   ,p_cag_segment6                 in     varchar2  default hr_api.g_varchar2
1433   ,p_cag_segment7                 in     varchar2  default hr_api.g_varchar2
1434   ,p_cag_segment8                 in     varchar2  default hr_api.g_varchar2
1435   ,p_cag_segment9                 in     varchar2  default hr_api.g_varchar2
1436   ,p_cag_segment10                in     varchar2  default hr_api.g_varchar2
1437   ,p_cag_segment11                in     varchar2  default hr_api.g_varchar2
1438   ,p_cag_segment12                in     varchar2  default hr_api.g_varchar2
1439   ,p_cag_segment13                in     varchar2  default hr_api.g_varchar2
1440   ,p_cag_segment14                in     varchar2  default hr_api.g_varchar2
1441   ,p_cag_segment15                in     varchar2  default hr_api.g_varchar2
1442   ,p_cag_segment16                in     varchar2  default hr_api.g_varchar2
1443   ,p_cag_segment17                in     varchar2  default hr_api.g_varchar2
1444   ,p_cag_segment18                in     varchar2  default hr_api.g_varchar2
1445   ,p_cag_segment19                in     varchar2  default hr_api.g_varchar2
1446   ,p_cag_segment20                in     varchar2  default hr_api.g_varchar2
1447   ,p_notice_period                in     number    default hr_api.g_number
1448   ,p_notice_period_uom            in     varchar2  default hr_api.g_varchar2
1449   ,p_employee_category            in     varchar2  default hr_api.g_varchar2
1450   ,p_work_at_home                 in     varchar2  default hr_api.g_varchar2
1451   ,p_job_post_source_name         in     varchar2  default hr_api.g_varchar2
1452   ,p_cagr_grade_def_id               out nocopy number
1453   ,p_cagr_concatenated_segments      out nocopy varchar2
1454   ,p_concatenated_segments           out nocopy varchar2
1455   ,p_soft_coding_keyflex_id          out nocopy number
1456   ,p_comment_id                      out nocopy number
1457   ,p_effective_start_date            out nocopy date
1458   ,p_effective_end_date              out nocopy date
1459   ,p_return_status                   out nocopy varchar2
1460   ) is
1461   --
1462   -- Variables for API Boolean parameters
1463   l_validate                      boolean;
1464   l_no_managers_warning           boolean;
1465   l_other_manager_warning         boolean;
1466   l_hourly_salaried_warning       boolean;
1467   --
1468   -- Variables for IN/OUT parameters
1469   l_object_version_number         number;
1470   --
1471   -- Other variables
1472   l_proc    varchar2(72) := g_package ||'update_emp_asg';
1473 Begin
1474   hr_utility.set_location(' Entering:' || l_proc,10);
1475   --
1476   -- Issue a savepoint
1477   --
1478   savepoint update_emp_asg_swi;
1479   --
1480   -- Initialise Multiple Message Detection
1481   --
1482   hr_multi_message.enable_message_list;
1483   --
1484   -- Remember IN OUT parameter IN values
1485   --
1486   l_object_version_number         := p_object_version_number;
1487   --
1488   -- Convert constant values to their corresponding boolean value
1489   --
1490   l_validate :=
1491     hr_api.constant_to_boolean
1492       (p_constant_value => p_validate);
1493   --
1494   -- Register Surrogate ID or user key values
1495   --
1496   --
1497   -- Call API
1498   --
1499   hr_assignment_api.update_emp_asg
1500     (p_validate                     => l_validate
1501     ,p_effective_date               => p_effective_date
1502     ,p_datetrack_update_mode        => p_datetrack_update_mode
1503     ,p_assignment_id                => p_assignment_id
1504     ,p_object_version_number        => p_object_version_number
1505     ,p_supervisor_id                => p_supervisor_id
1506     ,p_assignment_number            => p_assignment_number
1507     ,p_change_reason                => p_change_reason
1508     ,p_assignment_status_type_id    => p_assignment_status_type_id
1509     ,p_comments                     => p_comments
1510     ,p_date_probation_end           => p_date_probation_end
1511     ,p_default_code_comb_id         => p_default_code_comb_id
1512     ,p_frequency                    => p_frequency
1513     ,p_internal_address_line        => p_internal_address_line
1514     ,p_manager_flag                 => p_manager_flag
1515     ,p_normal_hours                 => p_normal_hours
1516     ,p_perf_review_period           => p_perf_review_period
1517     ,p_perf_review_period_frequency => p_perf_review_period_frequency
1518     ,p_probation_period             => p_probation_period
1519     ,p_probation_unit               => p_probation_unit
1520     ,p_sal_review_period            => p_sal_review_period
1521     ,p_sal_review_period_frequency  => p_sal_review_period_frequency
1522     ,p_set_of_books_id              => p_set_of_books_id
1523     ,p_source_type                  => p_source_type
1524     ,p_time_normal_finish           => p_time_normal_finish
1525     ,p_time_normal_start            => p_time_normal_start
1526     ,p_bargaining_unit_code         => p_bargaining_unit_code
1527     ,p_labour_union_member_flag     => p_labour_union_member_flag
1528     ,p_hourly_salaried_code         => p_hourly_salaried_code
1529     ,p_ass_attribute_category       => p_ass_attribute_category
1530     ,p_ass_attribute1               => p_ass_attribute1
1531     ,p_ass_attribute2               => p_ass_attribute2
1532     ,p_ass_attribute3               => p_ass_attribute3
1533     ,p_ass_attribute4               => p_ass_attribute4
1534     ,p_ass_attribute5               => p_ass_attribute5
1535     ,p_ass_attribute6               => p_ass_attribute6
1536     ,p_ass_attribute7               => p_ass_attribute7
1537     ,p_ass_attribute8               => p_ass_attribute8
1538     ,p_ass_attribute9               => p_ass_attribute9
1539     ,p_ass_attribute10              => p_ass_attribute10
1540     ,p_ass_attribute11              => p_ass_attribute11
1541     ,p_ass_attribute12              => p_ass_attribute12
1542     ,p_ass_attribute13              => p_ass_attribute13
1543     ,p_ass_attribute14              => p_ass_attribute14
1544     ,p_ass_attribute15              => p_ass_attribute15
1545     ,p_ass_attribute16              => p_ass_attribute16
1546     ,p_ass_attribute17              => p_ass_attribute17
1547     ,p_ass_attribute18              => p_ass_attribute18
1548     ,p_ass_attribute19              => p_ass_attribute19
1549     ,p_ass_attribute20              => p_ass_attribute20
1550     ,p_ass_attribute21              => p_ass_attribute21
1551     ,p_ass_attribute22              => p_ass_attribute22
1552     ,p_ass_attribute23              => p_ass_attribute23
1553     ,p_ass_attribute24              => p_ass_attribute24
1554     ,p_ass_attribute25              => p_ass_attribute25
1555     ,p_ass_attribute26              => p_ass_attribute26
1556     ,p_ass_attribute27              => p_ass_attribute27
1557     ,p_ass_attribute28              => p_ass_attribute28
1558     ,p_ass_attribute29              => p_ass_attribute29
1559     ,p_ass_attribute30              => p_ass_attribute30
1560     ,p_title                        => p_title
1561     ,p_segment1                     => p_segment1
1562     ,p_segment2                     => p_segment2
1563     ,p_segment3                     => p_segment3
1564     ,p_segment4                     => p_segment4
1565     ,p_segment5                     => p_segment5
1566     ,p_segment6                     => p_segment6
1567     ,p_segment7                     => p_segment7
1568     ,p_segment8                     => p_segment8
1569     ,p_segment9                     => p_segment9
1570     ,p_segment10                    => p_segment10
1571     ,p_segment11                    => p_segment11
1572     ,p_segment12                    => p_segment12
1573     ,p_segment13                    => p_segment13
1574     ,p_segment14                    => p_segment14
1575     ,p_segment15                    => p_segment15
1576     ,p_segment16                    => p_segment16
1577     ,p_segment17                    => p_segment17
1578     ,p_segment18                    => p_segment18
1579     ,p_segment19                    => p_segment19
1580     ,p_segment20                    => p_segment20
1581     ,p_segment21                    => p_segment21
1582     ,p_segment22                    => p_segment22
1583     ,p_segment23                    => p_segment23
1584     ,p_segment24                    => p_segment24
1585     ,p_segment25                    => p_segment25
1586     ,p_segment26                    => p_segment26
1587     ,p_segment27                    => p_segment27
1588     ,p_segment28                    => p_segment28
1589     ,p_segment29                    => p_segment29
1590     ,p_segment30                    => p_segment30
1591     ,p_concat_segments              => p_concat_segments
1592     ,p_contract_id                  => p_contract_id
1593     ,p_establishment_id             => p_establishment_id
1594     ,p_collective_agreement_id      => p_collective_agreement_id
1595     ,p_cagr_id_flex_num             => p_cagr_id_flex_num
1596     ,p_cag_segment1                 => p_cag_segment1
1597     ,p_cag_segment2                 => p_cag_segment2
1598     ,p_cag_segment3                 => p_cag_segment3
1599     ,p_cag_segment4                 => p_cag_segment4
1600     ,p_cag_segment5                 => p_cag_segment5
1601     ,p_cag_segment6                 => p_cag_segment6
1602     ,p_cag_segment7                 => p_cag_segment7
1603     ,p_cag_segment8                 => p_cag_segment8
1604     ,p_cag_segment9                 => p_cag_segment9
1605     ,p_cag_segment10                => p_cag_segment10
1606     ,p_cag_segment11                => p_cag_segment11
1607     ,p_cag_segment12                => p_cag_segment12
1608     ,p_cag_segment13                => p_cag_segment13
1609     ,p_cag_segment14                => p_cag_segment14
1610     ,p_cag_segment15                => p_cag_segment15
1611     ,p_cag_segment16                => p_cag_segment16
1612     ,p_cag_segment17                => p_cag_segment17
1613     ,p_cag_segment18                => p_cag_segment18
1614     ,p_cag_segment19                => p_cag_segment19
1615     ,p_cag_segment20                => p_cag_segment20
1616     ,p_notice_period                => p_notice_period
1617     ,p_notice_period_uom            => p_notice_period_uom
1618     ,p_employee_category            => p_employee_category
1619     ,p_work_at_home                 => p_work_at_home
1620     ,p_job_post_source_name         => p_job_post_source_name
1621     ,p_cagr_grade_def_id            => p_cagr_grade_def_id
1622     ,p_cagr_concatenated_segments   => p_cagr_concatenated_segments
1623     ,p_concatenated_segments        => p_concatenated_segments
1624     ,p_soft_coding_keyflex_id       => p_soft_coding_keyflex_id
1625     ,p_comment_id                   => p_comment_id
1626     ,p_effective_start_date         => p_effective_start_date
1627     ,p_effective_end_date           => p_effective_end_date
1628     ,p_no_managers_warning          => l_no_managers_warning
1629     ,p_other_manager_warning        => l_other_manager_warning
1630     ,p_hourly_salaried_warning      => l_hourly_salaried_warning
1631     );
1632   --
1633   -- Convert API warning boolean parameter values to specific
1634   -- messages and add them to Multiple Message List
1635   --
1636   if l_no_managers_warning then
1637      fnd_message.set_name('PER', 'HR_289214_NO_MANAGERS');
1638       hr_multi_message.add
1639         (p_message_type => hr_multi_message.g_warning_msg
1640         );
1641   end if;
1642   if l_other_manager_warning then
1643      fnd_message.set_name('PER', 'HR_289215_DUPLICATE_MANAGERS');
1644       hr_multi_message.add
1645         (p_message_type => hr_multi_message.g_warning_msg
1646         );
1647   end if;
1648   if l_hourly_salaried_warning then
1649      fnd_message.set_name('PER', 'HR_289648_CWK_HR_CODE_NOT_NULL');
1650       hr_multi_message.add
1651         (p_message_type => hr_multi_message.g_warning_msg
1652         );
1653   end if;  --
1654   -- Convert API non-warning boolean parameter values
1655   --
1656   --
1657   -- Derive the API return status value based on whether
1658   -- messages of any type exist in the Multiple Message List.
1659   -- Also disable Multiple Message Detection.
1660   --
1661   p_return_status := hr_multi_message.get_return_status_disable;
1662   hr_utility.set_location(' Leaving:' || l_proc,20);
1663   --
1664 exception
1665   when hr_multi_message.error_message_exist then
1666     --
1667     -- Catch the Multiple Message List exception which
1668     -- indicates API processing has been aborted because
1669     -- at least one message exists in the list.
1670     --
1671     rollback to update_emp_asg_swi;
1672     --
1673     -- Reset IN OUT parameters and set OUT parameters
1674     --
1675     p_object_version_number        := l_object_version_number;
1676     p_cagr_grade_def_id            := null;
1677     p_cagr_concatenated_segments   := null;
1678     p_concatenated_segments        := null;
1679     p_soft_coding_keyflex_id       := null;
1680     p_comment_id                   := null;
1681     p_effective_start_date         := null;
1682     p_effective_end_date           := null;
1683     p_return_status := hr_multi_message.get_return_status_disable;
1684     hr_utility.set_location(' Leaving:' || l_proc, 30);
1685   when others then
1686     --
1687     -- When Multiple Message Detection is enabled catch
1688     -- any Application specific or other unexpected
1689     -- exceptions.  Adding appropriate details to the
1690     -- Multiple Message List.  Otherwise re-raise the
1691     -- error.
1692     --
1693     rollback to update_emp_asg_swi;
1694     if hr_multi_message.unexpected_error_add(l_proc) then
1695        hr_utility.set_location(' Leaving:' || l_proc,40);
1696        raise;
1697     end if;
1698     --
1699     -- Reset IN OUT and set OUT parameters
1700     --
1701     p_object_version_number        := l_object_version_number;
1702     p_cagr_grade_def_id            := null;
1703     p_cagr_concatenated_segments   := null;
1704     p_concatenated_segments        := null;
1705     p_soft_coding_keyflex_id       := null;
1706     p_comment_id                   := null;
1707     p_effective_start_date         := null;
1708     p_effective_end_date           := null;
1709     p_return_status := hr_multi_message.get_return_status_disable;
1710     hr_utility.set_location(' Leaving:' || l_proc,50);
1711 end update_emp_asg;
1712 --
1713 --
1714 --
1715 -- ----------------------------------------------------------------------------
1716 -- |------------------------< update_emp_asg_criteria >-----------------------|
1717 -- ----------------------------------------------------------------------------
1718 PROCEDURE update_emp_asg_criteria
1719   (p_validate                     in     number    default hr_api.g_false_num
1720   ,p_effective_date               in     date
1721   ,p_datetrack_update_mode        in     varchar2
1722   ,p_assignment_id                in     number
1723   ,p_object_version_number        in out nocopy number
1724   ,p_grade_id                     in     number    default hr_api.g_number
1725   ,p_position_id                  in     number    default hr_api.g_number
1726   ,p_job_id                       in     number    default hr_api.g_number
1727   ,p_payroll_id                   in     number    default hr_api.g_number
1728   ,p_location_id                  in     number    default hr_api.g_number
1729   ,p_special_ceiling_step_id      in out nocopy number
1730   ,p_organization_id              in     number    default hr_api.g_number
1731   ,p_pay_basis_id                 in     number    default hr_api.g_number
1732   ,p_segment1                     in     varchar2  default hr_api.g_varchar2
1733   ,p_segment2                     in     varchar2  default hr_api.g_varchar2
1734   ,p_segment3                     in     varchar2  default hr_api.g_varchar2
1735   ,p_segment4                     in     varchar2  default hr_api.g_varchar2
1736   ,p_segment5                     in     varchar2  default hr_api.g_varchar2
1737   ,p_segment6                     in     varchar2  default hr_api.g_varchar2
1738   ,p_segment7                     in     varchar2  default hr_api.g_varchar2
1739   ,p_segment8                     in     varchar2  default hr_api.g_varchar2
1740   ,p_segment9                     in     varchar2  default hr_api.g_varchar2
1741   ,p_segment10                    in     varchar2  default hr_api.g_varchar2
1742   ,p_segment11                    in     varchar2  default hr_api.g_varchar2
1743   ,p_segment12                    in     varchar2  default hr_api.g_varchar2
1744   ,p_segment13                    in     varchar2  default hr_api.g_varchar2
1745   ,p_segment14                    in     varchar2  default hr_api.g_varchar2
1746   ,p_segment15                    in     varchar2  default hr_api.g_varchar2
1747   ,p_segment16                    in     varchar2  default hr_api.g_varchar2
1748   ,p_segment17                    in     varchar2  default hr_api.g_varchar2
1749   ,p_segment18                    in     varchar2  default hr_api.g_varchar2
1750   ,p_segment19                    in     varchar2  default hr_api.g_varchar2
1751   ,p_segment20                    in     varchar2  default hr_api.g_varchar2
1752   ,p_segment21                    in     varchar2  default hr_api.g_varchar2
1753   ,p_segment22                    in     varchar2  default hr_api.g_varchar2
1754   ,p_segment23                    in     varchar2  default hr_api.g_varchar2
1755   ,p_segment24                    in     varchar2  default hr_api.g_varchar2
1756   ,p_segment25                    in     varchar2  default hr_api.g_varchar2
1757   ,p_segment26                    in     varchar2  default hr_api.g_varchar2
1758   ,p_segment27                    in     varchar2  default hr_api.g_varchar2
1759   ,p_segment28                    in     varchar2  default hr_api.g_varchar2
1760   ,p_segment29                    in     varchar2  default hr_api.g_varchar2
1761   ,p_segment30                    in     varchar2  default hr_api.g_varchar2
1762   ,p_concat_segments              in     varchar2  default hr_api.g_varchar2
1763   ,p_group_name                      out nocopy varchar2
1764   ,p_employment_category          in     varchar2  default hr_api.g_varchar2
1765   ,p_effective_start_date            out nocopy date
1766   ,p_effective_end_date              out nocopy date
1767   ,p_people_group_id                 out nocopy number
1768   ,p_entries_changed_warning         out nocopy varchar2
1769   ,p_return_status                   out nocopy varchar2
1770   ) is
1771   --
1772   -- Variables for API Boolean parameters
1773   l_validate                      boolean;
1774   l_org_now_no_manager_warning    boolean;
1775   l_other_manager_warning         boolean;
1776   l_spp_delete_warning            boolean;
1777   l_tax_district_changed_warning  boolean;
1778   --
1779   -- Variables for IN/OUT parameters
1780   l_object_version_number         number;
1781   l_special_ceiling_step_id       number;
1782   --
1783   -- Other variables
1784   l_proc    varchar2(72) := g_package ||'update_emp_asg_criteria';
1785 Begin
1786   hr_utility.set_location(' Entering:' || l_proc,10);
1787   --
1788   -- Issue a savepoint
1789   --
1790   savepoint update_emp_asg_criteria_swi;
1791   --
1792   -- Initialise Multiple Message Detection
1793   --
1794   hr_multi_message.enable_message_list;
1795   --
1796   -- Remember IN OUT parameter IN values
1797   --
1798   l_object_version_number         := p_object_version_number;
1799   l_special_ceiling_step_id       := p_special_ceiling_step_id;
1800   --
1801   -- Convert constant values to their corresponding boolean value
1802   --
1803   l_validate :=
1804     hr_api.constant_to_boolean
1805       (p_constant_value => p_validate);
1806   --
1807   -- Register Surrogate ID or user key values
1808   --
1809   --
1810   -- Call API
1811   --
1812   hr_assignment_api.update_emp_asg_criteria
1813     (p_validate                     => l_validate
1814     ,p_effective_date               => p_effective_date
1815     ,p_datetrack_update_mode        => p_datetrack_update_mode
1816     ,p_assignment_id                => p_assignment_id
1817     ,p_object_version_number        => p_object_version_number
1818     ,p_grade_id                     => p_grade_id
1819     ,p_position_id                  => p_position_id
1820     ,p_job_id                       => p_job_id
1821     ,p_payroll_id                   => p_payroll_id
1822     ,p_location_id                  => p_location_id
1823     ,p_special_ceiling_step_id      => p_special_ceiling_step_id
1824     ,p_organization_id              => p_organization_id
1825     ,p_pay_basis_id                 => p_pay_basis_id
1826     ,p_segment1                     => p_segment1
1827     ,p_segment2                     => p_segment2
1828     ,p_segment3                     => p_segment3
1829     ,p_segment4                     => p_segment4
1830     ,p_segment5                     => p_segment5
1831     ,p_segment6                     => p_segment6
1832     ,p_segment7                     => p_segment7
1833     ,p_segment8                     => p_segment8
1834     ,p_segment9                     => p_segment9
1835     ,p_segment10                    => p_segment10
1836     ,p_segment11                    => p_segment11
1837     ,p_segment12                    => p_segment12
1838     ,p_segment13                    => p_segment13
1839     ,p_segment14                    => p_segment14
1840     ,p_segment15                    => p_segment15
1841     ,p_segment16                    => p_segment16
1842     ,p_segment17                    => p_segment17
1843     ,p_segment18                    => p_segment18
1844     ,p_segment19                    => p_segment19
1845     ,p_segment20                    => p_segment20
1846     ,p_segment21                    => p_segment21
1847     ,p_segment22                    => p_segment22
1848     ,p_segment23                    => p_segment23
1849     ,p_segment24                    => p_segment24
1850     ,p_segment25                    => p_segment25
1851     ,p_segment26                    => p_segment26
1852     ,p_segment27                    => p_segment27
1853     ,p_segment28                    => p_segment28
1854     ,p_segment29                    => p_segment29
1855     ,p_segment30                    => p_segment30
1856     ,p_concat_segments              => p_concat_segments
1857     ,p_group_name                   => p_group_name
1858     ,p_employment_category          => p_employment_category
1859     ,p_effective_start_date         => p_effective_start_date
1860     ,p_effective_end_date           => p_effective_end_date
1861     ,p_people_group_id              => p_people_group_id
1862     ,p_org_now_no_manager_warning   => l_org_now_no_manager_warning
1863     ,p_other_manager_warning        => l_other_manager_warning
1864     ,p_spp_delete_warning           => l_spp_delete_warning
1865     ,p_entries_changed_warning      => p_entries_changed_warning
1866     ,p_tax_district_changed_warning => l_tax_district_changed_warning
1867     );
1868   --
1869   -- Convert API warning boolean parameter values to specific
1870   -- messages and add them to Multiple Message List
1871   --
1872   if l_org_now_no_manager_warning then
1873      fnd_message.set_name('PER', 'HR_7429_ASG_INV_MANAGER_FLAG');
1874       hr_multi_message.add
1875         (p_message_type => hr_multi_message.g_warning_msg
1876         );
1877   end if;
1878   if l_other_manager_warning then
1879      fnd_message.set_name('PER', 'HR_289215_DUPLICATE_MANAGERS');
1880       hr_multi_message.add
1881         (p_message_type => hr_multi_message.g_warning_msg
1882         );
1883   end if;
1884   if l_spp_delete_warning then
1885      fnd_message.set_name('PER', 'HR_289826_SPP_DELETE_WARN_API');
1886       hr_multi_message.add
1887         (p_message_type => hr_multi_message.g_warning_msg
1888         );
1889   end if;
1890   if l_tax_district_changed_warning then
1891      fnd_message.set_name('PER', 'EDIT_HERE: MESSAGE_NAME ');
1892       hr_multi_message.add
1893         (p_message_type => hr_multi_message.g_warning_msg
1894         );
1895   end if;  --
1896   -- Convert API non-warning boolean parameter values
1897   --
1898   --
1899   -- Derive the API return status value based on whether
1900   -- messages of any type exist in the Multiple Message List.
1901   -- Also disable Multiple Message Detection.
1902   --
1903   p_return_status := hr_multi_message.get_return_status_disable;
1904   hr_utility.set_location(' Leaving:' || l_proc,20);
1905   --
1906 exception
1907   when hr_multi_message.error_message_exist then
1908     --
1909     -- Catch the Multiple Message List exception which
1910     -- indicates API processing has been aborted because
1911     -- at least one message exists in the list.
1912     --
1913     rollback to update_emp_asg_criteria_swi;
1914     --
1915     -- Reset IN OUT parameters and set OUT parameters
1916     --
1917     p_object_version_number        := l_object_version_number;
1918     p_special_ceiling_step_id      := l_special_ceiling_step_id;
1919     p_group_name                   := null;
1920     p_effective_start_date         := null;
1921     p_effective_end_date           := null;
1922     p_people_group_id              := null;
1923     p_return_status := hr_multi_message.get_return_status_disable;
1924     hr_utility.set_location(' Leaving:' || l_proc, 30);
1925   when others then
1926     --
1927     -- When Multiple Message Detection is enabled catch
1928     -- any Application specific or other unexpected
1929     -- exceptions.  Adding appropriate details to the
1930     -- Multiple Message List.  Otherwise re-raise the
1931     -- error.
1932     --
1933     rollback to update_emp_asg_criteria_swi;
1934     if hr_multi_message.unexpected_error_add(l_proc) then
1935        hr_utility.set_location(' Leaving:' || l_proc,40);
1936        raise;
1937     end if;
1938     --
1939     -- Reset IN OUT and set OUT parameters
1940     --
1941     p_object_version_number        := l_object_version_number;
1942     p_special_ceiling_step_id      := l_special_ceiling_step_id;
1943     p_group_name                   := null;
1944     p_effective_start_date         := null;
1945     p_effective_end_date           := null;
1946     p_people_group_id              := null;
1947     p_return_status := hr_multi_message.get_return_status_disable;
1948     hr_utility.set_location(' Leaving:' || l_proc,50);
1949 end update_emp_asg_criteria;
1950 
1951 end hr_assignment_swi;