[Home] [Help]
PACKAGE BODY: APPS.HR_TPT_SHD
Source
1 Package Body hr_tpt_shd as
2 /* $Header: hrtptrhi.pkb 115.4 2002/12/03 13:09:29 raranjan noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hr_tpt_shd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure constraint_error
14 (p_constraint_name in all_constraints.constraint_name%TYPE
15 ) Is
16 --
17 l_proc varchar2(72) := g_package||'constraint_error';
18 --
19 Begin
20 --
21 If (p_constraint_name = 'HR_TAB_PAGE_PROPERTIES_TL_FK1') Then
22 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
23 fnd_message.set_token('PROCEDURE', l_proc);
24 fnd_message.set_token('STEP','5');
25 fnd_message.raise_error;
26 ElsIf (p_constraint_name = 'HR_TAB_PAGE_PROPERTIES_TL_PK') Then
27 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
28 fnd_message.set_token('PROCEDURE', l_proc);
29 fnd_message.set_token('STEP','10');
30 fnd_message.raise_error;
31 Else
32 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
33 fnd_message.set_token('PROCEDURE', l_proc);
34 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
35 fnd_message.raise_error;
36 End If;
37 --
38 End constraint_error;
39 --
40 -- ----------------------------------------------------------------------------
41 -- |-----------------------------< api_updating >-----------------------------|
42 -- ----------------------------------------------------------------------------
43 Function api_updating
44 (p_tab_page_property_id in number
45 ,p_language in varchar2
46 ) Return Boolean Is
47 --
48 --
49 -- Cursor selects the 'current' row from the HR Schema
50 --
51 Cursor C_Sel1 is
52 select
53 tab_page_property_id
54 ,language
55 ,source_lang
56 ,label
57 from hr_tab_page_properties_tl
58 where tab_page_property_id = p_tab_page_property_id
59 and language = p_language;
60 --
61 l_fct_ret boolean;
62 --
63 Begin
64 --
65 If (p_tab_page_property_id is null or
66 p_language is null
67 ) Then
68 --
69 -- One of the primary key arguments is null therefore we must
70 -- set the returning function value to false
71 --
72 l_fct_ret := false;
73 Else
74 If (p_tab_page_property_id
75 = hr_tpt_shd.g_old_rec.tab_page_property_id and
76 p_language
77 = hr_tpt_shd.g_old_rec.language
78 ) Then
79 --
80 -- The g_old_rec is current therefore we must
81 -- set the returning function to true
82 --
83 l_fct_ret := true;
84 Else
85 --
86 -- Select the current row into g_old_rec
87 --
88 Open C_Sel1;
89 Fetch C_Sel1 Into hr_tpt_shd.g_old_rec;
90 If C_Sel1%notfound Then
91 Close C_Sel1;
92 --
93 -- The primary key is invalid therefore we must error
94 --
95 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
96 fnd_message.raise_error;
97 End If;
98 Close C_Sel1;
99 --
100 l_fct_ret := true;
101 End If;
102 End If;
103 Return (l_fct_ret);
104 --
105 End api_updating;
106 --
107 -- ----------------------------------------------------------------------------
108 -- |---------------------------------< lck >----------------------------------|
109 -- ----------------------------------------------------------------------------
110 Procedure lck
111 (p_tab_page_property_id in number
112 ,p_language in varchar2
113 ) is
114 --
115 -- Cursor selects the 'current' row from the HR Schema
116 --
117 Cursor C_Sel1 is
118 select
119 tab_page_property_id
120 ,language
121 ,source_lang
122 ,label
123 from hr_tab_page_properties_tl
124 where tab_page_property_id = p_tab_page_property_id
125 and language = p_language
126 for update nowait;
127 --
128 l_proc varchar2(72) := g_package||'lck';
129 --
130 Begin
131 hr_utility.set_location('Entering:'||l_proc, 5);
132 --
133 hr_api.mandatory_arg_error
134 (p_api_name => l_proc
135 ,p_argument => 'TAB_PAGE_PROPERTY_ID'
136 ,p_argument_value => p_tab_page_property_id
137 );
138 hr_utility.set_location(l_proc,6);
139 hr_api.mandatory_arg_error
140 (p_api_name => l_proc
141 ,p_argument => 'LANGUAGE'
142 ,p_argument_value => p_language
143 );
144 --
145 Open C_Sel1;
146 Fetch C_Sel1 Into hr_tpt_shd.g_old_rec;
147 If C_Sel1%notfound then
148 Close C_Sel1;
149 --
150 -- The primary key is invalid therefore we must error
151 --
152 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
153 fnd_message.raise_error;
154 End If;
155 Close C_Sel1;
156 --
157 --
158 hr_utility.set_location(' Leaving:'||l_proc, 10);
159 --
160 -- We need to trap the ORA LOCK exception
161 --
162 Exception
163 When HR_Api.Object_Locked then
164 --
165 -- The object is locked therefore we need to supply a meaningful
166 -- error message.
167 --
168 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
169 fnd_message.set_token('TABLE_NAME', 'hr_tab_page_properties_tl');
170 fnd_message.raise_error;
171 End lck;
172 --
173 -- ----------------------------------------------------------------------------
174 -- |----------------------------< add_language >------------------------------|
175 -- ----------------------------------------------------------------------------
176 Procedure add_language is
177 --
178 cursor csr_tab_page_properties is
179 select tpt.tab_page_property_id
180 ,tpt.label
181 ,tpt.source_lang
182 from hr_tab_page_properties_tl tpt
183 where tpt.language = userenv('LANG');
184 --
185 Begin
186 --
187 delete from hr_tab_page_properties_tl t
188 where not exists
189 ( select null
190 from hr_tab_page_properties_b b
191 where b.tab_page_property_id = t.tab_page_property_id
192 );
193
194 update hr_tab_page_properties_tl t
195 set ( label
196 ) =
197 ( select b.label
198 from hr_tab_page_properties_tl b
199 where b.tab_page_property_id = t.tab_page_property_id
200 and b.language = t.source_lang )
201 where ( t.tab_page_property_id,
202 t.language
203 ) in
204 ( select subt.tab_page_property_id,
205 subt.language
206 from hr_tab_page_properties_tl subb, hr_tab_page_properties_tl subt
207 where subb.tab_page_property_id = subt.tab_page_property_id
208 and subb.language = subt.source_lang
209 and ( subb.label <> subt.label
210 or (subb.label is null and subt.label is not null)
211 or (subb.label is not null and subt.label is null)
212 )
213 );
214 --
215 --
216 for l_tab_page_property in csr_tab_page_properties loop
217 hr_tpt_ins.ins_tl
218 (p_language_code => l_tab_page_property.source_lang
219 ,p_tab_page_property_id => l_tab_page_property.tab_page_property_id
220 ,p_label => l_tab_page_property.label
221 );
222 end loop;
223 --
224 End;
225 --
226 -- ----------------------------------------------------------------------------
227 -- |-----------------------------< convert_args >-----------------------------|
228 -- ----------------------------------------------------------------------------
229 Function convert_args
230 (p_tab_page_property_id in number
231 ,p_language in varchar2
232 ,p_source_lang in varchar2
233 ,p_label in varchar2
234 )
235 Return g_rec_type is
236 --
237 l_rec g_rec_type;
238 --
239 Begin
240 --
241 -- Convert arguments into local l_rec structure.
242 --
243 l_rec.tab_page_property_id := p_tab_page_property_id;
244 l_rec.language := p_language;
245 l_rec.source_lang := p_source_lang;
246 l_rec.label := p_label;
247 --
248 -- Return the plsql record structure.
249 --
250 Return(l_rec);
251 --
252 End convert_args;
253 --
254 end hr_tpt_shd;