[Home] [Help]
PACKAGE BODY: APPS.OTA_BJT_SHD
Source
1 Package Body ota_bjt_shd as
2 /* $Header: otbjtrhi.pkb 120.0 2005/05/29 07:03:39 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ota_bjt_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 = 'SYS_C00179292') 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 Else
27 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
28 fnd_message.set_token('PROCEDURE', l_proc);
29 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
30 fnd_message.raise_error;
31 End If;
32 --
33 End constraint_error;
34 --
35 -- ----------------------------------------------------------------------------
36 -- |-----------------------------< api_updating >-----------------------------|
37 -- ----------------------------------------------------------------------------
38 Function api_updating
39 (p_booking_justification_id in number
40 ,p_language in varchar2
41 ) Return Boolean Is
42 --
43 --
44 -- Cursor selects the 'current' row from the HR Schema
45 --
46 Cursor C_Sel1 is
47 select
48 booking_justification_id
49 ,justification_text
50 ,source_lang
51 ,language
52 from ota_bkng_justifications_tl
53 where booking_justification_id = p_booking_justification_id
54 and language = p_language;
55 --
56 l_fct_ret boolean;
57 --
58 Begin
59 --
60 If (p_booking_justification_id is null or
61 p_language is null
62 ) Then
63 --
64 -- One of the primary key arguments is null therefore we must
65 -- set the returning function value to false
66 --
67 l_fct_ret := false;
68 Else
69 If (p_booking_justification_id
70 = ota_bjt_shd.g_old_rec.booking_justification_id and
71 p_language
72 = ota_bjt_shd.g_old_rec.language
73 ) Then
74 --
75 -- The g_old_rec is current therefore we must
76 -- set the returning function to true
77 --
78 l_fct_ret := true;
79 Else
80 --
81 -- Select the current row into g_old_rec
82 --
83 Open C_Sel1;
84 Fetch C_Sel1 Into ota_bjt_shd.g_old_rec;
85 If C_Sel1%notfound Then
86 Close C_Sel1;
87 --
88 -- The primary key is invalid therefore we must error
89 --
90 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
91 fnd_message.raise_error;
92 End If;
93 Close C_Sel1;
94 l_fct_ret := true;
95 End If;
96 End If;
97 Return (l_fct_ret);
98 --
99 End api_updating;
100 --
101 -- ----------------------------------------------------------------------------
102 -- |---------------------------------< lck >----------------------------------|
103 -- ----------------------------------------------------------------------------
104 Procedure lck
105 (p_booking_justification_id in number
106 ,p_language in varchar2
107 ) is
108 --
109 -- Cursor selects the 'current' row from the HR Schema
110 --
111 Cursor C_Sel1 is
112 select
113 booking_justification_id
114 ,justification_text
115 ,source_lang
116 ,language
117 from ota_bkng_justifications_tl
118 where booking_justification_id = p_booking_justification_id
119 and language = p_language
120 for update nowait;
121 --
122 l_proc varchar2(72) := g_package||'lck';
123 --
124 Begin
125 hr_utility.set_location('Entering:'||l_proc, 5);
126 --
127 hr_api.mandatory_arg_error
128 (p_api_name => l_proc
129 ,p_argument => 'BOOKING_JUSTIFICATION_ID'
130 ,p_argument_value => p_booking_justification_id
131 );
132 hr_utility.set_location(l_proc,6);
133 hr_api.mandatory_arg_error
134 (p_api_name => l_proc
135 ,p_argument => 'LANGUAGE'
136 ,p_argument_value => p_language
137 );
138 --
139 Open C_Sel1;
140 Fetch C_Sel1 Into ota_bjt_shd.g_old_rec;
141 If C_Sel1%notfound then
142 Close C_Sel1;
143 --
144 -- The primary key is invalid therefore we must error
145 --
146 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
147 fnd_message.raise_error;
148 End If;
149 Close C_Sel1;
150 --
151 hr_utility.set_location(' Leaving:'||l_proc, 10);
152 --
153 -- We need to trap the ORA LOCK exception
154 --
155 Exception
156 When HR_Api.Object_Locked then
157 --
158 -- The object is locked therefore we need to supply a meaningful
159 -- error message.
160 --
161 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
162 fnd_message.set_token('TABLE_NAME', 'ota_bkng_justifications_tl');
163 fnd_message.raise_error;
164 End lck;
165 --
166 -- ----------------------------------------------------------------------------
167 -- |----------------------------< add_language >------------------------------|
168 -- ----------------------------------------------------------------------------
169 procedure ADD_LANGUAGE
170 is
171 begin
172 delete from OTA_BKNG_JUSTIFICATIONS_TL T
173 where not exists
174 (select NULL
175 from OTA_BKNG_JUSTIFICATIONS_B B
176 where B.BOOKING_JUSTIFICATION_ID = T.BOOKING_JUSTIFICATION_ID
177 );
178
179 update OTA_BKNG_JUSTIFICATIONS_TL T set (
180 JUSTIFICATION_TEXT
181 ) = (select
182 B.JUSTIFICATION_TEXT
183 from OTA_BKNG_JUSTIFICATIONS_TL B
184 where B.BOOKING_JUSTIFICATION_ID = T.BOOKING_JUSTIFICATION_ID
185 and B.LANGUAGE = T.SOURCE_LANG)
186 where (
187 T.BOOKING_JUSTIFICATION_ID,
188 T.LANGUAGE
189 ) in (select
190 SUBT.BOOKING_JUSTIFICATION_ID,
191 SUBT.LANGUAGE
192 from OTA_BKNG_JUSTIFICATIONS_TL SUBB, OTA_BKNG_JUSTIFICATIONS_TL SUBT
193 where SUBB.BOOKING_JUSTIFICATION_ID = SUBT.BOOKING_JUSTIFICATION_ID
194 and SUBB.LANGUAGE = SUBT.SOURCE_LANG
195 and (SUBB.JUSTIFICATION_TEXT <> SUBT.JUSTIFICATION_TEXT
196 ));
197
198 insert into OTA_BKNG_JUSTIFICATIONS_TL (
199 BOOKING_JUSTIFICATION_ID,
200 JUSTIFICATION_TEXT,
201 CREATED_BY,
202 CREATION_DATE,
203 LAST_UPDATE_DATE,
204 LAST_UPDATED_BY,
205 LAST_UPDATE_LOGIN,
206 LANGUAGE,
207 SOURCE_LANG
208 ) select /*+ ORDERED */
209 B.BOOKING_JUSTIFICATION_ID,
210 B.JUSTIFICATION_TEXT,
211 B.CREATED_BY,
212 B.CREATION_DATE,
213 B.LAST_UPDATE_DATE,
214 B.LAST_UPDATED_BY,
215 B.LAST_UPDATE_LOGIN,
216 L.LANGUAGE_CODE,
217 B.SOURCE_LANG
218 from OTA_BKNG_JUSTIFICATIONS_TL B, FND_LANGUAGES L
219 where L.INSTALLED_FLAG in ('I', 'B')
220 and B.LANGUAGE = userenv('LANG')
221 and not exists
222 (select NULL
223 from OTA_BKNG_JUSTIFICATIONS_TL T
224 where T.BOOKING_JUSTIFICATION_ID = B.BOOKING_JUSTIFICATION_ID
225 and T.LANGUAGE = L.LANGUAGE_CODE);
226 end ADD_LANGUAGE;
227
228 --
229 -- ----------------------------------------------------------------------------
230 -- |-----------------------------< convert_args >-----------------------------|
231 -- ----------------------------------------------------------------------------
232 Function convert_args
233 (p_booking_justification_id in number
234 ,p_justification_text in varchar2
235 ,p_source_lang in varchar2
236 ,p_language in varchar2
237 )
238 Return g_rec_type is
239 --
240 l_rec g_rec_type;
241 --
242 Begin
243 --
244 -- Convert arguments into local l_rec structure.
245 --
246 l_rec.booking_justification_id := p_booking_justification_id;
247 l_rec.justification_text := p_justification_text;
248 l_rec.source_lang := p_source_lang;
249 l_rec.language := p_language;
250 --
251 -- Return the plsql record structure.
252 --
253 Return(l_rec);
254 --
255 End convert_args;
256 --
257 end ota_bjt_shd;