DBA Data[Home] [Help]

PACKAGE BODY: APPS.HRDPP_HIRE_MX_APPLICANT

Source


1 package body hrdpp_HIRE_MX_APPLICANT as
2 /*
3  * Generated by hr_pump_meta_mapper at: 2012/11/27 04:11:35
4  * Generated for API: HR_MX_APPLICANT_API.HIRE_MX_APPLICANT
5  */
6 --
7 dh constant date := hr_api.g_date;
8 nh constant number := hr_api.g_number;
9 vh constant varchar2(64) := hr_api.g_varchar2;
10 c_sot constant date := to_date('01010001','DDMMYYYY');
11 cn constant varchar2(32) := '<NULL>';
12 dn constant date := null;
13 nn constant number := null;
14 vn constant varchar2(1) := null;
15 --
16 function dc(p in date) return varchar2 is
17 begin
18 if p<c_sot then
19  if p<>trunc(p) then
20   return to_char(p,'SYYYY/MM/DD HH24:MI:SS');
21  end if;
22  return to_char(p,'SYYYY/MM/DD');
23 elsif p<>trunc(p) then
24  return to_char(p,'YYYY/MM/DD HH24:MI:SS');
25 end if;
26 return to_char(p,'YYYY/MM/DD');
27 end dc;
28 function d(p in varchar2) return date is
29 begin
30 if length(p)=10 then
31 return to_date(p,'YYYY/MM/DD');
32 elsif length(p)=19 then
33 return to_date(p,'YYYY/MM/DD HH24:MI:SS');
34 elsif length(p)=11 then
35 return to_date(p,'SYYYY/MM/DD');
36 elsif length(p)=20 then
37 return to_date(p,'SYYYY/MM/DD HH24:MI:SS');
38 end if;
39 -- Try default format as last resort.
40 return to_date(p,'YYYY/MM/DD');
41 end d;
42 function n(p in varchar2) return number is
43 begin
44 return to_number(p);
45 end n;
46 function dd(p in date,i in varchar2)
47 return varchar2 is
48 begin
49 if upper(i) = 'N' then return dc(p);
50 else return cn; end if;
51 end dd;
52 function nd(p in number,i in varchar2)
53 return varchar2 is
54 begin
55 if upper(i) = 'N' then return to_char(p);
56 else return cn; end if;
57 end nd;
58 --
59 procedure iuk
60 (p_batch_line_id  in number,
61 p_user_key_value in varchar2,
62 p_unique_key_id  in number)
63 is
64 begin
65 hr_data_pump.entry('ins_user_key');
66 insert into hr_pump_batch_line_user_keys
67 (user_key_id, batch_line_id,user_key_value,unique_key_id)
68 values
69 (hr_pump_batch_line_user_keys_s.nextval,
70 p_batch_line_id,
71 p_user_key_value,
72 p_unique_key_id);
73 hr_data_pump.exit('ins_user_key');
74 end iuk;
75 --
76 procedure insert_batch_lines
77 (p_batch_id      in number
78 ,p_data_pump_batch_line_id in number default null
79 ,p_data_pump_business_grp_name in varchar2 default null
80 ,p_user_sequence in number default null
81 ,p_link_value    in number default null
82 ,P_HIRE_DATE in date
83 ,P_CURP_ID in varchar2 default null
84 ,P_EMPLOYEE_NUMBER in varchar2
85 ,P_ORIGINAL_DATE_OF_HIRE in date default null
86 ,I_ORIGINAL_DATE_OF_HIRE in varchar2 default 'N'
87 ,P_MIGRATE in boolean default null
88 ,P_PERSON_USER_KEY in varchar2
89 ,P_ASSIGNMENT_USER_KEY in varchar2 default null
90 ,P_USER_PERSON_TYPE in varchar2 default null
91 ,P_LANGUAGE_CODE in varchar2 default null) is
92 blid number := p_data_pump_batch_line_id;
93  L_MIGRATE varchar2(5);
94 begin
95 if P_MIGRATE is null then
96  L_MIGRATE := null;
97 elsif P_MIGRATE then
98  L_MIGRATE := 'TRUE';
99 else 
100  L_MIGRATE := 'FALSE';
101 end if;
102 if blid is not null then
103 delete from hr_pump_batch_lines where batch_line_id = blid;
104 delete from hr_pump_batch_exceptions
105 where source_type = 'BATCH_LINE' and source_id = blid;
106 end if;
107 insert into hr_pump_batch_lines
108 (batch_id
109 ,batch_line_id
110 ,business_group_name
111 ,api_module_id
112 ,line_status
116 ,pval002
113 ,user_sequence
114 ,link_value
115 ,pval001
117 ,pval003
118 ,pval009
119 ,pval010
120 ,pval011
121 ,pval012
122 ,pval013
123 ,pval014)
124 values
125 (p_batch_id
126 ,nvl(blid,hr_pump_batch_lines_s.nextval)
127 ,p_data_pump_business_grp_name
128 ,3856
129 ,'U'
130 ,p_user_sequence
131 ,p_link_value
132 ,dc(P_HIRE_DATE)
133 ,P_CURP_ID
134 ,P_EMPLOYEE_NUMBER
135 ,dd(P_ORIGINAL_DATE_OF_HIRE,I_ORIGINAL_DATE_OF_HIRE)
136 ,L_MIGRATE
137 ,P_PERSON_USER_KEY
138 ,P_ASSIGNMENT_USER_KEY
139 ,P_USER_PERSON_TYPE
140 ,P_LANGUAGE_CODE);
141 end insert_batch_lines;
142 --
143 procedure call
144 (p_business_group_id in number,
145 p_batch_line_id     in number) is
146 cursor cr is
147 select l.rowid myrowid,
148 decode(l.pval001,cn,dn,d(l.pval001)) p1,
149 decode(l.pval002,cn,vn,vn,vh,l.pval002) p2,
150 l.pval002 d2,
151 decode(l.pval003,cn,vn,l.pval003) p3,
152 decode(l.pval004,cn,dn,d(l.pval004)) p4,
153 decode(l.pval005,cn,dn,d(l.pval005)) p5,
154 l.pval006 p6,
155 l.pval007 p7,
156 l.pval008 p8,
157 decode(l.pval009,cn,dn,vn,dh,d(l.pval009)) p9,
158 l.pval009 d9,
159 decode(l.pval010,cn,vn,vn,null,l.pval010) p10,
160 l.pval010 d10,
161 decode(l.pval011,cn,vn,l.pval011) p11,
162 decode(l.pval012,cn,vn,vn,vn,l.pval012) p12,
163 l.pval012 d12,
164 decode(l.pval013,cn,vn,vn,vh,l.pval013) p13,
165 l.pval013 d13,
166 decode(l.pval014,cn,vn,vn,vh,l.pval014) p14,
167 l.pval014 d14
168 from hr_pump_batch_lines l
169 where l.batch_line_id = p_batch_line_id;
170 --
171 c cr%rowtype;
172 l_validate boolean := false;
173 L_UNACCEPTED_ASG_DEL_WARNING boolean;
174 L_ASSIGN_PAYROLL_WARNING boolean;
175 L_MIGRATE boolean;
176 L_PERSON_ID number;
177 L_ASSIGNMENT_ID number;
178 L_PERSON_TYPE_ID number;
179 L_PER_OBJECT_VERSION_NUMBER number;
180 --
181 begin
182 hr_data_pump.entry('call');
183 open cr;
184 fetch cr into c;
185 if cr%notfound then
186 hr_utility.set_message(800,'HR_50326_DP_NO_ROW');
187 hr_utility.set_message_token('TABLE','HR_PUMP_BATCH_LINES');
188 hr_utility.set_message_token('COLUMN','P_BATCH_LINE_ID');
189 hr_utility.set_message_token('VALUE',p_batch_line_id);
190 hr_utility.raise_error;
191 end if;
192 --
193 if upper(c.p10) = 'TRUE' then
194 L_MIGRATE := true;
195 elsif upper(c.p10) = 'FALSE' then
196 L_MIGRATE := false;
197 elsif c.p10 is not null then
198 hr_utility.set_message(800,'HR_50327_DP_TYPE_ERR');
199 hr_utility.set_message_token('TYPE','BOOLEAN');
200 hr_utility.set_message_token('PARAMETER','P_MIGRATE');
201 hr_utility.set_message_token('VALUE',c.p10);
202 hr_utility.set_message_token('TABLE','HR_PUMP_BATCH_LINES');
203 hr_utility.raise_error;
204 end if;
205 --
206 if c.p11 is null then
207 L_PERSON_ID:=nn;
208 else
209 L_PERSON_ID := 
210 hr_pump_get.get_person_id
211 (P_PERSON_USER_KEY => c.p11);
212 end if;
213 --
214 if c.d12=cn then
215 L_ASSIGNMENT_ID:=nn;
216 elsif c.d12 is null then 
217 L_ASSIGNMENT_ID:=nh;
218 else
219 L_ASSIGNMENT_ID := 
220 hr_pump_get.get_assignment_id
221 (P_ASSIGNMENT_USER_KEY => c.p12);
222 end if;
223 --
224 if c.d13=cn or
225 c.d14=cn then
226 L_PERSON_TYPE_ID:=nn;
227 elsif c.d13 is null or
228 c.d14 is null then 
229 L_PERSON_TYPE_ID:=nh;
230 else
231 L_PERSON_TYPE_ID := 
232 hr_pump_get.get_person_type_id
233 (P_USER_PERSON_TYPE => c.p13
234 ,P_BUSINESS_GROUP_ID => P_BUSINESS_GROUP_ID
235 ,P_LANGUAGE_CODE => c.p14);
236 end if;
237 --
238 if c.p11 is null or
239 c.p1 is null then
240 L_PER_OBJECT_VERSION_NUMBER:=nn;
241 else
242 L_PER_OBJECT_VERSION_NUMBER := 
243 hr_pump_get.GET_PER_OVN
244 (P_PERSON_USER_KEY => c.p11
245 ,P_EFFECTIVE_DATE => c.p1);
246 end if;
247 --
248 hr_data_pump.api_trc_on;
249 HR_MX_APPLICANT_API.HIRE_MX_APPLICANT
250 (p_validate => l_validate
251 ,P_HIRE_DATE => c.p1
252 ,P_PERSON_ID => L_PERSON_ID
253 ,P_ASSIGNMENT_ID => L_ASSIGNMENT_ID
254 ,P_PERSON_TYPE_ID => L_PERSON_TYPE_ID
255 ,P_CURP_ID => c.p2
256 ,P_PER_OBJECT_VERSION_NUMBER => L_PER_OBJECT_VERSION_NUMBER
257 ,P_EMPLOYEE_NUMBER => c.p3
258 ,P_PER_EFFECTIVE_START_DATE => c.p4
259 ,P_PER_EFFECTIVE_END_DATE => c.p5
260 ,P_UNACCEPTED_ASG_DEL_WARNING => L_UNACCEPTED_ASG_DEL_WARNING
261 ,P_ASSIGN_PAYROLL_WARNING => L_ASSIGN_PAYROLL_WARNING
262 ,P_OVERSUBSCRIBED_VACANCY_ID => c.p8
263 ,P_ORIGINAL_DATE_OF_HIRE => c.p9
264 ,P_MIGRATE => L_MIGRATE);
265 hr_data_pump.api_trc_off;
266 --
267 if L_UNACCEPTED_ASG_DEL_WARNING then
268 c.p6 := 'TRUE';
269 else
270 c.p6 := 'FALSE';
271 end if;
272 --
273 if L_ASSIGN_PAYROLL_WARNING then
274 c.p7 := 'TRUE';
275 else
276 c.p7 := 'FALSE';
277 end if;
278 --
279 update hr_pump_batch_lines l set
280 l.pval003 = decode(c.p3,null,cn,c.p3),
281 l.pval004 = decode(c.p4,null,cn,dc(c.p4)),
282 l.pval005 = decode(c.p5,null,cn,dc(c.p5)),
283 l.pval006 = decode(c.p6,null,cn,c.p6),
284 l.pval007 = decode(c.p7,null,cn,c.p7),
285 l.pval008 = decode(c.p8,null,cn,c.p8)
286 where l.rowid = c.myrowid;
287 --
288 close cr;
289 --
290 hr_data_pump.exit('call');
291 exception
292  when hr_multi_message.error_message_exist then
293    if cr%isopen then
294     close cr;
295    end if;
296    hr_pump_utils.set_multi_msg_error_flag(true);
297  when others then
298  if cr%isopen then
299   close cr;
300  end if;
301  raise;
302 end call;
303 end hrdpp_HIRE_MX_APPLICANT;