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