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