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