[Home] [Help]
PACKAGE BODY: APPS.HR_FIT_SHD
Source
1 Package Body hr_fit_shd as
2 /* $Header: hrfitrhi.pkb 115.4 2003/05/06 11:07:14 adhunter noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hr_fit_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_ITEMS_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_ITEMS_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_item_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_item_id
54 ,language
55 ,source_lang
56 ,user_item_name
57 ,description
58 from hr_form_items_tl
59 where form_item_id = p_form_item_id
60 and language = p_language;
61 --
62 l_fct_ret boolean;
63 --
64 Begin
65 --
66 If (p_form_item_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_item_id
76 = hr_fit_shd.g_old_rec.form_item_id and
77 p_language
78 = hr_fit_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_fit_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_item_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_item_id
121 ,language
122 ,source_lang
123 ,user_item_name
124 ,description
125 from hr_form_items_tl
126 where form_item_id = p_form_item_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_ITEM_ID'
138 ,p_argument_value => p_form_item_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_fit_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_items_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_items is
181 select fit.form_item_id
182 ,fit.user_item_name
183 ,fit.description
184 ,fit.source_lang
185 from hr_form_items_tl fit
186 where fit.language = userenv('LANG');
187 --
188 Begin
189 -- 115.4 after AOL recommendation the UPDATE and DELETE statements were removed
190 -- to assist performance of NLS patchsets
191 --
192 for l_form_item in csr_form_items loop
193 hr_fit_ins.ins_tl
194 (p_language_code => l_form_item.source_lang
195 ,p_form_item_id => l_form_item.form_item_id
196 ,p_user_item_name => l_form_item.user_item_name
197 ,p_description => l_form_item.description
198 );
199 end loop;
200 --
201 End;
202 --
203 -- ----------------------------------------------------------------------------
204 -- |-----------------------------< convert_args >-----------------------------|
205 -- ----------------------------------------------------------------------------
206 Function convert_args
207 (p_form_item_id in number
208 ,p_language in varchar2
209 ,p_source_lang in varchar2
210 ,p_user_item_name in varchar2
211 ,p_description in varchar2
212 )
213 Return g_rec_type is
214 --
215 l_rec g_rec_type;
216 --
217 Begin
218 --
219 -- Convert arguments into local l_rec structure.
220 --
221 l_rec.form_item_id := p_form_item_id;
222 l_rec.language := p_language;
223 l_rec.source_lang := p_source_lang;
224 l_rec.user_item_name := p_user_item_name;
225 l_rec.description := p_description;
226 --
227 -- Return the plsql record structure.
228 --
229 Return(l_rec);
230 --
231 End convert_args;
232 --
233 end hr_fit_shd;