DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_RVT_BUS

Source


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