DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_RAP_BUS

Source


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