DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_ASG_INS

Source


1 Package Body per_asg_ins as
2 /* $Header: peasgrhi.pkb 120.19.12010000.3 2008/11/12 06:37:24 skura 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   l_proc    varchar2(72) := g_package||'post_insert';
609 --
610 Begin
611   hr_utility.set_location('Entering:'||l_proc, 5);
612   --
613   ben_dt_trgr_handle.assignment
614     (p_rowid                   => null
615     ,p_assignment_id           => p_rec.assignment_id
616     ,p_business_group_id       => p_rec.business_group_id
617     ,p_person_id               => p_rec.person_id
618     ,p_effective_start_date    => p_rec.effective_start_date
619     ,p_effective_end_date      => p_rec.effective_end_date
620     ,p_assignment_status_type_id  => p_rec.assignment_status_type_id
621     ,p_assignment_type         => p_rec.assignment_type
622     ,p_organization_id         => p_rec.organization_id
623     ,p_primary_flag            => p_rec.primary_flag
624     ,p_change_reason           => p_rec.change_reason
625     ,p_employment_category     => p_rec.employment_category
626     ,p_frequency               => p_rec.frequency
627     ,p_grade_id                => p_rec.grade_id
628     ,p_job_id                  => p_rec.job_id
629     ,p_position_id             => p_rec.position_id
630     ,p_location_id             => p_rec.location_id
631     ,p_normal_hours            => p_rec.normal_hours
632     ,p_payroll_id              => p_rec.payroll_id
633     ,p_pay_basis_id            => p_rec.pay_basis_id
634     ,p_bargaining_unit_code    => p_rec.bargaining_unit_code
635     ,p_labour_union_member_flag => p_rec.labour_union_member_flag
636     ,p_hourly_salaried_code    => p_rec.hourly_salaried_code
637     ,p_people_group_id    => p_rec.people_group_id
638     ,p_ass_attribute1 => p_rec.ass_attribute1
639     ,p_ass_attribute2 => p_rec.ass_attribute2
640     ,p_ass_attribute3 => p_rec.ass_attribute3
641     ,p_ass_attribute4 => p_rec.ass_attribute4
642     ,p_ass_attribute5 => p_rec.ass_attribute5
643     ,p_ass_attribute6 => p_rec.ass_attribute6
644     ,p_ass_attribute7 => p_rec.ass_attribute7
645     ,p_ass_attribute8 => p_rec.ass_attribute8
646     ,p_ass_attribute9 => p_rec.ass_attribute9
647     ,p_ass_attribute10 => p_rec.ass_attribute10
648     ,p_ass_attribute11 => p_rec.ass_attribute11
649     ,p_ass_attribute12 => p_rec.ass_attribute12
650     ,p_ass_attribute13 => p_rec.ass_attribute13
651     ,p_ass_attribute14 => p_rec.ass_attribute14
652     ,p_ass_attribute15 => p_rec.ass_attribute15
653     ,p_ass_attribute16 => p_rec.ass_attribute16
654     ,p_ass_attribute17 => p_rec.ass_attribute17
655     ,p_ass_attribute18 => p_rec.ass_attribute18
656     ,p_ass_attribute19 => p_rec.ass_attribute19
657     ,p_ass_attribute20 => p_rec.ass_attribute20
658     ,p_ass_attribute21 => p_rec.ass_attribute21
659     ,p_ass_attribute22 => p_rec.ass_attribute22
660     ,p_ass_attribute23 => p_rec.ass_attribute23
661     ,p_ass_attribute24 => p_rec.ass_attribute24
662     ,p_ass_attribute25 => p_rec.ass_attribute25
663     ,p_ass_attribute26 => p_rec.ass_attribute26
664     ,p_ass_attribute27 => p_rec.ass_attribute27
665     ,p_ass_attribute28 => p_rec.ass_attribute28
666     ,p_ass_attribute29 => p_rec.ass_attribute29
667     ,p_ass_attribute30 => p_rec.ass_attribute30
668     );
669 
670   --
671   -- Add this assignment to the security list when
672   -- restricting on individual assignments.
673   --
674   IF p_rec.assignment_type <> 'B' THEN
675     hr_security.add_assignment
676       (p_person_id     => p_rec.person_id
677       ,p_assignment_id => p_rec.assignment_id);
678   END IF;
679 
680   --
681   -- Start of API User Hook for post_insert.
682   --
683   begin
684     per_asg_rki.after_insert
685       (p_effective_date                 => p_effective_date
686       ,p_validation_start_date          => p_validation_start_date
687       ,p_validation_end_date            => p_validation_end_date
688       ,p_assignment_id                  => p_rec.assignment_id
689       ,p_effective_start_date           => p_rec.effective_start_date
690       ,p_effective_end_date             => p_rec.effective_end_date
691       ,p_business_group_id              => p_rec.business_group_id
692       ,p_recruiter_id                   => p_rec.recruiter_id
693       ,p_grade_id                       => p_rec.grade_id
694       ,p_position_id                    => p_rec.position_id
695       ,p_job_id                         => p_rec.job_id
696       ,p_assignment_status_type_id      => p_rec.assignment_status_type_id
697       ,p_payroll_id                     => p_rec.payroll_id
698       ,p_location_id                    => p_rec.location_id
699       ,p_person_referred_by_id          => p_rec.person_referred_by_id
700       ,p_supervisor_id                  => p_rec.supervisor_id
701       ,p_special_ceiling_step_id        => p_rec.special_ceiling_step_id
702       ,p_person_id                      => p_rec.person_id
703       ,p_recruitment_activity_id        => p_rec.recruitment_activity_id
704       ,p_source_organization_id         => p_rec.source_organization_id
705       ,p_organization_id                => p_rec.organization_id
706       ,p_people_group_id                => p_rec.people_group_id
707       ,p_soft_coding_keyflex_id         => p_rec.soft_coding_keyflex_id
708       ,p_vacancy_id                     => p_rec.vacancy_id
709       ,p_pay_basis_id                   => p_rec.pay_basis_id
710       ,p_assignment_sequence            => p_rec.assignment_sequence
711       ,p_assignment_type                => p_rec.assignment_type
712       ,p_primary_flag                   => p_rec.primary_flag
713       ,p_application_id                 => p_rec.application_id
714       ,p_assignment_number              => p_rec.assignment_number
715       ,p_change_reason                  => p_rec.change_reason
716       ,p_comment_id                     => p_rec.comment_id
717       ,p_date_probation_end             => p_rec.date_probation_end
718       ,p_default_code_comb_id           => p_rec.default_code_comb_id
719       ,p_employment_category            => p_rec.employment_category
720       ,p_frequency                      => p_rec.frequency
721       ,p_internal_address_line          => p_rec.internal_address_line
722       ,p_manager_flag                   => p_rec.manager_flag
723       ,p_normal_hours                   => p_rec.normal_hours
724       ,p_perf_review_period             => p_rec.perf_review_period
725       ,p_perf_review_period_frequen     => p_rec.perf_review_period_frequency
726       ,p_period_of_service_id           => p_rec.period_of_service_id
727       ,p_probation_period               => p_rec.probation_period
728       ,p_probation_unit                 => p_rec.probation_unit
729       ,p_sal_review_period              => p_rec.sal_review_period
730       ,p_sal_review_period_frequen      => p_rec.sal_review_period_frequency
731       ,p_set_of_books_id                => p_rec.set_of_books_id
732       ,p_source_type                    => p_rec.source_type
733       ,p_time_normal_finish             => p_rec.time_normal_finish
734       ,p_time_normal_start              => p_rec.time_normal_start
735       ,p_bargaining_unit_code           => p_rec.bargaining_unit_code
736       ,p_labour_union_member_flag       => p_rec.labour_union_member_flag
737       ,p_hourly_salaried_code           => p_rec.hourly_salaried_code
738       ,p_request_id                     => p_rec.request_id
739       ,p_program_application_id         => p_rec.program_application_id
740       ,p_program_id                     => p_rec.program_id
741       ,p_program_update_date            => p_rec.program_update_date
742       ,p_ass_attribute_category         => p_rec.ass_attribute_category
743       ,p_ass_attribute1                 => p_rec.ass_attribute1
744       ,p_ass_attribute2                 => p_rec.ass_attribute2
745       ,p_ass_attribute3                 => p_rec.ass_attribute3
746       ,p_ass_attribute4                 => p_rec.ass_attribute4
747       ,p_ass_attribute5                 => p_rec.ass_attribute5
748       ,p_ass_attribute6                 => p_rec.ass_attribute6
749       ,p_ass_attribute7                 => p_rec.ass_attribute7
750       ,p_ass_attribute8                 => p_rec.ass_attribute8
751       ,p_ass_attribute9                 => p_rec.ass_attribute9
752       ,p_ass_attribute10                => p_rec.ass_attribute10
753       ,p_ass_attribute11                => p_rec.ass_attribute11
754       ,p_ass_attribute12                => p_rec.ass_attribute12
755       ,p_ass_attribute13                => p_rec.ass_attribute13
756       ,p_ass_attribute14                => p_rec.ass_attribute14
757       ,p_ass_attribute15                => p_rec.ass_attribute15
758       ,p_ass_attribute16                => p_rec.ass_attribute16
759       ,p_ass_attribute17                => p_rec.ass_attribute17
760       ,p_ass_attribute18                => p_rec.ass_attribute18
761       ,p_ass_attribute19                => p_rec.ass_attribute19
762       ,p_ass_attribute20                => p_rec.ass_attribute20
763       ,p_ass_attribute21                => p_rec.ass_attribute21
764       ,p_ass_attribute22                => p_rec.ass_attribute22
765       ,p_ass_attribute23                => p_rec.ass_attribute23
766       ,p_ass_attribute24                => p_rec.ass_attribute24
767       ,p_ass_attribute25                => p_rec.ass_attribute25
768       ,p_ass_attribute26                => p_rec.ass_attribute26
769       ,p_ass_attribute27                => p_rec.ass_attribute27
770       ,p_ass_attribute28                => p_rec.ass_attribute28
771       ,p_ass_attribute29                => p_rec.ass_attribute29
772       ,p_ass_attribute30                => p_rec.ass_attribute30
773       ,p_title                          => p_rec.title
774       ,p_contract_id                    => p_rec.contract_id
775       ,p_establishment_id               => p_rec.establishment_id
776       ,p_collective_agreement_id        => p_rec.collective_agreement_id
777       ,p_cagr_grade_def_id              => p_rec.cagr_grade_def_id
778       ,p_cagr_id_flex_num               => p_rec.cagr_id_flex_num
779       ,p_object_version_number          => p_rec.object_version_number
780       ,p_notice_period        => p_rec.notice_period
781       ,p_notice_period_uom    => p_rec.notice_period_uom
782       ,p_employee_category    => p_rec.employee_category
783       ,p_work_at_home         => p_rec.work_at_home
784       ,p_job_post_source_name    => p_rec.job_post_source_name
785       ,p_posting_content_id             => p_rec.posting_content_id
786       ,p_placement_date_start           => p_rec.period_of_placement_date_start
787       ,p_vendor_id                      => p_rec.vendor_id
788       ,p_vendor_employee_number          => p_rec.vendor_employee_number
789       ,p_vendor_assignment_number       => p_rec.vendor_assignment_number
790       ,p_assignment_category            => p_rec.assignment_category
791       ,p_project_title                  => p_rec.project_title
792       ,p_applicant_rank                 => p_rec.applicant_rank
793       ,p_grade_ladder_pgm_id            => p_rec.grade_ladder_pgm_id
794       ,p_supervisor_assignment_id       => p_rec.supervisor_assignment_id
795       ,p_vendor_site_id                 => p_rec.vendor_site_id
796       ,p_po_header_id                   => p_rec.po_header_id
797       ,p_po_line_id                     => p_rec.po_line_id
798       ,p_projected_assignment_end       => p_rec.projected_assignment_end);
799   exception
800     when hr_api.cannot_find_prog_unit then
801       hr_api.cannot_find_prog_unit_error
802         (p_module_name => 'PER_ALL_ASSIGNMENTS_F'
803         ,p_hook_type   => 'AI'
804         );
805   end;
806   -- End of API User Hook for post_insert.
807   -- Temporary hardcoded hook added for pay object group functionality. Will
808   -- replace by proper hook when dynamic triggers for assignments converted
809   -- to package dynamic triggers.
810   --
811 --bug no 5404530
812    hr_assignment.load_budget_values(
813       p_rec.assignment_id,
814       p_rec.business_group_id,
815       to_char(0),
816       to_char(0),
817       p_validation_start_date,
818       p_validation_end_date);
819 --bug no 5404530
820   pay_pog_all_assignments_pkg.after_insert
821   (p_effective_date             => p_effective_date
822   ,p_validation_start_date      => p_validation_start_date
823   ,p_validation_end_date        => p_validation_end_date
824   ,P_APPLICANT_RANK             => p_rec.applicant_rank
825   ,P_APPLICATION_ID             => p_rec.program_application_id
826   ,P_ASSIGNMENT_CATEGORY        => p_rec.assignment_category
827   ,P_ASSIGNMENT_ID              => p_rec.assignment_id
828   ,P_ASSIGNMENT_NUMBER          => p_rec.assignment_number
829   ,P_ASSIGNMENT_SEQUENCE        => p_rec.assignment_sequence
830   ,P_ASSIGNMENT_STATUS_TYPE_ID  => p_rec.assignment_status_type_id
831   ,P_ASSIGNMENT_TYPE            => p_rec.assignment_type
832   ,P_ASS_ATTRIBUTE1             => p_rec.ass_attribute1
833   ,P_ASS_ATTRIBUTE10            => p_rec.ass_attribute10
834   ,P_ASS_ATTRIBUTE11            => p_rec.ass_attribute11
835   ,P_ASS_ATTRIBUTE12            => p_rec.ass_attribute12
836   ,P_ASS_ATTRIBUTE13            => p_rec.ass_attribute13
837   ,P_ASS_ATTRIBUTE14            => p_rec.ass_attribute14
838   ,P_ASS_ATTRIBUTE15            => p_rec.ass_attribute15
839   ,P_ASS_ATTRIBUTE16            => p_rec.ass_attribute16
840   ,P_ASS_ATTRIBUTE17            => p_rec.ass_attribute17
841   ,P_ASS_ATTRIBUTE18            => p_rec.ass_attribute18
842   ,P_ASS_ATTRIBUTE19            => p_rec.ass_attribute19
843   ,P_ASS_ATTRIBUTE2             => p_rec.ass_attribute2
844   ,P_ASS_ATTRIBUTE20            => p_rec.ass_attribute20
845   ,P_ASS_ATTRIBUTE21            => p_rec.ass_attribute21
846   ,P_ASS_ATTRIBUTE22            => p_rec.ass_attribute22
847   ,P_ASS_ATTRIBUTE23            => p_rec.ass_attribute23
848   ,P_ASS_ATTRIBUTE24            => p_rec.ass_attribute24
849   ,P_ASS_ATTRIBUTE25            => p_rec.ass_attribute25
850   ,P_ASS_ATTRIBUTE26            => p_rec.ass_attribute26
851   ,P_ASS_ATTRIBUTE27            => p_rec.ass_attribute27
852   ,P_ASS_ATTRIBUTE28            => p_rec.ass_attribute28
853   ,P_ASS_ATTRIBUTE29            => p_rec.ass_attribute29
854   ,P_ASS_ATTRIBUTE3             => p_rec.ass_attribute3
855   ,P_ASS_ATTRIBUTE30            => p_rec.ass_attribute30
856   ,P_ASS_ATTRIBUTE4             => p_rec.ass_attribute4
857   ,P_ASS_ATTRIBUTE5             => p_rec.ass_attribute5
858   ,P_ASS_ATTRIBUTE6             => p_rec.ass_attribute6
859   ,P_ASS_ATTRIBUTE7             => p_rec.ass_attribute7
860   ,P_ASS_ATTRIBUTE8             => p_rec.ass_attribute8
861   ,P_ASS_ATTRIBUTE9             => p_rec.ass_attribute9
862   ,P_ASS_ATTRIBUTE_CATEGORY     => p_rec.ass_attribute_category
863   ,P_BARGAINING_UNIT_CODE       => p_rec.bargaining_unit_code
864   ,P_BUSINESS_GROUP_ID          => p_rec.business_group_id
865   ,P_CAGR_GRADE_DEF_ID          => p_rec.cagr_grade_def_id
866   ,P_CAGR_ID_FLEX_NUM           => p_rec.cagr_id_flex_num
867   ,P_CHANGE_REASON              => p_rec.change_reason
868   ,P_COLLECTIVE_AGREEMENT_ID    => p_rec.collective_agreement_id
869   ,P_COMMENT_ID                 => p_rec.comment_id
870   ,P_CONTRACT_ID                => p_rec.contract_id
871   ,P_DATE_PROBATION_END         => p_rec.date_probation_end
872   ,P_DEFAULT_CODE_COMB_ID       => p_rec.default_code_comb_id
873   ,P_EFFECTIVE_END_DATE         => p_rec.effective_end_date
874   ,P_EFFECTIVE_START_DATE       => p_rec.effective_start_date
875   ,P_EMPLOYEE_CATEGORY          => p_rec.employee_category
876   ,P_EMPLOYMENT_CATEGORY        => p_rec.employment_category
877   ,P_ESTABLISHMENT_ID           => p_rec.establishment_id
878   ,P_FREQUENCY                  => p_rec.frequency
879   ,P_GRADE_ID                   => p_rec.grade_id
880   ,P_HOURLY_SALARIED_CODE       => p_rec.hourly_salaried_code
881   ,P_INTERNAL_ADDRESS_LINE      => p_rec.internal_address_line
882   ,P_JOB_ID                     => p_rec.job_id
883   ,P_JOB_POST_SOURCE_NAME       => p_rec.job_post_source_name
884   ,P_LABOUR_UNION_MEMBER_FLAG   => p_rec.labour_union_member_flag
885   ,P_LOCATION_ID                => p_rec.location_id
886   ,P_MANAGER_FLAG               => p_rec.manager_flag
887   ,P_NORMAL_HOURS               => p_rec.normal_hours
888   ,P_NOTICE_PERIOD              => p_rec.notice_period
889   ,P_NOTICE_PERIOD_UOM          => p_rec.notice_period_uom
890   ,P_OBJECT_VERSION_NUMBER      => p_rec.object_version_number
891   ,P_ORGANIZATION_ID            => p_rec.organization_id
892   ,P_PAYROLL_ID                 => p_rec.payroll_id
893   ,P_PAY_BASIS_ID               => p_rec.pay_basis_id
894   ,P_PEOPLE_GROUP_ID            => p_rec.people_group_id
895   ,P_PERF_REVIEW_PERIOD         => p_rec.perf_review_period
896   ,P_PERF_REVIEW_PERIOD_FREQUEN => p_rec.perf_review_period_frequency
897   ,P_PERIOD_OF_SERVICE_ID       => p_rec.period_of_service_id
898   ,P_PERSON_ID                  => p_rec.person_id
899   ,P_PERSON_REFERRED_BY_ID      => p_rec.person_referred_by_id
900   ,P_PLACEMENT_DATE_START       => p_rec.period_of_placement_date_start
901   ,P_POSITION_ID                => p_rec.position_id
902   ,P_POSTING_CONTENT_ID         => p_rec.posting_content_id
903   ,P_PRIMARY_FLAG               => p_rec.primary_flag
904   ,P_PROBATION_PERIOD           => p_rec.probation_period
905   ,P_PROBATION_UNIT             => p_rec.probation_unit
906   ,P_PROGRAM_APPLICATION_ID     => p_rec.program_application_id
907   ,P_PROGRAM_ID                 => p_rec.program_id
908   ,P_PROGRAM_UPDATE_DATE        => p_rec.program_update_date
909   ,P_PROJECT_TITLE              => p_rec.project_title
910   ,P_RECRUITER_ID               => p_rec.recruiter_id
911   ,P_RECRUITMENT_ACTIVITY_ID    => p_rec.recruitment_activity_id
912   ,P_REQUEST_ID                 => p_rec.request_id
913   ,P_SAL_REVIEW_PERIOD          => p_rec.sal_review_period
914   ,P_SAL_REVIEW_PERIOD_FREQUEN  => p_rec.sal_review_period_frequency
915   ,P_SET_OF_BOOKS_ID            => p_rec.set_of_books_id
916   ,P_SOFT_CODING_KEYFLEX_ID     => p_rec.soft_coding_keyflex_id
917   ,P_SOURCE_ORGANIZATION_ID     => p_rec.source_organization_id
918   ,P_SOURCE_TYPE                => p_rec.source_type
919   ,P_SPECIAL_CEILING_STEP_ID    => p_rec.special_ceiling_step_id
920   ,P_SUPERVISOR_ID              => p_rec.supervisor_id
921   ,P_TIME_NORMAL_FINISH         => p_rec.time_normal_finish
922   ,P_TIME_NORMAL_START          => p_rec.time_normal_start
923   ,P_TITLE                      => p_rec.title
924   ,P_VACANCY_ID                 => p_rec.vacancy_id
925   ,P_VENDOR_ASSIGNMENT_NUMBER   => p_rec.vendor_assignment_number
926   ,P_VENDOR_EMPLOYEE_NUMBER     => p_rec.vendor_employee_number
927   ,P_VENDOR_ID                  => p_rec.vendor_id
928   ,P_WORK_AT_HOME               => p_rec.work_at_home
929   ,P_GRADE_LADDER_PGM_ID        => p_rec.grade_ladder_pgm_id
930   ,P_SUPERVISOR_ASSIGNMENT_ID   => p_rec.supervisor_assignment_id
931   ,P_VENDOR_SITE_ID             => p_rec.vendor_site_id
932   ,P_PO_HEADER_ID               => p_rec.po_header_id
933   ,P_PO_LINE_ID                 => p_rec.po_line_id
934   ,P_PROJECTED_ASSIGNMENT_END   => p_rec.projected_assignment_end
935   );
936  --
937  -- Call to Workflow Sync Procedure For Assignments
938 
939     per_pqh_shr.per_asg_wf_sync('POST_INSERT',
940                             p_rec,
941                             null,
942                             p_effective_date,
943                             p_validation_start_date,
944                             p_validation_end_date,
945                             p_datetrack_mode);
946 
947  -- End of call to Workflow Sync Procedure For Assignments
948   --
949   hr_utility.set_location(' Leaving:'||l_proc, 10);
950 End post_insert;
951 -- ----------------------------------------------------------------------------
952 -- |-------------------------------< ins_lck >--------------------------------|
953 -- ----------------------------------------------------------------------------
954 -- {Start Of Comments}
955 --
956 -- Description:
957 --   The ins_lck process has one main function to perform. When inserting
958 --   a datetracked row, we must validate the DT mode.
959 --   be manipulated.
960 --
961 -- Pre Conditions:
962 --   This procedure can only be called for the datetrack mode of INSERT.
963 --
964 -- In Arguments:
965 --
966 -- Post Success:
967 --   On successful completion of the ins_lck process the parental
968 --   datetracked rows will be locked providing the p_enforce_foreign_locking
969 --   argument value is TRUE.
970 --   If the p_enforce_foreign_locking argument value is FALSE then the
971 --   parential rows are not locked.
972 --
973 -- Post Failure:
974 --   The Lck process can fail for:
975 --   1) When attempting to lock the row the row could already be locked by
976 --      another user. This will raise the HR_Api.Object_Locked exception.
977 --   2) When attempting to the lock the parent which doesn't exist.
978 --      For the entity to be locked the parent must exist!
979 --
980 -- Developer Implementation Notes:
981 --   None.
982 --
983 -- Access Status:
984 --   Internal Table Handler Use Only.
985 --
986 -- {End Of Comments}
987 -- ----------------------------------------------------------------------------
988 Procedure ins_lck
989     (p_effective_date     in  date,
990      p_datetrack_mode     in  varchar2,
991      p_rec              in  per_asg_shd.g_rec_type,
992      p_validation_start_date out nocopy date,
993      p_validation_end_date     out nocopy date) is
994 --
995   l_proc          varchar2(72) := g_package||'ins_lck';
996   l_validation_start_date date;
997   l_validation_end_date      date;
998 --
999 Begin
1000   hr_utility.set_location('Entering:'||l_proc, 5);
1001   --
1002   -- Validate the datetrack mode getting the validation start
1003   -- and end dates for the specified datetrack operation.
1004   --
1005   -- added position_id in parent table validation SCNair [VM]
1006   --
1007   -- Removed reference to pay_payrolls_f
1008   -- as part of fix for bug 1056246.
1009   --
1010 
1011          --parent_table_name1      => 'pay_payrolls_f',
1012          --parent_key_column1      => 'payroll_id',
1013          --parent_key_value1       => p_rec.payroll_id,
1014 
1015   -- Bug fix 4210721
1016   -- Parameter p_parent_table_name1 passed as 'per_all_people_f'
1017   -- instead of 'per_people_f'
1018 
1019   dt_api.validate_dt_mode
1020         (p_effective_date          => p_effective_date,
1021          p_datetrack_mode          => p_datetrack_mode,
1022          p_base_table_name         => 'per_all_assignments_f',
1023          p_base_key_column         => 'assignment_id',
1024          p_base_key_value          => p_rec.assignment_id,
1025          p_parent_table_name1     => 'per_all_people_f',
1026          p_parent_key_column1     => 'person_id',
1027          p_parent_key_value1      => p_rec.person_id,
1028          p_enforce_foreign_locking => true,
1029          p_validation_start_date   => l_validation_start_date,
1030          p_validation_end_date     => l_validation_end_date);
1031   --
1032   -- Set the validation start and end date OUT arguments
1033   --
1034   p_validation_start_date := l_validation_start_date;
1035   p_validation_end_date   := l_validation_end_date;
1036   --
1037   hr_utility.set_location(' Leaving:'||l_proc, 15);
1038 --
1039 End ins_lck;
1040 --
1041 -- ----------------------------------------------------------------------------
1042 -- |---------------------------------< ins >----------------------------------|
1043 -- ----------------------------------------------------------------------------
1044 Procedure ins
1045   (
1046   p_rec                       in out nocopy per_asg_shd.g_rec_type,
1047   p_effective_date             in     date,
1048   p_validate                   in     boolean default false,
1049   p_validate_df_flex           in     boolean default true,
1050   p_other_manager_warning      out nocopy boolean,
1051   p_hourly_salaried_warning    out nocopy boolean
1052   ) is
1053 --
1054   l_proc            varchar2(72) := g_package||'ins';
1055   l_datetrack_mode        varchar2(30) := 'INSERT';
1056   l_validation_start_date    date;
1057   l_validation_end_date        date;
1058   l_inv_pos_grade_warning       boolean;
1059 --
1060 Begin
1061   hr_utility.set_location('Entering:'||l_proc, 5);
1062   --
1063   -- Determine if the business process is to be validated.
1064   --
1065   If p_validate then
1066     --
1067     -- Issue the savepoint.
1068     --
1069     SAVEPOINT ins_per_asg;
1070     --
1071   End If;
1072   --
1073   -- Call the lock operation
1074   --
1075   ins_lck
1076     (p_effective_date     => p_effective_date,
1077      p_datetrack_mode     => l_datetrack_mode,
1078      p_rec              => p_rec,
1079          p_validation_start_date => l_validation_start_date,
1080          p_validation_end_date   => l_validation_end_date
1081         );
1082   --
1083   -- Call the supporting insert validate operations
1084   --
1085   per_asg_bus1.insert_validate
1086     (p_rec                  => p_rec,
1087      p_effective_date          => p_effective_date,
1088      p_datetrack_mode          => l_datetrack_mode,
1089      p_validation_start_date      => l_validation_start_date,
1090      p_validation_end_date          => l_validation_end_date,
1091          p_validate_df_flex           => p_validate_df_flex,
1092          p_other_manager_warning      => p_other_manager_warning,
1093          p_hourly_salaried_warning    => p_hourly_salaried_warning,
1094          p_inv_pos_grade_warning      => l_inv_pos_grade_warning
1095         );
1096   --
1097   -- Call to raise any errors on multi-message list
1098   hr_multi_message.end_validation_set;
1099   --
1100   -- Call the supporting pre-insert operation
1101   --
1102   pre_insert
1103      (p_rec             => p_rec,
1104      p_effective_date     => p_effective_date,
1105      p_datetrack_mode     => l_datetrack_mode,
1106      p_validation_start_date => l_validation_start_date,
1107      p_validation_end_date     => l_validation_end_date
1108         );
1109   --
1110   -- Insert the row
1111   --
1112   insert_dml
1113      (p_rec             => p_rec,
1114      p_effective_date     => p_effective_date,
1115      p_datetrack_mode     => l_datetrack_mode,
1116      p_validation_start_date => l_validation_start_date,
1117      p_validation_end_date     => l_validation_end_date
1118         );
1119   --
1120   -- Cache the assignment record into security cache.
1121   --
1122   hr_security.add_assignment(p_rec.person_id,   -- Bug 4018555
1123                              p_rec.assignment_id);
1124   --
1125   -- Call the supporting post-insert operation
1126   --
1127   post_insert
1128      (p_rec             => p_rec,
1129      p_effective_date     => p_effective_date,
1130      p_datetrack_mode     => l_datetrack_mode,
1131      p_validation_start_date => l_validation_start_date,
1132      p_validation_end_date     => l_validation_end_date
1133         );
1134   --
1135   -- Call to raise any errors on multi-message list
1136   hr_multi_message.end_validation_set;
1137   --
1138   -- If we are validating then raise the Validate_Enabled exception
1139   --
1140   If p_validate then
1141     Raise HR_Api.Validate_Enabled;
1142   End If;
1143   --
1144   hr_utility.set_location(' Leaving:'||l_proc, 10);
1145 Exception
1146   When HR_Api.Validate_Enabled Then
1147     --
1148     -- As the Validate_Enabled exception has been raised
1149     -- we must rollback to the savepoint
1150     --
1151     ROLLBACK TO ins_per_asg;
1152 end ins;
1153 --
1154 -- ----------------------------------------------------------------------------
1155 -- |---------------------------------< ins >----------------------------------|
1156 -- ----------------------------------------------------------------------------
1157 Procedure ins
1158   (
1159   p_assignment_id                out nocopy number,
1160   p_effective_start_date         out nocopy date,
1161   p_effective_end_date           out nocopy date,
1162   p_business_group_id            in number,
1163   p_recruiter_id                 in number           default null,
1164   p_grade_id                     in number           default null,
1165   p_position_id                  in number           default null,
1166   p_job_id                       in number           default null,
1167   p_assignment_status_type_id    in number,
1168   p_payroll_id                   in number           default null,
1169   p_location_id                  in number           default null,
1170   p_person_referred_by_id        in number           default null,
1171   p_supervisor_id                in number           default null,
1172   p_special_ceiling_step_id      in number           default null,
1173   p_person_id                    in number,
1174   p_recruitment_activity_id      in number           default null,
1175   p_source_organization_id       in number           default null,
1176   p_organization_id              in number,
1177   p_people_group_id              in number           default null,
1178   p_soft_coding_keyflex_id       in number           default null,
1179   p_vacancy_id                   in number           default null,
1180   p_pay_basis_id                 in number           default null,
1181   p_assignment_sequence          out nocopy number,
1182   p_assignment_type              in varchar2,
1183   p_primary_flag                 in varchar2,
1184   p_application_id               in number           default null,
1185   p_assignment_number            in out nocopy varchar2,
1186   p_change_reason                in varchar2         default null,
1187   p_comment_id                   out nocopy number,
1188   p_comments                     in varchar2         default null,
1189   p_date_probation_end           in date             default null,
1190   p_default_code_comb_id         in number           default null,
1191   p_employment_category          in varchar2         default null,
1192   p_frequency                    in varchar2         default null,
1193   p_internal_address_line        in varchar2         default null,
1194   p_manager_flag                 in varchar2         default null,
1195   p_normal_hours                 in number           default null,
1196   p_perf_review_period           in number           default null,
1197   p_perf_review_period_frequency in varchar2         default null,
1198   p_period_of_service_id         in number           default null,
1199   p_probation_period             in number           default null,
1200   p_probation_unit               in varchar2         default null,
1201   p_sal_review_period            in number           default null,
1202   p_sal_review_period_frequency  in varchar2         default null,
1203   p_set_of_books_id              in number           default null,
1204   p_source_type                  in varchar2         default null,
1205   p_time_normal_finish           in varchar2         default null,
1206   p_time_normal_start            in varchar2         default null,
1207   p_bargaining_unit_code         in varchar2         default null,
1208   p_labour_union_member_flag     in varchar2         default 'N',
1209   p_hourly_salaried_code         in varchar2         default null,
1210   p_request_id                   in number           default null,
1211   p_program_application_id       in number           default null,
1212   p_program_id                   in number           default null,
1213   p_program_update_date          in date             default null,
1214   p_ass_attribute_category       in varchar2         default null,
1215   p_ass_attribute1               in varchar2         default null,
1216   p_ass_attribute2               in varchar2         default null,
1217   p_ass_attribute3               in varchar2         default null,
1218   p_ass_attribute4               in varchar2         default null,
1219   p_ass_attribute5               in varchar2         default null,
1220   p_ass_attribute6               in varchar2         default null,
1221   p_ass_attribute7               in varchar2         default null,
1222   p_ass_attribute8               in varchar2         default null,
1223   p_ass_attribute9               in varchar2         default null,
1224   p_ass_attribute10              in varchar2         default null,
1225   p_ass_attribute11              in varchar2         default null,
1226   p_ass_attribute12              in varchar2         default null,
1227   p_ass_attribute13              in varchar2         default null,
1228   p_ass_attribute14              in varchar2         default null,
1229   p_ass_attribute15              in varchar2         default null,
1230   p_ass_attribute16              in varchar2         default null,
1231   p_ass_attribute17              in varchar2         default null,
1232   p_ass_attribute18              in varchar2         default null,
1233   p_ass_attribute19              in varchar2         default null,
1234   p_ass_attribute20              in varchar2         default null,
1235   p_ass_attribute21              in varchar2         default null,
1236   p_ass_attribute22              in varchar2         default null,
1237   p_ass_attribute23              in varchar2         default null,
1238   p_ass_attribute24              in varchar2         default null,
1239   p_ass_attribute25              in varchar2         default null,
1240   p_ass_attribute26              in varchar2         default null,
1241   p_ass_attribute27              in varchar2         default null,
1242   p_ass_attribute28              in varchar2         default null,
1243   p_ass_attribute29              in varchar2         default null,
1244   p_ass_attribute30              in varchar2         default null,
1245   p_title                        in varchar2         default null,
1246   p_validate_df_flex             in boolean          default true,
1247   p_object_version_number        out nocopy number,
1248   p_other_manager_warning        out nocopy boolean,
1249   p_hourly_salaried_warning      out nocopy boolean,
1250   p_effective_date         in date,
1251   p_validate             in boolean   default false ,
1252   p_contract_id                  in number           default null,
1253   p_establishment_id             in number           default null,
1254   p_collective_agreement_id      in number           default null,
1255   p_cagr_grade_def_id            in number           default null,
1256   p_cagr_id_flex_num             in number           default null,
1257   p_notice_period     in number       default null,
1258   p_notice_period_uom       in varchar2         default null,
1259   p_employee_category       in varchar2         default null,
1260   p_work_at_home      in varchar2         default null,
1261   p_job_post_source_name    in varchar2         default null,
1262   p_posting_content_id           in number           default null,
1263   p_placement_date_start         in date             default null,
1264   p_vendor_id                    in number           default null,
1265   p_vendor_employee_number        in varchar2         default null,
1266   p_vendor_assignment_number     in varchar2         default null,
1267   p_assignment_category          in varchar2         default null,
1268   p_project_title                in varchar2         default null,
1269   p_applicant_rank               in number           default null,
1270   p_grade_ladder_pgm_id          in number           default null,
1271   p_supervisor_assignment_id     in number           default null,
1272   p_vendor_site_id               in number           default null,
1273   p_po_header_id                 in number           default null,
1274   p_po_line_id                   in number           default null,
1275   p_projected_assignment_end     in date             default null
1276 )
1277  is
1278 --
1279   l_rec        per_asg_shd.g_rec_type;
1280   l_proc    varchar2(72) := g_package||'ins';
1281 --
1282 Begin
1283   hr_utility.set_location('Entering:'||l_proc, 5);
1284   --
1285   -- Call conversion function to turn arguments into the
1286   -- p_rec structure.
1287   --
1288   l_rec :=
1289   per_asg_shd.convert_args
1290   (
1291   null,
1292   null,
1293   null,
1294   p_business_group_id,
1295   p_recruiter_id,
1296   p_grade_id,
1297   p_position_id,
1298   p_job_id,
1299   p_assignment_status_type_id,
1300   p_payroll_id,
1301   p_location_id,
1302   p_person_referred_by_id,
1303   p_supervisor_id,
1304   p_special_ceiling_step_id,
1305   p_person_id,
1306   p_recruitment_activity_id,
1307   p_source_organization_id,
1308   p_organization_id,
1309   p_people_group_id,
1310   p_soft_coding_keyflex_id,
1311   p_vacancy_id,
1312   p_pay_basis_id,
1313   null,
1314   p_assignment_type,
1315   p_primary_flag,
1316   p_application_id,
1317   p_assignment_number,
1318   p_change_reason,
1319   null,
1320   p_comments,
1321   p_date_probation_end,
1322   p_default_code_comb_id,
1323   p_employment_category,
1324   p_frequency,
1325   p_internal_address_line,
1326   p_manager_flag,
1327   p_normal_hours,
1328   p_perf_review_period,
1329   p_perf_review_period_frequency,
1330   p_period_of_service_id,
1331   p_probation_period,
1332   p_probation_unit,
1333   p_sal_review_period,
1334   p_sal_review_period_frequency,
1335   p_set_of_books_id,
1336   p_source_type,
1337   p_time_normal_finish,
1338   p_time_normal_start,
1339   p_bargaining_unit_code,
1340   p_labour_union_member_flag,
1341   p_hourly_salaried_code,
1342   p_request_id,
1343   p_program_application_id,
1344   p_program_id,
1345   p_program_update_date,
1346   p_ass_attribute_category,
1347   p_ass_attribute1,
1348   p_ass_attribute2,
1349   p_ass_attribute3,
1350   p_ass_attribute4,
1351   p_ass_attribute5,
1352   p_ass_attribute6,
1353   p_ass_attribute7,
1354   p_ass_attribute8,
1355   p_ass_attribute9,
1356   p_ass_attribute10,
1357   p_ass_attribute11,
1358   p_ass_attribute12,
1359   p_ass_attribute13,
1360   p_ass_attribute14,
1361   p_ass_attribute15,
1362   p_ass_attribute16,
1363   p_ass_attribute17,
1364   p_ass_attribute18,
1365   p_ass_attribute19,
1366   p_ass_attribute20,
1367   p_ass_attribute21,
1368   p_ass_attribute22,
1369   p_ass_attribute23,
1370   p_ass_attribute24,
1371   p_ass_attribute25,
1372   p_ass_attribute26,
1373   p_ass_attribute27,
1374   p_ass_attribute28,
1375   p_ass_attribute29,
1376   p_ass_attribute30,
1377   p_title,
1378   null ,
1379   p_contract_id,
1380   p_establishment_id,
1381   p_collective_agreement_id,
1382   p_cagr_grade_def_id,
1383   p_cagr_id_flex_num,
1384   p_notice_period,
1385   p_notice_period_uom,
1386   p_employee_category,
1387   p_work_at_home,
1388   p_job_post_source_name,
1389   p_posting_content_id,
1390   p_placement_date_start,
1391   p_vendor_id,
1392   p_vendor_employee_number,
1393   p_vendor_assignment_number,
1394   p_assignment_category,
1395   p_project_title,
1396   p_applicant_rank,
1397   p_grade_ladder_pgm_id,
1398   p_supervisor_assignment_id,
1399   p_vendor_site_id,
1400   p_po_header_id,
1401   p_po_line_id,
1402   p_projected_assignment_end
1403  );
1404   --
1405   -- Having converted the arguments into the per_asg_rec
1406   -- plsql record structure we call the corresponding record
1407   -- business process.
1408   --
1409   ins(l_rec,
1410       p_effective_date,
1411       p_validate,
1412       p_validate_df_flex,
1413       p_other_manager_warning,
1414       p_hourly_salaried_warning
1415      );
1416   --
1417   -- Set the OUT arguments.
1418   --
1419   p_assignment_id            := l_rec.assignment_id;
1420   p_effective_start_date      := l_rec.effective_start_date;
1421   p_effective_end_date        := l_rec.effective_end_date;
1422   p_object_version_number     := l_rec.object_version_number;
1423   p_comment_id                  := l_rec.comment_id;
1424   p_assignment_number           := l_rec.assignment_number;
1425   p_assignment_sequence         := l_rec.assignment_sequence;
1426   --
1427   hr_utility.set_location(' Leaving:'||l_proc, 10);
1428 End ins;
1429 --
1430 end per_asg_ins;