DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_SBT_BUS

Source


1 Package Body per_sbt_bus as
2 /* $Header: pesbtrhi.pkb 120.0 2005/05/31 20:43:05 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_sbt_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_subjects_taken_id           number         default null;
15 g_language                    varchar2(4)    default null;
16 --
17 --  ---------------------------------------------------------------------------
18 --  |----------------------< set_security_group_id >--------------------------|
19 --  ---------------------------------------------------------------------------
20 -- PF - The base table does not have a business group ID, but it does
21 -- call the qualifications set_business_group_id. We therefore need to
22 -- derive the qualification_id from the base table, so we can call
23 -- per_qua_bus.set_security_group_id (it would be better to call
24 -- per_sbt_bus.set_secutity_group_id, but that does not exist...)
25 --
26 Procedure set_security_group_id
27   (p_subjects_taken_id                    in number
28   ,p_associated_column1                   in varchar2 default null
29   ) is
30   --
31   -- Declare cursor
32   -- PF - This cursor gets the qualification_id from the base table
33   --
34   cursor csr_qua_id is
35     select sub.qualification_id
36       from per_subjects_taken sub
37      where sub.subjects_taken_id = p_subjects_taken_id;
38   --
39   -- Declare local variables
40   --
41   l_qualification_id number;
42   l_security_group_id number;
43   l_proc              varchar2(72)  :=  g_package||'set_security_group_id';
44   --
45 begin
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           => 'subjects_taken_id'
54     ,p_argument_value     => p_subjects_taken_id
55     );
56   --
57   --
58   open csr_qua_id;
59   fetch csr_qua_id into l_qualification_id;
60   --
61   if csr_qua_id%notfound then
62      --
63      close csr_qua_id;
64      --
65      -- The primary key is invalid therefore we must error
66      --
67      fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
68      hr_multi_message.add
69        (p_associated_column1
70         => nvl(p_associated_column1,'SUBJECTS_TAKEN_ID')
71        );
72      --
73   else
74     close csr_qua_id;
75     --
76     -- PF - Now set the security group via per_qua_bus.set_security_group_id
77     --
78     -- Set the security_group_id in CLIENT_INFO
79     --
80     per_qua_bus.set_security_group_id
81       ( p_qualification_id => l_qualification_id
82       );
83   end if;
84   --
85   hr_utility.set_location(' Leaving:'|| l_proc, 20);
86   --
87 end set_security_group_id;
88 --
89 -- ----------------------------------------------------------------------------
90 -- |-----------------------< chk_non_updateable_args >------------------------|
91 -- ----------------------------------------------------------------------------
92 -- {Start Of Comments}
93 --
94 -- Description:
95 --   This procedure is used to ensure that non updateable attributes have
96 --   not been updated. If an attribute has been updated an error is generated.
97 --
98 -- Pre Conditions:
99 --   g_old_rec has been populated with details of the values currently in
100 --   the database.
101 --
102 -- In Arguments:
103 --   p_rec has been populated with the updated values the user would like the
104 --   record set to.
105 --
106 -- Post Success:
107 --   Processing continues if all the non updateable attributes have not
108 --   changed.
109 --
110 -- Post Failure:
111 --   An application error is raised if any of the non updatable attributes
112 --   have been altered.
113 --
114 -- {End Of Comments}
115 -- ----------------------------------------------------------------------------
116 Procedure chk_non_updateable_args
117   (p_rec in per_sbt_shd.g_rec_type
118   ) IS
119 --
120   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
121 --
122 Begin
123   --
124   -- Only proceed with the validation if a row exists for the current
125   -- record in the HR Schema.
126   --
127   IF NOT per_sbt_shd.api_updating
128       (p_subjects_taken_id                 => p_rec.subjects_taken_id
129       ,p_language                          => p_rec.language
130       ) THEN
131      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
132      fnd_message.set_token('PROCEDURE ', l_proc);
133      fnd_message.set_token('STEP ', '5');
134      fnd_message.raise_error;
135   END IF;
136   --
137   -- PF - No non-updateable fields
138   --
139 End chk_non_updateable_args;
140 --
141 -- ----------------------------------------------------------------------------
142 -- |---------------------------< insert_validate >----------------------------|
143 -- ----------------------------------------------------------------------------
144 Procedure insert_validate
145   (p_rec                          in per_sbt_shd.g_rec_type
146   ) is
147 --
148   l_proc  varchar2(72) := g_package||'insert_validate';
149   l_language_code   VARCHAR2(30);
150 --
151 Begin
152   hr_utility.set_location('Entering:'||l_proc, 5);
153   --
154   -- Call all supporting business operations
155   --
156   -- PF - Call local procedure
157   --set_security_group_id( p_subjects_taken_id => p_rec.subjects_taken_id
158   --                     );
159   --
160   -- PF - subjects_taken_id is already implicitly validated against base
161   -- table in set_security_group_id; Do not need to do again
162   --
163   -- PF - calling api language validation as there is no API package yet.
164   l_language_code := p_rec.source_lang;
165   hr_api.validate_language_code ( p_language_code => l_language_code
166                                 );
167   --
168   -- Validate Dependent Attributes
169   --
170   --
171   hr_utility.set_location(' Leaving:'||l_proc, 10);
172 End insert_validate;
173 --
174 -- ----------------------------------------------------------------------------
175 -- |---------------------------< update_validate >----------------------------|
176 -- ----------------------------------------------------------------------------
177 Procedure update_validate
178   (p_rec                          in per_sbt_shd.g_rec_type
179   ) is
180 --
181   l_proc  varchar2(72) := g_package||'update_validate';
182   l_language_code   VARCHAR2(30);
183 --
184 Begin
185   hr_utility.set_location('Entering:'||l_proc, 5);
186   --
187   -- Call all supporting business operations
188   --
189   -- PF - Call local procedure
190   --set_security_group_id( p_subjects_taken_id => p_rec.subjects_taken_id
191   --                     );
192   --
193   -- PF - subjects_taken_id is already implicitly validated against base
194   -- table in set_security_group_id; Do not need to do again
195   --
196   -- PF - calling api language validation as there is no API package yet.
197   l_language_code := p_rec.source_lang;
198   hr_api.validate_language_code ( p_language_code => l_language_code
199                                 );
200   --
201   -- Validate Dependent Attributes
202   --
203   chk_non_updateable_args
204     (p_rec              => p_rec
205     );
206   --
207   --
208   hr_utility.set_location(' Leaving:'||l_proc, 10);
209 End update_validate;
210 --
211 -- ----------------------------------------------------------------------------
212 -- |---------------------------< delete_validate >----------------------------|
213 -- ----------------------------------------------------------------------------
214 Procedure delete_validate
215   (p_rec                          in per_sbt_shd.g_rec_type
216   ) is
217 --
218   l_proc  varchar2(72) := g_package||'delete_validate';
219 --
220 Begin
221   hr_utility.set_location('Entering:'||l_proc, 5);
222   --
223   -- Call all supporting business operations
224   --
225   hr_utility.set_location(' Leaving:'||l_proc, 10);
226 End delete_validate;
228 end per_sbt_bus;
227 --