1 Package Body pqh_tsh_bus as
2 /* $Header: pqtshrhi.pkb 120.2 2005/12/21 11:28:58 hpandya noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pqh_tsh_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_transaction_history_id number default null;
15 g_approval_history_id number default null;
16 --
17 -- ---------------------------------------------------------------------------
18 -- |----------------------< set_security_group_id >--------------------------|
19 -- ---------------------------------------------------------------------------
20 --
21 Procedure set_security_group_id
22 (p_transaction_history_id in number
23 ,p_approval_history_id in number
24 ,p_associated_column1 in varchar2 default null
25 ,p_associated_column2 in varchar2 default null
26 ) is
27 --
28 -- Declare cursor
29 -- No business group context required.
30 /*cursor csr_sec_grp is
31 select pbg.security_group_id,
32 pbg.legislation_code
33 from per_business_groups_perf pbg
34 , pqh_ss_trans_state_history tsh
35 -- , EDIT_HERE table_name(s) 333
36 where tsh.transaction_history_id = p_transaction_history_id
37 and tsh.approval_history_id = p_approval_history_id;*/
38 -- and pbg.business_group_id = EDIT_HERE 333.business_group_id;
39 --
40 -- Declare local variables
41 --
42 l_security_group_id number;
43 l_proc varchar2(72) := g_package||'set_security_group_id';
44 l_legislation_code varchar2(150);
45 --
46 begin
47 --
48 hr_utility.set_location('Entering:'|| l_proc, 10);
49 --
50 -- Ensure that all the mandatory parameter are not null
51 --
52 hr_api.mandatory_arg_error
53 (p_api_name => l_proc
54 ,p_argument => 'transaction_history_id'
55 ,p_argument_value => p_transaction_history_id
56 );
57 hr_api.mandatory_arg_error
58 (p_api_name => l_proc
59 ,p_argument => 'approval_history_id'
60 ,p_argument_value => p_approval_history_id
61 );
62 --
63 -- No business group context.
64
65 /*open csr_sec_grp;
66 fetch csr_sec_grp into l_security_group_id
67 , l_legislation_code;
68 --
69 if csr_sec_grp%notfound then
70 --
71 close csr_sec_grp;
72 --
73 -- The primary key is invalid therefore we must error
74 --
75 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
76 hr_multi_message.add
77 (p_associated_column1
78 => nvl(p_associated_column1,'TRANSACTION_HISTORY_ID')
79 ,p_associated_column2
80 => nvl(p_associated_column2,'APPROVAL_HISTORY_ID')
81 );
82 --
83 else
84 close csr_sec_grp;
85 --
86 -- Set the security_group_id in CLIENT_INFO
87 --
88 hr_api.set_security_group_id
89 (p_security_group_id => l_security_group_id
90 );
91 --
92 -- Set the sessions legislation context in HR_SESSION_DATA
93 --
94 hr_api.set_legislation_context(l_legislation_code);
95 end if;*/
96 --
97 hr_utility.set_location(' Leaving:'|| l_proc, 20);
98 --
99 end set_security_group_id;
100 --
101 -- ---------------------------------------------------------------------------
102 -- |---------------------< return_legislation_code >-------------------------|
103 -- ---------------------------------------------------------------------------
104 --
105 Function return_legislation_code
106 (p_transaction_history_id in number
107 ,p_approval_history_id in number
108 )
109 Return Varchar2 Is
110 --
111 -- Declare cursor
112 -- No Security Group Context.
113 /*cursor csr_leg_code is
114 select pbg.legislation_code
115 from per_business_groups_perf pbg
116 , pqh_ss_trans_state_history tsh
117 -- , EDIT_HERE table_name(s) 333
118 where tsh.transaction_history_id = p_transaction_history_id
119 and tsh.approval_history_id = p_approval_history_id;*/
120 -- and pbg.business_group_id = EDIT_HERE 333.business_group_id;
121 --
122 -- Declare local variables
123 --
124 l_legislation_code varchar2(150);
125 l_proc varchar2(72) := g_package||'return_legislation_code';
126 --
127 Begin
128 --
129 hr_utility.set_location('Entering:'|| l_proc, 10);
130 --
131 -- Ensure that all the mandatory parameter are not null
132 --
133 hr_api.mandatory_arg_error
134 (p_api_name => l_proc
135 ,p_argument => 'transaction_history_id'
136 ,p_argument_value => p_transaction_history_id
137 );
138 hr_api.mandatory_arg_error
139 (p_api_name => l_proc
140 ,p_argument => 'approval_history_id'
141 ,p_argument_value => p_approval_history_id
142 );
143 --
144 /*if (( nvl(pqh_tsh_bus.g_transaction_history_id, hr_api.g_number)
145 = p_transaction_history_id)
146 and ( nvl(pqh_tsh_bus.g_approval_history_id, hr_api.g_number)
147 = p_approval_history_id)) then
148 --
149 -- The legislation code has already been found with a previous
150 -- call to this function. Just return the value in the global
151 -- variable.
152 --
153 l_legislation_code := pqh_tsh_bus.g_legislation_code;
154 hr_utility.set_location(l_proc, 20);
155 else
156 --
157 -- The ID is different to the last call to this function
158 -- or this is the first call to this function.
159 --
160 open csr_leg_code;
161 fetch csr_leg_code into l_legislation_code;
162 --
163 if csr_leg_code%notfound then
164 --
165 -- The primary key is invalid therefore we must error
166 --
167 close csr_leg_code;
168 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
169 fnd_message.raise_error;
170 end if;
171 hr_utility.set_location(l_proc,30);
172 --
173 -- Set the global variables so the values are
174 -- available for the next call to this function.
175 --
176 close csr_leg_code;
177 pqh_tsh_bus.g_transaction_history_id := p_transaction_history_id;
178 pqh_tsh_bus.g_approval_history_id := p_approval_history_id;
179 pqh_tsh_bus.g_legislation_code := l_legislation_code;
180 end if;*/
181 hr_utility.set_location(' Leaving:'|| l_proc, 40);
182 return l_legislation_code;
183 end return_legislation_code;
184 --
185 -- ----------------------------------------------------------------------------
186 -- |-----------------------< chk_non_updateable_args >------------------------|
187 -- ----------------------------------------------------------------------------
188 -- {Start Of Comments}
189 --
190 -- Description:
191 -- This procedure is used to ensure that non updateable attributes have
192 -- not been updated. If an attribute has been updated an error is generated.
193 --
194 -- Pre Conditions:
195 -- g_old_rec has been populated with details of the values currently in
196 -- the database.
197 --
198 -- In Arguments:
199 -- p_rec has been populated with the updated values the user would like the
200 -- record set to.
201 --
202 -- Post Success:
203 -- Processing continues if all the non updateable attributes have not
204 -- changed.
205 --
206 -- Post Failure:
207 -- An application error is raised if any of the non updatable attributes
208 -- have been altered.
209 --
210 -- {End Of Comments}
211 -- ----------------------------------------------------------------------------
212 Procedure chk_non_updateable_args
213 (p_rec in pqh_tsh_shd.g_rec_type
214 ) IS
215 --
216 l_proc varchar2(72) := g_package || 'chk_non_updateable_args';
217 --
218 Begin
219 --
220 -- Only proceed with the validation if a row exists for the current
221 -- record in the HR Schema.
222 --
223 IF NOT pqh_tsh_shd.api_updating
224 (p_transaction_history_id => p_rec.transaction_history_id
225 ,p_approval_history_id => p_rec.approval_history_id
226 ) THEN
227 fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
228 fnd_message.set_token('PROCEDURE ', l_proc);
229 fnd_message.set_token('STEP ', '5');
230 fnd_message.raise_error;
231 END IF;
232 --
233 -- EDIT_HERE: Add checks to ensure non-updateable args have
234 -- not been updated.
235 --
236 End chk_non_updateable_args;
237 --
238 -- ----------------------------------------------------------------------------
239 -- |---------------------------< insert_validate >----------------------------|
240 -- ----------------------------------------------------------------------------
241 Procedure insert_validate
242 (p_rec in pqh_tsh_shd.g_rec_type
243 ) is
244 --
245 l_proc varchar2(72) := g_package||'insert_validate';
246 --
247 Begin
248 hr_utility.set_location('Entering:'||l_proc, 5);
249 --
250 -- Call all supporting business operations
251 --
252 -- "-- No business group context. HR_STANDARD_LOOKUPS used for validation."
253 -- "-- CLIENT_INFO not set. No lookup validation or joins to HR_LOOKUPS."
254 --
255 -- Validate Dependent Attributes
256 --
257 --
258 hr_utility.set_location(' Leaving:'||l_proc, 10);
259 End insert_validate;
260 --
261 -- ----------------------------------------------------------------------------
262 -- |---------------------------< update_validate >----------------------------|
263 -- ----------------------------------------------------------------------------
264 Procedure update_validate
265 (p_rec in pqh_tsh_shd.g_rec_type
266 ) is
267 --
268 l_proc varchar2(72) := g_package||'update_validate';
269 --
270 Begin
271 hr_utility.set_location('Entering:'||l_proc, 5);
272 --
273 -- Call all supporting business operations
274 --
275 -- "-- No business group context. HR_STANDARD_LOOKUPS used for validation."
276 -- "-- CLIENT_INFO not set. No lookup validation or joins to HR_LOOKUPS."
277 --
278 -- Validate Dependent Attributes
279 --
280 chk_non_updateable_args
281 (p_rec => p_rec
282 );
283 --
284 --
285 hr_utility.set_location(' Leaving:'||l_proc, 10);
286 End update_validate;
287 --
288 -- ----------------------------------------------------------------------------
289 -- |---------------------------< delete_validate >----------------------------|
290 -- ----------------------------------------------------------------------------
291 Procedure delete_validate
292 (p_rec in pqh_tsh_shd.g_rec_type
293 ) is
294 --
295 l_proc varchar2(72) := g_package||'delete_validate';
296 --
297 Begin
298 hr_utility.set_location('Entering:'||l_proc, 5);
299 --
300 -- Call all supporting business operations
301 --
302 hr_utility.set_location(' Leaving:'||l_proc, 10);
303 End delete_validate;
304 --
305 end pqh_tsh_bus;