DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQP_ERS_BUS

Source


1 Package Body pqp_ers_bus as
2 /* $Header: pqersrhi.pkb 115.2 2003/08/25 13:50:57 sshetty noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pqp_ers_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_database_item_suffix        varchar2(80)   default null;
15 --
16 --  ---------------------------------------------------------------------------
17 --  |----------------------< set_security_group_id >--------------------------|
18 --  ---------------------------------------------------------------------------
19 --
20 Procedure set_security_group_id
21   (p_business_group_id                  in number
22   ) is
23   --
24   -- Declare cursor
25   --
26   cursor csr_sec_grp is
27     select pbg.security_group_id
28       from per_business_groups pbg
29      where pbg.business_group_id = p_business_group_id;
30   --
31   -- Declare local variables
32   --
33   l_security_group_id number;
34   l_proc              varchar2(72)  :=  g_package||'set_security_group_id';
35   --
36 begin
37   --
38   hr_utility.set_location('Entering:'|| l_proc, 10);
39   --
40   open csr_sec_grp;
41   fetch csr_sec_grp into l_security_group_id;
42   --
43   if csr_sec_grp%notfound then
44      --
45      close csr_sec_grp;
46      --
47      -- The primary key is invalid therefore we must error
48      --
49      fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
50      fnd_message.raise_error;
51      --
52   end if;
53   close csr_sec_grp;
54   --
55   -- Set the security_group_id in CLIENT_INFO
56   --
57   hr_api.set_security_group_id
58   (p_security_group_id => l_security_group_id
59   );
60   --
61   hr_utility.set_location(' Leaving:'|| l_proc, 20);
62   --
63 end set_security_group_id;
64 --
65 --  ---------------------------------------------------------------------------
66 --  |---------------------< return_legislation_code >-------------------------|
67 --  ---------------------------------------------------------------------------
68 --
69 Function return_legislation_code
70   (p_business_group_id            in     number)
71   Return Varchar2 Is
72   --
73   -- Declare cursor
74   --
75   cursor csr_leg_code is
76     select pbg.legislation_code
77       from per_business_groups     pbg
78      where pbg.business_group_id = p_business_group_id;
79 
80   --
81   -- Declare local variables
82   --
83   l_legislation_code  varchar2(150);
84   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
85   --
86 Begin
87   --
88   hr_utility.set_location('Entering:'|| l_proc, 10);
89   --
90     -- The legislation code has already been found with a previous
91     -- call to this function. Just return the value in the global
92     -- variable.
93     --
94     if pqp_ers_bus.g_legislation_code IS NOT NULL THEN
95       l_legislation_code := pqp_ers_bus.g_legislation_code;
96       hr_utility.set_location(l_proc, 20);
97     else
98       hr_utility.set_location(l_proc, 30);
99       -- The ID is different to the last call to this function
100       -- or this is the first call to this function.
101       --
102       open csr_leg_code;
103       fetch csr_leg_code into l_legislation_code;
104       --
105       if csr_leg_code%notfound then
106         --
107         -- The primary key is invalid therefore we must error
108         --
109         close csr_leg_code;
110         fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
111         fnd_message.raise_error;
112       end if;
113       hr_utility.set_location(l_proc,30);
114       --
115       -- Set the global variables so the values are
116       -- available for the next call to this function.
117       --
118       close csr_leg_code;
119       pqp_ers_bus.g_legislation_code  := l_legislation_code;
120   end if;
121   hr_utility.set_location(' Leaving:'|| l_proc, 40);
122   return l_legislation_code;
123 end return_legislation_code;
124 --
125 -- ----------------------------------------------------------------------------
126 -- |-----------------------< chk_non_updateable_args >------------------------|
127 -- ----------------------------------------------------------------------------
128 -- {Start Of Comments}
129 --
130 -- Description:
131 --   This procedure is used to ensure that non updateable attributes have
132 --   not been updated. If an attribute has been updated an error is generated.
133 --
134 -- Pre Conditions:
135 --   g_old_rec has been populated with details of the values currently in
136 --   the database.
137 --
138 -- In Arguments:
139 --   p_rec has been populated with the updated values the user would like the
140 --   record set to.
141 --
142 -- Post Success:
143 --   Processing continues if all the non updateable attributes have not
144 --   changed.
145 --
146 -- Post Failure:
147 --   An application error is raised if any of the non updatable attributes
148 --   have been altered.
149 --
150 -- {End Of Comments}
151 -- ----------------------------------------------------------------------------
152 Procedure chk_non_updateable_args
153   (p_rec in pqp_ers_shd.g_rec_type
154   ) IS
155 --
156   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
157 --
158 Begin
159   --
160   -- Only proceed with the validation if a row exists for the current
161   -- record in the HR Schema.
162   --
163   IF NOT pqp_ers_shd.api_updating
164       (p_database_item_suffix              => p_rec.database_item_suffix
165       ,p_legislation_code                  => p_rec.legislation_code
166       ,p_object_version_number             => p_rec.object_version_number
167       ) THEN
168      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
169      fnd_message.set_token('PROCEDURE ', l_proc);
170      fnd_message.set_token('STEP ', '5');
171      fnd_message.raise_error;
172   END IF;
173   --
174   -- All Fields are updatable in g_rec_type;
175   --
176   --
177 End chk_non_updateable_args;
178 --
179 -- ----------------------------------------------------------------------------
180 -- |---------------------------< insert_validate >----------------------------|
181 -- ----------------------------------------------------------------------------
182 Procedure insert_validate
183   (p_rec                          in pqp_ers_shd.g_rec_type
184   ) is
185 --
186   l_proc  varchar2(72) := g_package||'insert_validate';
187 --
188 Begin
189   hr_utility.set_location('Entering:'||l_proc, 5);
190   --
191   -- Call all supporting business operations
192   --
193   --
194   -- No business group context.  HR_STANDARD_LOOKUPS used for validation.
195   -- CLIENT_INFO not set.  No lookup validation or joins to HR_LOOKUPS.
196   --
197   -- Validate Dependent Attributes
198   --
199   -- No validation required.
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 pqp_ers_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   --
218   -- No business group context.  HR_STANDARD_LOOKUPS used for validation.
219   -- CLIENT_INFO not set.  No lookup validation or joins to HR_LOOKUPS.
220   --
221   -- Validate Dependent Attributes
222   --
223   chk_non_updateable_args
224     (p_rec              => p_rec
225     );
226   --
227   --
228   hr_utility.set_location(' Leaving:'||l_proc, 10);
229 End update_validate;
230 --
231 -- ----------------------------------------------------------------------------
232 -- |---------------------------< delete_validate >----------------------------|
233 -- ----------------------------------------------------------------------------
234 Procedure delete_validate
235   (p_rec                          in pqp_ers_shd.g_rec_type
236   ) is
237 --
238   l_proc  varchar2(72) := g_package||'delete_validate';
239 --
240 Begin
241   hr_utility.set_location('Entering:'||l_proc, 5);
242   --
243   -- Call all supporting business operations
244   --
245   hr_utility.set_location(' Leaving:'||l_proc, 10);
246 End delete_validate;
247 --
248 end pqp_ers_bus;