[Home] [Help]
PACKAGE BODY: APPS.PQH_RTL_SHD
Source
1 Package Body pqh_rtl_shd as
2 /* $Header: pqrtlrhi.pkb 115.7 2003/01/26 02:01:52 rpasapul noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pqh_rtl_shd.'; -- Global package name
9 --
10 --
11 -- ----------------------------------------------------------------------------
12 -- |---------------------------< constraint_error >---------------------------|
13 -- ----------------------------------------------------------------------------
14 Procedure constraint_error
15 (p_constraint_name in all_constraints.constraint_name%TYPE) Is
16 --
17 l_proc varchar2(72) := g_package||'constraint_error';
18 --
19 Begin
20 hr_utility.set_location('Entering:'||l_proc, 5);
21 --
22 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
23 hr_utility.set_message_token('PROCEDURE', l_proc);
24 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
25 hr_utility.raise_error;
26 --
27 hr_utility.set_location(' Leaving:'||l_proc, 10);
28 End constraint_error;
29 --
30 -- ----------------------------------------------------------------------------
31 -- |-----------------------------< api_updating >-----------------------------|
32 -- ----------------------------------------------------------------------------
33 Function api_updating
34 (
35 p_rule_set_id in number,
36 p_language in varchar2
37 ) Return Boolean Is
38 --
39 --
40 -- Cursor selects the 'current' row from the HR Schema
41 --
42 Cursor C_Sel1 is
43 Select
44 rule_set_id,
45 rule_set_name,
46 description,
47 language,
48 source_lang
49 from pqh_rule_sets_tl
50 where rule_set_id = p_rule_set_id
51 and language = p_language;
52 --
53 l_proc varchar2(72) := g_package||'api_updating';
54 l_fct_ret boolean;
55 --
56 Begin
57 hr_utility.set_location('Entering:'||l_proc, 5);
58 --
59 If (
60 p_rule_set_id is null or
61 p_language is null
62 ) Then
63 --
64 -- One of the primary key arguments is null therefore we must
65 -- set the returning function value to false
66 --
67 l_fct_ret := false;
68 Else
69 If (
70 p_rule_set_id = g_old_rec.rule_set_id and
71 p_language = g_old_rec.language
72 ) Then
73 hr_utility.set_location(l_proc, 10);
74 --
75 -- The g_old_rec is current therefore we must
76 -- set the returning function to true
77 --
78 l_fct_ret := true;
79 Else
80 --
81 -- Select the current row into g_old_rec
82 --
83 Open C_Sel1;
84 Fetch C_Sel1 Into g_old_rec;
85 If C_Sel1%notfound Then
86 Close C_Sel1;
87 --
88 -- The primary key is invalid therefore we must error
89 --
90 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
91 hr_utility.raise_error;
92 End If;
93 Close C_Sel1;
94 --
95 hr_utility.set_location(l_proc, 15);
96 l_fct_ret := true;
97 End If;
98 End If;
99 hr_utility.set_location(' Leaving:'||l_proc, 20);
100 Return (l_fct_ret);
101 --
102 End api_updating;
103 --
104 -- ----------------------------------------------------------------------------
105 -- |---------------------------------< lck >----------------------------------|
106 -- ----------------------------------------------------------------------------
107 Procedure lck
108 (
109 p_rule_set_id in number,
110 p_language in varchar2
111 ) is
112 --
113 -- Cursor selects the 'current' row from the HR Schema
114 --
115 Cursor C_Sel1 is
116 select rule_set_id,
117 rule_set_name,
118 description,
119 language,
120 source_lang
121 from pqh_rule_sets_tl
122 where rule_set_id = p_rule_set_id
123 and language = p_language
124 for update nowait;
125 --
126 l_proc varchar2(72) := g_package||'lck';
127 --
128 Begin
129 hr_utility.set_location('Entering:'||l_proc, 5);
130 --
131 -- Add any mandatory argument checking here:
132 -- Example:
133 -- hr_api.mandatory_arg_error
134 -- (p_api_name => l_proc,
135 -- p_argument => 'object_version_number',
136 -- p_argument_value => p_object_version_number);
137 --
138 Open C_Sel1;
139 Fetch C_Sel1 Into g_old_rec;
140 If C_Sel1%notfound then
141 Close C_Sel1;
142 --
143 -- The primary key is invalid therefore we must error
144 --
145 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
146 hr_utility.raise_error;
147 End If;
148 Close C_Sel1;
149 --
150 --
151 hr_utility.set_location(' Leaving:'||l_proc, 10);
152 --
153 -- We need to trap the ORA LOCK exception
154 --
155 Exception
156 When HR_Api.Object_Locked then
157 --
158 -- The object is locked therefore we need to supply a meaningful
159 -- error message.
160 --
161 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
162 hr_utility.set_message_token('TABLE_NAME', 'pqh_rule_sets_tl');
163 hr_utility.raise_error;
164 End lck;
165 --
166 -- ------------------------------------------------------------------------
167 -- |--------------------------< add_language >----------------------------|
168 -- ------------------------------------------------------------------------
169 -- {Start Of Comments}
170 --
171 -- Description:
172 -- Maintains the PQH_RULE_SETS_TL table. Ensures there is translation for every
173 -- installed language, removes any orphaned translation rows and
174 -- corrects any translations which have got out of synchronisation.
175 --
176 -- Prerequisites:
177 --
178 -- In Parameters:
179 --
180 -- Post Success:
181 -- A translation row exists for every installed language.
182 --
183 -- Post Failure:
184 -- Maintenance is aborted.
185 --
186 -- Developer Implementation Notes:
187 -- None.
188 --
189 -- Access Status:
190 -- Internal Development Use Only.
191 --
192 -- {End Of Comments}
193 -- ------------------------------------------------------------------------
194 procedure ADD_LANGUAGE
195 is
196 begin
197 delete from PQH_RULE_SETS_TL T
198 where not exists
199 (select NULL
200 from PQH_RULE_SETS B
201 where B.RULE_SET_ID = T.RULE_SET_ID
202 );
203
204 update PQH_RULE_SETS_TL T set (
205 RULE_SET_NAME
206 ) = (select
207 B.RULE_SET_NAME
208 from PQH_RULE_SETS_TL B
209 where B.RULE_SET_ID = T.RULE_SET_ID
210 and B.LANGUAGE = T.SOURCE_LANG)
211 where (
212 T.RULE_SET_ID,
213 T.LANGUAGE
214 ) in (select
215 SUBT.RULE_SET_ID,
216 SUBT.LANGUAGE
217 from PQH_RULE_SETS_TL SUBB, PQH_RULE_SETS_TL SUBT
218 where SUBB.RULE_SET_ID = SUBT.RULE_SET_ID
219 and SUBB.LANGUAGE = SUBT.SOURCE_LANG
220 and (SUBB.RULE_SET_NAME <> SUBT.RULE_SET_NAME
221 or (SUBB.RULE_SET_NAME is null and SUBT.RULE_SET_NAME is not null)
222 or (SUBB.RULE_SET_NAME is not null and SUBT.RULE_SET_NAME is null)
223 ));
224
225 insert into PQH_RULE_SETS_TL (
226 RULE_SET_ID,
227 RULE_SET_NAME,
228 CREATION_DATE,
229 CREATED_BY,
230 LAST_UPDATE_LOGIN,
231 LAST_UPDATED_BY,
232 LAST_UPDATE_DATE,
233 LANGUAGE,
234 SOURCE_LANG
235 ) select /*+ ORDERED */
236 B.RULE_SET_ID,
237 B.RULE_SET_NAME,
238 B.CREATION_DATE,
239 B.CREATED_BY,
240 B.LAST_UPDATE_LOGIN,
241 B.LAST_UPDATED_BY,
242 B.LAST_UPDATE_DATE,
243 L.LANGUAGE_CODE,
244 B.SOURCE_LANG
245 from PQH_RULE_SETS_TL B, FND_LANGUAGES L
246 where L.INSTALLED_FLAG in ('I', 'B')
247 and B.LANGUAGE = userenv('LANG')
248 and not exists
249 (select NULL
250 from PQH_RULE_SETS_TL T
251 where T.RULE_SET_ID = B.RULE_SET_ID
252 and T.LANGUAGE = L.LANGUAGE_CODE);
253 end ADD_LANGUAGE;
254 --
255 -- ----------------------------------------------------------------------------
256 -- |-----------------------------< convert_args >-----------------------------|
257 -- ----------------------------------------------------------------------------
258 Function convert_args
259 (
260 p_rule_set_id in number,
261 p_rule_set_name in varchar2,
262 p_description in varchar2,
263 p_language in varchar2,
264 p_source_lang in varchar2
265 )
266 Return g_rec_type is
267 --
268 l_rec g_rec_type;
269 l_proc varchar2(72) := g_package||'convert_args';
270 --
271 Begin
272 --
273 hr_utility.set_location('Entering:'||l_proc, 5);
274 --
275 -- Convert arguments into local l_rec structure.
276 --
277 l_rec.rule_set_id := p_rule_set_id;
278 l_rec.rule_set_name := p_rule_set_name;
279 l_rec.description := p_description;
280 l_rec.language := p_language;
281 l_rec.source_lang := p_source_lang;
282 --
283 -- Return the plsql record structure.
284 --
285 hr_utility.set_location(' Leaving:'||l_proc, 10);
286 Return(l_rec);
287 --
288 End convert_args;
289 --
290 end pqh_rtl_shd;