DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_GDT_BUS

Source


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