DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_HAC_SHD

Source


1 Package Body hxc_hac_shd as
2  /* $Header: hxchacrhi.pkb 120.4 2006/06/13 08:42:23 gsirigin noship $ */
3  --
4  -- ----------------------------------------------------------------------------
5  -- |                     Private Global Definitions                           |
6  -- ----------------------------------------------------------------------------
7  --
8  g_package  varchar2(33)	:= '  hxc_hac_shd.';  -- Global package name
9  g_debug    boolean		:= hr_utility.debug_enabled;
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_COMPS_FK1') 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    ElsIf (p_constraint_name = 'HXC_APPROVAL_COMPS_FK2') Then
39      fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
40      fnd_message.set_token('PROCEDURE', l_proc);
41      fnd_message.set_token('STEP','10');
42      fnd_message.raise_error;
43    ElsIf (p_constraint_name = 'HXC_APPROVAL_COMPS_PK') Then
44      fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
45      fnd_message.set_token('PROCEDURE', l_proc);
46      fnd_message.set_token('STEP','15');
47      fnd_message.raise_error;
48    Else
49      fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
50      fnd_message.set_token('PROCEDURE', l_proc);
51      fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
52      fnd_message.raise_error;
53    End If;
54    --
55  End constraint_error;
56  --
57  -- ----------------------------------------------------------------------------
58  -- |-----------------------------< api_updating >-----------------------------|
59  -- ----------------------------------------------------------------------------
60  Function api_updating
61    (p_approval_comp_id                     in     number
62    ,p_object_version_number                in     number
63    )
64    Return Boolean Is
65  --
66    --
67    -- Cursor selects the 'current' row from the HR Schema
68    --
69    Cursor C_Sel1 is
70      select
71         approval_comp_id
72        ,approval_style_id
73        ,time_recipient_id
74        ,approval_mechanism
75        ,approval_mechanism_id
76        ,wf_item_type
77        ,wf_name
78        ,start_date
79        ,end_date
80        ,object_version_number
81        ,approval_order
82        ,time_category_id
83        ,parent_comp_id
84        ,parent_comp_ovn
85        ,run_recipient_extensions
86      from	hxc_approval_comps
87      where	approval_comp_id = p_approval_comp_id;
88  --
89    l_fct_ret	boolean;
90  --
91  Begin
92    --
93    If (p_approval_comp_id is null and
94        p_object_version_number is null
95       ) Then
96      --
97      -- One of the primary key arguments is null therefore we must
98      -- set the returning function value to false
99      --
100      l_fct_ret := false;
101    Else
102      If (p_approval_comp_id
103          = hxc_hac_shd.g_old_rec.approval_comp_id and
104          p_object_version_number
105          = hxc_hac_shd.g_old_rec.object_version_number
106         ) Then
107        --
108        -- The g_old_rec is current therefore we must
109        -- set the returning function to true
110        --
111        l_fct_ret := true;
112      Else
113        --
114        -- Select the current row into g_old_rec
115        --
116        Open C_Sel1;
117        Fetch C_Sel1 Into hxc_hac_shd.g_old_rec;
118        If C_Sel1%notfound Then
119          Close C_Sel1;
120          --
121          -- The primary key is invalid therefore we must error
122          --
123          fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
124          fnd_message.raise_error;
125        End If;
126        Close C_Sel1;
127        If (p_object_version_number
128            <> hxc_hac_shd.g_old_rec.object_version_number) Then
129          fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
130          fnd_message.raise_error;
131        End If;
132        l_fct_ret := true;
133      End If;
134    End If;
135    Return (l_fct_ret);
136  --
137  End api_updating;
138  --
139  -- ----------------------------------------------------------------------------
140  -- |---------------------------------< lck >----------------------------------|
141  -- ----------------------------------------------------------------------------
142  Procedure lck
143    (p_approval_comp_id                     in     number
144    ,p_object_version_number                in     number
145    ) is
146  --
147  -- Cursor selects the 'current' row from the HR Schema
148  --
149    Cursor C_Sel1 is
150      select
151         approval_comp_id
152        ,approval_style_id
153        ,time_recipient_id
154        ,approval_mechanism
155        ,approval_mechanism_id
156        ,wf_item_type
157        ,wf_name
158        ,start_date
159        ,end_date
160        ,object_version_number
161        ,approval_order
162        ,time_category_id
163  	  ,parent_comp_id
164        ,parent_comp_ovn
165        ,run_recipient_extensions
166      from	hxc_approval_comps
167      where	approval_comp_id = p_approval_comp_id
168      for	update nowait;
169  --
170    l_proc	varchar2(72);
171  --
172  Begin
173    g_debug:=hr_utility.debug_enabled;
174    if g_debug then
175 	l_proc := g_package||'lck';
176 	hr_utility.set_location('Entering:'||l_proc, 5);
177    end if;
178    --
179    hr_api.mandatory_arg_error
180      (p_api_name           => l_proc
181      ,p_argument           => 'APPROVAL_COMP_ID'
182      ,p_argument_value     => p_approval_comp_id
183      );
184    --
185    Open  C_Sel1;
186    Fetch C_Sel1 Into hxc_hac_shd.g_old_rec;
187    If C_Sel1%notfound then
188      Close C_Sel1;
189      --
190      -- The primary key is invalid therefore we must error
191      --
192      fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
193      fnd_message.raise_error;
194    End If;
195    Close C_Sel1;
196    If (p_object_version_number
197        <> hxc_hac_shd.g_old_rec.object_version_number) Then
198          fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
199          fnd_message.raise_error;
200    End If;
201    --
202    if g_debug then
203 	hr_utility.set_location(' Leaving:'||l_proc, 10);
204    end if;
205    --
206    -- We need to trap the ORA LOCK exception
207    --
208  Exception
209    When HR_Api.Object_Locked then
210      --
211      -- The object is locked therefore we need to supply a meaningful
212      -- error message.
213      --
214      fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
215      fnd_message.set_token('TABLE_NAME', 'hxc_approval_comps');
216      fnd_message.raise_error;
217  End lck;
218  --
219  -- ----------------------------------------------------------------------------
220  -- |-----------------------------< convert_args >-----------------------------|
221  -- ----------------------------------------------------------------------------
222  Function convert_args
223    (p_approval_comp_id               in number
224    ,p_approval_style_id              in number
225    ,p_time_recipient_id              in number
226    ,p_approval_mechanism             in varchar2
227    ,p_approval_mechanism_id          in number
228    ,p_wf_item_type                   in varchar2
229    ,p_wf_name                        in varchar2
230    ,p_start_date                     in date
231    ,p_end_date                       in date
232    ,p_object_version_number          in number
233    ,p_approval_order                 in number
234    ,p_time_category_id               in number
235    ,p_parent_comp_id                 in number
236    ,p_parent_comp_ovn		     in number
237    ,p_run_recipient_extensions       in varchar2
238    )
239    Return g_rec_type is
240  --
241    l_rec   g_rec_type;
242  --
243  Begin
244    --
245    -- Convert arguments into local l_rec structure.
246    --
247    l_rec.approval_comp_id                 := p_approval_comp_id;
248    l_rec.approval_style_id                := p_approval_style_id;
249    l_rec.time_recipient_id                := p_time_recipient_id;
250    l_rec.approval_mechanism               := p_approval_mechanism;
251    l_rec.approval_mechanism_id            := p_approval_mechanism_id;
252    l_rec.wf_item_type                     := p_wf_item_type;
253    l_rec.wf_name                          := p_wf_name;
254    l_rec.start_date                       := p_start_date;
255    l_rec.end_date                         := p_end_date;
256    l_rec.object_version_number            := p_object_version_number;
257    l_rec.approval_order                   := p_approval_order;
258    l_rec.time_category_id                 := p_time_category_id;
259    l_rec.parent_comp_id                   := p_parent_comp_id;
260    l_rec.parent_comp_ovn                  := p_parent_comp_ovn;
261    l_rec.run_recipient_extensions         := p_run_recipient_extensions;
262    --
263    -- Return the plsql record structure.
264    --
265    Return(l_rec);
266  --
267  End convert_args;
268  --
269  end hxc_hac_shd;