[Home] [Help]
PACKAGE BODY: APPS.PQH_TTL_SHD
Source
1 Package Body pqh_ttl_shd as
2 /* $Header: pqttlrhi.pkb 120.1 2005/08/06 13:18:05 srajakum noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pqh_ttl_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_template_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 template_id,
45 template_name,
46 language,
47 source_lang
48 from pqh_templates_tl
49 where template_id = p_template_id
50 and language = p_language;
51 --
52 l_proc varchar2(72) := g_package||'api_updating';
53 l_fct_ret boolean;
54 --
55 Begin
56 hr_utility.set_location('Entering:'||l_proc, 5);
57 --
58 If (
59 p_template_id is null or
60 p_language is null
61 ) Then
62 --
63 -- One of the primary key arguments is null therefore we must
64 -- set the returning function value to false
65 --
66 l_fct_ret := false;
67 Else
68 If (
69 p_template_id = g_old_rec.template_id and
70 p_language = g_old_rec.language
71 ) Then
72 hr_utility.set_location(l_proc, 10);
73 --
74 -- The g_old_rec is current therefore we must
75 -- set the returning function to true
76 --
77 l_fct_ret := true;
78 Else
79 --
80 -- Select the current row into g_old_rec
81 --
82 Open C_Sel1;
83 Fetch C_Sel1 Into g_old_rec;
84 If C_Sel1%notfound Then
85 Close C_Sel1;
86 --
87 -- The primary key is invalid therefore we must error
88 --
89 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
90 hr_utility.raise_error;
91 End If;
92 Close C_Sel1;
93 --
94 hr_utility.set_location(l_proc, 15);
95 l_fct_ret := true;
96 End If;
97 End If;
98 hr_utility.set_location(' Leaving:'||l_proc, 20);
99 Return (l_fct_ret);
100 --
101 End api_updating;
102 --
103 -- ----------------------------------------------------------------------------
104 -- |---------------------------------< lck >----------------------------------|
105 -- ----------------------------------------------------------------------------
106 Procedure lck
107 (
108 p_template_id in number,
109 p_language in varchar2
110 ) is
111 --
112 -- Cursor selects the 'current' row from the HR Schema
113 --
114 Cursor C_Sel1 is
115 select template_id,
116 template_name,
117 language,
118 source_lang
119 from pqh_templates_tl
120 where template_id = p_template_id
121 and language = p_language
122 for update nowait;
123 --
124 l_proc varchar2(72) := g_package||'lck';
125 --
126 Begin
127 hr_utility.set_location('Entering:'||l_proc, 5);
128 --
129 -- Add any mandatory argument checking here:
130 -- Example:
131 -- hr_api.mandatory_arg_error
132 -- (p_api_name => l_proc,
133 -- p_argument => 'object_version_number',
134 -- p_argument_value => p_object_version_number);
135 --
136 Open C_Sel1;
137 Fetch C_Sel1 Into g_old_rec;
138 If C_Sel1%notfound then
139 Close C_Sel1;
140 --
141 -- The primary key is invalid therefore we must error
142 --
143 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
144 hr_utility.raise_error;
145 End If;
146 Close C_Sel1;
147 --
148 --
149 hr_utility.set_location(' Leaving:'||l_proc, 10);
150 --
151 -- We need to trap the ORA LOCK exception
152 --
153 Exception
154 When HR_Api.Object_Locked then
155 --
156 -- The object is locked therefore we need to supply a meaningful
157 -- error message.
158 --
159 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
160 hr_utility.set_message_token('TABLE_NAME', 'pqh_templates_tl');
161 hr_utility.raise_error;
162 End lck;
163 --
164 --
165 -- --------------------------------------ADD LANGUAGE ------------------------
166 --
167
168 procedure ADD_LANGUAGE
169 is
170 begin
171 delete from PQH_TEMPLATES_TL T
172 where not exists
173 (select NULL
174 from PQH_TEMPLATES B
175 where B.TEMPLATE_ID = T.TEMPLATE_ID
176 );
177
178 update PQH_TEMPLATES_TL T set (
179 TEMPLATE_NAME
180 ) = (select
181 B.TEMPLATE_NAME
182 from PQH_TEMPLATES_TL B
183 where B.TEMPLATE_ID = T.TEMPLATE_ID
184 and B.LANGUAGE = T.SOURCE_LANG)
185 where (
186 T.TEMPLATE_ID,
187 T.LANGUAGE
188 ) in (select
189 SUBT.TEMPLATE_ID,
190 SUBT.LANGUAGE
191 from PQH_TEMPLATES_TL SUBB, PQH_TEMPLATES_TL SUBT
192 where SUBB.TEMPLATE_ID = SUBT.TEMPLATE_ID
193 and SUBB.LANGUAGE = SUBT.SOURCE_LANG
194 and (SUBB.TEMPLATE_NAME <> SUBT.TEMPLATE_NAME
195 ));
196
197 insert into PQH_TEMPLATES_TL (
198 TEMPLATE_ID,
199 TEMPLATE_NAME,
200 LAST_UPDATE_DATE,
201 CREATION_DATE,
202 CREATED_BY,
203 LAST_UPDATE_LOGIN,
204 LAST_UPDATED_BY,
205 LANGUAGE,
206 SOURCE_LANG
207 ) select
208 B.TEMPLATE_ID,
209 B.TEMPLATE_NAME,
210 B.LAST_UPDATE_DATE,
211 B.CREATION_DATE,
212 B.CREATED_BY,
213 B.LAST_UPDATE_LOGIN,
214 B.LAST_UPDATED_BY,
215 L.LANGUAGE_CODE,
216 B.SOURCE_LANG
217 from PQH_TEMPLATES_TL B, FND_LANGUAGES L
218 where L.INSTALLED_FLAG in ('I', 'B')
219 and B.LANGUAGE = userenv('LANG')
220 and not exists
221 (select NULL
222 from PQH_TEMPLATES_TL T
223 where T.TEMPLATE_ID = B.TEMPLATE_ID
224 and T.LANGUAGE = L.LANGUAGE_CODE);
225 end ADD_LANGUAGE;
226
227 -- ----------------------------------------------------------------------------
228 -- |-----------------------------< convert_args >-----------------------------|
229 -- ----------------------------------------------------------------------------
230 Function convert_args
231 (
232 p_template_id in number,
233 p_template_name in varchar2,
234 p_language in varchar2,
235 p_source_lang in varchar2
236 )
237 Return g_rec_type is
238 --
239 l_rec g_rec_type;
240 l_proc varchar2(72) := g_package||'convert_args';
241 --
242 Begin
243 --
244 hr_utility.set_location('Entering:'||l_proc, 5);
245 --
246 -- Convert arguments into local l_rec structure.
247 --
248 l_rec.template_id := p_template_id;
249 l_rec.template_name := p_template_name;
250 l_rec.language := p_language;
251 l_rec.source_lang := p_source_lang;
252 --
253 -- Return the plsql record structure.
254 --
255 hr_utility.set_location(' Leaving:'||l_proc, 10);
256 Return(l_rec);
257 --
258 End convert_args;
259 --
260 end pqh_ttl_shd;