[Home] [Help]
PACKAGE BODY: APPS.HR_FCT_SHD
Source
1 Package Body hr_fct_shd as
2 /* $Header: hrfctrhi.pkb 115.3 2002/12/03 10:28:03 hjonnala noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hr_fct_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_FORM_CANVASES_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_FORM_CANVASES_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_form_canvas_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 form_canvas_id
54 ,language
55 ,source_lang
56 ,user_canvas_name
57 ,description
58 from hr_form_canvases_tl
59 where form_canvas_id = p_form_canvas_id
60 and language = p_language;
61 --
62 l_fct_ret boolean;
63 --
64 Begin
65 --
66 If (p_form_canvas_id is null or
67 p_language is null
68 ) Then
69 --
70 -- One of the primary key arguments is null therefore we must
71 -- set the returning function value to false
72 --
73 l_fct_ret := false;
74 Else
75 If (p_form_canvas_id
76 = hr_fct_shd.g_old_rec.form_canvas_id and
77 p_language
78 = hr_fct_shd.g_old_rec.language
79 ) Then
80 --
81 -- The g_old_rec is current therefore we must
82 -- set the returning function to true
83 --
84 l_fct_ret := true;
85 Else
86 --
87 -- Select the current row into g_old_rec
88 --
89 Open C_Sel1;
90 Fetch C_Sel1 Into hr_fct_shd.g_old_rec;
91 If C_Sel1%notfound Then
92 Close C_Sel1;
93 --
94 -- The primary key is invalid therefore we must error
95 --
96 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
97 fnd_message.raise_error;
98 End If;
99 Close C_Sel1;
100 --
101 l_fct_ret := true;
102 End If;
103 End If;
104 Return (l_fct_ret);
105 --
106 End api_updating;
107 --
108 -- ----------------------------------------------------------------------------
109 -- |---------------------------------< lck >----------------------------------|
110 -- ----------------------------------------------------------------------------
111 Procedure lck
112 (p_form_canvas_id in number
113 ,p_language in varchar2
114 ) is
115 --
116 -- Cursor selects the 'current' row from the HR Schema
117 --
118 Cursor C_Sel1 is
119 select
120 form_canvas_id
121 ,language
122 ,source_lang
123 ,user_canvas_name
124 ,description
125 from hr_form_canvases_tl
126 where form_canvas_id = p_form_canvas_id
127 and language = p_language
128 for update nowait;
129 --
130 l_proc varchar2(72) := g_package||'lck';
131 --
132 Begin
133 hr_utility.set_location('Entering:'||l_proc, 5);
134 --
135 hr_api.mandatory_arg_error
136 (p_api_name => l_proc
137 ,p_argument => 'FORM_CANVAS_ID'
138 ,p_argument_value => p_form_canvas_id
139 );
140 hr_utility.set_location(l_proc,6);
141 hr_api.mandatory_arg_error
142 (p_api_name => l_proc
143 ,p_argument => 'LANGUAGE'
144 ,p_argument_value => p_language
145 );
146 --
147 Open C_Sel1;
148 Fetch C_Sel1 Into hr_fct_shd.g_old_rec;
149 If C_Sel1%notfound then
150 Close C_Sel1;
151 --
152 -- The primary key is invalid therefore we must error
153 --
154 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
155 fnd_message.raise_error;
156 End If;
157 Close C_Sel1;
158 --
159 --
160 hr_utility.set_location(' Leaving:'||l_proc, 10);
161 --
162 -- We need to trap the ORA LOCK exception
163 --
164 Exception
165 When HR_Api.Object_Locked then
166 --
167 -- The object is locked therefore we need to supply a meaningful
168 -- error message.
169 --
170 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
171 fnd_message.set_token('TABLE_NAME', 'hr_form_canvases_tl');
172 fnd_message.raise_error;
173 End lck;
174 --
175 -- ----------------------------------------------------------------------------
176 -- |----------------------------< add_language >------------------------------|
177 -- ----------------------------------------------------------------------------
178 Procedure add_language is
179 --
180 cursor csr_form_canvases is
181 select fct.form_canvas_id
182 ,fct.user_canvas_name
183 ,fct.description
184 ,fct.source_lang
185 from hr_form_canvases_tl fct
186 where fct.language = userenv('LANG');
187 --
188 Begin
189 --
190 delete from hr_form_canvases_tl t
191 where not exists
192 ( select null
193 from hr_form_canvases b
194 where b.form_canvas_id = t.form_canvas_id
195 );
196
197 update hr_form_canvases_tl t
198 set ( user_canvas_name,
199 description ) =
200 ( select b.user_canvas_name,
201 b.description
202 from hr_form_canvases_tl b
203 where b.form_canvas_id = t.form_canvas_id
204 and b.language = t.source_lang )
205 where ( t.form_canvas_id,
206 t.language
207 ) in
208 ( select subt.form_canvas_id,
209 subt.language
210 from hr_form_canvases_tl subb, hr_form_canvases_tl subt
211 where subb.form_canvas_id = subt.form_canvas_id
212 and subb.language = subt.source_lang
213 and ( subb.user_canvas_name <> subt.user_canvas_name
214 or subb.description <> subt.description
215 or (subb.description is null and subt.description is not null)
216 or (subb.description is not null and subt.description is null)
217 )
218 );
219 --
220 --
221 for l_form_canvas in csr_form_canvases loop
222 hr_fct_ins.ins_tl
223 (p_language_code => l_form_canvas.source_lang
224 ,p_form_canvas_id => l_form_canvas.form_canvas_id
225 ,p_user_canvas_name => l_form_canvas.user_canvas_name
226 ,p_description => l_form_canvas.description
227 );
228 end loop;
229 --
230 End;
231 --
232 -- ----------------------------------------------------------------------------
233 -- |-----------------------------< convert_args >-----------------------------|
234 -- ----------------------------------------------------------------------------
235 Function convert_args
236 (p_form_canvas_id in number
237 ,p_language in varchar2
238 ,p_source_lang in varchar2
239 ,p_user_canvas_name in varchar2
240 ,p_description in varchar2
241 )
242 Return g_rec_type is
243 --
244 l_rec g_rec_type;
245 --
246 Begin
247 --
248 -- Convert arguments into local l_rec structure.
249 --
250 l_rec.form_canvas_id := p_form_canvas_id;
251 l_rec.language := p_language;
252 l_rec.source_lang := p_source_lang;
253 l_rec.user_canvas_name := p_user_canvas_name;
254 l_rec.description := p_description;
255 --
256 -- Return the plsql record structure.
257 --
258 Return(l_rec);
259 --
260 End convert_args;
261 --
262 end hr_fct_shd;