DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_TAH_BUS

Source


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