DBA Data[Home] [Help]

PACKAGE BODY: APPS.IRC_IDT_BUS

Source


1 Package Body irc_idt_bus as
2 /* $Header: iridtrhi.pkb 120.0 2005/07/26 15:07:27 mbocutt noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  irc_idt_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_default_posting_id          number         default null;
15 g_language                    varchar2(4)    default null;
16 
17 --
18 -- ----------------------------------------------------------------------------
19 -- |-----------------------< chk_non_updateable_args >------------------------|
20 -- ----------------------------------------------------------------------------
21 -- {Start Of Comments}
22 --
23 -- Description:
24 --   This procedure is used to ensure that non updateable attributes have
25 --   not been updated. If an attribute has been updated an error is generated.
26 --
27 -- Pre Conditions:
28 --   g_old_rec has been populated with details of the values currently in
29 --   the database.
30 --
31 -- In Arguments:
32 --   p_rec has been populated with the updated values the user would like the
33 --   record set to.
34 --
35 -- Post Success:
36 --   Processing continues if all the non updateable attributes have not
37 --   changed.
38 --
39 -- Post Failure:
40 --   An application error is raised if any of the non updatable attributes
41 --   have been altered.
42 --
43 -- {End Of Comments}
44 -- ----------------------------------------------------------------------------
45 Procedure chk_non_updateable_args
46   (p_rec in irc_idt_shd.g_rec_type
47   ) IS
48 --
49   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
50   l_error    EXCEPTION;
51   l_argument varchar2(30);
52 --
53 Begin
54   --
55   -- Only proceed with the validation if a row exists for the current
56   -- record in the HR Schema.
57   --
58   IF NOT irc_idt_shd.api_updating
59       (p_default_posting_id                   => p_rec.default_posting_id
60       ,p_language                             => p_rec.language
61       ) THEN
62      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
63      fnd_message.set_token('PROCEDURE ', l_proc);
64      fnd_message.set_token('STEP ', '5');
65      fnd_message.raise_error;
66   END IF;
67   --
68   EXCEPTION
69     WHEN l_error THEN
70        hr_api.argument_changed_error
71          (p_api_name => l_proc
72          ,p_argument => l_argument);
73     WHEN OTHERS THEN
74        RAISE;
75 End chk_non_updateable_args;
76 
77 --
78 -- ----------------------------------------------------------------------------
79 -- |---------------------------< chk_source_lang >----------------------------|
80 -- ----------------------------------------------------------------------------
81 Procedure chk_source_lang
82   (p_language                     in varchar2
83   ,p_source_lang                  in varchar2
84   ) is
85   --
86   cursor csr_language is
87     select l.installed_flag
88       from fnd_languages l
89      where l.language_code = p_source_lang;
90   --
91   l_proc                         varchar2(72) := g_package || 'chk_source_lang';
92   l_installed_flag               varchar2(30);
93   --
94 Begin
95   hr_utility.set_location('Entering:'||l_proc, 10);
96   --
97   -- Only proceed with SQL validation if absolutely necessary
98   --
99 
100   if ((irc_idt_shd.g_old_rec.default_posting_id is null and p_language is not null)
101   or (irc_idt_shd.g_old_rec.default_posting_id is not null
102   and nvl(irc_idt_shd.g_old_rec.language, hr_api.g_varchar2)
103                          <> nvl(p_language, hr_api.g_varchar2))) then
104     --
105     hr_utility.set_location(l_proc,30);
106     --
107     -- Check value has been passed
108     --
109     hr_api.mandatory_arg_error
110       (p_api_name                     => l_proc
111       ,p_argument                     => 'source_lang'
112       ,p_argument_value               => p_source_lang
113       );
114     --
115     hr_utility.set_location(l_proc,40);
116     --
117     -- Check source language exists and is base or installed language
118     --
119     open csr_language;
120     fetch csr_language into l_installed_flag;
121     if csr_language%notfound then
122       close csr_language;
123       fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
124       fnd_message.set_token('PROCEDURE', l_proc);
125       fnd_message.set_token('STEP','10');
126       fnd_message.raise_error;
127     end if;
128     close csr_language;
129     --
130     if nvl(l_installed_flag,hr_api.g_varchar2) not in ('I','B') then
131       fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
132       fnd_message.set_token('PROCEDURE', l_proc);
133       fnd_message.set_token('STEP','20');
134       fnd_message.raise_error;
135     end if;
136     --
137   end if;
138   --
139   hr_utility.set_location('Leaving:'||l_proc, 100);
140 End chk_source_lang;
141 
142 --
143 -- ----------------------------------------------------------------------------
144 -- |---------------------------< insert_validate >----------------------------|
145 -- ----------------------------------------------------------------------------
146 Procedure insert_validate
147   (p_rec                          in irc_idt_shd.g_rec_type
148   ) is
149 --
150   l_proc  varchar2(72) := g_package||'insert_validate';
151 --
152 Begin
153   hr_utility.set_location('Entering:'||l_proc, 5);
154   --
155   -- Call all supporting business operations
156   --
157 
158   --
159   -- validate chk_source_lang
160   --
161   irc_idt_bus.chk_source_lang
162   (p_language                     => p_rec.language
163   ,p_source_lang                  => p_rec.source_language
164   );
165 
166   --
167   -- CLIENT_INFO not set.  No lookup validation or joins to HR_LOOKUPS.
168   --
169   --
170   hr_utility.set_location(' Leaving:'||l_proc, 10);
171 End insert_validate;
172 --
173 -- ----------------------------------------------------------------------------
174 -- |---------------------------< update_validate >----------------------------|
175 -- ----------------------------------------------------------------------------
176 Procedure update_validate
177   (p_rec                          in irc_idt_shd.g_rec_type
178   ) is
179 --
180   l_proc  varchar2(72) := g_package||'update_validate';
181 --
182 Begin
183   hr_utility.set_location('Entering:'||l_proc, 5);
184   --
185   -- Call all supporting business operations
186   --
187 
188   --
189   -- validate chk_source_lang
190   --
191   irc_idt_bus.chk_source_lang
192   (p_language                     => p_rec.language
193   ,p_source_lang                  => p_rec.source_language
194   );
195 
196   --
197   -- CLIENT_INFO not set.  No lookup validation or joins to HR_LOOKUPS.
198   --
199   chk_non_updateable_args
200     (p_rec              => p_rec
201     );
202   --
203   --
204   hr_utility.set_location(' Leaving:'||l_proc,
205  10);
206 End update_validate;
207 --
208 -- ----------------------------------------------------------------------------
209 -- |---------------------------< delete_validate >----------------------------|
210 -- ----------------------------------------------------------------------------
211 Procedure delete_validate
212   (p_rec                          in irc_idt_shd.g_rec_type
213   ) is
214 --
215   l_proc  varchar2(72) := g_package||'delete_validate';
216 --
217 Begin
218   hr_utility.set_location('Entering:'||l_proc, 5);
219   --
220   -- Call all supporting business operations
221   --
222   hr_utility.set_location(' Leaving:'||l_proc, 10);
223 End delete_validate;
224 --
225 end irc_idt_bus;