258: -- End of bug 1925131
259: --
260: l_entries_changed varchar2(200) := null;
261: begin
262: hr_utility.set_location('Entering:'|| l_proc, 5);
263: --
264: -- Issue a savepoint.
265: --
266: -- Truncate the parameter p_effective_date and p_date_probation_end
283: -- End of API User Hook for the before hook of create_secondary_emp_asg
284: --
285: end;
286: --
287: hr_utility.set_location(l_proc, 10);
288: --
289: -- Validation in addition to Table Handlers
290: --
291: -- Get person details.
313: if csr_get_derived_details%NOTFOUND then
314: --
315: close csr_get_derived_details;
316: --
317: hr_utility.set_message(801,'HR_7432_ASG_INVALID_PERSON');
318: hr_utility.raise_error;
319: --
320: end if;
321: close csr_get_derived_details;
314: --
315: close csr_get_derived_details;
316: --
317: hr_utility.set_message(801,'HR_7432_ASG_INVALID_PERSON');
318: hr_utility.raise_error;
319: --
320: end if;
321: close csr_get_derived_details;
322: --- check for whther the Business group allows
322: --- check for whther the Business group allows
323: --- creation of benefits assignments
324: ---
325: if not check__benasg_allow(l_business_group_id) then
326: hr_utility.set_location('Leaving:'|| l_proc, 999);
327: return ;
328: end if ;
329: hr_utility.set_location(l_proc, 20);
330:
325: if not check__benasg_allow(l_business_group_id) then
326: hr_utility.set_location('Leaving:'|| l_proc, 999);
327: return ;
328: end if ;
329: hr_utility.set_location(l_proc, 20);
330:
331: --
332: -- Remove this edit as it is not relevant for reduction of hours.
333: --
348: --
349: -- A benefit assignment cannot be created for a person with an
350: -- active employee assignment
351: --
352: hr_utility.set_message(805,'BEN_92114_ACTEMPASGEXISTS');
353: hr_utility.raise_error;
354: --
355: end if;
356: close csr_getactempasg;
349: -- A benefit assignment cannot be created for a person with an
350: -- active employee assignment
351: --
352: hr_utility.set_message(805,'BEN_92114_ACTEMPASGEXISTS');
353: hr_utility.raise_error;
354: --
355: end if;
356: close csr_getactempasg;
357: hr_utility.set_location(l_proc, 25);
353: hr_utility.raise_error;
354: --
355: end if;
356: close csr_getactempasg;
357: hr_utility.set_location(l_proc, 25);
358: --
359: end if; */
360: --
361: -- Default the payroll from the business group
359: end if; */
360: --
361: -- Default the payroll from the business group
362: --
363: hr_utility.set_location(l_proc, 35);
364: --
365: -- Get the default payroll
366: --
367: open c_getdefmthpaydets
372: if hr_api.return_legislation_code(l_business_group_id) in ('US','CA') and
373: (c_getdefmthpaydets%notfound or l_mthpayroll_id is null) then --Bug 1539414
374: close c_getdefmthpaydets;
375: --
376: hr_utility.set_message(805,'BEN_92109_NODEFPAYEXISTS');
377: hr_utility.raise_error;
378: --
379: end if;
380: close c_getdefmthpaydets;
373: (c_getdefmthpaydets%notfound or l_mthpayroll_id is null) then --Bug 1539414
374: close c_getdefmthpaydets;
375: --
376: hr_utility.set_message(805,'BEN_92109_NODEFPAYEXISTS');
377: hr_utility.raise_error;
378: --
379: end if;
380: close c_getdefmthpaydets;
381:
378: --
379: end if;
380: close c_getdefmthpaydets;
381:
382: hr_utility.set_location(l_proc, 45);
383: hr_utility.set_location('p_payroll_id: '||p_payroll_id||' '||l_proc, 45);
384: hr_utility.set_location('l_mthpayroll_id: '||l_mthpayroll_id||' '||l_proc, 45);
385: --
386: -- Check if existing payroll is set
379: end if;
380: close c_getdefmthpaydets;
381:
382: hr_utility.set_location(l_proc, 45);
383: hr_utility.set_location('p_payroll_id: '||p_payroll_id||' '||l_proc, 45);
384: hr_utility.set_location('l_mthpayroll_id: '||l_mthpayroll_id||' '||l_proc, 45);
385: --
386: -- Check if existing payroll is set
387: --
380: close c_getdefmthpaydets;
381:
382: hr_utility.set_location(l_proc, 45);
383: hr_utility.set_location('p_payroll_id: '||p_payroll_id||' '||l_proc, 45);
384: hr_utility.set_location('l_mthpayroll_id: '||l_mthpayroll_id||' '||l_proc, 45);
385: --
386: -- Check if existing payroll is set
387: --
388: if p_payroll_id is not null then
483: -- Create the benefits assignment
484: --
485: l_assignment_number := null;
486: --
487: hr_utility.set_location(l_proc, 40);
488:
489: --
490: -- Call per_asg_ins.ins when p_called_from = 'FORM', (called from BENEBNAS.pld)
491: -- to create benefits assignment with HR api validations.
666: ,p_object_version_number => l_object_version_number
667: ,p_hourly_salaried_warning => l_boolean_dummy2
668: );
669: end if;
670: hr_utility.set_location(l_proc, 50);
671: --
672: -- Bug 5355232
673: --
674: hr_utility.set_location('ACE : Before : hrentmnt.adjust_entries_asg_criteria', 9999);
670: hr_utility.set_location(l_proc, 50);
671: --
672: -- Bug 5355232
673: --
674: hr_utility.set_location('ACE : Before : hrentmnt.adjust_entries_asg_criteria', 9999);
675: --
676: begin
677: --
678: hrentmnt.maintain_entries_asg
697: exception
698: --
699: when others then
700: --
701: hr_utility.set_location('EXC : ' || substr(SQLERRM, 1, 50), 9999);
702: hr_utility.set_location('EXC : ' || substr(SQLERRM, 51, 100), 9999);
703: hr_utility.set_location('EXC : ' || substr(SQLERRM, 101, 150), 9999);
704: hr_utility.set_location('EXC : ' || substr(SQLERRM, 151, 200), 9999);
705: --
698: --
699: when others then
700: --
701: hr_utility.set_location('EXC : ' || substr(SQLERRM, 1, 50), 9999);
702: hr_utility.set_location('EXC : ' || substr(SQLERRM, 51, 100), 9999);
703: hr_utility.set_location('EXC : ' || substr(SQLERRM, 101, 150), 9999);
704: hr_utility.set_location('EXC : ' || substr(SQLERRM, 151, 200), 9999);
705: --
706: raise;
699: when others then
700: --
701: hr_utility.set_location('EXC : ' || substr(SQLERRM, 1, 50), 9999);
702: hr_utility.set_location('EXC : ' || substr(SQLERRM, 51, 100), 9999);
703: hr_utility.set_location('EXC : ' || substr(SQLERRM, 101, 150), 9999);
704: hr_utility.set_location('EXC : ' || substr(SQLERRM, 151, 200), 9999);
705: --
706: raise;
707: --
700: --
701: hr_utility.set_location('EXC : ' || substr(SQLERRM, 1, 50), 9999);
702: hr_utility.set_location('EXC : ' || substr(SQLERRM, 51, 100), 9999);
703: hr_utility.set_location('EXC : ' || substr(SQLERRM, 101, 150), 9999);
704: hr_utility.set_location('EXC : ' || substr(SQLERRM, 151, 200), 9999);
705: --
706: raise;
707: --
708: end;
706: raise;
707: --
708: end;
709: --
710: hr_utility.set_location('ACE : After : hrentmnt.adjust_entries_asg_criteria', 9999);
711: --
712: --
713: -- Bug 5355232
714: --
736: --
737: ,p_assignment_extra_info_id => l_aei_id
738: ,p_object_version_number => l_aei_ovn
739: );
740: hr_utility.set_location(l_proc, 60);
741: begin
742: null;
743: exception
744: when hr_api.cannot_find_prog_unit then
765: p_effective_end_date := l_asg_eed;
766: p_assignment_extra_info_id := l_aei_id;
767: p_aei_object_version_number := l_aei_ovn;
768: --
769: hr_utility.set_location(' Leaving:'||l_proc, 50);
770: exception
771: when hr_api.validate_enabled then
772: --
773: -- As the Validate_Enabled exception has been raised
974: where ori.organization_id = c_bgp_id
975: and ori.ORG_INFORMATION_CONTEXT = 'Benefits Defaults';
976: l_mthpayroll_id number := null;
977: begin
978: hr_utility.set_location('Entering:'|| l_proc, 10);
979: hr_utility.set_location('OVN:'||p_object_version_number||' '||l_proc, 10);
980: --
981: -- Truncate date and date_probation_end values, effectively removing time element.
982: --
975: and ori.ORG_INFORMATION_CONTEXT = 'Benefits Defaults';
976: l_mthpayroll_id number := null;
977: begin
978: hr_utility.set_location('Entering:'|| l_proc, 10);
979: hr_utility.set_location('OVN:'||p_object_version_number||' '||l_proc, 10);
980: --
981: -- Truncate date and date_probation_end values, effectively removing time element.
982: --
983: l_effective_date := trunc(p_effective_date);
988: -- Issue a savepoint.
989: --
990: savepoint update_ben_asg;
991: --
992: hr_utility.set_location(l_proc, 20);
993: --
994: -- Validation in addition to Table Handlers
995: --
996: -- Get assignment type.
1003: hr_api.mandatory_arg_error
1004: (p_api_name => l_proc
1005: ,p_argument => 'effective_date'
1006: ,p_argument_value => l_effective_date);
1007: hr_utility.set_location('ASG ID: '||p_assignment_id||' '||l_proc, 25);
1008: hr_utility.set_location('ESD: '||l_effective_date||' '||l_proc, 25);
1009: --
1010: -- Get assignment details
1011: --
1004: (p_api_name => l_proc
1005: ,p_argument => 'effective_date'
1006: ,p_argument_value => l_effective_date);
1007: hr_utility.set_location('ASG ID: '||p_assignment_id||' '||l_proc, 25);
1008: hr_utility.set_location('ESD: '||l_effective_date||' '||l_proc, 25);
1009: --
1010: -- Get assignment details
1011: --
1012: open csr_get_asg_dets
1025: -- Temporary - BEN_????_BENASGNOTEXISTS
1026: --
1027: -- - The benefit assignment cannot be modified because it does not exist
1028: --
1029: hr_utility.set_message(805,'BEN_????_BENASGNOTEXISTS ');
1030: hr_utility.raise_error;
1031: --
1032: end if;
1033: close csr_get_asg_dets;
1026: --
1027: -- - The benefit assignment cannot be modified because it does not exist
1028: --
1029: hr_utility.set_message(805,'BEN_????_BENASGNOTEXISTS ');
1030: hr_utility.raise_error;
1031: --
1032: end if;
1033: close csr_get_asg_dets;
1034: hr_utility.set_location(l_proc, 20);
1030: hr_utility.raise_error;
1031: --
1032: end if;
1033: close csr_get_asg_dets;
1034: hr_utility.set_location(l_proc, 20);
1035: --- check for whether the Business group allows
1036: --- creation of benefits assignments
1037: ---
1038: if not check__benasg_allow(l_business_group_id) then
1035: --- check for whether the Business group allows
1036: --- creation of benefits assignments
1037: ---
1038: if not check__benasg_allow(l_business_group_id) then
1039: hr_utility.set_location('Leaving:'|| l_proc, 999);
1040: return ;
1041: end if ;
1042:
1043: --
1050: l_assignment_extra_info_ovn,
1051: l_aei_origpayroll_id;
1052: --
1053: close csr_get_aei_dets;
1054: hr_utility.set_location(l_proc, 30);
1055: --
1056: -- Check for a assignment type of B
1057: --
1058: if l_assignment_type <> 'B'
1061: -- Temporary - BEN_????_NOTBENASG
1062: --
1063: -- - The assignment being modified should be a benefits assignment.
1064: --
1065: hr_utility.set_message(805,'BEN_????_NOTBENASG');
1066: hr_utility.raise_error;
1067: --
1068: end if;
1069: --
1062: --
1063: -- - The assignment being modified should be a benefits assignment.
1064: --
1065: hr_utility.set_message(805,'BEN_????_NOTBENASG');
1066: hr_utility.raise_error;
1067: --
1068: end if;
1069: --
1070: -- Update assignment.
1182: if hr_api.return_legislation_code(l_business_group_id) in ('US','CA') and
1183: (c_getdefmthpaydets%notfound or l_mthpayroll_id is null) then -- Bug 1539414
1184: close c_getdefmthpaydets;
1185: --
1186: hr_utility.set_message(805,'BEN_92109_NODEFPAYEXISTS');
1187: hr_utility.raise_error;
1188: --
1189: end if;
1190: close c_getdefmthpaydets;
1183: (c_getdefmthpaydets%notfound or l_mthpayroll_id is null) then -- Bug 1539414
1184: close c_getdefmthpaydets;
1185: --
1186: hr_utility.set_message(805,'BEN_92109_NODEFPAYEXISTS');
1187: hr_utility.raise_error;
1188: --
1189: end if;
1190: close c_getdefmthpaydets;
1191: hr_utility.set_location(l_proc, 45);
1187: hr_utility.raise_error;
1188: --
1189: end if;
1190: close c_getdefmthpaydets;
1191: hr_utility.set_location(l_proc, 45);
1192: hr_utility.set_location('p_payroll_id: '||p_payroll_id||' '||l_proc, 45);
1193: hr_utility.set_location('l_mthpayroll_id: '||l_mthpayroll_id||' '||l_proc, 45);
1194: --
1195: -- Check if existing payroll is set
1188: --
1189: end if;
1190: close c_getdefmthpaydets;
1191: hr_utility.set_location(l_proc, 45);
1192: hr_utility.set_location('p_payroll_id: '||p_payroll_id||' '||l_proc, 45);
1193: hr_utility.set_location('l_mthpayroll_id: '||l_mthpayroll_id||' '||l_proc, 45);
1194: --
1195: -- Check if existing payroll is set
1196: if p_payroll_id is not null then
1189: end if;
1190: close c_getdefmthpaydets;
1191: hr_utility.set_location(l_proc, 45);
1192: hr_utility.set_location('p_payroll_id: '||p_payroll_id||' '||l_proc, 45);
1193: hr_utility.set_location('l_mthpayroll_id: '||l_mthpayroll_id||' '||l_proc, 45);
1194: --
1195: -- Check if existing payroll is set
1196: if p_payroll_id is not null then
1197: if p_payroll_id <> l_mthpayroll_id then
1295: ,p_validate => FALSE
1296: ,p_hourly_salaried_warning => l_boolean_dummy2
1297: );
1298: end if;
1299: hr_utility.set_location(l_proc, 30);
1300: --
1301: -- Bug 5355232
1302: --
1303: hr_utility.set_location('ACE : Before : hrentmnt.adjust_entries_asg_criteria', 9999);
1299: hr_utility.set_location(l_proc, 30);
1300: --
1301: -- Bug 5355232
1302: --
1303: hr_utility.set_location('ACE : Before : hrentmnt.adjust_entries_asg_criteria', 9999);
1304: --
1305: begin
1306: --
1307: hrentmnt.maintain_entries_asg
1326: exception
1327: --
1328: when others then
1329: --
1330: hr_utility.set_location('EXC : ' || substr(SQLERRM, 1, 50), 9999);
1331: hr_utility.set_location('EXC : ' || substr(SQLERRM, 51, 100), 9999);
1332: hr_utility.set_location('EXC : ' || substr(SQLERRM, 101, 150), 9999);
1333: hr_utility.set_location('EXC : ' || substr(SQLERRM, 151, 200), 9999);
1334: --
1327: --
1328: when others then
1329: --
1330: hr_utility.set_location('EXC : ' || substr(SQLERRM, 1, 50), 9999);
1331: hr_utility.set_location('EXC : ' || substr(SQLERRM, 51, 100), 9999);
1332: hr_utility.set_location('EXC : ' || substr(SQLERRM, 101, 150), 9999);
1333: hr_utility.set_location('EXC : ' || substr(SQLERRM, 151, 200), 9999);
1334: --
1335: raise;
1328: when others then
1329: --
1330: hr_utility.set_location('EXC : ' || substr(SQLERRM, 1, 50), 9999);
1331: hr_utility.set_location('EXC : ' || substr(SQLERRM, 51, 100), 9999);
1332: hr_utility.set_location('EXC : ' || substr(SQLERRM, 101, 150), 9999);
1333: hr_utility.set_location('EXC : ' || substr(SQLERRM, 151, 200), 9999);
1334: --
1335: raise;
1336: --
1329: --
1330: hr_utility.set_location('EXC : ' || substr(SQLERRM, 1, 50), 9999);
1331: hr_utility.set_location('EXC : ' || substr(SQLERRM, 51, 100), 9999);
1332: hr_utility.set_location('EXC : ' || substr(SQLERRM, 101, 150), 9999);
1333: hr_utility.set_location('EXC : ' || substr(SQLERRM, 151, 200), 9999);
1334: --
1335: raise;
1336: --
1337: end;
1335: raise;
1336: --
1337: end;
1338: --
1339: hr_utility.set_location('ACE : After : hrentmnt.adjust_entries_asg_criteria', 9999);
1340: --
1341: --
1342: -- Bug 5355232
1343: --
1347: /*
1348: if l_payroll_id_updated
1349: then
1350: --
1351: hr_utility.set_location(l_proc, 50);
1352: hr_utility.set_location('ORIG PAY ID: '||l_orig_payroll_id||' '||l_proc, 50);
1353: --
1354: -- Check if the original payroll is already set
1355: --
1348: if l_payroll_id_updated
1349: then
1350: --
1351: hr_utility.set_location(l_proc, 50);
1352: hr_utility.set_location('ORIG PAY ID: '||l_orig_payroll_id||' '||l_proc, 50);
1353: --
1354: -- Check if the original payroll is already set
1355: --
1356: if l_aei_origpayroll_id is null then
1366: end if;
1367: --
1368: else
1369: --
1370: hr_utility.set_location(l_proc, 60);
1371: --
1372: -- Unchanged
1373: --
1374: l_orig_payroll_id := hr_api.g_varchar2;
1385: -- p_adjusted_service_date, p_original_hire_date, p_termination_date
1386: -- p_leave_of_absence_date are defaulted to dates, when they are defaulted
1387: -- they have to go as hr_api.g_varchar2.
1388: --
1389: hr_utility.set_location('ORIG PAY ID: '||l_orig_payroll_id||' '||l_proc, 50);
1390: if p_age = hr_api.g_number then
1391: --
1392: l_char_age := hr_api.g_varchar2;
1393: --
1464: ,p_aei_information11 => p_absence_type
1465: ,p_aei_information12 => p_absence_reason
1466: ,p_aei_information13 => l_char_date_of_hire -- fnd_date.date_to_canonical(p_date_of_hire)
1467: );
1468: hr_utility.set_location(l_proc, 70);
1469: --
1470: -- When in validation only mode raise the Validate_Enabled exception
1471: --
1472: if p_validate then
1478: p_object_version_number := l_object_version_number;
1479: p_effective_start_date := l_effective_start_date;
1480: p_effective_end_date := l_effective_end_date;
1481: --
1482: hr_utility.set_location(' Leaving:'||l_proc, 30);
1483: exception
1484: when hr_api.validate_enabled then
1485: --
1486: -- As the Validate_Enabled exception has been raised
1583: l_ovn number;
1584: --
1585: begin
1586: --
1587: hr_utility.set_location('Entering:'|| l_proc, 10);
1588: begin
1589: select asg.business_group_id
1590: into l_business_group_id
1591: from per_all_assignments_f asg
1605: /*
1606: -- This restrict to delete the asg which is created
1607: -- whne the prfile allows to create the asg
1608: if not check__benasg_allow(l_business_group_id) then
1609: hr_utility.set_location('Leaving:'|| l_proc, 999);
1610: return ;
1611: end if ;
1612: */
1613: --
1614: -- Issue a savepoint if operating in validation only mode
1615: --
1616: savepoint delete_ben_asg;
1617: --
1618: hr_utility.set_location(l_proc, 20);
1619: --
1620: -- Check the datetrack mode
1621: --
1622: if p_datetrack_mode = hr_api.g_zap then
1782: end loop;
1783: --
1784: end if;
1785: --
1786: hr_utility.set_location(l_proc, 30);
1787: --
1788: l_object_version_number := p_object_version_number;
1789: --
1790: per_asg_del.del
1801: ,p_validation_end_date => l_validation_end_date
1802: ,p_org_now_no_manager_warning => l_dummy_warning
1803: );
1804: --
1805: hr_utility.set_location(l_proc, 60);
1806: --
1807: -- When in validation only mode raise the Validate_Enabled exception
1808: --
1809: if p_validate then
1815: p_effective_start_date := l_effective_start_date;
1816: p_effective_end_date := l_effective_end_date;
1817: p_object_version_number := l_object_version_number;
1818: --
1819: hr_utility.set_location(' Leaving:'||l_proc, 70);
1820: --
1821: exception
1822: --
1823: when hr_api.validate_enabled then