1 Package Body per_qtt_bus as
2 /* $Header: peqttrhi.pkb 115.2 2003/05/13 06:22:26 fsheikh noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_qtt_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_qualification_type_id number default null;
15 g_language varchar2(4) default null;
16 --
17 -- ----------------------------------------------------------------------------
18 -- |-----------------------< chk_qualification_name >-------------------------|
19 -- ----------------------------------------------------------------------------
20 Procedure chk_name_unique( p_qualification_type_id in number
21 , p_language in varchar2
22 , p_name in varchar2
23 ) is
24 --
25 l_proc varchar2(72) := g_package||'chk_name_unique';
26 l_api_updating boolean;
27 l_dummy varchar2(1);
28 --
29 cursor c1 is
30 select 'x'
31 from per_qualification_types_tl qtt
32 where qtt.name = p_name
33 and qtt.language = p_language
34 and ( (p_qualification_type_id is null)
35 or
36 p_qualification_type_id <> qtt.qualification_type_id
37 );
38 --
39 Begin
40 hr_utility.set_location('Entering:'||l_proc, 5);
41 --
42 l_api_updating := per_qtt_shd.api_updating
43 (p_qualification_type_id => p_qualification_type_id,
44 p_language => p_language
45 );
46 --
47
48 if ( (l_api_updating and (per_qtt_shd.g_old_rec.name
49 <> nvl(p_name,hr_api.g_varchar2))
50 ) or
51 (NOT l_api_updating)
52 ) then
53 --
54 if p_name is null then
55 --
56 -- raise error
57 --
58 hr_utility.set_message(801, 'HR_51536_EQT_NAME_UK');
59 hr_utility.raise_error;
60 --
61 end if;
62 --
63 -- check if the qualification name exists in the per_qualification_types
64 -- table.
65 --
66 open c1;
67 --
68 fetch c1 into l_dummy;
69 if c1%found then
70 --
71 -- raise error
72 --
73 close c1;
74 hr_utility.set_message(801, 'HR_51536_EQT_NAME_UK');
75 hr_utility.raise_error;
76 --
77 end if;
78 --
79 close c1;
80 --
81 end if;
82 --
83 hr_utility.set_location('Leaving:'||l_proc,5);
84
85 end chk_name_unique;
86 --
87 -- ----------------------------------------------------------------------------
88 -- |-----------------------< chk_non_updateable_args >------------------------|
89 -- ----------------------------------------------------------------------------
90 -- {Start Of Comments}
91 --
92 -- Description:
93 -- This procedure is used to ensure that non updateable attributes have
94 -- not been updated. If an attribute has been updated an error is generated.
95 --
96 -- Pre Conditions:
97 -- g_old_rec has been populated with details of the values currently in
98 -- the database.
99 --
100 -- In Arguments:
101 -- p_rec has been populated with the updated values the user would like the
102 -- record set to.
103 --
104 -- Post Success:
105 -- Processing continues if all the non updateable attributes have not
106 -- changed.
107 --
108 -- Post Failure:
109 -- An application error is raised if any of the non updatable attributes
110 -- have been altered.
111 --
112 -- {End Of Comments}
113 -- ----------------------------------------------------------------------------
114 Procedure chk_non_updateable_args
115 (p_rec in per_qtt_shd.g_rec_type
116 ) IS
117 --
118 l_proc varchar2(72) := g_package || 'chk_non_updateable_args';
119 --
120 Begin
121 --
122 -- Only proceed with the validation if a row exists for the current
123 -- record in the HR Schema.
124 --
125 IF NOT per_qtt_shd.api_updating
126 (p_qualification_type_id => p_rec.qualification_type_id
127 ,p_language => p_rec.language
128 ) THEN
129 fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
130 fnd_message.set_token('PROCEDURE ', l_proc);
131 fnd_message.set_token('STEP ', '5');
132 fnd_message.raise_error;
133 END IF;
134 --
135 -- No non-updateable args
136 --
137 End chk_non_updateable_args;
138 --
139 -- ----------------------------------------------------------------------------
140 -- |------------------------< validate_translation>--------------------------|
141 -- ----------------------------------------------------------------------------
142 Procedure validate_translation
143 (p_rec in per_qtt_shd.g_rec_type
144 ,p_qualification_type_id in per_qualification_types_tl.qualification_type_id%TYPE default null
145 ) IS
146 --
147 l_proc varchar2(72) := g_package||'validate_translation';
148 --
149 Begin
150 --
151 hr_utility.set_location('Entering:'||l_proc,5);
152 --
153 -- Get any required base table values here
154 -- (none)
155 --
156 validate_translation
157 (p_qualification_type_id => p_rec.qualification_type_id
158 ,p_language => p_rec.language
159 ,p_name => p_rec.name
160 );
161 --
162 hr_utility.set_location('Leaving:'||l_proc,10);
163 --
164 END;
165 --
166 -- ----------------------------------------------------------------------------
167 -- |---------------------------< insert_validate >----------------------------|
168 -- ----------------------------------------------------------------------------
169 Procedure insert_validate
170 (p_rec in per_qtt_shd.g_rec_type
171 ,p_qualification_type_id in per_qualification_types_tl.qualification_type_id%TYPE
172 ) is
173 --
174 l_proc varchar2(72) := g_package||'insert_validate';
175 --
176 Begin
177 hr_utility.set_location('Entering:'||l_proc, 5);
178 --
179 -- Call all supporting business operations
180 --
181 -- PMFLETCH - Implemented as per base table
182 -- As this data is not within the context of a business group
183 -- the set_security_group_id procedure has zero passed
184 -- to it as the default security_group_id.
185 --
186 -- Fix for bug 2723065
187 -- Commented line which hardcodes security profile to '0'
188 -- hr_api.set_security_group_id(p_security_group_id => 0);
189 --
190 hr_utility.set_location('Entering:'||l_proc, 7);
191 --
192 validate_translation
193 ( p_rec
194 , p_qualification_type_id
195 );
196 --
197 -- Validate Dependent Attributes
198 -- None
199 --
200 hr_utility.set_location(' Leaving:'||l_proc, 10);
201 End insert_validate;
202 --
203 -- ----------------------------------------------------------------------------
204 -- |---------------------------< update_validate >----------------------------|
205 -- ----------------------------------------------------------------------------
206 Procedure update_validate
207 (p_rec in per_qtt_shd.g_rec_type
208 ) is
209 --
210 l_proc varchar2(72) := g_package||'update_validate';
211 --
212 Begin
213 hr_utility.set_location('Entering:'||l_proc, 5);
214 --
215 -- Call all supporting business operations
216 --
217 -- PMFLETCH - Implemented as per base table
218 -- As this data is not within the context of a business group
219 -- the set_security_group_id procedure has zero passed
220 -- to it as the default security_group_id.
221 --
222 -- Fix for bug 2723065
223 -- Commented line which hardcodes security profile to '0'
224 -- hr_api.set_security_group_id(p_security_group_id => 0);
225 --
226 hr_utility.set_location('Entering:'||l_proc, 7);
227 --
228 --
229 validate_translation
230 ( p_rec
231 );
232 --
233 -- Validate Dependent Attributes
234 -- None
235 --
236 chk_non_updateable_args
237 (p_rec => p_rec
238 );
239 --
240 --
241 hr_utility.set_location(' Leaving:'||l_proc, 10);
242 End update_validate;
243 --
244 -- ----------------------------------------------------------------------------
245 -- |---------------------------< delete_validate >----------------------------|
246 -- ----------------------------------------------------------------------------
247 Procedure delete_validate
248 (p_rec in per_qtt_shd.g_rec_type
249 ) is
250 --
251 l_proc varchar2(72) := g_package||'delete_validate';
252 --
253 Begin
254 hr_utility.set_location('Entering:'||l_proc, 5);
255 --
256 -- Call all supporting business operations
257 --
258 hr_utility.set_location(' Leaving:'||l_proc, 10);
259 End delete_validate;
260 --
261 -- ----------------------------------------------------------------------------
262 -- |---------------------------< validate_translation >------------------------|
263 -- ----------------------------------------------------------------------------
264 -- {Start Of Comments}
265 --
266 -- Description:
267 -- This procedure performs the validation for the MLS widget.
268 --
269 -- Prerequisites:
270 -- This procedure is called from from the MLS widget.
271 --
272 -- In Parameters:
273 --
274 -- Post Success:
275 -- Processing continues.
276 --
277 -- Post Failure:
278 -- If a business rules fails the error will not be handled by this procedure
279 --
280 -- Developer Implementation Notes:
281 --
282 -- Access Status:
283 -- MLS Widget Only.
284 --
285 -- {End Of Comments}
286 -- ----------------------------------------------------------------------------
287 Procedure validate_translation
288 (p_qualification_type_id in number
289 ,p_language in varchar2
290 ,p_name in varchar2
291 ) IS
292 --
293 l_proc varchar2(72) := g_package||'validate_translation';
294 --
295 BEGIN
296 --
297 hr_utility.set_location('Entering:'||l_proc,5);
298 --
299 chk_name_unique
300 ( p_qualification_type_id => p_qualification_type_id
301 , p_language => p_language
302 , p_name => p_name
303 );
304 --
305 hr_utility.set_location('Leaving:'||l_proc,10);
306 --
307 END;
308 --
309 end per_qtt_bus;