[Home] [Help]
PACKAGE BODY: APPS.HR_NMF_SHD
Source
1 Package Body hr_nmf_shd as
2 /* $Header: hrnmfrhi.pkb 120.0 2005/05/31 01:34 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hr_nmf_shd.'; -- Global package name
9 g_debug boolean := hr_utility.debug_enabled;
10 --
11 -- ----------------------------------------------------------------------------
12 -- |---------------------------< constraint_error >---------------------------|
13 -- ----------------------------------------------------------------------------
14 Procedure constraint_error
15 (p_constraint_name in all_constraints.constraint_name%TYPE
16 ) Is
17 --
18 l_proc varchar2(72) := g_package||'constraint_error';
19 --
20 Begin
21 --
22 If (p_constraint_name = 'HR_NAME_FORMATS_PK') Then
23 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
24 fnd_message.set_token('PROCEDURE', l_proc);
25 fnd_message.set_token('STEP','5');
26 fnd_message.raise_error;
27 ElsIf (p_constraint_name = 'HR_NAME_FORMATS_U1') Then
28 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
29 fnd_message.set_token('PROCEDURE', l_proc);
30 fnd_message.set_token('STEP','10');
31 fnd_message.raise_error;
32 Else
33 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
34 fnd_message.set_token('PROCEDURE', l_proc);
35 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
36 fnd_message.raise_error;
37 End If;
38 --
39 End constraint_error;
40 --
41 -- ----------------------------------------------------------------------------
42 -- |-----------------------------< api_updating >-----------------------------|
43 -- ----------------------------------------------------------------------------
44 Function api_updating
45 (p_name_format_id in number
46 ,p_object_version_number in number
47 )
48 Return Boolean Is
49 --
50 --
51 -- Cursor selects the 'current' row from the HR Schema
52 --
53 Cursor C_Sel1 is
54 select
55 name_format_id
56 ,format_name
57 ,legislation_code
58 ,user_format_choice
59 ,format_mask
60 ,object_version_number
61 from hr_name_formats
62 where name_format_id = p_name_format_id;
63 --
64 l_fct_ret boolean;
65 --
66 Begin
67 --
68 If (p_name_format_id is null and
69 p_object_version_number is null
70 ) Then
71 --
72 -- One of the primary key arguments is null therefore we must
73 -- set the returning function value to false
74 --
75 l_fct_ret := false;
76 Else
77 If (p_name_format_id
78 = hr_nmf_shd.g_old_rec.name_format_id and
79 p_object_version_number
80 = hr_nmf_shd.g_old_rec.object_version_number
81 ) Then
82 --
83 -- The g_old_rec is current therefore we must
84 -- set the returning function to true
85 --
86 l_fct_ret := true;
87 Else
88 --
89 -- Select the current row into g_old_rec
90 --
91 Open C_Sel1;
92 Fetch C_Sel1 Into hr_nmf_shd.g_old_rec;
93 If C_Sel1%notfound Then
94 Close C_Sel1;
95 --
96 -- The primary key is invalid therefore we must error
97 --
98 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
99 fnd_message.raise_error;
100 End If;
101 Close C_Sel1;
102 If (p_object_version_number
103 <> hr_nmf_shd.g_old_rec.object_version_number) Then
104 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
105 fnd_message.raise_error;
106 End If;
107 l_fct_ret := true;
108 End If;
109 End If;
110 Return (l_fct_ret);
111 --
112 End api_updating;
113 --
114 -- ----------------------------------------------------------------------------
115 -- |---------------------------------< lck >----------------------------------|
116 -- ----------------------------------------------------------------------------
117 Procedure lck
118 (p_name_format_id in number
119 ,p_object_version_number in number
120 ) is
121 --
122 -- Cursor selects the 'current' row from the HR Schema
123 --
124 Cursor C_Sel1 is
125 select
126 name_format_id
127 ,format_name
128 ,legislation_code
129 ,user_format_choice
130 ,format_mask
131 ,object_version_number
132 from hr_name_formats
133 where name_format_id = p_name_format_id
134 for update nowait;
135 --
136 l_proc varchar2(72) := g_package||'lck';
137 --
138 Begin
139 if g_debug then
140 hr_utility.set_location('Entering:'||l_proc, 5);
141 end if;
142 --
143 hr_api.mandatory_arg_error
144 (p_api_name => l_proc
145 ,p_argument => 'NAME_FORMAT_ID'
146 ,p_argument_value => p_name_format_id
147 );
148 if g_debug then
149 hr_utility.set_location(l_proc,6);
150 end if;
151 hr_api.mandatory_arg_error
152 (p_api_name => l_proc
153 ,p_argument => 'OBJECT_VERSION_NUMBER'
154 ,p_argument_value => p_object_version_number
155 );
156 --
157 Open C_Sel1;
158 Fetch C_Sel1 Into hr_nmf_shd.g_old_rec;
159 If C_Sel1%notfound then
160 Close C_Sel1;
161 --
162 -- The primary key is invalid therefore we must error
163 --
164 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
165 fnd_message.raise_error;
166 End If;
167 Close C_Sel1;
168 If (p_object_version_number
169 <> hr_nmf_shd.g_old_rec.object_version_number) Then
170 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
171 fnd_message.raise_error;
172 End If;
173 --
174 if g_debug then
175 hr_utility.set_location(' Leaving:'||l_proc, 10);
176 end if;
177 --
178 -- We need to trap the ORA LOCK exception
179 --
180 Exception
181 When HR_Api.Object_Locked then
182 --
183 -- The object is locked therefore we need to supply a meaningful
184 -- error message.
185 --
186 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
187 fnd_message.set_token('TABLE_NAME', 'hr_name_formats');
188 fnd_message.raise_error;
189 End lck;
190 --
191 -- ----------------------------------------------------------------------------
192 -- |-----------------------------< convert_args >-----------------------------|
193 -- ----------------------------------------------------------------------------
194 Function convert_args
195 (p_name_format_id in number
196 ,p_format_name in varchar2
197 ,p_legislation_code in varchar2
198 ,p_user_format_choice in varchar2
199 ,p_format_mask in varchar2
200 ,p_object_version_number in number
201 )
202 Return g_rec_type is
203 --
204 l_rec g_rec_type;
205 --
206 Begin
207 --
208 -- Convert arguments into local l_rec structure.
209 --
210 l_rec.name_format_id := p_name_format_id;
211 l_rec.format_name := p_format_name;
212 l_rec.legislation_code := p_legislation_code;
213 l_rec.user_format_choice := p_user_format_choice;
214 l_rec.format_mask := p_format_mask;
215 l_rec.object_version_number := p_object_version_number;
216 --
217 -- Return the plsql record structure.
218 --
219 Return(l_rec);
220 --
221 End convert_args;
222 --
223 end hr_nmf_shd;