DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_STL_SHD

Source


1 Package Body per_stl_shd as
2 /* $Header: pestlrhi.pkb 120.1 2005/06/01 12:05:24 ndorai noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_stl_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 = 'PER_RI_SETUP_TASKS_TL_PK') 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 = 'PER_RI_SETUP_TASKS_TL_PK1') 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_setup_task_code                      in     varchar2
45   )      Return Boolean Is
46 --
47   --
48   -- Cursor selects the 'current' row from the HR Schema
49   --
50   Cursor C_Sel1 is
51     select
52        setup_task_code
53       ,language
54       ,source_lang
55       ,setup_task_name
56       ,setup_task_description
57     from  per_ri_setup_tasks_tl
58     where setup_task_code = p_setup_task_code;
59 --
60   l_fct_ret     boolean;
61 --
62 Begin
63   --
64   If (p_setup_task_code is null
65      ) Then
66     --
67     -- One of the primary key arguments is null therefore we must
68     -- set the returning function value to false
69     --
70     l_fct_ret := false;
71   Else
72     If (p_setup_task_code
73         = per_stl_shd.g_old_rec.setup_task_code
74        ) Then
75       --
76       -- The g_old_rec is current therefore we must
77       -- set the returning function to true
78       --
79       l_fct_ret := true;
80     Else
81       --
82       -- Select the current row into g_old_rec
83       --
84       Open C_Sel1;
85       Fetch C_Sel1 Into per_stl_shd.g_old_rec;
86       If C_Sel1%notfound Then
87         Close C_Sel1;
88         --
89         -- The primary key is invalid therefore we must error
90         --
91         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
92         fnd_message.raise_error;
93       End If;
94       Close C_Sel1;
95       --
96       l_fct_ret := true;
97     End If;
98   End If;
99   Return (l_fct_ret);
100 --
101 End api_updating;
102 --
103 -- ----------------------------------------------------------------------------
104 -- |---------------------------------< lck >----------------------------------|
105 -- ----------------------------------------------------------------------------
106 Procedure lck
107   (p_setup_task_code                      in     varchar2
108   ) is
109 --
110 -- Cursor selects the 'current' row from the HR Schema
111 --
112   Cursor C_Sel1 is
113     select
114        setup_task_code
115       ,language
116       ,source_lang
117       ,setup_task_name
118       ,setup_task_description
119     from        per_ri_setup_tasks_tl
120     where       setup_task_code = p_setup_task_code
121     for update nowait;
122 --
123   l_proc        varchar2(72) := g_package||'lck';
124 --
125 Begin
126   hr_utility.set_location('Entering:'||l_proc, 5);
127   --
128   hr_api.mandatory_arg_error
129     (p_api_name           => l_proc
130     ,p_argument           => 'SETUP_TASK_CODE'
131     ,p_argument_value     => p_setup_task_code
132     );
133   --
134   Open  C_Sel1;
135   Fetch C_Sel1 Into per_stl_shd.g_old_rec;
136   If C_Sel1%notfound then
137     Close C_Sel1;
138     --
139     -- The primary key is invalid therefore we must error
140     --
141     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
142     fnd_message.raise_error;
143   End If;
144   Close C_Sel1;
145   --
146   --
147   hr_utility.set_location(' Leaving:'||l_proc, 10);
148   --
149   -- We need to trap the ORA LOCK exception
150   --
151 Exception
152   When HR_Api.Object_Locked then
153     --
154     -- The object is locked therefore we need to supply a meaningful
155     -- error message.
156     --
157     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
158     fnd_message.set_token('TABLE_NAME', 'per_ri_setup_tasks_tl');
159     fnd_message.raise_error;
160 End lck;
161 --
162 -- ----------------------------------------------------------------------------
163 -- |----------------------------< add_language >------------------------------|
164 -- ----------------------------------------------------------------------------
165 --
166 -- EDIT_HERE:  Execute AOL's tltblgen(UNIX) program to generate the
167 --             ADD_LANGUAGE procedure.  Only the add_language procedure
168 --             should be added here.  Remove the following skeleton
169 --             procedure.
170 --
171 -- ----------------------------------------------------------------------------
172 PROCEDURE add_language IS
173 Begin
174   --
175 delete from PER_RI_SETUP_TASKS_TL T
176   where not exists
177     (select NULL
178     from PER_RI_SETUP_TASKS B
179     where B.SETUP_TASK_CODE = T.SETUP_TASK_CODE
180     );
181 
182   update PER_RI_SETUP_TASKS_TL T set (
183       SETUP_TASK_NAME,
184       SETUP_TASK_DESCRIPTION
185     ) = (select
186       B.SETUP_TASK_NAME,
187       B.SETUP_TASK_DESCRIPTION
188     from PER_RI_SETUP_TASKS_TL B
189     where B.SETUP_TASK_CODE = T.SETUP_TASK_CODE
190     and B.LANGUAGE = T.SOURCE_LANG)
191   where (
192       T.SETUP_TASK_CODE,
193       T.LANGUAGE
194   ) in (select
195       SUBT.SETUP_TASK_CODE,
196       SUBT.LANGUAGE
197     from PER_RI_SETUP_TASKS_TL SUBB, PER_RI_SETUP_TASKS_TL SUBT
198     where SUBB.SETUP_TASK_CODE = SUBT.SETUP_TASK_CODE
199     and SUBB.LANGUAGE = SUBT.SOURCE_LANG
200     and (SUBB.SETUP_TASK_NAME <> SUBT.SETUP_TASK_NAME
201       or SUBB.SETUP_TASK_DESCRIPTION <> SUBT.SETUP_TASK_DESCRIPTION
202   ));
203 
204   insert into PER_RI_SETUP_TASKS_TL (
205     SETUP_TASK_CODE,
206     SETUP_TASK_NAME,
207     SETUP_TASK_DESCRIPTION,
208     LAST_UPDATE_DATE,
209     LAST_UPDATED_BY,
210     LAST_UPDATE_LOGIN,
211     CREATED_BY,
212     CREATION_DATE,
213     LANGUAGE,
214     SOURCE_LANG
215   ) select /*+ ORDERED */
216     B.SETUP_TASK_CODE,
217     B.SETUP_TASK_NAME,
218     B.SETUP_TASK_DESCRIPTION,
219     B.LAST_UPDATE_DATE,
220     B.LAST_UPDATED_BY,
221     B.LAST_UPDATE_LOGIN,
222     B.CREATED_BY,
223     B.CREATION_DATE,
224     L.LANGUAGE_CODE,
225     B.SOURCE_LANG
226   from PER_RI_SETUP_TASKS_TL B, FND_LANGUAGES L
227   where L.INSTALLED_FLAG in ('I', 'B')
228   and B.LANGUAGE = userenv('LANG')
229   and not exists
230     (select NULL
231     from PER_RI_SETUP_TASKS_TL T
232     where T.SETUP_TASK_CODE = B.SETUP_TASK_CODE
233     and T.LANGUAGE = L.LANGUAGE_CODE);
234   --
235 End add_language;
236 --
237 -- ----------------------------------------------------------------------------
238 -- |-----------------------------< convert_args >-----------------------------|
239 -- ----------------------------------------------------------------------------
240 Function convert_args
241   (p_setup_task_code                in varchar2
242   ,p_language                       in varchar2
243   ,p_source_lang                    in varchar2
244   ,p_setup_task_name                in varchar2
245   ,p_setup_task_description         in varchar2
246   )
247   Return g_rec_type is
248 --
249   l_rec   g_rec_type;
250 --
251 Begin
252   --
253   -- Convert arguments into local l_rec structure.
254   --
255   l_rec.setup_task_code                  := p_setup_task_code;
256   l_rec.language                         := p_language;
257   l_rec.source_lang                      := p_source_lang;
258   l_rec.setup_task_name                  := p_setup_task_name;
259   l_rec.setup_task_description           := p_setup_task_description;
260   --
261   -- Return the plsql record structure.
262   --
263   Return(l_rec);
264 --
265 End convert_args;
266 --
267 end per_stl_shd;