DBA Data[Home] [Help]

PACKAGE BODY: APPS.IRC_VACANCY_CONSIDERATIONS_API

Source


1 Package Body IRC_VACANCY_CONSIDERATIONS_API as
2 /* $Header: irivcapi.pkb 120.7.12020000.3 2012/08/21 11:37:45 sbaswa ship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := '  IRC_VACANCY_CONSIDERATIONS_API.';
7 --
8 -- -------------------------------------------------------------------------
9 -- |----------------------< Remove_Html_Tags >-----------------------------|
10 -- -------------------------------------------------------------------------
11 --
12 FUNCTION remove_html_tags
13   ( p_html_string  in   varchar2
14   )
15 RETURN varchar2
16 IS
17   in_html                    BOOLEAN  := FALSE;
18   tempchar                   VARCHAR2(1);
19   l_return_string            VARCHAR2(500);
20 BEGIN
21   --
22   -- If the length of the brief description is more than 500 chars, then
23   -- remove the tags.
24   --
25   for i in 1 .. length(p_html_string) loop
26     tempchar := substr( p_html_string, i, 1 );
27     if in_html then
28       if tempchar = '>' then
29         in_html := FALSE;
30       end if;
31     else
32       if tempchar = '<' then
33         in_html := TRUE;
34       end if;
35     end if;
36     if not in_html and tempchar <> '>' then
37       l_return_string := l_return_string || tempchar;
38     end if;
39   end loop;
40 --
41   RETURN l_return_string;
42   EXCEPTION
43   WHEN OTHERS THEN
44     RETURN l_return_string;
45 --
46 END remove_html_tags;
47 --
48 --
49 -- ----------------------------------------------------------------------------
50 -- |----------------------< GET_EMAIL_MESSAGE_BODY >--------------------------|
51 -- ----------------------------------------------------------------------------
52 --
53 function get_email_message_body
54   (p_person_id                     in     number
55   ,p_vacancy_id                    in     number
56   ,p_effective_date                in     date
57   )
58 return varchar2 is
59   --
60   -- Declare cursors and local variables
61   --
62   cursor c_potential_applicant_details is
63     select first_name
64       from per_all_people_f
65      where  person_id = p_person_id;
66    --
67   cursor c_recruiter_details is
68     select ppl.full_name
69          , pj.name  job_name
70       from per_all_people_f ppl
71          , per_all_assignments_f pasg
72          , per_jobs pj
73      where ppl.person_id = fnd_global.employee_id
74        and ppl.person_id = pasg.person_id
75        and pasg.primary_flag = 'Y'
76        and pasg.job_id = pj.job_id(+)
77        and p_effective_date
78            between ppl.effective_start_date
79                and ppl.effective_end_date
80        and p_effective_date
81            between pasg.effective_start_date
82                and pasg.effective_end_date;
83    --
84   cursor c_posting_details is
85     select substr(pctl.brief_description,1,500)
86          , length(pctl.brief_description)
87          , pctl.job_title
88          , pctl.posting_content_id
89          , pctl.name
90       from per_recruitment_activity_for raf
91          , per_recruitment_activities ra
92          , irc_posting_contents_tl pctl
93      where raf.vacancy_id = p_vacancy_id
94        and raf.recruitment_activity_id = ra.recruitment_activity_id
95        and ra.posting_content_id = pctl.posting_content_id
96        and userenv('LANG') = pctl.language
97        and rownum = 1;
98   --
99   l_message_intro        VARCHAR2(2000) ;
100   l_message_conc         VARCHAR2(2000) ;
101   l_base_url             VARCHAR2(250);
102   l_whole_url            VARCHAR2(2000);
103   l_appl_first_name      VARCHAR2(150);
104   l_recr_full_name       VARCHAR2(150);
105   l_recr_job_name        VARCHAR2(150);
106   l_job_title            irc_posting_contents_tl.job_title%type;
107   l_posting_content_id   irc_posting_contents_tl.posting_content_id%type;
108   l_posting_content_name irc_posting_contents_tl.name%type;
109   l_name                 VARCHAR2(240);
110   l_brief_description_v  VARCHAR2(700) default '';
111   l_length               NUMBER;
112   l_user_name            VARCHAR2(240) ;
113   l_whole_message        VARCHAR2(32000);
114   l_proc                 VARCHAR2(72) := g_package||'get_email_message_body';
115   l_apps_fwk_agent       VARCHAR2(2000);
116   --
117 begin
118   hr_utility.set_location('Entering:'|| l_proc, 10);
119   --
120   -- Obtain all the data for use in the message.
121   --
122   --Commented for Bug 6004149
123   --l_base_url := fnd_profile.value('IRC_JOB_NOTIFICATION_URL');
124 
125   if (irc_utilities_pkg.is_internal_person(p_person_id,p_effective_date)='TRUE') then
126     l_apps_fwk_agent := rtrim(fnd_profile.value_specific('APPS_FRAMEWORK_AGENT',0,0,0,0,0)
127                           ||fnd_profile.value('ICX_PREFIX'),'/');
128     l_base_url := irc_seeker_vac_matching_pkg.get_job_notification_function('Y');
129   else
130     l_apps_fwk_agent := rtrim(nvl(fnd_profile.value('IRC_FRAMEWORK_AGENT'),fnd_profile.value('APPS_FRAMEWORK_AGENT'))
131                           ||fnd_profile.value('ICX_PREFIX'),'/');
132     l_base_url := irc_seeker_vac_matching_pkg.get_job_notification_function('N');
133   end if;
134   --
135   if l_base_url is null then
136     fnd_message.set_name('PER','IRC_412056_NO_EMAIL_JOB_URL');
137     fnd_message.raise_error;
138   end if;
139   --
140   open c_potential_applicant_details ;
141   fetch c_potential_applicant_details into l_appl_first_name;
142   close c_potential_applicant_details;
143   --
144   open c_recruiter_details ;
145   fetch c_recruiter_details into l_recr_full_name, l_recr_job_name ;
146   close c_recruiter_details ;
147   -- Get the advert details (inc a clob), convert to a v2 for workflow to accept.
148   open c_posting_details ;
149   fetch c_posting_details into l_brief_description_v, l_length, l_job_title, l_posting_content_id, l_posting_content_name ;
150   close c_posting_details;
151   --
152   -- Incase the job_title is null, Display posting name.
153   if ( l_job_title is null ) then
154      l_name := l_posting_content_name;
155   else
156      l_name := l_job_title;
157   end if;
158   --
159   l_whole_url:= '<a HREF="'
160                ||   l_apps_fwk_agent
161                ||   '/OA_HTML/OA.jsp?OAFunc='
162                ||   l_base_url
163                ||   '&p_svid='||to_char(p_vacancy_id)
164                ||   '&p_spid='||to_char(l_posting_content_id)
165                ||   '">'
166                ||   l_name
167                ||   '</a>';
168   --
169   -- Remove the html tags if the brief description length is more than 500 charactrers.
170   --
171   IF (l_length > 0) THEN
172     IF (l_length > 500) then
173        l_brief_description_v := remove_html_tags (l_brief_description_v) || ' ...';
174     END IF;
175   --
176   ELSE
177     l_brief_description_v := '';
178   END IF;
179   --
180   l_user_name := irc_notification_helper_pkg.get_job_seekers_role(p_person_id => p_person_id);
181   --
182   -- Build the message up.
183   --
184   fnd_message.set_name('PER','IRC_PURSUE_SEEKER_INTRO');
185   fnd_message.set_token('SEEKER_FIRST_NAME',l_appl_first_name );
186   fnd_message.set_token('VAC_JOB_TITLE', l_name);
187   l_message_intro := fnd_message.get;
188   --
189   fnd_message.set_name('PER','IRC_PURSUE_SEEKER_CONC');
190   fnd_message.set_token('URL', l_whole_url);
191   fnd_message.set_token('SENDER_FULL_NAME', l_recr_full_name);
192   fnd_message.set_token('SENDER_JOB_TITLE', l_recr_job_name);
193   l_message_conc := fnd_message.get;
194   --
195   l_whole_message := l_message_intro
196                   || '<br>' || l_brief_description_v||'<br><br>'
197                   || l_message_conc ;
198   --
199   RETURN l_whole_message;
200   --
201   hr_utility.set_location('Leaving:'|| l_proc, 100);
202 end get_email_message_body;
203 --
204 -- ----------------------------------------------------------------------------
205 -- |----------------------< GET_TEXT_MESSAGE_BODY >---------------------------|
206 -- ----------------------------------------------------------------------------
207 function get_text_message_body
208   (p_person_id                     in     number
209   ,p_vacancy_id                    in     number
210   ,p_effective_date                in     date
211   )
212 return varchar2 is
213   --
214   -- Declare cursors and local variables
215   --
216   cursor c_potential_applicant_details is
217     select first_name
218       from per_all_people_f
219      where  person_id = p_person_id;
220    --
221   cursor c_recruiter_details is
222     select ppl.full_name
223          , pj.name  job_name
224       from per_all_people_f ppl
225          , per_all_assignments_f pasg
226          , per_jobs pj
227      where ppl.person_id = fnd_global.employee_id
228        and ppl.person_id = pasg.person_id
229        and pasg.primary_flag = 'Y'
230        and pasg.job_id = pj.job_id(+)
231        and p_effective_date
232            between ppl.effective_start_date
233                and ppl.effective_end_date
234        and p_effective_date
235            between pasg.effective_start_date
236                and pasg.effective_end_date;
237    --
238   cursor c_posting_details is
239     select substr(pctl.brief_description,1,500)
240          , length(pctl.brief_description)
241          , pctl.job_title
242          , pctl.posting_content_id
243          , pctl.name
244       from per_recruitment_activity_for raf
245          , per_recruitment_activities ra
246          , irc_posting_contents_tl pctl
247      where raf.vacancy_id = p_vacancy_id
248        and raf.recruitment_activity_id = ra.recruitment_activity_id
249        and ra.posting_content_id = pctl.posting_content_id
250        and userenv('LANG') = pctl.language
251        and rownum = 1;
252   --
253   l_message_intro        VARCHAR2(2000) ;
254   l_message_conc         VARCHAR2(2000) ;
255   l_base_url             VARCHAR2(250);
256   l_whole_url            VARCHAR2(2000);
257   l_appl_first_name      VARCHAR2(150);
258   l_recr_full_name       VARCHAR2(150);
259   l_recr_job_name        VARCHAR2(150);
260   l_job_title            irc_posting_contents_tl.job_title%type;
261   l_posting_content_id   irc_posting_contents_tl.posting_content_id%type;
262   l_posting_content_name irc_posting_contents_tl.name%type;
263   l_name                 VARCHAR2(240);
264   l_brief_description_v  VARCHAR2(700) default '';
265   l_length               NUMBER;
266   l_user_name            VARCHAR2(240) ;
267   l_whole_message        VARCHAR2(32000);
268   l_proc                 VARCHAR2(72) := g_package||'get_text_message_body';
269   l_apps_fwk_agent       VARCHAR2(2000);
270   --
271 begin
272   hr_utility.set_location('Entering:'|| l_proc, 10);
273   --
274   -- Obtain all the data for use in the message.
275   --
276   --Commented for Bug 6004149
277   --l_base_url := fnd_profile.value('IRC_JOB_NOTIFICATION_URL');
278   if (irc_utilities_pkg.is_internal_person(p_person_id,p_effective_date)='TRUE') then
279     l_apps_fwk_agent := rtrim(fnd_profile.value_specific('APPS_FRAMEWORK_AGENT',0,0,0,0,0)
280                           ||fnd_profile.value('ICX_PREFIX'),'/');
281     l_base_url := irc_seeker_vac_matching_pkg.get_job_notification_function('Y');
282   else
283     l_apps_fwk_agent := rtrim(nvl(fnd_profile.value('IRC_FRAMEWORK_AGENT'),fnd_profile.value('APPS_FRAMEWORK_AGENT'))
284                           ||fnd_profile.value('ICX_PREFIX'),'/');
285     l_base_url := irc_seeker_vac_matching_pkg.get_job_notification_function('N');
286   end if;
287   --
288   if l_base_url is null then
289     fnd_message.set_name('PER','IRC_412056_NO_EMAIL_JOB_URL');
290     fnd_message.raise_error;
291   end if;
292   --
293   open c_potential_applicant_details ;
294   fetch c_potential_applicant_details into l_appl_first_name;
295   close c_potential_applicant_details;
296   --
297   open c_recruiter_details ;
298   fetch c_recruiter_details into l_recr_full_name, l_recr_job_name ;
299   close c_recruiter_details ;
300   -- Get the advert details (inc a clob), convert to a v2 for workflow to accept.
301   open c_posting_details ;
302   fetch c_posting_details into l_brief_description_v, l_length, l_job_title, l_posting_content_id, l_posting_content_name ;
303   close c_posting_details;
304   --
305   -- Incase the job_title is null, Display posting name.
306   if ( l_job_title is null ) then
307      l_name := l_posting_content_name;
308   else
309      l_name := l_job_title;
310   end if;
311   --
312   l_whole_url:=    l_apps_fwk_agent
313                ||   '/OA_HTML/OA.jsp?OAFunc='
314                ||   l_base_url
315                ||   '&p_svid='||to_char(p_vacancy_id)
316                ||   '&p_spid='||to_char(l_posting_content_id);
317   --
318   -- Remove the html tags to display the text content.
319   --
320   IF (l_length > 0) THEN
321      l_brief_description_v := remove_html_tags (l_brief_description_v) || ' ...';
322   --
323   ELSE
324     l_brief_description_v := '';
325   END IF;
326   --
327   l_user_name := irc_notification_helper_pkg.get_job_seekers_role(p_person_id => p_person_id);
328   --
329   -- Build the message up.
330   --
331   fnd_message.set_name('PER','IRC_PURSUE_SEEKER_INTRO_TEXT');
332   fnd_message.set_token('SEEKER_FIRST_NAME',l_appl_first_name );
333   fnd_message.set_token('VAC_JOB_TITLE', l_name);
334   l_message_intro := fnd_message.get;
335   --
336   fnd_message.set_name('PER','IRC_PURSUE_SEEKER_CONC_TEXT');
337   fnd_message.set_token('URL', l_whole_url);
338   fnd_message.set_token('SENDER_FULL_NAME', l_recr_full_name);
339   fnd_message.set_token('SENDER_JOB_TITLE', l_recr_job_name);
340   l_message_conc := fnd_message.get;
341   --
342   l_whole_message := l_message_intro
343                   || '\n' || l_brief_description_v||'\n\n'
344                   || l_message_conc ;
345   --
346   RETURN l_whole_message;
347   --
348   hr_utility.set_location('Leaving:'|| l_proc, 100);
349 end get_text_message_body;
350 
351 -- ----------------------------------------------------------------------------
352 -- |--------------------------< NOTIFY_SEEKER_IF_REQUIRED >-------------------|
353 -- ----------------------------------------------------------------------------
354 -- Comment
355 --   This procedure will send an email to a job seeker under certain
356 --   circumstances.
357 procedure notify_seeker_if_required
358   (p_person_id                     in     number
359   ,p_vacancy_id                    in     number
360   ,p_consideration_status          in     varchar2
361   ,p_effective_date                in     date
362   ,p_validate_only                 in     boolean)
363 is
364  --
365   -- Declare cursors and local variables
366   --
367   l_proc                    varchar2(72) := g_package||
368                                             'notify_seeker_if_required';
369   l_message_subject      VARCHAR2(240);
370 
371   --
372   l_id                   NUMBER;
373   l_rec_found varchar2(1);
374   l_user_role varchar2(240);
375   l_dft_lang  varchar2(20);
376   l_user_lang varchar2(20);
377 
378   --
379   cursor c_posting_details is
380     select null
381       from per_recruitment_activity_for raf
382          , per_recruitment_activities ra
383          , irc_posting_contents_tl pctl
384      where raf.vacancy_id = p_vacancy_id
385        and raf.recruitment_activity_id = ra.recruitment_activity_id
386        and ra.posting_content_id = pctl.posting_content_id
387        and userenv('LANG') = pctl.language
388        and rownum = 1;
389 
390   --- starting Added for 14500909
391   cursor get_nls_lang (p_dft_lang varchar2) is
392       select NLS_LANGUAGE
393         from fnd_languages_vl
394        where language_code = p_dft_lang;
395 
396   cursor get_user_lang(p_user_name varchar2) is
397   select FND_PROFILE.value_specific('ICX_LANGUAGE',usr.user_id)
398          from fnd_user usr
399          where usr.user_name = p_user_name;
400      --- End Added for 14500909
401 begin
402   hr_utility.set_location('Entering:'|| l_proc, 10);
403   --
404   -- An email only need to be sent under certain conditions
405   --
406   if p_consideration_status = 'PURSUE'  and p_validate_only = FALSE then
407     --
408     open c_posting_details;
409     fetch c_posting_details into l_rec_found;
410     if(c_posting_details%notfound)
411     then
412       close c_posting_details;
413       fnd_message.set_name('PER','IRC_412148_VAC_NO_POSTING');
414       fnd_message.raise_error;
415     end if;
416     close c_posting_details;
417     l_user_role := irc_notification_helper_pkg.get_job_seekers_role(p_person_id => p_person_id);
418 
419    --- Starting Added for 14500909
420 
421     open get_nls_lang(userenv('LANG'));
422     fetch get_nls_lang into l_dft_lang;
423     close get_nls_lang;
424 
425     open get_user_lang(l_user_role);
426     fetch get_user_lang into l_user_lang;
427     close get_user_lang;
428 
429    --- End Added for 14500909
430 
431 
432     if(l_user_role is not null ) then
433       -- Starting Added for 14500909
434       if l_dft_lang <> l_user_lang then
435 	   DBMS_SESSION.SET_NLS('NLS_LANGUAGE',''''||l_user_lang||'''');
436       end if;
437       l_message_subject := fnd_message.get_string('PER','IRC_PURSUE_SEEKER_SUBJECT');
438        --- End Added for 14500909
439 
440       l_id := irc_notification_helper_pkg.send_notification
441                     ( p_person_id  => p_person_id
442                     , p_subject   => l_message_subject
443                     , p_html_body => get_email_message_body
444                                     ( p_person_id      => p_person_id
445                                     , p_vacancy_id     => p_vacancy_id
446                                     , p_effective_date => p_effective_date)
447                     , p_text_body => get_text_message_body
448                                         ( p_person_id      => p_person_id
449                                         , p_vacancy_id     => p_vacancy_id
450                                         , p_effective_date => p_effective_date)
451                     );
452     end if;
453   end if;
454   --
455   hr_utility.set_location('Leaving:'|| l_proc, 100);
456 exception
457 when others then
458   -- Let the calling code handle any errors
459   DBMS_SESSION.SET_NLS('NLS_LANGUAGE',''''||l_dft_lang||'''');
460   raise;
461 end notify_seeker_if_required;
462 -- ----------------------------------------------------------------------------
463 -- |--------------------------< CREATE_VACANCY_CONSIDERATION >----------------|
464 -- ----------------------------------------------------------------------------
465 --
466 procedure create_vacancy_consideration
467   (p_validate                      in     boolean  default false
468   ,p_person_id                     in     number
469   ,p_vacancy_id                    in     number
470   ,p_consideration_status          in     varchar2 default 'CONSIDER'
471   ,p_vacancy_consideration_id      out nocopy number
472   ,p_object_version_number         out nocopy    number
473   ,p_effective_date                in     date
474   )is
475   --
476   -- Declare cursors and local variables
477   --
478   --
479   l_proc                    varchar2(72) := g_package||
480                                             'create_vacancy_consideration';
481   l_vacancy_consideration_id number;
482   l_object_version_number   number;
483   l_effective_date          date;
484   --
485 begin
486   hr_utility.set_location('Entering:'|| l_proc, 10);
487   --
488   -- Issue a savepoint
489   --
490   savepoint create_vacancy_consideration;
491   --
492   -- Truncate the time portion from all IN date parameters
493   --
494   l_effective_date := trunc(p_effective_date);
495   --
496   -- Call Before Process User Hook
497   --
498   begin
499     IRC_VACANCY_CONSIDERATIONS_BK1.CREATE_VACANCY_CONSIDERATION_B
500     (
501      p_person_id            =>   p_person_id
502     ,p_vacancy_id           =>   p_vacancy_id
503     ,p_consideration_status =>   p_consideration_status
504     ,p_effective_date       =>   l_effective_date
505     );
506   exception
507     when hr_api.cannot_find_prog_unit then
508       hr_api.cannot_find_prog_unit_error
509         (p_module_name => 'CREATE_VACANCY_CONSIDERATION'
510         ,p_hook_type   => 'BP'
511         );
512   end;
513   --
514   -- Process Logic
515   --
516   irc_ivc_ins.ins
517   (
518    p_person_id                      => p_person_id
519   ,p_vacancy_id                     => p_vacancy_id
520   ,p_consideration_status           => p_consideration_status
521   ,p_vacancy_consideration_id       => l_vacancy_consideration_id
522   ,p_object_version_number          => l_object_version_number
523   ,p_effective_date                 => l_effective_date
524   );
525   --
526   notify_seeker_if_required
527   (p_person_id                      => p_person_id
528   ,p_vacancy_id                     => p_vacancy_id
529   ,p_consideration_status           => p_consideration_status
530   ,p_effective_date                 => l_effective_date
531   ,p_validate_only                  => p_validate
532   );
533   --
534   -- Call After Process User Hook
535   --
536   begin
537     IRC_VACANCY_CONSIDERATIONS_BK1.CREATE_VACANCY_CONSIDERATION_A
538     (p_vacancy_consideration_id     => l_vacancy_consideration_id
539     ,p_person_id                    => p_person_id
540     ,p_vacancy_id                   => p_vacancy_id
541     ,p_consideration_status         => p_consideration_status
542     ,p_object_version_number        => l_object_version_number
543     ,p_effective_date               => l_effective_date
544     );
545   exception
546     when hr_api.cannot_find_prog_unit then
547       hr_api.cannot_find_prog_unit_error
548         (p_module_name => 'CREATE_VACANCY_CONSIDERATION'
549         ,p_hook_type   => 'AP'
550         );
551   end;
552   --
553   -- When in validation only mode raise the Validate_Enabled exception
554   --
555   if p_validate then
556     raise hr_api.validate_enabled;
557   end if;
558   --
559   -- Set all output arguments
560   --
561   p_object_version_number  := l_object_version_number;
562   p_vacancy_consideration_id := l_vacancy_consideration_id;
563   --
564   hr_utility.set_location(' Leaving:'||l_proc, 70);
565 exception
566   when hr_api.validate_enabled then
567     --
568     -- As the Validate_Enabled exception has been raised
569     -- we must rollback to the savepoint
570     --
571     rollback to CREATE_VACANCY_CONSIDERATION;
572     --
573     -- Only set output warning arguments
574     -- (Any key or derived arguments must be set to null
575     -- when validation only mode is being used.)
576     --
577     p_object_version_number  := null;
578     p_vacancy_consideration_id := null;
579     hr_utility.set_location(' Leaving:'||l_proc, 80);
580   when others then
581     --
582     -- A validation or unexpected error has occured
583     --
584     rollback to CREATE_VACANCY_CONSIDERATION;
585     --
586     -- Reset IN OUT parameters and set OUT parameters
587     --
588     p_object_version_number := null;
589     p_vacancy_consideration_id := null;
590     hr_utility.set_location(' Leaving:'||l_proc, 90);
591     raise;
592 end CREATE_VACANCY_CONSIDERATION;
593 --
594 -- ----------------------------------------------------------------------------
595 -- |--------------------------< UPDATE_VACANCY_CONSIDERATION >----------------|
596 -- ----------------------------------------------------------------------------
597 --
598 procedure update_vacancy_consideration
599   (p_validate                      in     boolean  default false
600   ,p_vacancy_consideration_id      in     number
601   ,p_party_id                      in     number   default hr_api.g_number
602   ,p_consideration_status          in     varchar2 default hr_api.g_varchar2
603   ,p_object_version_number         in out nocopy number
604   ,p_effective_date                in     date
605   ) is
606 --
607   --
608   -- Declare cursors and local variables
609   --
610   l_proc              varchar2(72) := g_package||
611                                            'update_vacancy_consideration';
612   l_object_version_number  number := p_object_version_number;
613   l_effective_date    date;
614   l_person_id         number;
615   l_vacancy_id        number;
616   cursor csr_person_vac is
617       Select person_id, vacancy_id
618         from irc_vacancy_considerations
619        where vacancy_consideration_id = p_vacancy_consideration_id;
620 --
621 begin
622   hr_utility.set_location('Entering:'|| l_proc, 10);
623   --
624   -- Issue a savepoint
625   --
626   savepoint update_vacancy_consideration;
627   --
628   -- Truncate the time portion from all IN date parameters
629   --
630   l_effective_date := trunc(p_effective_date);
631   --
632   -- Call Before Process User Hook
633   --
634   begin
635     IRC_VACANCY_CONSIDERATIONS_BK2.UPDATE_VACANCY_CONSIDERATION_B
636     (
637      p_vacancy_consideration_id =>   p_vacancy_consideration_id
638     ,p_party_id                 =>   p_party_id
639     ,p_consideration_status     =>   p_consideration_status
640     ,p_object_version_number    =>   l_object_version_number
641     ,p_effective_date           =>   l_effective_date
642     );
643   exception
644     when hr_api.cannot_find_prog_unit then
645       hr_api.cannot_find_prog_unit_error
646         (p_module_name => 'UPDATE_VACANCY_CONSIDERATION'
647         ,p_hook_type   => 'BP'
648         );
649   end;
650   --
651   -- Process Logic
652   --
653   irc_ivc_upd.upd
654   (
655    p_vacancy_consideration_id => p_vacancy_consideration_id
656   ,p_party_id                 => p_party_id
657   ,p_consideration_status     => p_consideration_status
658   ,p_object_version_number    => l_object_version_number
659   ,p_effective_date           => l_effective_date
660   );
661   --
662   --
663   open csr_person_vac;
664   fetch csr_person_vac into l_person_id, l_vacancy_id;
665   close csr_person_vac;
666   notify_seeker_if_required
667   (p_person_id                      => l_person_id
668   ,p_vacancy_id                     => l_vacancy_id
669   ,p_consideration_status           => p_consideration_status
670   ,p_effective_date                 => l_effective_date
671   ,p_validate_only                  => p_validate
672   );
673   -- Call After Process User Hook
674   --
675   begin
676     IRC_VACANCY_CONSIDERATIONS_BK2.UPDATE_VACANCY_CONSIDERATION_A
677     (p_vacancy_consideration_id => p_vacancy_consideration_id
678     ,p_party_id                 => p_party_id
679     ,p_consideration_status     => p_consideration_status
680     ,p_object_version_number    => l_object_version_number
681     ,p_effective_date           => l_effective_date
682     );
683   exception
684     when hr_api.cannot_find_prog_unit then
685       hr_api.cannot_find_prog_unit_error
686         (p_module_name => 'UPDATE_VACANCY_CONSIDERATION'
687         ,p_hook_type   => 'AP'
688         );
689   end;
690   --
691   -- When in validation only mode raise the Validate_Enabled exception
692   --
693   if p_validate then
694     raise hr_api.validate_enabled;
695   end if;
696   --
697   -- Set all output arguments
698   --
699   p_object_version_number := l_object_version_number;
700   --
701   hr_utility.set_location(' Leaving:'||l_proc, 70);
702 exception
703   when hr_api.validate_enabled then
704     --
705     -- As the Validate_Enabled exception has been raised
706     -- we must rollback to the savepoint
707     --
708     rollback to UPDATE_VACANCY_CONSIDERATION;
709     --
710     -- Only set output warning arguments
711     -- (Any key or derived arguments must be set to null
712     -- when validation only mode is being used.)
713     --
714     p_object_version_number := l_object_version_number;
715     hr_utility.set_location(' Leaving:'||l_proc, 80);
716   when others then
717     --
718     -- A validation or unexpected error has occured
719     --
720     rollback to UPDATE_VACANCY_CONSIDERATION;
721     --
722     -- Reset IN OUT parameters and set OUT parameters
723     --
724     p_object_version_number := l_object_version_number;
725     hr_utility.set_location(' Leaving:'||l_proc, 90);
726     raise;
727 end UPDATE_VACANCY_CONSIDERATION;
728 --
729 -- ----------------------------------------------------------------------------
730 -- |--------------------------< DELETE_VACANCY_CONSIDERATION >----------------|
731 -- ----------------------------------------------------------------------------
732 --
733 procedure delete_vacancy_consideration
734   (p_validate                      in     boolean  default false
735   ,p_vacancy_consideration_id      in     number
736   ,p_object_version_number         in     number
737   ) is
738   --
739   -- Declare cursors and local variables
740   --
741   l_proc                varchar2(72) := g_package||
742                                         'delete_vacancy_consideration';
743 begin
744   hr_utility.set_location('Entering:'|| l_proc, 10);
745   --
746   -- Issue a savepoint
747   --
748   savepoint delete_vacancy_consideration;
749   --
750   -- Call Before Process User Hook
751   --
752   begin
753     IRC_VACANCY_CONSIDERATIONS_BK3.DELETE_VACANCY_CONSIDERATION_B
754     (p_vacancy_consideration_id      => p_vacancy_consideration_id
755     ,p_object_version_number         => p_object_version_number
756     );
757   exception
758     when hr_api.cannot_find_prog_unit then
759       hr_api.cannot_find_prog_unit_error
760         (p_module_name => 'DELETE_VACANCY_CONSIDERATION'
761         ,p_hook_type   => 'BP'
762         );
763   end;
764   --
765   -- Process Logic
766   --
767   irc_ivc_del.del
768   (p_vacancy_consideration_id      => p_vacancy_consideration_id
769   ,p_object_version_number         => p_object_version_number
770   );
771   --
772   -- Call After Process User Hook
773   --
774   begin
775      IRC_VACANCY_CONSIDERATIONS_BK3.DELETE_VACANCY_CONSIDERATION_A
776     (
777      p_vacancy_consideration_id  => p_vacancy_consideration_id
778     ,p_object_version_number     => p_object_version_number
779     );
780   exception
781     when hr_api.cannot_find_prog_unit then
782       hr_api.cannot_find_prog_unit_error
783         (p_module_name => 'DELETE_VACANCY_CONSIDERATION'
784         ,p_hook_type   => 'AP'
785         );
786   end;
787   --
788   -- When in validation only mode raise the Validate_Enabled exception
789   --
790   if p_validate then
791     raise hr_api.validate_enabled;
792   end if;
793   --
794   -- Set all output arguments
795   --
796   --
797   hr_utility.set_location(' Leaving:'||l_proc, 70);
798 exception
799   when hr_api.validate_enabled then
800     --
801     -- As the Validate_Enabled exception has been raised
802     -- we must rollback to the savepoint
803     --
804     rollback to DELETE_VACANCY_CONSIDERATION;
805     --
806     -- Only set output warning arguments
807     -- (Any key or derived arguments must be set to null
808     -- when validation only mode is being used.)
809     --
810     hr_utility.set_location(' Leaving:'||l_proc, 80);
811   when others then
812     --
813     -- A validation or unexpected error has occured
814     --
815     rollback to DELETE_VACANCY_CONSIDERATION;
816     hr_utility.set_location(' Leaving:'||l_proc, 90);
817     raise;
818 end DELETE_VACANCY_CONSIDERATION;
819 --
820 end IRC_VACANCY_CONSIDERATIONS_API;