DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_ASG_INS

Source


1 Package Body per_asg_ins as
2 /* $Header: peasgrhi.pkb 120.44.12020000.3 2013/02/13 07:11:42 srannama ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)    := '  per_asg_ins.';  -- Global package name
9 --
10 -- The following global variables are only to be used by
11 -- the set_base_key_value and pre_insert procedures.
12 --
13 g_assignment_id_i  number   default null;
14 --
15 -- ----------------------------------------------------------------------------
16 -- |------------------------< set_base_key_value >----------------------------|
17 -- ----------------------------------------------------------------------------
18 procedure set_base_key_value
19   (p_assignment_id  in  number) is
20 --
21   l_proc       varchar2(72) := g_package||'set_base_key_value';
22 --
23 Begin
24   hr_utility.set_location('Entering:'||l_proc, 10);
25   --
26   per_asg_ins.g_assignment_id_i := p_assignment_id;
27   --
28   hr_utility.set_location(' Leaving:'||l_proc, 20);
29 End set_base_key_value;
30 --
31 -- ----------------------------------------------------------------------------
32 -- |----------------------------< dt_insert_dml >-----------------------------|
33 -- ----------------------------------------------------------------------------
34 -- {Start Of Comments}
35 --
36 -- Description:
37 --   This procedure controls the actual dml insert logic for datetrack. The
38 --   functions of this procedure are as follows:
39 --   1) Get the object_version_number.
40 --   2) To set the effective start and end dates to the corresponding
41 --      validation start and end dates. Also, the object version number
42 --      record attribute is set.
43 --   3) To set and unset the g_api_dml status as required (as we are about to
44 --      perform dml).
45 --   4) To insert the row into the schema with the derived effective start
46 --      and end dates and the object version number.
47 --   5) To trap any constraint violations that may have occurred.
48 --   6) To raise any other errors.
49 --
50 -- Pre Conditions:
51 --   This is an internal private procedure which must be called from the
52 --   insert_dml and pre_update (logic permitting) procedure and must have
53 --   all mandatory arguments set.
54 --
55 -- In Arguments:
56 --   A Pl/Sql record structre.
57 --
58 -- Post Success:
59 --   The specified row will be inserted into the schema.
60 --
61 -- Post Failure:
62 --   On the insert dml failure it is important to note that we always reset the
63 --   g_api_dml status to false.
64 --   If a check or unique integrity constraint violation is raised the
65 --   constraint_error procedure will be called.
66 --   If any other error is reported, the error will be raised after the
67 --   g_api_dml status is reset.
68 --
69 -- Developer Implementation Notes:
70 --   This is an internal datetrack maintenance procedure which should
71 --   not be modified in anyway.
72 --
73 -- Access Status:
74 --   Internal Table Handler Use Only.
75 --
76 -- {End Of Comments}
77 -- ----------------------------------------------------------------------------
78 Procedure dt_insert_dml
79     (p_rec              in out nocopy per_asg_shd.g_rec_type,
80      p_effective_date     in    date,
81      p_datetrack_mode     in    varchar2,
82      p_validation_start_date in    date,
83      p_validation_end_date     in    date
84         ) is
85 --
86 -- Cursor to select 'old' created AOL who column values
87 --
88   Cursor C_Sel1 Is
89     select asg.created_by,
90            asg.creation_date
91     from   per_all_assignments_f asg
92     where  asg.assignment_id        = p_rec.assignment_id
93     and    asg.effective_start_date =
94              per_asg_shd.g_old_rec.effective_start_date
95     and    asg.effective_end_date   = (p_validation_start_date - 1);
96 --
97   l_proc        varchar2(72) := g_package||'dt_insert_dml';
98   l_created_by          per_all_assignments_f.created_by%TYPE;
99   l_creation_date       per_all_assignments_f.creation_date%TYPE;
100   l_last_update_date       per_all_assignments_f.last_update_date%TYPE;
101   l_last_updated_by     per_all_assignments_f.last_updated_by%TYPE;
102   l_last_update_login   per_all_assignments_f.last_update_login%TYPE;
103 --
104 Begin
105   hr_utility.set_location('Entering:'||l_proc, 5);
106   --
107   -- Get the object version number for the insert
108   --
109   p_rec.object_version_number :=
110     dt_api.get_object_version_number
111     (p_base_table_name => 'per_all_assignments_f',
112      p_base_key_column => 'assignment_id',
113      p_base_key_value  => p_rec.assignment_id);
114   --
115   -- Set the effective start and end dates to the corresponding
116   -- validation start and end dates
117   --
118   p_rec.effective_start_date := p_validation_start_date;
119   p_rec.effective_end_date   := p_validation_end_date;
120   --
121   -- If the datetrack_mode is not INSERT then we must populate the WHO
122   -- columns with the 'old' creation values and 'new' updated values.
123   --
124   If (p_datetrack_mode <> 'INSERT') then
125     hr_utility.set_location(l_proc, 10);
126     --
127     -- Select the 'old' created values
128     --
129     Open C_Sel1;
130     Fetch C_Sel1 Into l_created_by, l_creation_date;
131     If C_Sel1%notfound Then
132       --
133       -- The previous 'old' created row has not been found. We need
134       -- to error as an internal datetrack problem exists.
135       --
136       Close C_Sel1;
137       hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
138       hr_utility.set_message_token('PROCEDURE', l_proc);
139       hr_utility.set_message_token('STEP','10');
140       hr_utility.raise_error;
141     End If;
142     Close C_Sel1;
143     --
144     -- Set the AOL updated WHO values
145     --
146     l_last_update_date   := sysdate;
147     l_last_updated_by    := fnd_global.user_id;
148     l_last_update_login  := fnd_global.login_id;
149   End If;
150   --
151   per_asg_shd.g_api_dml := true;  -- Set the api dml status
152   --
153   -- Insert the row into: per_all_assignments_f
154   --
155   insert into per_all_assignments_f
156   (    assignment_id,
157     effective_start_date,
158     effective_end_date,
159     business_group_id,
160     recruiter_id,
161     grade_id,
162     position_id,
163     job_id,
164     assignment_status_type_id,
165     payroll_id,
166     location_id,
167     person_referred_by_id,
168     supervisor_id,
169     special_ceiling_step_id,
170     person_id,
171     recruitment_activity_id,
172     source_organization_id,
173     organization_id,
174     people_group_id,
175     soft_coding_keyflex_id,
176     vacancy_id,
177     pay_basis_id,
178     assignment_sequence,
179     assignment_type,
180     primary_flag,
181     application_id,
182     assignment_number,
183     change_reason,
184     comment_id,
185     date_probation_end,
186     default_code_comb_id,
187     employment_category,
188     frequency,
189     internal_address_line,
190     manager_flag,
191     normal_hours,
192     perf_review_period,
193     perf_review_period_frequency,
194     period_of_service_id,
195     probation_period,
196     probation_unit,
197     sal_review_period,
198     sal_review_period_frequency,
199     set_of_books_id,
200     source_type,
201     time_normal_finish,
202     time_normal_start,
203     bargaining_unit_code,
204     labour_union_member_flag,
205     hourly_salaried_code,
206     request_id,
207     program_application_id,
208     program_id,
209     program_update_date,
210     ass_attribute_category,
211     ass_attribute1,
212     ass_attribute2,
213     ass_attribute3,
214     ass_attribute4,
215     ass_attribute5,
216     ass_attribute6,
217     ass_attribute7,
218     ass_attribute8,
219     ass_attribute9,
220     ass_attribute10,
221     ass_attribute11,
222     ass_attribute12,
223     ass_attribute13,
224     ass_attribute14,
225     ass_attribute15,
226     ass_attribute16,
227     ass_attribute17,
228     ass_attribute18,
229     ass_attribute19,
230     ass_attribute20,
231     ass_attribute21,
232     ass_attribute22,
233     ass_attribute23,
234     ass_attribute24,
235     ass_attribute25,
236     ass_attribute26,
237     ass_attribute27,
238     ass_attribute28,
239     ass_attribute29,
240     ass_attribute30,
241     title,
242     contract_id,
243     establishment_id,
244     collective_agreement_id,
245     cagr_grade_def_id,
246     cagr_id_flex_num,
247     object_version_number,
248     created_by,
249     creation_date,
250     last_update_date,
251     last_updated_by,
252     last_update_login,
253     notice_period,
254     notice_period_uom,
255     employee_category,
256     work_at_home,
257     job_post_source_name,
258     posting_content_id,
259     period_of_placement_date_start,
260     vendor_id,
261     vendor_employee_number,
262     vendor_assignment_number,
263     assignment_category,
264     project_title,
265     applicant_rank,
266     grade_ladder_pgm_id,
267     supervisor_assignment_id,
268     vendor_site_id,
269     po_header_id,
270     po_line_id,
271     projected_assignment_end
272   )
273   Values
274   (    p_rec.assignment_id,
275     p_rec.effective_start_date,
276     p_rec.effective_end_date,
277     p_rec.business_group_id,
278     p_rec.recruiter_id,
279     p_rec.grade_id,
280     p_rec.position_id,
281     p_rec.job_id,
282     p_rec.assignment_status_type_id,
283     p_rec.payroll_id,
284     p_rec.location_id,
285     p_rec.person_referred_by_id,
286     p_rec.supervisor_id,
287     p_rec.special_ceiling_step_id,
288     p_rec.person_id,
289     p_rec.recruitment_activity_id,
290     p_rec.source_organization_id,
291     p_rec.organization_id,
292     p_rec.people_group_id,
293     p_rec.soft_coding_keyflex_id,
294     p_rec.vacancy_id,
295     p_rec.pay_basis_id,
296     p_rec.assignment_sequence,
297     p_rec.assignment_type,
298     p_rec.primary_flag,
299     p_rec.application_id,
300     p_rec.assignment_number,
301     p_rec.change_reason,
302     p_rec.comment_id,
303     p_rec.date_probation_end,
304     p_rec.default_code_comb_id,
305     p_rec.employment_category,
306     p_rec.frequency,
307     p_rec.internal_address_line,
308     p_rec.manager_flag,
309     p_rec.normal_hours,
310     p_rec.perf_review_period,
311     p_rec.perf_review_period_frequency,
312     p_rec.period_of_service_id,
313     p_rec.probation_period,
314     p_rec.probation_unit,
315     p_rec.sal_review_period,
316     p_rec.sal_review_period_frequency,
317     p_rec.set_of_books_id,
318     p_rec.source_type,
319     p_rec.time_normal_finish,
320         p_rec.time_normal_start,
321         p_rec.bargaining_unit_code,
322         p_rec.labour_union_member_flag,
323         p_rec.hourly_salaried_code,
324     p_rec.request_id,
325     p_rec.program_application_id,
326     p_rec.program_id,
327     p_rec.program_update_date,
328     p_rec.ass_attribute_category,
329     p_rec.ass_attribute1,
330     p_rec.ass_attribute2,
331     p_rec.ass_attribute3,
332     p_rec.ass_attribute4,
333     p_rec.ass_attribute5,
334     p_rec.ass_attribute6,
335     p_rec.ass_attribute7,
336     p_rec.ass_attribute8,
337     p_rec.ass_attribute9,
338     p_rec.ass_attribute10,
339     p_rec.ass_attribute11,
340     p_rec.ass_attribute12,
341     p_rec.ass_attribute13,
342     p_rec.ass_attribute14,
343     p_rec.ass_attribute15,
344     p_rec.ass_attribute16,
345     p_rec.ass_attribute17,
346     p_rec.ass_attribute18,
347     p_rec.ass_attribute19,
348     p_rec.ass_attribute20,
349     p_rec.ass_attribute21,
350     p_rec.ass_attribute22,
351     p_rec.ass_attribute23,
352     p_rec.ass_attribute24,
353     p_rec.ass_attribute25,
354     p_rec.ass_attribute26,
355     p_rec.ass_attribute27,
356     p_rec.ass_attribute28,
357     p_rec.ass_attribute29,
358     p_rec.ass_attribute30,
359     p_rec.title,
360     p_rec.contract_id,
361     p_rec.establishment_id,
362     p_rec.collective_agreement_id,
363     p_rec.cagr_grade_def_id,
364     p_rec.cagr_id_flex_num,
365     p_rec.object_version_number,
366     l_created_by,
367     l_creation_date,
368     l_last_update_date,
369     l_last_updated_by,
370     l_last_update_login,
371     p_rec.notice_period,
372     p_rec.notice_period_uom,
373     p_rec.employee_category,
374     p_rec.work_at_home,
375     p_rec.job_post_source_name,
376     p_rec.posting_content_id,
377     p_rec.period_of_placement_date_start,
378     p_rec.vendor_id,
379     p_rec.vendor_employee_number,
380     p_rec.vendor_assignment_number,
381     p_rec.assignment_category,
382     p_rec.project_title,
383     p_rec.applicant_rank,
384     p_rec.grade_ladder_pgm_id,
385     p_rec.supervisor_assignment_id,
386     p_rec.vendor_site_id,
387     p_rec.po_header_id,
388     p_rec.po_line_id,
389     p_rec.projected_assignment_end
390   );
391   --
392   per_asg_shd.g_api_dml := false;   -- Unset the api dml status
393   hr_utility.set_location(' Leaving:'||l_proc, 15);
394 --
395 Exception
396   When hr_api.check_integrity_violated Then
397     -- A check constraint has been violated
398     per_asg_shd.g_api_dml := false;   -- Unset the api dml status
399     per_asg_shd.constraint_error
400       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
401   When hr_api.unique_integrity_violated Then
402     -- Unique integrity has been violated
403     per_asg_shd.g_api_dml := false;   -- Unset the api dml status
404     per_asg_shd.constraint_error
405       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
406   When Others Then
407     per_asg_shd.g_api_dml := false;   -- Unset the api dml status
408     Raise;
409 End dt_insert_dml;
410 --
411 -- ----------------------------------------------------------------------------
412 -- |------------------------------< insert_dml >------------------------------|
413 -- ----------------------------------------------------------------------------
414 Procedure insert_dml
415     (p_rec              in out nocopy per_asg_shd.g_rec_type,
416      p_effective_date     in    date,
417      p_datetrack_mode     in    varchar2,
418      p_validation_start_date in    date,
419      p_validation_end_date     in    date) is
420 --
421   l_proc    varchar2(72) := g_package||'insert_dml';
422 --
423 Begin
424   hr_utility.set_location('Entering:'||l_proc, 5);
425   --
426   dt_insert_dml(p_rec            => p_rec,
427         p_effective_date    => p_effective_date,
428         p_datetrack_mode    => p_datetrack_mode,
429                p_validation_start_date    => p_validation_start_date,
430         p_validation_end_date    => p_validation_end_date);
431   --
432   hr_utility.set_location(' Leaving:'||l_proc, 10);
433 End insert_dml;
434 --
435 -- ----------------------------------------------------------------------------
436 -- |------------------------------< pre_insert >------------------------------|
437 -- ----------------------------------------------------------------------------
438 -- {Start Of Comments}
439 --
440 -- Description:
441 --   This private procedure contains any processing which is required before
442 --   the insert dml. Presently, if the entity has a corresponding primary
443 --   key which is maintained by an associating sequence, the primary key for
444 --   the entity will be populated with the next sequence value in
445 --   preparation for the insert dml.
446 --   Also, if comments are defined for this entity, the comments insert
447 --   logic will also be called, generating a comment_id if required.
448 --
449 -- Pre Conditions:
450 --   This is an internal procedure which is called from the ins procedure.
451 --
452 -- In Arguments:
453 --   A Pl/Sql record structre.
454 --
455 -- Post Success:
456 --   Processing continues.
457 --
458 -- Post Failure:
459 --   If an error has occurred, an error message and exception will be raised
460 --   but not handled.
461 --
462 -- Developer Implementation Notes:
463 --   Any pre-processing required before the insert dml is issued should be
464 --   coded within this procedure. As stated above, a good example is the
465 --   generation of a primary key number via a corresponding sequence.
466 --   It is important to note that any 3rd party maintenance should be reviewed
467 --   before placing in this procedure.
468 --
469 -- Access Status:
470 --   Internal Table Handler Use Only.
471 --
472 -- {End Of Comments}
473 -- ----------------------------------------------------------------------------
474 Procedure pre_insert
475     (p_rec              in out nocopy per_asg_shd.g_rec_type,
476      p_effective_date        in date,
477      p_datetrack_mode        in varchar2,
478      p_validation_start_date    in date,
479      p_validation_end_date        in date) is
480 --
481   l_proc    varchar2(72) := g_package||'pre_insert';
482   l_exists varchar2(1);
483   l_benefits    varchar2(1);
484 --
485   Cursor C_Sel1 is select per_assignments_s.nextval from sys.dual;
486   --
487   Cursor C_Sel2 is
488     Select null
489       from per_all_assignments_f
490      where assignment_id =
491              per_asg_ins.g_assignment_id_i;
492 --
493 Begin
494   hr_utility.set_location('Entering:'||l_proc, 1);
495   --
496   If (per_asg_ins.g_assignment_id_i is not null) Then
497     --
498     -- Verify registered primary key values not already in use
499     --
500     Open C_Sel2;
501     Fetch C_Sel2 into l_exists;
502     If C_Sel2%found Then
503        Close C_Sel2;
504        --
505        -- The primary key values are already in use.
506        --
507        -- Bug 2661569
508        -- Changed the calls to hr_utility package.
509        hr_utility.set_message(800, 'PER_289391_KEY_ALREADY_USED');
510        hr_utility.set_message_token('TABLE_NAME', 'per_all_assignments_f');
511        hr_utility.raise_error;
512     End If;
513     Close C_Sel2;
514     --
515     -- Use registered key values and clear globals
516     --
517     p_rec.assignment_id :=
518       per_asg_ins.g_assignment_id_i;
519     per_asg_ins.g_assignment_id_i := null;
520   Else
521     --
522     -- No registerd key values, so select the next sequence number
523     --
524     --
525     -- Select the next sequence number
526     --
527     Open C_Sel1;
528     Fetch C_Sel1 Into p_rec.assignment_id;
529     Close C_Sel1;
530     hr_utility.set_location(l_proc, 10);
531     --
532     -- Insert the comment text if comments exist
533     --
534     If (p_rec.comment_text is not null) then
535       hr_comm_api.ins(p_comment_id        => p_rec.comment_id,
536                       p_source_table_name => 'PER_ALL_ASSIGNMENTS_F',
537                       p_comment_text      => p_rec.comment_text);
538     End If;
539     hr_utility.set_location(l_proc, 20);
540   End If;
541   --
542   -- Generate date probation end
543   --
544   -- Business Rule Mapping
545   -- =====================
546   -- Rule CHK_DATE_PROBATION_END c,e and f
547   -- Rule CHK_PROBATION_PERIOD c
548   -- Rule CHK_PROBATION_UNIT d
549   --
550 -- Bug 4041992 Starts Here
551 -- Desc: TO skip the probation end date calculation for both EMP and APL
552   if p_rec.date_probation_end is null then
553   per_asg_bus2.gen_date_probation_end
554     (p_assignment_id         =>  p_rec.assignment_id
555     ,p_effective_date        =>  P_effective_date
556     ,p_probation_unit        =>  p_rec.probation_unit
557     ,p_probation_period      =>  p_rec.probation_period
558     ,p_validation_start_date =>  p_validation_start_date
559     ,p_object_version_number =>  p_rec.object_version_number
560     ,p_date_probation_end    =>  p_rec.date_probation_end
561     );
562   end if;
563 -- Bug 4041992 Ends Here
564   --
565   hr_utility.set_location(l_proc, 30);
566   --
567 End pre_insert;
568 --
569 -- ----------------------------------------------------------------------------
570 -- |-----------------------------< post_insert >------------------------------|
571 -- ----------------------------------------------------------------------------
572 -- {Start Of Comments}
573 --
574 -- Description:
575 --   This private procedure contains any processing which is required after the
576 --   insert dml.
577 --
578 -- Pre Conditions:
579 --   This is an internal procedure which is called from the ins procedure.
580 --
581 -- In Arguments:
582 --   A Pl/Sql record structre.
583 --
584 -- Post Success:
585 --   Processing continues.
586 --
587 -- Post Failure:
588 --   If an error has occurred, an error message and exception will be raised
589 --   but not handled.
590 --
591 -- Developer Implementation Notes:
592 --   Any post-processing required after the insert dml is issued should be
593 --   coded within this procedure. It is important to note that any 3rd party
594 --   maintenance should be reviewed before placing in this procedure.
595 --
596 -- Access Status:
597 --   Internal Table Handler Use Only.
598 --
599 -- {End Of Comments}
600 -- ----------------------------------------------------------------------------
601 Procedure post_insert
602     (p_rec              in per_asg_shd.g_rec_type,
603      p_effective_date     in date,
604      p_datetrack_mode     in varchar2,
605      p_validation_start_date in date,
606      p_validation_end_date     in date) is
607 
608       -- Start changes for bug 13855370
609   Cursor C_asg_rec is
610     select
611     assignment_id,
612     effective_start_date,
613     effective_end_date,
614     business_group_id,
615     recruiter_id,
616     grade_id,
617     position_id,
618     job_id,
619     assignment_status_type_id,
620     payroll_id,
621     location_id,
622     person_referred_by_id,
623     supervisor_id,
624     special_ceiling_step_id,
625     person_id,
626     recruitment_activity_id,
627     source_organization_id,
628     organization_id,
629     people_group_id,
630     soft_coding_keyflex_id,
631     vacancy_id,
632     pay_basis_id,
633     assignment_sequence,
634     assignment_type,
635     primary_flag,
636     application_id,
637     assignment_number,
638     change_reason,
639     comment_id,
640     null,
641     date_probation_end,
642     default_code_comb_id,
643     employment_category,
644     frequency,
645     internal_address_line,
646     manager_flag,
647     normal_hours,
648     perf_review_period,
649     perf_review_period_frequency,
650     period_of_service_id,
651     probation_period,
652     probation_unit,
653     sal_review_period,
654     sal_review_period_frequency,
655     set_of_books_id,
656     source_type,
657     time_normal_finish,
658     time_normal_start,
659     bargaining_unit_code,
660     labour_union_member_flag,
661     hourly_salaried_code,
662     request_id,
663     program_application_id,
664     program_id,
665     program_update_date,
666     ass_attribute_category,
667     ass_attribute1,
668     ass_attribute2,
669     ass_attribute3,
670     ass_attribute4,
671     ass_attribute5,
672     ass_attribute6,
673     ass_attribute7,
674     ass_attribute8,
675     ass_attribute9,
676     ass_attribute10,
677     ass_attribute11,
678     ass_attribute12,
679     ass_attribute13,
680     ass_attribute14,
681     ass_attribute15,
682     ass_attribute16,
683     ass_attribute17,
684     ass_attribute18,
685     ass_attribute19,
686     ass_attribute20,
687     ass_attribute21,
688     ass_attribute22,
689     ass_attribute23,
690     ass_attribute24,
691     ass_attribute25,
692     ass_attribute26,
693     ass_attribute27,
694     ass_attribute28,
695     ass_attribute29,
696     ass_attribute30,
697     title,
698     object_version_number ,
699     contract_id,
700     establishment_id,
701     collective_agreement_id,
702     cagr_grade_def_id,
703     cagr_id_flex_num,
704     notice_period,
705     notice_period_uom,
706     employee_category,
707     work_at_home,
708     job_post_source_name,
709     posting_content_id,
710     period_of_placement_date_start,
711     vendor_id,
712     vendor_employee_number,
713     vendor_assignment_number,
714     assignment_category,
715     project_title,
716     applicant_rank,
717     grade_ladder_pgm_id,
718     supervisor_assignment_id,
719     vendor_site_id,
720     po_header_id,
721     po_line_id,
722     projected_assignment_end
723     from    per_all_assignments_f
724     where    assignment_id    = p_rec.assignment_id
725     and        p_effective_date - 1 between effective_start_date
726                                  and     effective_end_date;
727 
728   cursor c_asg_rowid is
729     select rowid
730     from    per_all_assignments_f
731     where    assignment_id    = p_rec.assignment_id
732     and        p_effective_date between effective_start_date
733                                  and     effective_end_date;
734 
735   l_old_rec per_asg_shd.g_old_rec%type;
736   l_new_rowid rowid;
737   -- End changes for bug 13855370
738 --
739   l_proc    varchar2(72) := g_package||'post_insert';
740 --
741 Begin
742   hr_utility.set_location('Entering:'||l_proc, 5);
743 
744    -- Start changes for bug 13855370
745   open c_asg_rec;
746   fetch c_asg_rec into l_old_rec;
747   close c_asg_rec;
748 
749   open c_asg_rowid;
750   fetch c_asg_rowid into l_new_rowid;
751   close c_asg_rowid;
752   --
753   ben_dt_trgr_handle.assignment
754     (p_rowid                   => l_new_rowid
755     ,p_assignment_id           => l_old_rec.assignment_id
756     ,p_business_group_id       => l_old_rec.business_group_id
757     ,p_person_id               => l_old_rec.person_id
758     ,p_effective_start_date    => l_old_rec.effective_start_date
759     ,p_effective_end_date      => l_old_rec.effective_end_date
760     ,p_assignment_status_type_id  => l_old_rec.assignment_status_type_id
761     ,p_assignment_type         => l_old_rec.assignment_type
762     ,p_organization_id         => l_old_rec.organization_id
763     ,p_primary_flag            => l_old_rec.primary_flag
764     ,p_change_reason           => l_old_rec.change_reason
765     ,p_employment_category     => l_old_rec.employment_category
766     ,p_frequency               => l_old_rec.frequency
767     ,p_grade_id                => l_old_rec.grade_id
768     ,p_job_id                  => l_old_rec.job_id
769     ,p_position_id             => l_old_rec.position_id
770     ,p_location_id             => l_old_rec.location_id
771     ,p_normal_hours            => l_old_rec.normal_hours
772     ,p_payroll_id              => l_old_rec.payroll_id
773     ,p_pay_basis_id            => l_old_rec.pay_basis_id
774     ,p_bargaining_unit_code    => l_old_rec.bargaining_unit_code
775     ,p_labour_union_member_flag => l_old_rec.labour_union_member_flag
776     ,p_hourly_salaried_code    => l_old_rec.hourly_salaried_code
777     ,p_people_group_id    => l_old_rec.people_group_id
778     ,p_ass_attribute1 => l_old_rec.ass_attribute1
779     ,p_ass_attribute2 => l_old_rec.ass_attribute2
780     ,p_ass_attribute3 => l_old_rec.ass_attribute3
781     ,p_ass_attribute4 => l_old_rec.ass_attribute4
782     ,p_ass_attribute5 => l_old_rec.ass_attribute5
783     ,p_ass_attribute6 => l_old_rec.ass_attribute6
784     ,p_ass_attribute7 => l_old_rec.ass_attribute7
785     ,p_ass_attribute8 => l_old_rec.ass_attribute8
786     ,p_ass_attribute9 => l_old_rec.ass_attribute9
787     ,p_ass_attribute10 => l_old_rec.ass_attribute10
788     ,p_ass_attribute11 => l_old_rec.ass_attribute11
789     ,p_ass_attribute12 => l_old_rec.ass_attribute12
790     ,p_ass_attribute13 => l_old_rec.ass_attribute13
791     ,p_ass_attribute14 => l_old_rec.ass_attribute14
792     ,p_ass_attribute15 => l_old_rec.ass_attribute15
793     ,p_ass_attribute16 => l_old_rec.ass_attribute16
794     ,p_ass_attribute17 => l_old_rec.ass_attribute17
795     ,p_ass_attribute18 => l_old_rec.ass_attribute18
796     ,p_ass_attribute19 => l_old_rec.ass_attribute19
797     ,p_ass_attribute20 => l_old_rec.ass_attribute20
798     ,p_ass_attribute21 => l_old_rec.ass_attribute21
799     ,p_ass_attribute22 => l_old_rec.ass_attribute22
800     ,p_ass_attribute23 => l_old_rec.ass_attribute23
801     ,p_ass_attribute24 => l_old_rec.ass_attribute24
802     ,p_ass_attribute25 => l_old_rec.ass_attribute25
803     ,p_ass_attribute26 => l_old_rec.ass_attribute26
804     ,p_ass_attribute27 => l_old_rec.ass_attribute27
805     ,p_ass_attribute28 => l_old_rec.ass_attribute28
806     ,p_ass_attribute29 => l_old_rec.ass_attribute29
807     ,p_ass_attribute30 => l_old_rec.ass_attribute30
808     );
809   -- End changes for bug 13855370
810 
811   --
812   -- Add this assignment to the security list when
813   -- restricting on individual assignments.
814   --
815   IF p_rec.assignment_type <> 'B' THEN
816     hr_security.add_assignment
817       (p_person_id     => p_rec.person_id
818       ,p_assignment_id => p_rec.assignment_id);
819   END IF;
820 
821   --
822   -- Start of API User Hook for post_insert.
823   --
824   begin
825     per_asg_rki.after_insert
826       (p_effective_date                 => p_effective_date
827       ,p_validation_start_date          => p_validation_start_date
828       ,p_validation_end_date            => p_validation_end_date
829       ,p_assignment_id                  => p_rec.assignment_id
830       ,p_effective_start_date           => p_rec.effective_start_date
831       ,p_effective_end_date             => p_rec.effective_end_date
832       ,p_business_group_id              => p_rec.business_group_id
833       ,p_recruiter_id                   => p_rec.recruiter_id
834       ,p_grade_id                       => p_rec.grade_id
835       ,p_position_id                    => p_rec.position_id
836       ,p_job_id                         => p_rec.job_id
837       ,p_assignment_status_type_id      => p_rec.assignment_status_type_id
838       ,p_payroll_id                     => p_rec.payroll_id
839       ,p_location_id                    => p_rec.location_id
840       ,p_person_referred_by_id          => p_rec.person_referred_by_id
841       ,p_supervisor_id                  => p_rec.supervisor_id
842       ,p_special_ceiling_step_id        => p_rec.special_ceiling_step_id
843       ,p_person_id                      => p_rec.person_id
844       ,p_recruitment_activity_id        => p_rec.recruitment_activity_id
845       ,p_source_organization_id         => p_rec.source_organization_id
846       ,p_organization_id                => p_rec.organization_id
847       ,p_people_group_id                => p_rec.people_group_id
848       ,p_soft_coding_keyflex_id         => p_rec.soft_coding_keyflex_id
849       ,p_vacancy_id                     => p_rec.vacancy_id
850       ,p_pay_basis_id                   => p_rec.pay_basis_id
851       ,p_assignment_sequence            => p_rec.assignment_sequence
852       ,p_assignment_type                => p_rec.assignment_type
853       ,p_primary_flag                   => p_rec.primary_flag
854       ,p_application_id                 => p_rec.application_id
855       ,p_assignment_number              => p_rec.assignment_number
856       ,p_change_reason                  => p_rec.change_reason
857       ,p_comment_id                     => p_rec.comment_id
858       ,p_date_probation_end             => p_rec.date_probation_end
859       ,p_default_code_comb_id           => p_rec.default_code_comb_id
860       ,p_employment_category            => p_rec.employment_category
861       ,p_frequency                      => p_rec.frequency
862       ,p_internal_address_line          => p_rec.internal_address_line
863       ,p_manager_flag                   => p_rec.manager_flag
864       ,p_normal_hours                   => p_rec.normal_hours
865       ,p_perf_review_period             => p_rec.perf_review_period
866       ,p_perf_review_period_frequen     => p_rec.perf_review_period_frequency
867       ,p_period_of_service_id           => p_rec.period_of_service_id
868       ,p_probation_period               => p_rec.probation_period
869       ,p_probation_unit                 => p_rec.probation_unit
870       ,p_sal_review_period              => p_rec.sal_review_period
871       ,p_sal_review_period_frequen      => p_rec.sal_review_period_frequency
872       ,p_set_of_books_id                => p_rec.set_of_books_id
873       ,p_source_type                    => p_rec.source_type
874       ,p_time_normal_finish             => p_rec.time_normal_finish
875       ,p_time_normal_start              => p_rec.time_normal_start
876       ,p_bargaining_unit_code           => p_rec.bargaining_unit_code
877       ,p_labour_union_member_flag       => p_rec.labour_union_member_flag
878       ,p_hourly_salaried_code           => p_rec.hourly_salaried_code
879       ,p_request_id                     => p_rec.request_id
880       ,p_program_application_id         => p_rec.program_application_id
881       ,p_program_id                     => p_rec.program_id
882       ,p_program_update_date            => p_rec.program_update_date
883       ,p_ass_attribute_category         => p_rec.ass_attribute_category
884       ,p_ass_attribute1                 => p_rec.ass_attribute1
885       ,p_ass_attribute2                 => p_rec.ass_attribute2
886       ,p_ass_attribute3                 => p_rec.ass_attribute3
887       ,p_ass_attribute4                 => p_rec.ass_attribute4
888       ,p_ass_attribute5                 => p_rec.ass_attribute5
889       ,p_ass_attribute6                 => p_rec.ass_attribute6
890       ,p_ass_attribute7                 => p_rec.ass_attribute7
891       ,p_ass_attribute8                 => p_rec.ass_attribute8
892       ,p_ass_attribute9                 => p_rec.ass_attribute9
893       ,p_ass_attribute10                => p_rec.ass_attribute10
894       ,p_ass_attribute11                => p_rec.ass_attribute11
895       ,p_ass_attribute12                => p_rec.ass_attribute12
896       ,p_ass_attribute13                => p_rec.ass_attribute13
897       ,p_ass_attribute14                => p_rec.ass_attribute14
898       ,p_ass_attribute15                => p_rec.ass_attribute15
899       ,p_ass_attribute16                => p_rec.ass_attribute16
900       ,p_ass_attribute17                => p_rec.ass_attribute17
901       ,p_ass_attribute18                => p_rec.ass_attribute18
902       ,p_ass_attribute19                => p_rec.ass_attribute19
903       ,p_ass_attribute20                => p_rec.ass_attribute20
904       ,p_ass_attribute21                => p_rec.ass_attribute21
905       ,p_ass_attribute22                => p_rec.ass_attribute22
906       ,p_ass_attribute23                => p_rec.ass_attribute23
907       ,p_ass_attribute24                => p_rec.ass_attribute24
908       ,p_ass_attribute25                => p_rec.ass_attribute25
909       ,p_ass_attribute26                => p_rec.ass_attribute26
910       ,p_ass_attribute27                => p_rec.ass_attribute27
911       ,p_ass_attribute28                => p_rec.ass_attribute28
912       ,p_ass_attribute29                => p_rec.ass_attribute29
913       ,p_ass_attribute30                => p_rec.ass_attribute30
914       ,p_title                          => p_rec.title
915       ,p_contract_id                    => p_rec.contract_id
916       ,p_establishment_id               => p_rec.establishment_id
917       ,p_collective_agreement_id        => p_rec.collective_agreement_id
918       ,p_cagr_grade_def_id              => p_rec.cagr_grade_def_id
919       ,p_cagr_id_flex_num               => p_rec.cagr_id_flex_num
920       ,p_object_version_number          => p_rec.object_version_number
921       ,p_notice_period        => p_rec.notice_period
922       ,p_notice_period_uom    => p_rec.notice_period_uom
923       ,p_employee_category    => p_rec.employee_category
924       ,p_work_at_home         => p_rec.work_at_home
925       ,p_job_post_source_name    => p_rec.job_post_source_name
926       ,p_posting_content_id             => p_rec.posting_content_id
927       ,p_placement_date_start           => p_rec.period_of_placement_date_start
928       ,p_vendor_id                      => p_rec.vendor_id
929       ,p_vendor_employee_number          => p_rec.vendor_employee_number
930       ,p_vendor_assignment_number       => p_rec.vendor_assignment_number
931       ,p_assignment_category            => p_rec.assignment_category
932       ,p_project_title                  => p_rec.project_title
933       ,p_applicant_rank                 => p_rec.applicant_rank
934       ,p_grade_ladder_pgm_id            => p_rec.grade_ladder_pgm_id
935       ,p_supervisor_assignment_id       => p_rec.supervisor_assignment_id
936       ,p_vendor_site_id                 => p_rec.vendor_site_id
937       ,p_po_header_id                   => p_rec.po_header_id
938       ,p_po_line_id                     => p_rec.po_line_id
939       ,p_projected_assignment_end       => p_rec.projected_assignment_end);
940   exception
941     when hr_api.cannot_find_prog_unit then
942       hr_api.cannot_find_prog_unit_error
943         (p_module_name => 'PER_ALL_ASSIGNMENTS_F'
944         ,p_hook_type   => 'AI'
945         );
946   end;
947   -- End of API User Hook for post_insert.
948   -- Temporary hardcoded hook added for pay object group functionality. Will
949   -- replace by proper hook when dynamic triggers for assignments converted
950   -- to package dynamic triggers.
951   --
952 --bug no 5404530
953    hr_assignment.load_budget_values(
954       p_rec.assignment_id,
955       p_rec.business_group_id,
956       to_char(0),
957       to_char(0),
958       p_validation_start_date,
959       p_validation_end_date);
960 --bug no 5404530
961   pay_pog_all_assignments_pkg.after_insert
962   (p_effective_date             => p_effective_date
963   ,p_validation_start_date      => p_validation_start_date
964   ,p_validation_end_date        => p_validation_end_date
965   ,P_APPLICANT_RANK             => p_rec.applicant_rank
966   ,P_APPLICATION_ID             => p_rec.program_application_id
967   ,P_ASSIGNMENT_CATEGORY        => p_rec.assignment_category
968   ,P_ASSIGNMENT_ID              => p_rec.assignment_id
969   ,P_ASSIGNMENT_NUMBER          => p_rec.assignment_number
970   ,P_ASSIGNMENT_SEQUENCE        => p_rec.assignment_sequence
971   ,P_ASSIGNMENT_STATUS_TYPE_ID  => p_rec.assignment_status_type_id
972   ,P_ASSIGNMENT_TYPE            => p_rec.assignment_type
973   ,P_ASS_ATTRIBUTE1             => p_rec.ass_attribute1
974   ,P_ASS_ATTRIBUTE10            => p_rec.ass_attribute10
975   ,P_ASS_ATTRIBUTE11            => p_rec.ass_attribute11
976   ,P_ASS_ATTRIBUTE12            => p_rec.ass_attribute12
977   ,P_ASS_ATTRIBUTE13            => p_rec.ass_attribute13
978   ,P_ASS_ATTRIBUTE14            => p_rec.ass_attribute14
979   ,P_ASS_ATTRIBUTE15            => p_rec.ass_attribute15
980   ,P_ASS_ATTRIBUTE16            => p_rec.ass_attribute16
981   ,P_ASS_ATTRIBUTE17            => p_rec.ass_attribute17
982   ,P_ASS_ATTRIBUTE18            => p_rec.ass_attribute18
983   ,P_ASS_ATTRIBUTE19            => p_rec.ass_attribute19
984   ,P_ASS_ATTRIBUTE2             => p_rec.ass_attribute2
985   ,P_ASS_ATTRIBUTE20            => p_rec.ass_attribute20
986   ,P_ASS_ATTRIBUTE21            => p_rec.ass_attribute21
987   ,P_ASS_ATTRIBUTE22            => p_rec.ass_attribute22
988   ,P_ASS_ATTRIBUTE23            => p_rec.ass_attribute23
989   ,P_ASS_ATTRIBUTE24            => p_rec.ass_attribute24
990   ,P_ASS_ATTRIBUTE25            => p_rec.ass_attribute25
991   ,P_ASS_ATTRIBUTE26            => p_rec.ass_attribute26
992   ,P_ASS_ATTRIBUTE27            => p_rec.ass_attribute27
993   ,P_ASS_ATTRIBUTE28            => p_rec.ass_attribute28
994   ,P_ASS_ATTRIBUTE29            => p_rec.ass_attribute29
995   ,P_ASS_ATTRIBUTE3             => p_rec.ass_attribute3
996   ,P_ASS_ATTRIBUTE30            => p_rec.ass_attribute30
997   ,P_ASS_ATTRIBUTE4             => p_rec.ass_attribute4
998   ,P_ASS_ATTRIBUTE5             => p_rec.ass_attribute5
999   ,P_ASS_ATTRIBUTE6             => p_rec.ass_attribute6
1000   ,P_ASS_ATTRIBUTE7             => p_rec.ass_attribute7
1001   ,P_ASS_ATTRIBUTE8             => p_rec.ass_attribute8
1002   ,P_ASS_ATTRIBUTE9             => p_rec.ass_attribute9
1003   ,P_ASS_ATTRIBUTE_CATEGORY     => p_rec.ass_attribute_category
1004   ,P_BARGAINING_UNIT_CODE       => p_rec.bargaining_unit_code
1005   ,P_BUSINESS_GROUP_ID          => p_rec.business_group_id
1006   ,P_CAGR_GRADE_DEF_ID          => p_rec.cagr_grade_def_id
1007   ,P_CAGR_ID_FLEX_NUM           => p_rec.cagr_id_flex_num
1008   ,P_CHANGE_REASON              => p_rec.change_reason
1009   ,P_COLLECTIVE_AGREEMENT_ID    => p_rec.collective_agreement_id
1010   ,P_COMMENT_ID                 => p_rec.comment_id
1011   ,P_CONTRACT_ID                => p_rec.contract_id
1012   ,P_DATE_PROBATION_END         => p_rec.date_probation_end
1013   ,P_DEFAULT_CODE_COMB_ID       => p_rec.default_code_comb_id
1014   ,P_EFFECTIVE_END_DATE         => p_rec.effective_end_date
1015   ,P_EFFECTIVE_START_DATE       => p_rec.effective_start_date
1016   ,P_EMPLOYEE_CATEGORY          => p_rec.employee_category
1017   ,P_EMPLOYMENT_CATEGORY        => p_rec.employment_category
1018   ,P_ESTABLISHMENT_ID           => p_rec.establishment_id
1019   ,P_FREQUENCY                  => p_rec.frequency
1020   ,P_GRADE_ID                   => p_rec.grade_id
1021   ,P_HOURLY_SALARIED_CODE       => p_rec.hourly_salaried_code
1022   ,P_INTERNAL_ADDRESS_LINE      => p_rec.internal_address_line
1023   ,P_JOB_ID                     => p_rec.job_id
1024   ,P_JOB_POST_SOURCE_NAME       => p_rec.job_post_source_name
1025   ,P_LABOUR_UNION_MEMBER_FLAG   => p_rec.labour_union_member_flag
1026   ,P_LOCATION_ID                => p_rec.location_id
1027   ,P_MANAGER_FLAG               => p_rec.manager_flag
1028   ,P_NORMAL_HOURS               => p_rec.normal_hours
1029   ,P_NOTICE_PERIOD              => p_rec.notice_period
1030   ,P_NOTICE_PERIOD_UOM          => p_rec.notice_period_uom
1031   ,P_OBJECT_VERSION_NUMBER      => p_rec.object_version_number
1032   ,P_ORGANIZATION_ID            => p_rec.organization_id
1033   ,P_PAYROLL_ID                 => p_rec.payroll_id
1034   ,P_PAY_BASIS_ID               => p_rec.pay_basis_id
1035   ,P_PEOPLE_GROUP_ID            => p_rec.people_group_id
1036   ,P_PERF_REVIEW_PERIOD         => p_rec.perf_review_period
1037   ,P_PERF_REVIEW_PERIOD_FREQUEN => p_rec.perf_review_period_frequency
1038   ,P_PERIOD_OF_SERVICE_ID       => p_rec.period_of_service_id
1039   ,P_PERSON_ID                  => p_rec.person_id
1040   ,P_PERSON_REFERRED_BY_ID      => p_rec.person_referred_by_id
1041   ,P_PLACEMENT_DATE_START       => p_rec.period_of_placement_date_start
1042   ,P_POSITION_ID                => p_rec.position_id
1043   ,P_POSTING_CONTENT_ID         => p_rec.posting_content_id
1044   ,P_PRIMARY_FLAG               => p_rec.primary_flag
1045   ,P_PROBATION_PERIOD           => p_rec.probation_period
1046   ,P_PROBATION_UNIT             => p_rec.probation_unit
1047   ,P_PROGRAM_APPLICATION_ID     => p_rec.program_application_id
1048   ,P_PROGRAM_ID                 => p_rec.program_id
1049   ,P_PROGRAM_UPDATE_DATE        => p_rec.program_update_date
1050   ,P_PROJECT_TITLE              => p_rec.project_title
1051   ,P_RECRUITER_ID               => p_rec.recruiter_id
1052   ,P_RECRUITMENT_ACTIVITY_ID    => p_rec.recruitment_activity_id
1053   ,P_REQUEST_ID                 => p_rec.request_id
1054   ,P_SAL_REVIEW_PERIOD          => p_rec.sal_review_period
1055   ,P_SAL_REVIEW_PERIOD_FREQUEN  => p_rec.sal_review_period_frequency
1056   ,P_SET_OF_BOOKS_ID            => p_rec.set_of_books_id
1057   ,P_SOFT_CODING_KEYFLEX_ID     => p_rec.soft_coding_keyflex_id
1058   ,P_SOURCE_ORGANIZATION_ID     => p_rec.source_organization_id
1059   ,P_SOURCE_TYPE                => p_rec.source_type
1060   ,P_SPECIAL_CEILING_STEP_ID    => p_rec.special_ceiling_step_id
1061   ,P_SUPERVISOR_ID              => p_rec.supervisor_id
1062   ,P_TIME_NORMAL_FINISH         => p_rec.time_normal_finish
1063   ,P_TIME_NORMAL_START          => p_rec.time_normal_start
1064   ,P_TITLE                      => p_rec.title
1065   ,P_VACANCY_ID                 => p_rec.vacancy_id
1066   ,P_VENDOR_ASSIGNMENT_NUMBER   => p_rec.vendor_assignment_number
1067   ,P_VENDOR_EMPLOYEE_NUMBER     => p_rec.vendor_employee_number
1068   ,P_VENDOR_ID                  => p_rec.vendor_id
1069   ,P_WORK_AT_HOME               => p_rec.work_at_home
1070   ,P_GRADE_LADDER_PGM_ID        => p_rec.grade_ladder_pgm_id
1071   ,P_SUPERVISOR_ASSIGNMENT_ID   => p_rec.supervisor_assignment_id
1072   ,P_VENDOR_SITE_ID             => p_rec.vendor_site_id
1073   ,P_PO_HEADER_ID               => p_rec.po_header_id
1074   ,P_PO_LINE_ID                 => p_rec.po_line_id
1075   ,P_PROJECTED_ASSIGNMENT_END   => p_rec.projected_assignment_end
1076   );
1077  --
1078  -- Call to Workflow Sync Procedure For Assignments
1079 
1080     per_pqh_shr.per_asg_wf_sync('POST_INSERT',
1081                             p_rec,
1082                             null,
1083                             p_effective_date,
1084                             p_validation_start_date,
1085                             p_validation_end_date,
1086                             p_datetrack_mode);
1087 
1088  -- End of call to Workflow Sync Procedure For Assignments
1089   --
1090   hr_utility.set_location(' Leaving:'||l_proc, 10);
1091 End post_insert;
1092 -- ----------------------------------------------------------------------------
1093 -- |-------------------------------< ins_lck >--------------------------------|
1094 -- ----------------------------------------------------------------------------
1095 -- {Start Of Comments}
1096 --
1097 -- Description:
1098 --   The ins_lck process has one main function to perform. When inserting
1099 --   a datetracked row, we must validate the DT mode.
1100 --   be manipulated.
1101 --
1102 -- Pre Conditions:
1103 --   This procedure can only be called for the datetrack mode of INSERT.
1104 --
1105 -- In Arguments:
1106 --
1107 -- Post Success:
1108 --   On successful completion of the ins_lck process the parental
1109 --   datetracked rows will be locked providing the p_enforce_foreign_locking
1110 --   argument value is TRUE.
1111 --   If the p_enforce_foreign_locking argument value is FALSE then the
1112 --   parential rows are not locked.
1113 --
1114 -- Post Failure:
1115 --   The Lck process can fail for:
1116 --   1) When attempting to lock the row the row could already be locked by
1117 --      another user. This will raise the HR_Api.Object_Locked exception.
1118 --   2) When attempting to the lock the parent which doesn't exist.
1119 --      For the entity to be locked the parent must exist!
1120 --
1121 -- Developer Implementation Notes:
1122 --   None.
1123 --
1124 -- Access Status:
1125 --   Internal Table Handler Use Only.
1126 --
1127 -- {End Of Comments}
1128 -- ----------------------------------------------------------------------------
1129 Procedure ins_lck
1130     (p_effective_date     in  date,
1131      p_datetrack_mode     in  varchar2,
1132      p_rec              in  per_asg_shd.g_rec_type,
1133      p_validation_start_date out nocopy date,
1134      p_validation_end_date     out nocopy date) is
1135 --
1136   l_proc          varchar2(72) := g_package||'ins_lck';
1137   l_validation_start_date date;
1138   l_validation_end_date      date;
1139 --
1140 Begin
1141   hr_utility.set_location('Entering:'||l_proc, 5);
1142   --
1143   -- Validate the datetrack mode getting the validation start
1144   -- and end dates for the specified datetrack operation.
1145   --
1146   -- added position_id in parent table validation SCNair [VM]
1147   --
1148   -- Removed reference to pay_payrolls_f
1149   -- as part of fix for bug 1056246.
1150   --
1151 
1152          --parent_table_name1      => 'pay_payrolls_f',
1153          --parent_key_column1      => 'payroll_id',
1154          --parent_key_value1       => p_rec.payroll_id,
1155 
1156   -- Bug fix 4210721
1157   -- Parameter p_parent_table_name1 passed as 'per_all_people_f'
1158   -- instead of 'per_people_f'
1159 
1160   dt_api.validate_dt_mode
1161         (p_effective_date          => p_effective_date,
1162          p_datetrack_mode          => p_datetrack_mode,
1163          p_base_table_name         => 'per_all_assignments_f',
1164          p_base_key_column         => 'assignment_id',
1165          p_base_key_value          => p_rec.assignment_id,
1166          p_parent_table_name1     => 'per_all_people_f',
1167          p_parent_key_column1     => 'person_id',
1168          p_parent_key_value1      => p_rec.person_id,
1169          p_enforce_foreign_locking => true,
1170          p_validation_start_date   => l_validation_start_date,
1171          p_validation_end_date     => l_validation_end_date);
1172   --
1173   -- Set the validation start and end date OUT arguments
1174   --
1175   p_validation_start_date := l_validation_start_date;
1176   p_validation_end_date   := l_validation_end_date;
1177   --
1178   hr_utility.set_location(' Leaving:'||l_proc, 15);
1179 --
1180 End ins_lck;
1181 --
1182 -- ----------------------------------------------------------------------------
1183 -- |---------------------------------< ins >----------------------------------|
1184 -- ----------------------------------------------------------------------------
1185 Procedure ins
1186   (
1187   p_rec                       in out nocopy per_asg_shd.g_rec_type,
1188   p_effective_date             in     date,
1189   p_validate                   in     boolean default false,
1190   p_validate_df_flex           in     boolean default true,
1191   p_other_manager_warning      out nocopy boolean,
1192   p_hourly_salaried_warning    out nocopy boolean
1193   ) is
1194 --
1195   l_proc            varchar2(72) := g_package||'ins';
1196   l_datetrack_mode        varchar2(30) := 'INSERT';
1197   l_validation_start_date    date;
1198   l_validation_end_date        date;
1199   l_inv_pos_grade_warning       boolean;
1200 --
1201 Begin
1202   hr_utility.set_location('Entering:'||l_proc, 5);
1203   --
1204   -- Determine if the business process is to be validated.
1205   --
1206   If p_validate then
1207     --
1208     -- Issue the savepoint.
1209     --
1210     SAVEPOINT ins_per_asg;
1211     --
1212   End If;
1213   --
1214   -- Call the lock operation
1215   --
1216   ins_lck
1217     (p_effective_date     => p_effective_date,
1218      p_datetrack_mode     => l_datetrack_mode,
1219      p_rec              => p_rec,
1220          p_validation_start_date => l_validation_start_date,
1221          p_validation_end_date   => l_validation_end_date
1222         );
1223   --
1224   -- Call the supporting insert validate operations
1225   --
1226   per_asg_bus1.insert_validate
1227     (p_rec                  => p_rec,
1228      p_effective_date          => p_effective_date,
1229      p_datetrack_mode          => l_datetrack_mode,
1230      p_validation_start_date      => l_validation_start_date,
1231      p_validation_end_date          => l_validation_end_date,
1232          p_validate_df_flex           => p_validate_df_flex,
1233          p_other_manager_warning      => p_other_manager_warning,
1234          p_hourly_salaried_warning    => p_hourly_salaried_warning,
1235          p_inv_pos_grade_warning      => l_inv_pos_grade_warning
1236         );
1237   --
1238   -- Call to raise any errors on multi-message list
1239   hr_multi_message.end_validation_set;
1240   --
1241   -- Call the supporting pre-insert operation
1242   --
1243   pre_insert
1244      (p_rec             => p_rec,
1245      p_effective_date     => p_effective_date,
1246      p_datetrack_mode     => l_datetrack_mode,
1247      p_validation_start_date => l_validation_start_date,
1248      p_validation_end_date     => l_validation_end_date
1249         );
1250   --
1251   -- Insert the row
1252   --
1253   insert_dml
1254      (p_rec             => p_rec,
1255      p_effective_date     => p_effective_date,
1256      p_datetrack_mode     => l_datetrack_mode,
1257      p_validation_start_date => l_validation_start_date,
1258      p_validation_end_date     => l_validation_end_date
1259         );
1260   --
1261   -- Cache the assignment record into security cache.
1262   --
1263   hr_security.add_assignment(p_rec.person_id,   -- Bug 4018555
1264                              p_rec.assignment_id);
1265   --
1266   -- Call the supporting post-insert operation
1267   --
1268   post_insert
1269      (p_rec             => p_rec,
1270      p_effective_date     => p_effective_date,
1271      p_datetrack_mode     => l_datetrack_mode,
1272      p_validation_start_date => l_validation_start_date,
1273      p_validation_end_date     => l_validation_end_date
1274         );
1275   --
1276   -- Call to raise any errors on multi-message list
1277   hr_multi_message.end_validation_set;
1278   --
1279   -- If we are validating then raise the Validate_Enabled exception
1280   --
1281   If p_validate then
1282     Raise HR_Api.Validate_Enabled;
1283   End If;
1284   --
1285   hr_utility.set_location(' Leaving:'||l_proc, 10);
1286 Exception
1287   When HR_Api.Validate_Enabled Then
1288     --
1289     -- As the Validate_Enabled exception has been raised
1290     -- we must rollback to the savepoint
1291     --
1292     ROLLBACK TO ins_per_asg;
1293 end ins;
1294 --
1295 -- ----------------------------------------------------------------------------
1296 -- |---------------------------------< ins >----------------------------------|
1297 -- ----------------------------------------------------------------------------
1298 Procedure ins
1299   (
1300   p_assignment_id                out nocopy number,
1301   p_effective_start_date         out nocopy date,
1302   p_effective_end_date           out nocopy date,
1303   p_business_group_id            in number,
1304   p_recruiter_id                 in number           default null,
1305   p_grade_id                     in number           default null,
1306   p_position_id                  in number           default null,
1307   p_job_id                       in number           default null,
1308   p_assignment_status_type_id    in number,
1309   p_payroll_id                   in number           default null,
1310   p_location_id                  in number           default null,
1311   p_person_referred_by_id        in number           default null,
1312   p_supervisor_id                in number           default null,
1313   p_special_ceiling_step_id      in number           default null,
1314   p_person_id                    in number,
1315   p_recruitment_activity_id      in number           default null,
1316   p_source_organization_id       in number           default null,
1317   p_organization_id              in number,
1318   p_people_group_id              in number           default null,
1319   p_soft_coding_keyflex_id       in number           default null,
1320   p_vacancy_id                   in number           default null,
1321   p_pay_basis_id                 in number           default null,
1322   p_assignment_sequence          out nocopy number,
1323   p_assignment_type              in varchar2,
1324   p_primary_flag                 in varchar2,
1325   p_application_id               in number           default null,
1326   p_assignment_number            in out nocopy varchar2,
1327   p_change_reason                in varchar2         default null,
1328   p_comment_id                   out nocopy number,
1329   p_comments                     in varchar2         default null,
1330   p_date_probation_end           in date             default null,
1331   p_default_code_comb_id         in number           default null,
1332   p_employment_category          in varchar2         default null,
1333   p_frequency                    in varchar2         default null,
1334   p_internal_address_line        in varchar2         default null,
1335   p_manager_flag                 in varchar2         default null,
1336   p_normal_hours                 in number           default null,
1337   p_perf_review_period           in number           default null,
1338   p_perf_review_period_frequency in varchar2         default null,
1339   p_period_of_service_id         in number           default null,
1340   p_probation_period             in number           default null,
1341   p_probation_unit               in varchar2         default null,
1342   p_sal_review_period            in number           default null,
1343   p_sal_review_period_frequency  in varchar2         default null,
1344   p_set_of_books_id              in number           default null,
1345   p_source_type                  in varchar2         default null,
1346   p_time_normal_finish           in varchar2         default null,
1347   p_time_normal_start            in varchar2         default null,
1348   p_bargaining_unit_code         in varchar2         default null,
1349   p_labour_union_member_flag     in varchar2         default 'N',
1350   p_hourly_salaried_code         in varchar2         default null,
1351   p_request_id                   in number           default null,
1352   p_program_application_id       in number           default null,
1353   p_program_id                   in number           default null,
1354   p_program_update_date          in date             default null,
1355   p_ass_attribute_category       in varchar2         default null,
1356   p_ass_attribute1               in varchar2         default null,
1357   p_ass_attribute2               in varchar2         default null,
1358   p_ass_attribute3               in varchar2         default null,
1359   p_ass_attribute4               in varchar2         default null,
1360   p_ass_attribute5               in varchar2         default null,
1361   p_ass_attribute6               in varchar2         default null,
1362   p_ass_attribute7               in varchar2         default null,
1363   p_ass_attribute8               in varchar2         default null,
1364   p_ass_attribute9               in varchar2         default null,
1365   p_ass_attribute10              in varchar2         default null,
1366   p_ass_attribute11              in varchar2         default null,
1367   p_ass_attribute12              in varchar2         default null,
1368   p_ass_attribute13              in varchar2         default null,
1369   p_ass_attribute14              in varchar2         default null,
1370   p_ass_attribute15              in varchar2         default null,
1371   p_ass_attribute16              in varchar2         default null,
1372   p_ass_attribute17              in varchar2         default null,
1373   p_ass_attribute18              in varchar2         default null,
1374   p_ass_attribute19              in varchar2         default null,
1375   p_ass_attribute20              in varchar2         default null,
1376   p_ass_attribute21              in varchar2         default null,
1377   p_ass_attribute22              in varchar2         default null,
1378   p_ass_attribute23              in varchar2         default null,
1379   p_ass_attribute24              in varchar2         default null,
1380   p_ass_attribute25              in varchar2         default null,
1381   p_ass_attribute26              in varchar2         default null,
1382   p_ass_attribute27              in varchar2         default null,
1383   p_ass_attribute28              in varchar2         default null,
1384   p_ass_attribute29              in varchar2         default null,
1385   p_ass_attribute30              in varchar2         default null,
1386   p_title                        in varchar2         default null,
1387   p_validate_df_flex             in boolean          default true,
1388   p_object_version_number        out nocopy number,
1389   p_other_manager_warning        out nocopy boolean,
1390   p_hourly_salaried_warning      out nocopy boolean,
1391   p_effective_date         in date,
1392   p_validate             in boolean   default false ,
1393   p_contract_id                  in number           default null,
1394   p_establishment_id             in number           default null,
1395   p_collective_agreement_id      in number           default null,
1396   p_cagr_grade_def_id            in number           default null,
1397   p_cagr_id_flex_num             in number           default null,
1398   p_notice_period     in number       default null,
1399   p_notice_period_uom       in varchar2         default null,
1400   p_employee_category       in varchar2         default null,
1401   p_work_at_home      in varchar2         default null,
1402   p_job_post_source_name    in varchar2         default null,
1403   p_posting_content_id           in number           default null,
1404   p_placement_date_start         in date             default null,
1405   p_vendor_id                    in number           default null,
1406   p_vendor_employee_number        in varchar2         default null,
1407   p_vendor_assignment_number     in varchar2         default null,
1408   p_assignment_category          in varchar2         default null,
1409   p_project_title                in varchar2         default null,
1410   p_applicant_rank               in number           default null,
1411   p_grade_ladder_pgm_id          in number           default null,
1412   p_supervisor_assignment_id     in number           default null,
1413   p_vendor_site_id               in number           default null,
1414   p_po_header_id                 in number           default null,
1415   p_po_line_id                   in number           default null,
1416   p_projected_assignment_end     in date             default null
1417 )
1418  is
1419 --
1420   l_rec        per_asg_shd.g_rec_type;
1421   l_proc    varchar2(72) := g_package||'ins';
1422 --
1423 Begin
1424   hr_utility.set_location('Entering:'||l_proc, 5);
1425   --
1426   -- Call conversion function to turn arguments into the
1427   -- p_rec structure.
1428   --
1429   l_rec :=
1430   per_asg_shd.convert_args
1431   (
1432   null,
1433   null,
1434   null,
1435   p_business_group_id,
1436   p_recruiter_id,
1437   p_grade_id,
1438   p_position_id,
1439   p_job_id,
1440   p_assignment_status_type_id,
1441   p_payroll_id,
1442   p_location_id,
1443   p_person_referred_by_id,
1444   p_supervisor_id,
1445   p_special_ceiling_step_id,
1446   p_person_id,
1447   p_recruitment_activity_id,
1448   p_source_organization_id,
1449   p_organization_id,
1450   p_people_group_id,
1451   p_soft_coding_keyflex_id,
1452   p_vacancy_id,
1453   p_pay_basis_id,
1454   null,
1455   p_assignment_type,
1456   p_primary_flag,
1457   p_application_id,
1458   p_assignment_number,
1459   p_change_reason,
1460   null,
1461   p_comments,
1462   p_date_probation_end,
1463   p_default_code_comb_id,
1464   p_employment_category,
1465   p_frequency,
1466   p_internal_address_line,
1467   p_manager_flag,
1468   p_normal_hours,
1469   p_perf_review_period,
1470   p_perf_review_period_frequency,
1471   p_period_of_service_id,
1472   p_probation_period,
1473   p_probation_unit,
1474   p_sal_review_period,
1475   p_sal_review_period_frequency,
1476   p_set_of_books_id,
1477   p_source_type,
1478   p_time_normal_finish,
1479   p_time_normal_start,
1480   p_bargaining_unit_code,
1481   p_labour_union_member_flag,
1482   p_hourly_salaried_code,
1483   p_request_id,
1484   p_program_application_id,
1485   p_program_id,
1486   p_program_update_date,
1487   p_ass_attribute_category,
1488   p_ass_attribute1,
1489   p_ass_attribute2,
1490   p_ass_attribute3,
1491   p_ass_attribute4,
1492   p_ass_attribute5,
1493   p_ass_attribute6,
1494   p_ass_attribute7,
1495   p_ass_attribute8,
1496   p_ass_attribute9,
1497   p_ass_attribute10,
1498   p_ass_attribute11,
1499   p_ass_attribute12,
1500   p_ass_attribute13,
1501   p_ass_attribute14,
1502   p_ass_attribute15,
1503   p_ass_attribute16,
1504   p_ass_attribute17,
1505   p_ass_attribute18,
1506   p_ass_attribute19,
1507   p_ass_attribute20,
1508   p_ass_attribute21,
1509   p_ass_attribute22,
1510   p_ass_attribute23,
1511   p_ass_attribute24,
1512   p_ass_attribute25,
1513   p_ass_attribute26,
1514   p_ass_attribute27,
1515   p_ass_attribute28,
1516   p_ass_attribute29,
1517   p_ass_attribute30,
1518   p_title,
1519   null ,
1520   p_contract_id,
1521   p_establishment_id,
1522   p_collective_agreement_id,
1523   p_cagr_grade_def_id,
1524   p_cagr_id_flex_num,
1525   p_notice_period,
1526   p_notice_period_uom,
1527   p_employee_category,
1528   p_work_at_home,
1529   p_job_post_source_name,
1530   p_posting_content_id,
1531   p_placement_date_start,
1532   p_vendor_id,
1533   p_vendor_employee_number,
1534   p_vendor_assignment_number,
1535   p_assignment_category,
1536   p_project_title,
1537   p_applicant_rank,
1538   p_grade_ladder_pgm_id,
1539   p_supervisor_assignment_id,
1540   p_vendor_site_id,
1541   p_po_header_id,
1542   p_po_line_id,
1543   p_projected_assignment_end
1544  );
1545   --
1546   -- Having converted the arguments into the per_asg_rec
1547   -- plsql record structure we call the corresponding record
1548   -- business process.
1549   --
1550   ins(l_rec,
1551       p_effective_date,
1552       p_validate,
1553       p_validate_df_flex,
1554       p_other_manager_warning,
1555       p_hourly_salaried_warning
1556      );
1557   --
1558   -- Set the OUT arguments.
1559   --
1560   p_assignment_id            := l_rec.assignment_id;
1561   p_effective_start_date      := l_rec.effective_start_date;
1562   p_effective_end_date        := l_rec.effective_end_date;
1563   p_object_version_number     := l_rec.object_version_number;
1564   p_comment_id                  := l_rec.comment_id;
1565   p_assignment_number           := l_rec.assignment_number;
1566   p_assignment_sequence         := l_rec.assignment_sequence;
1567   --
1568   hr_utility.set_location(' Leaving:'||l_proc, 10);
1569 End ins;
1570 --
1571 end per_asg_ins;