DBA Data[Home] [Help]

PACKAGE BODY: APPS.IRC_INO_BUS

Source


1 Package Body irc_ino_bus as
2 /* $Header: irinorhi.pkb 120.1 2005/10/04 06:25:18 kthavran noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  irc_ino_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_note_id                     number         default null;
15 --
16 --  ---------------------------------------------------------------------------
17 --  |----------------------< set_security_group_id >--------------------------|
18 --  ---------------------------------------------------------------------------
19 --
20 Procedure set_security_group_id
21   (p_note_id                              in number
22   ,p_associated_column1                   in varchar2 default null
23   ) is
24   --
25   -- Declare local variables
26   --
27   l_security_group_id number;
28   l_proc              varchar2(72)  :=  g_package||'set_security_group_id';
29   l_legislation_code  varchar2(150);
30   --
31 begin
32   --
33   hr_utility.set_location('Entering:'|| l_proc, 10);
34   --
35   -- Ensure that all the mandatory parameter are not null
36   --
37   hr_api.mandatory_arg_error
38     (p_api_name           => l_proc
39     ,p_argument           => 'note_id'
40     ,p_argument_value     => p_note_id
41     );
42   --
43   --
44   hr_utility.set_location(' Leaving:'|| l_proc, 20);
45   --
46 end set_security_group_id;
47 --
48 --  ---------------------------------------------------------------------------
49 --  |---------------------< return_legislation_code >-------------------------|
50 --  ---------------------------------------------------------------------------
51 --
52 Function return_legislation_code
53   (p_note_id                              in     number
54   )
55   Return Varchar2 Is
56   --
57   -- Declare local variables
58   --
59   l_legislation_code  varchar2(150);
60   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
61   --
62 Begin
63   --
64   hr_utility.set_location('Entering:'|| l_proc, 10);
65   --
66   -- Ensure that all the mandatory parameter are not null
67   --
68   hr_api.mandatory_arg_error
69     (p_api_name           => l_proc
70     ,p_argument           => 'note_id'
71     ,p_argument_value     => p_note_id
72     );
73   --
74   hr_utility.set_location(' Leaving:'|| l_proc, 40);
75   return l_legislation_code;
76 end return_legislation_code;
77 --
78 -- ----------------------------------------------------------------------------
79 -- |-----------------------< chk_non_updateable_args >------------------------|
80 -- ----------------------------------------------------------------------------
81 -- {Start Of Comments}
82 --
83 -- Description:
84 --   This procedure is used to ensure that non updateable attributes have
85 --   not been updated. If an attribute has been updated an error is generated.
86 --
87 -- Pre Conditions:
88 --   g_old_rec has been populated with details of the values currently in
89 --   the database.
90 --
91 -- In Arguments:
92 --   p_rec has been populated with the updated values the user would like the
93 --   record set to.
94 --
95 -- Post Success:
96 --   Processing continues if all the non updateable attributes have not
97 --   changed.
98 --
99 -- Post Failure:
100 --   An application error is raised if any of the non updatable attributes
101 --   have been altered.
102 --
103 -- {End Of Comments}
104 -- ----------------------------------------------------------------------------
105 Procedure chk_non_updateable_args
106   (p_rec in irc_ino_shd.g_rec_type
107   ) IS
108 --
109   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
110 --
111 Begin
112   --
113   -- Only proceed with the validation if a row exists for the current
114   -- record in the HR Schema.
115   --
116   IF NOT irc_ino_shd.api_updating
117       (p_note_id                           => p_rec.note_id
118       ,p_object_version_number             => p_rec.object_version_number
119       ) THEN
120      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
121      fnd_message.set_token('PROCEDURE ', l_proc);
122      fnd_message.set_token('STEP ', '5');
123      fnd_message.raise_error;
124   END IF;
125   --
126   -- Add checks to ensure non-updateable args have
127   -- not been updated.
128   --
129   if p_rec.note_id <> irc_ino_shd.g_old_rec.note_id
130     then
131     hr_api.argument_changed_error
132       (p_api_name   => l_proc
133       ,p_argument   => 'NOTE_ID'
134       ,p_base_table => irc_ino_shd.g_tab_nam
135       );
136   end if;
137   --
138   if p_rec.offer_status_history_id <> irc_ino_shd.g_old_rec.offer_status_history_id
139     then
140     hr_api.argument_changed_error
141       (p_api_name   => l_proc
142       ,p_argument   => 'OFFER_STATUS_HISTORY_ID'
143       ,p_base_table => irc_ino_shd.g_tab_nam
144       );
145   end if;
146   --
147 End chk_non_updateable_args;
148 --
149 -- ---------------------------------------------------------------------------------------
150 -- |---------------------------< chk_offer_status_history_id >----------------------------|
151 -- ----------------------------------------------------------------------------------------
152 -- {Start Of Comments}
153 --
154 -- Description:
155 --   This procedure is used to ensure that offer_status_history_id exists in
156 --   irc_offer_status_history.
157 --
158 -- Pre Conditions:
159 --   g_old_rec has been populated with details of the values currently in
160 --   the database.
161 --
162 -- In Arguments:
163 --   p_offer_status_history_id
164 --
165 -- Post Success:
166 --   Processing continues if the offer status history id exists.
167 --
168 -- Post Failure:
169 --   An application error is raised if the offer status history id does not exist
170 --
171 -- {End Of Comments}
172 -- ----------------------------------------------------------------------------
173 Procedure chk_offer_status_history_id
174   (p_offer_status_history_id in irc_notes.offer_status_history_id%type
175   ) IS
176 --
177   l_proc     varchar2(72) := g_package || 'chk_offer_status_history_id';
178   l_num number;
179   --
180   cursor csr_offer_status_history_id is
181     select 1
182     from irc_offer_status_history
183     where offer_status_history_id = p_offer_status_history_id;
184   --
185 Begin
186   --
187   hr_utility.set_location(' Entering:'||l_proc,10);
188   --
189   -- Check if the offer status history id is valid.
190   --
191   open csr_offer_status_history_id;
192   fetch csr_offer_status_history_id into l_num;
193   hr_utility.set_location(l_proc,20);
194   if csr_offer_status_history_id%notfound then
195     close csr_offer_status_history_id;
196     hr_utility.set_message(800,'IRC_412325_INV_OFFER_HISTORYID');
197     hr_utility.raise_error;
198   end if;
199   close csr_offer_status_history_id;
200   hr_utility.set_location(l_proc,30);
201 --
202 exception
203   when app_exception.application_exception then
204     if hr_multi_message.exception_add
205       (p_associated_column1 =>
206       'irc_notes.offer_status_history_id'
207       ) then
208       hr_utility.set_location(' Leaving:'||l_proc,50);
209       raise;
210     end if;
211   --
212   hr_utility.set_location(' Leaving:'||l_proc,60);
213 End chk_offer_status_history_id;
214 --
215 -- ----------------------------------------------------------------------------
216 -- |---------------------------< insert_validate >----------------------------|
217 -- ----------------------------------------------------------------------------
218 Procedure insert_validate
219   (p_rec                          in irc_ino_shd.g_rec_type
220   ) is
221 --
222   l_proc  varchar2(72) := g_package||'insert_validate';
223 --
224 Begin
225   hr_utility.set_location('Entering:'||l_proc, 5);
226   --
227   -- Call all supporting business operations
228   -- Validate Dependent Attributes
229   --
230    hr_api.mandatory_arg_error
231    (p_api_name           => l_proc
232    ,p_argument           => 'NOTE_TEXT'
233    ,p_argument_value     => p_rec.note_text
234    );
235   --
236    chk_offer_status_history_id
237    (p_offer_status_history_id => p_rec.offer_status_history_id
238    );
239   --
240   hr_utility.set_location(' Leaving:'||l_proc, 10);
241   End insert_validate;
242 --
243 -- ----------------------------------------------------------------------------
244 -- |---------------------------< update_validate >----------------------------|
245 -- ----------------------------------------------------------------------------
246 Procedure update_validate
247   (p_rec                          in irc_ino_shd.g_rec_type
248   ) is
249 --
250   l_proc  varchar2(72) := g_package||'update_validate';
251 --
252 Begin
253   hr_utility.set_location('Entering:'||l_proc, 5);
254   --
255   -- Call all supporting business operations
256   --
257   -- Validate Dependent Attributes
258   --
259   chk_non_updateable_args
260     (p_rec              => p_rec
261     );
262   --
263   --
264   hr_utility.set_location(' Leaving:'||l_proc, 10);
265 End update_validate;
266 --
267 -- ----------------------------------------------------------------------------
268 -- |---------------------------< delete_validate >----------------------------|
269 -- ----------------------------------------------------------------------------
270 Procedure delete_validate
271   (p_rec                          in irc_ino_shd.g_rec_type
272   ) is
273 --
274   l_proc  varchar2(72) := g_package||'delete_validate';
275 --
276 Begin
277   hr_utility.set_location('Entering:'||l_proc, 5);
278   --
279   -- Call all supporting business operations
280   --
281   hr_utility.set_location(' Leaving:'||l_proc, 10);
282 End delete_validate;
283 --
284 end irc_ino_bus;