1 Package Body irc_iss_bus as
2 /* $Header: irissrhi.pkb 120.0.12000000.1 2007/03/23 11:28:28 vboggava noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' irc_iss_bus.'; -- Global package name
9 --
10 -- The following two global variables are only to be
11 -- used by the return_legislation_code function.
12 --
13 g_legislation_code varchar2(150) default null;
14 g_saved_search_criteria_id number default null;
15 --
16 -- ---------------------------------------------------------------------------
17 -- |----------------------< set_security_group_id >--------------------------|
18 -- ---------------------------------------------------------------------------
19 --
20
21 --
22 -- ---------------------------------------------------------------------------
23 -- |---------------------< return_legislation_code >-------------------------|
24 -- ---------------------------------------------------------------------------
25 --
26
27 --
28 -- ----------------------------------------------------------------------------
29 -- |-----------------------< chk_non_updateable_args >------------------------|
30 -- ----------------------------------------------------------------------------
31 -- {Start Of Comments}
32 --
33 -- Description:
34 -- This procedure is used to ensure that non updateable attributes have
35 -- not been updated. If an attribute has been updated an error is generated.
36 --
37 -- Pre Conditions:
38 -- g_old_rec has been populated with details of the values currently in
39 -- the database.
40 --
41 -- In Arguments:
42 -- p_rec has been populated with the updated values the user would like the
43 -- record set to.
44 --
45 -- Post Success:
46 -- Processing continues if all the non updateable attributes have not
47 -- changed.
48 --
49 -- Post Failure:
50 -- An application error is raised if any of the non updatable attributes
51 -- have been altered.
52 --
53 -- {End Of Comments}
54 -- ----------------------------------------------------------------------------
55 Procedure chk_non_updateable_args
56 (p_rec in irc_iss_shd.g_rec_type
57 ) IS
58 --
59 l_proc varchar2(72) := g_package || 'chk_non_updateable_args';
60 --
61 Begin
62 --
63 -- Only proceed with the validation if a row exists for the current
64 -- record in the HR Schema.
65 --
66 IF NOT irc_iss_shd.api_updating
67 (p_saved_search_criteria_id => p_rec.saved_search_criteria_id
68 ,p_object_version_number => p_rec.object_version_number
69 ) THEN
70 fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
71 fnd_message.set_token('PROCEDURE ', l_proc);
72 fnd_message.set_token('STEP ', '5');
73 fnd_message.raise_error;
74 END IF;
75 --
76 if p_rec.saved_search_criteria_id <> irc_iss_shd.g_old_rec.saved_search_criteria_id
77 then
78 hr_api.argument_changed_error
79 (p_api_name => l_proc
80 ,p_argument => 'SAVED_SEARCH_CRITERIA_ID'
81 ,p_base_table => irc_iss_shd.g_tab_nam
82 );
83 end if;
84 --
85 End chk_non_updateable_args;
86 -- ----------------------------------------------------------------------------
87 -- |---------------------------< chk_vacancy_id >-----------------------------|
88 -- ----------------------------------------------------------------------------
89 --
90 -- Description:
91 -- Verifies that the vacancy_id exists in PER_ALL_VACANCIES_F.
92 --
93 -- Prerequisites:
94 -- Must be called as the first step in insert_validate.
95 --
96 -- In Arguments:
97 -- p_vacancy_id
98 --
99 -- Post Success:
100 -- If vacancy_id exists in PER_ALL_VACANCIES_F, then continue.
101 --
102 -- Post Failure:
103 -- If the p_vacancy_id does not exists in PER_ALL_VACANCIES_F, then throw
104 -- an error indicating the same.
105 --
106 -- Access Status:
107 -- Internal Row Handler Use Only.
108 --
109 procedure chk_vacancy_id
110 (p_vacancy_id in number
111 ,p_saved_search_criteria_id in
112 irc_saved_search_criteria.saved_search_criteria_id%TYPE
113 ,p_object_version_number in
114 irc_saved_search_criteria.object_version_number%TYPE
115 )
116 IS
117 --
118 l_proc varchar2(72) := g_package||'chk_vacancy_id';
119 l_api_updating boolean;
120 l_dummy varchar2(1);
121 --
122 cursor vacancy_exists(p_vacancy_id number) is
123 select null
124 from per_all_vacancies
125 where vacancy_id = p_vacancy_id;
126 --
127 Begin
128 --
129 hr_utility.set_location('Entering:'|| l_proc, 10);
130 --
131 l_api_updating := irc_iss_shd.api_updating
132 (p_saved_search_criteria_id => p_saved_search_criteria_id
133 ,p_object_version_number => p_object_version_number
134 );
135 --
136 if ((l_api_updating and
137 nvl(irc_iss_shd.g_old_rec.vacancy_id, hr_api.g_number) <>
138 nvl(p_vacancy_id, hr_api.g_number)) or
139 (NOT l_api_updating)) then
140 hr_utility.set_location(l_proc, 20);
141 --
142 -- Check if p_vacancy_id is not null
143 --
144 if p_vacancy_id IS NOT NULL then
145 --
146 -- p_vacancy_id must exist in PER_ALL_VACANCIES_F
147 --
148 open vacancy_exists(p_vacancy_id);
149 fetch vacancy_exists into l_dummy;
150 --
151 if vacancy_exists%notfound then
152 close vacancy_exists;
153 hr_utility.set_location(l_proc, 30);
154 fnd_message.set_name('PER', 'HR_52591_CEL_INVL_VAC_ID ');
155 fnd_message.raise_error;
156 else
157 close vacancy_exists;
158 end if;
159 --
160 end if;
161 end if;
162 hr_utility.set_location('Leaving: '||l_proc, 50);
163 exception
164 when app_exception.application_exception then
165 if hr_multi_message.exception_add
166 (p_associated_column1 => 'IRC_SAVED_SEARCH_CRITERIA.VACANCY_ID'
167 ) then
168 raise;
169 end if;
170 end chk_vacancy_id;
171 --
172 -- ----------------------------------------------------------------------------
173 --
174 -- ----------------------------------------------------------------------------
175 -- |---------------------------< insert_validate >----------------------------|
176 -- ----------------------------------------------------------------------------
177 Procedure insert_validate
178 (p_rec in irc_iss_shd.g_rec_type
179 ) is
180 --
181 l_proc varchar2(72) := g_package||'insert_validate';
182 --
183 Begin
184 hr_utility.set_location('Entering:'||l_proc, 5);
185 --
186 -- Call all supporting business operations
187 --
188 -- "-- CLIENT_INFO not set. No lookup validation or joins to HR_LOOKUPS."
189 --
190 -- Validate Dependent Attributes
191 -- This procedure check for given vacancy id is valid or not
192
193
194 If (p_rec.vacancy_id is not null) then
195 chk_vacancy_id
196 (p_vacancy_id => p_rec.vacancy_id
197 ,p_saved_search_criteria_id => p_rec.saved_search_criteria_id
198 ,p_object_version_number => p_rec.object_version_number
199 );
200 End if;
201 hr_utility.set_location(' Leaving:'||l_proc, 10);
202 End insert_validate;
203 --
204 -- ----------------------------------------------------------------------------
205 -- |---------------------------< update_validate >----------------------------|
206 -- ----------------------------------------------------------------------------
207 Procedure update_validate
208 (p_rec in irc_iss_shd.g_rec_type
209 ) is
210 --
211 l_proc varchar2(72) := g_package||'update_validate';
212 --
213 Begin
214 hr_utility.set_location('Entering:'||l_proc, 5);
215 --
216 -- Call all supporting business operations
217 --
218 --
219 -- EDIT_HERE: As this table does not have a mandatory business_group_id
220 -- column, ensure client_info is populated by calling a suitable
221 -- ???_???_bus.set_security_group_id procedure, or add one of the following
222 -- comments:
223 -- "-- No business group context. HR_STANDARD_LOOKUPS used for validation."
224 -- "-- CLIENT_INFO not set. No lookup validation or joins to HR_LOOKUPS."
225 --
226 -- Validate Dependent Attributes
227 --
228 chk_non_updateable_args
229 (p_rec => p_rec
230 );
231 --
232 --
233 hr_utility.set_location(' Leaving:'||l_proc, 10);
234 End update_validate;
235 --
236 -- ----------------------------------------------------------------------------
237 -- |---------------------------< delete_validate >----------------------------|
238 -- ----------------------------------------------------------------------------
239 Procedure delete_validate
240 (p_rec in irc_iss_shd.g_rec_type
241 ) is
242 --
243 l_proc varchar2(72) := g_package||'delete_validate';
244 --
245 Begin
246 hr_utility.set_location('Entering:'||l_proc, 5);
247 --
248 -- Call all supporting business operations
249 --
250 hr_utility.set_location(' Leaving:'||l_proc, 10);
251 End delete_validate;
252 --
253 end irc_iss_bus;