DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_ESTAB_ATTENDANCES_API

Source


1 Package Body PER_ESTAB_ATTENDANCES_API as
2 /* $Header: peesaapi.pkb 115.6 2003/02/12 16:39:09 pkakar noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := 'per_estab_attendances_api.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |-----------------------< CREATE_ATTENDED_ESTAB >--------------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure CREATE_ATTENDED_ESTAB
13   (p_validate                      in     boolean  default false
14   ,p_effective_date                in     date
15   ,p_fulltime                      in     varchar2
16   ,p_attended_start_date           in     date     default null
17   ,p_attended_end_date             in     date     default null
18   ,p_establishment                 in     varchar2 default null
19   ,p_business_group_id             in     number   default null
20   ,p_person_id                     in     number   default null
21   ,p_party_id                      in     number   default null
22   ,p_address			   in	  varchar2 default null
23   ,p_establishment_id              in     number   default null
24   ,p_attribute_category            in     varchar2 default null
25   ,p_attribute1                    in     varchar2 default null
26   ,p_attribute2                    in     varchar2 default null
27   ,p_attribute3                    in     varchar2 default null
28   ,p_attribute4                    in     varchar2 default null
29   ,p_attribute5                    in     varchar2 default null
30   ,p_attribute6                    in     varchar2 default null
31   ,p_attribute7                    in     varchar2 default null
32   ,p_attribute8                    in     varchar2 default null
33   ,p_attribute9                    in     varchar2 default null
34   ,p_attribute10                   in     varchar2 default null
35   ,p_attribute11                   in     varchar2 default null
36   ,p_attribute12                   in     varchar2 default null
37   ,p_attribute13                   in     varchar2 default null
38   ,p_attribute14                   in     varchar2 default null
39   ,p_attribute15                   in     varchar2 default null
40   ,p_attribute16                   in     varchar2 default null
41   ,p_attribute17                   in     varchar2 default null
42   ,p_attribute18                   in     varchar2 default null
43   ,p_attribute19                   in     varchar2 default null
44   ,p_attribute20                   in     varchar2 default null
45   ,p_attendance_id                    out nocopy number
46   ,p_object_version_number            out nocopy number
47   ) is
48   --
49   -- Declare cursors and local variables
50   --
51 
52   l_proc                   varchar2(72) := g_package||'create_attended_estab';
53   l_effective_date         date;
54   l_attended_start_date    date;
55   l_attended_end_date      date;
56   l_attendance_id          number;
57   l_object_version_number  number;
58 begin
59   hr_utility.set_location('Entering:'|| l_proc, 10);
60   --
61   -- Issue a savepoint
62   --
63   savepoint CREATE_ATTENDED_ESTAB;
64   --
65   -- Truncate the time portion from all IN date parameters
66   --
67   l_effective_date     := TRUNC(p_effective_date);
68   l_attended_start_date:= TRUNC(p_attended_start_date);
69   l_attended_end_date  := TRUNC(p_attended_end_date);
70   --
71   -- Call Before Process User Hook
72   --
73   begin
74   PER_ESTAB_ATTENDANCES_BK1.CREATE_ATTENDED_ESTAB_b
75   (p_effective_date               => l_effective_date
76   ,p_business_group_id            => p_business_group_id
77   ,p_person_id                    => p_person_id
78   ,p_party_id                     => p_party_id
79   ,p_establishment_id             => p_establishment_id
80   ,p_establishment                => p_establishment
81   ,p_attended_start_date          => l_attended_start_date
82   ,p_attended_end_date            => l_attended_end_date
83   ,p_fulltime                     => p_fulltime
84   ,p_attribute_category           => p_attribute_category
85   ,p_attribute1                   => p_attribute1
86   ,p_attribute2                   => p_attribute2
87   ,p_attribute3                   => p_attribute3
88   ,p_attribute4                   => p_attribute4
89   ,p_attribute5                   => p_attribute5
90   ,p_attribute6                   => p_attribute6
91   ,p_attribute7                   => p_attribute7
92   ,p_attribute8                   => p_attribute8
93   ,p_attribute9                   => p_attribute9
94   ,p_attribute10                  => p_attribute10
95   ,p_attribute11                  => p_attribute11
96   ,p_attribute12                  => p_attribute12
97   ,p_attribute13                  => p_attribute13
98   ,p_attribute14                  => p_attribute14
99   ,p_attribute15                  => p_attribute15
100   ,p_attribute16                  => p_attribute16
101   ,p_attribute17                  => p_attribute17
102   ,p_attribute18                  => p_attribute18
103   ,p_attribute19                  => p_attribute19
104   ,p_attribute20                  => p_attribute20
105   ,p_address   			  => p_address
106   );
107   exception
108     when hr_api.cannot_find_prog_unit then
109       hr_api.cannot_find_prog_unit_error
110         (p_module_name => 'CREATE_ATTENDED_ESTAB_b'
111         ,p_hook_type   => 'BP'
112         );
113   end;
114 
115   --
116   -- Process Logic
117   --
118   per_esa_ins.ins
119   (p_validate                     => false
120   ,p_effective_date               => l_effective_date
121   ,p_business_group_id            => p_business_group_id
122   ,p_person_id                    => p_person_id
123   ,p_establishment_id             => p_establishment_id
124   ,p_establishment                => p_establishment
125   ,p_attended_start_date          => l_attended_start_date
126   ,p_attended_end_date            => l_attended_end_date
127   ,p_full_time                    => p_fulltime
128   ,p_attribute_category           => p_attribute_category
129   ,p_attribute1                   => p_attribute1
130   ,p_attribute2                   => p_attribute2
131   ,p_attribute3                   => p_attribute3
132   ,p_attribute4                   => p_attribute4
133   ,p_attribute5                   => p_attribute5
134   ,p_attribute6                   => p_attribute6
135   ,p_attribute7                   => p_attribute7
136   ,p_attribute8                   => p_attribute8
137   ,p_attribute9                   => p_attribute9
138   ,p_attribute10                  => p_attribute10
139   ,p_attribute11                  => p_attribute11
140   ,p_attribute12                  => p_attribute12
141   ,p_attribute13                  => p_attribute13
142   ,p_attribute14                  => p_attribute14
143   ,p_attribute15                  => p_attribute15
144   ,p_attribute16                  => p_attribute16
145   ,p_attribute17                  => p_attribute17
146   ,p_attribute18                  => p_attribute18
147   ,p_attribute19                  => p_attribute19
148   ,p_attribute20                  => p_attribute20
149   ,p_object_version_number        => l_object_version_number
150   ,p_attendance_id                => l_attendance_id
151   ,p_party_id                     => p_party_id
152   ,p_address			  => p_address
153   );
154 
155   --
156   -- Call After Process User Hook
157   --
158   begin
159   PER_ESTAB_ATTENDANCES_BK1.CREATE_ATTENDED_ESTAB_a
160   (p_effective_date               => l_effective_date
161   ,p_business_group_id            => p_business_group_id
162   ,p_person_id                    => p_person_id
163   ,p_party_id                     => p_party_id
164   ,p_establishment_id             => p_establishment_id
165   ,p_establishment                => p_establishment
166   ,p_attended_start_date          => l_attended_start_date
167   ,p_attended_end_date            => l_attended_end_date
168   ,p_fulltime                     => p_fulltime
169   ,p_attribute_category           => p_attribute_category
170   ,p_attribute1                   => p_attribute1
171   ,p_attribute2                   => p_attribute2
172   ,p_attribute3                   => p_attribute3
173   ,p_attribute4                   => p_attribute4
174   ,p_attribute5                   => p_attribute5
175   ,p_attribute6                   => p_attribute6
176   ,p_attribute7                   => p_attribute7
177   ,p_attribute8                   => p_attribute8
178   ,p_attribute9                   => p_attribute9
179   ,p_attribute10                  => p_attribute10
180   ,p_attribute11                  => p_attribute11
181   ,p_attribute12                  => p_attribute12
182   ,p_attribute13                  => p_attribute13
183   ,p_attribute14                  => p_attribute14
184   ,p_attribute15                  => p_attribute15
185   ,p_attribute16                  => p_attribute16
186   ,p_attribute17                  => p_attribute17
187   ,p_attribute18                  => p_attribute18
188   ,p_attribute19                  => p_attribute19
189   ,p_attribute20                  => p_attribute20
190   ,p_address                      => p_address
191   );
192 
193   exception
194     when hr_api.cannot_find_prog_unit then
195       hr_api.cannot_find_prog_unit_error
196         (p_module_name => 'CREATE_ATTENDED_ESTAB_a'
197         ,p_hook_type   => 'AP'
198         );
199   end;
200   --
201   -- When in validation only mode raise the Validate_Enabled exception
202   --
203   if p_validate then
204     raise hr_api.validate_enabled;
205   end if;
206   --
207   -- Set all output arguments
208   --
209   --
210   p_attendance_id := l_attendance_id;
211   p_object_version_number := l_object_version_number;
212   hr_utility.set_location(' Leaving:'||l_proc, 70);
213 exception
214   when hr_api.validate_enabled then
215     --
216     -- As the Validate_Enabled exception has been raised
217     -- we must rollback to the savepoint
218     --
219     rollback to CREATE_ATTENDED_ESTAB;
220     --
221     -- Only set output warning arguments
222     -- (Any key or derived arguments must be set to null
223     -- when validation only mode is being used.)
224     --
225     p_attendance_id := null;
226     p_object_version_number := null;
227     hr_utility.set_location(' Leaving:'||l_proc, 80);
228   when others then
229     --
230     -- A validation or unexpected error has occured
231     --
232     rollback to CREATE_ATTENDED_ESTAB;
233     --
234     -- set in out parameters and set out parameters
235     --
236     p_attendance_id := null;
237     p_object_version_number := null;
238     hr_utility.set_location(' Leaving:'||l_proc, 90);
239     raise;
240 end CREATE_ATTENDED_ESTAB;
241 --
242 --
243 -- ----------------------------------------------------------------------------
244 -- |-----------------------< UPDATE_ATTENDED_ESTAB >--------------------------|
245 -- ----------------------------------------------------------------------------
246 --
247 procedure UPDATE_ATTENDED_ESTAB
248   (p_validate                      in     boolean  default false
249   ,p_effective_date                in     date
250   ,p_attendance_id                 in     number
251   ,p_fulltime                      in     varchar2
252   ,p_attended_start_date           in     date     default hr_api.g_date
253   ,p_attended_end_date             in     date     default hr_api.g_date
254   ,p_establishment                 in     varchar2 default hr_api.g_varchar2
255   ,p_establishment_id              in     number   default hr_api.g_number
256   ,p_address			   in     varchar2 default hr_api.g_varchar2
257   ,p_attribute_category            in     varchar2 default hr_api.g_varchar2
258   ,p_attribute1                    in     varchar2 default hr_api.g_varchar2
259   ,p_attribute2                    in     varchar2 default hr_api.g_varchar2
260   ,p_attribute3                    in     varchar2 default hr_api.g_varchar2
261   ,p_attribute4                    in     varchar2 default hr_api.g_varchar2
262   ,p_attribute5                    in     varchar2 default hr_api.g_varchar2
263   ,p_attribute6                    in     varchar2 default hr_api.g_varchar2
264   ,p_attribute7                    in     varchar2 default hr_api.g_varchar2
265   ,p_attribute8                    in     varchar2 default hr_api.g_varchar2
266   ,p_attribute9                    in     varchar2 default hr_api.g_varchar2
267   ,p_attribute10                   in     varchar2 default hr_api.g_varchar2
268   ,p_attribute11                   in     varchar2 default hr_api.g_varchar2
269   ,p_attribute12                   in     varchar2 default hr_api.g_varchar2
270   ,p_attribute13                   in     varchar2 default hr_api.g_varchar2
271   ,p_attribute14                   in     varchar2 default hr_api.g_varchar2
272   ,p_attribute15                   in     varchar2 default hr_api.g_varchar2
273   ,p_attribute16                   in     varchar2 default hr_api.g_varchar2
274   ,p_attribute17                   in     varchar2 default hr_api.g_varchar2
275   ,p_attribute18                   in     varchar2 default hr_api.g_varchar2
276   ,p_attribute19                   in     varchar2 default hr_api.g_varchar2
277   ,p_attribute20                   in     varchar2 default hr_api.g_varchar2
278   ,p_object_version_number         in out nocopy number
279   ) is
280   --
281   -- Declare cursors and local variables
282   --
283 
284   l_proc                varchar2(72) := g_package||'update_attended_estab';
285   l_effective_date      date;
286   l_attended_start_date date;
287   l_attended_end_date   date;
288   l_object_version_number number;
289   l_ovn number := p_object_version_number;
290 begin
291   hr_utility.set_location('Entering:'|| l_proc, 10);
292   --
293   -- Issue a savepoint
294   --
295   savepoint UPDATE_ATTENDED_ESTAB;
296   --
297   -- Truncate the time portion from all IN date parameters
298   --
299   l_effective_date     := TRUNC(p_effective_date);
300   l_attended_start_date:= TRUNC(p_attended_start_date);
301   l_attended_end_date  := TRUNC(p_attended_end_date);
302   l_object_version_number := p_object_version_number;
303   --
304   -- Call Before Process User Hook
305   --
306   begin
307   PER_ESTAB_ATTENDANCES_BK2.UPDATE_ATTENDED_ESTAB_b
308   (p_effective_date               => l_effective_date
309   ,p_attendance_id                => p_attendance_id
310   ,p_establishment_id             => p_establishment_id
311   ,p_establishment                => p_establishment
312   ,p_attended_start_date          => l_attended_start_date
313   ,p_attended_end_date            => l_attended_end_date
314   ,p_fulltime                     => p_fulltime
315   ,p_attribute_category           => p_attribute_category
316   ,p_attribute1                   => p_attribute1
317   ,p_attribute2                   => p_attribute2
318   ,p_attribute3                   => p_attribute3
319   ,p_attribute4                   => p_attribute4
320   ,p_attribute5                   => p_attribute5
321   ,p_attribute6                   => p_attribute6
322   ,p_attribute7                   => p_attribute7
323   ,p_attribute8                   => p_attribute8
324   ,p_attribute9                   => p_attribute9
325   ,p_attribute10                  => p_attribute10
326   ,p_attribute11                  => p_attribute11
327   ,p_attribute12                  => p_attribute12
328   ,p_attribute13                  => p_attribute13
329   ,p_attribute14                  => p_attribute14
330   ,p_attribute15                  => p_attribute15
331   ,p_attribute16                  => p_attribute16
332   ,p_attribute17                  => p_attribute17
333   ,p_attribute18                  => p_attribute18
334   ,p_attribute19                  => p_attribute19
335   ,p_attribute20                  => p_attribute20
336   ,p_object_version_number        => l_object_version_number
337   ,p_address			  => p_address
338   );
339   exception
340     when hr_api.cannot_find_prog_unit then
341       hr_api.cannot_find_prog_unit_error
342         (p_module_name => 'UPDATE_ATTENDED_ESTAB_b'
343         ,p_hook_type   => 'BP'
344         );
345   end;
346 
347   --
348   -- Process Logic
349   --
350   per_esa_upd.upd
351   (p_validate                     => false
352   ,p_effective_date               => l_effective_date
353   ,p_establishment_id             => p_establishment_id
354   ,p_establishment                => p_establishment
355   ,p_attended_start_date          => l_attended_start_date
356   ,p_attended_end_date            => l_attended_end_date
357   ,p_full_time                    => p_fulltime
358   ,p_attribute_category           => p_attribute_category
359   ,p_attribute1                   => p_attribute1
360   ,p_attribute2                   => p_attribute2
361   ,p_attribute3                   => p_attribute3
362   ,p_attribute4                   => p_attribute4
363   ,p_attribute5                   => p_attribute5
364   ,p_attribute6                   => p_attribute6
365   ,p_attribute7                   => p_attribute7
366   ,p_attribute8                   => p_attribute8
367   ,p_attribute9                   => p_attribute9
368   ,p_attribute10                  => p_attribute10
369   ,p_attribute11                  => p_attribute11
370   ,p_attribute12                  => p_attribute12
371   ,p_attribute13                  => p_attribute13
372   ,p_attribute14                  => p_attribute14
373   ,p_attribute15                  => p_attribute15
374   ,p_attribute16                  => p_attribute16
375   ,p_attribute17                  => p_attribute17
376   ,p_attribute18                  => p_attribute18
377   ,p_attribute19                  => p_attribute19
378   ,p_attribute20                  => p_attribute20
379   ,p_object_version_number        => l_object_version_number
380   ,p_attendance_id                => p_attendance_id
381   ,p_address			  => p_address
382   );
383 
384   --
385   -- Call After Process User Hook
386   --
387   begin
388   PER_ESTAB_ATTENDANCES_BK2.UPDATE_ATTENDED_ESTAB_a
389   (p_effective_date               => l_effective_date
390   ,p_attendance_id                => p_attendance_id
391   ,p_establishment_id             => p_establishment_id
392   ,p_establishment                => p_establishment
393   ,p_attended_start_date          => l_attended_start_date
394   ,p_attended_end_date            => l_attended_end_date
395   ,p_fulltime                     => p_fulltime
396   ,p_attribute_category           => p_attribute_category
397   ,p_attribute1                   => p_attribute1
398   ,p_attribute2                   => p_attribute2
399   ,p_attribute3                   => p_attribute3
400   ,p_attribute4                   => p_attribute4
401   ,p_attribute5                   => p_attribute5
402   ,p_attribute6                   => p_attribute6
403   ,p_attribute7                   => p_attribute7
404   ,p_attribute8                   => p_attribute8
405   ,p_attribute9                   => p_attribute9
406   ,p_attribute10                  => p_attribute10
407   ,p_attribute11                  => p_attribute11
408   ,p_attribute12                  => p_attribute12
409   ,p_attribute13                  => p_attribute13
410   ,p_attribute14                  => p_attribute14
411   ,p_attribute15                  => p_attribute15
412   ,p_attribute16                  => p_attribute16
413   ,p_attribute17                  => p_attribute17
414   ,p_attribute18                  => p_attribute18
415   ,p_attribute19                  => p_attribute19
416   ,p_attribute20                  => p_attribute20
417   ,p_object_version_number        => l_object_version_number
418   ,p_address			  => p_address
419   );
420 
421   exception
422     when hr_api.cannot_find_prog_unit then
423       hr_api.cannot_find_prog_unit_error
424         (p_module_name => 'UPDATE_ATTENDED_ESTAB_a'
425         ,p_hook_type   => 'AP'
426         );
427   end;
428   --
429   -- When in validation only mode raise the Validate_Enabled exception
430   --
431   if p_validate then
432     raise hr_api.validate_enabled;
433   end if;
434   --
435   -- Set all output arguments
436   --
437   --
438   p_object_version_number := l_object_version_number;
439   hr_utility.set_location(' Leaving:'||l_proc, 70);
440 exception
441   when hr_api.validate_enabled then
442     --
443     -- As the Validate_Enabled exception has been raised
444     -- we must rollback to the savepoint
445     --
446     rollback to UPDATE_ATTENDED_ESTAB;
447     --
448     -- Only set output warning arguments
449     -- (Any key or derived arguments must be set to null
450     -- when validation only mode is being used.)
451     --
452     hr_utility.set_location(' Leaving:'||l_proc, 80);
453   when others then
454     --
455     -- A validation or unexpected error has occured
456     --
457     rollback to UPDATE_ATTENDED_ESTAB;
458     --
459     -- set in out parameters and set out parameters
460     --
461     p_object_version_number := l_ovn;
462     hr_utility.set_location(' Leaving:'||l_proc, 90);
463     raise;
464 end UPDATE_ATTENDED_ESTAB;
465 --
466 
467 --
468 -- ----------------------------------------------------------------------------
469 -- |-----------------------< DELETE_ATTENDED_ESTAB >--------------------------|
470 -- ----------------------------------------------------------------------------
471 --
472 procedure DELETE_ATTENDED_ESTAB
473   (p_validate                      in     boolean  default false
474   ,p_attendance_id                 in     number
475   ,p_object_version_number         in     number
476   ) is
477   --
478   -- Declare cursors and local variables
479   --
480 
481   l_proc                varchar2(72) := g_package||'delete_attended_estab';
482 begin
483   hr_utility.set_location('Entering:'|| l_proc, 10);
484   --
485   -- Issue a savepoint
486   --
487   savepoint DELETE_ATTENDED_ESTAB;
488   --
489   -- Call Before Process User Hook
490   --
491   begin
492   PER_ESTAB_ATTENDANCES_BK3.DELETE_ATTENDED_ESTAB_b
493   (p_attendance_id                => p_attendance_id
494   ,p_object_version_number        => p_object_version_number
495   );
496   exception
497     when hr_api.cannot_find_prog_unit then
498       hr_api.cannot_find_prog_unit_error
499         (p_module_name => 'DELETE_ATTENDED_ESTAB_b'
500         ,p_hook_type   => 'BP'
501         );
502   end;
503 
504   --
505   -- Process Logic
506   --
507   per_esa_del.del
508   (p_validate                     => false
509   ,p_attendance_id                => p_attendance_id
510   ,p_object_version_number        => p_object_version_number
511   );
512 
513 
514   --
515   -- Call After Process User Hook
516   --
517   begin
518   PER_ESTAB_ATTENDANCES_BK3.DELETE_ATTENDED_ESTAB_a
519   (p_attendance_id                => p_attendance_id
520   ,p_object_version_number        => p_object_version_number
521   );
522 
523   exception
524     when hr_api.cannot_find_prog_unit then
525       hr_api.cannot_find_prog_unit_error
526         (p_module_name => 'DELETE_ATTENDED_ESTAB_a'
527         ,p_hook_type   => 'AP'
528         );
529   end;
530   --
531   -- When in validation only mode raise the Validate_Enabled exception
532   --
533   if p_validate then
534     raise hr_api.validate_enabled;
535   end if;
536   --
537   -- Set all output arguments
538   --
539   --
540   hr_utility.set_location(' Leaving:'||l_proc, 70);
541 exception
542   when hr_api.validate_enabled then
543     --
544     -- As the Validate_Enabled exception has been raised
545     -- we must rollback to the savepoint
546     --
547     rollback to DELETE_ATTENDED_ESTAB;
548     --
549     -- Only set output warning arguments
550     -- (Any key or derived arguments must be set to null
551     -- when validation only mode is being used.)
552     --
553     hr_utility.set_location(' Leaving:'||l_proc, 80);
554   when others then
555     --
556     -- A validation or unexpected error has occured
557     --
558     rollback to DELETE_ATTENDED_ESTAB;
559     hr_utility.set_location(' Leaving:'||l_proc, 90);
560     raise;
561 end DELETE_ATTENDED_ESTAB;
562 --
563 end PER_ESTAB_ATTENDANCES_API;