DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_TXH_BUS

Source


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