[Home] [Help]
1: package body PAY_ELEMENT_LINKS_PKG as
2: /* $Header: pyeli.pkb 120.4.12020000.3 2012/07/27 07:17:46 panumala ship $ */
3: /*===========================================================================+
4: | copyright (c) 1993 oracle corporation |
5: | redwood shores, california, usa |
42: existed.
43: 110.3 10-FEB-1999 M Reid 809540: Added segment19 to link test
44: as it was missing.
45: 115.2 27-APR-1999 S Billing 874781,
46: pay_element_links_pkg.update_row(),
47: if updating an element link row with
48: non-criteria information
49: (ie. Qualifying Conditions), then the
50: EED of the updated record or the
108: p_business_group_id number ) is
109: --
110: begin
111: --
112: hr_utility.set_location('PAY_ELEMENT_LINKS_PKG.CASCADE_INSERTION', 1);
113: --
114: pay_link_input_values_pkg.create_link_input_value(
115: --
116: p_element_link_id,
118: p_effective_start_date,
119: p_effective_end_date,
120: p_element_type_id);
121: --
122: hr_utility.set_location('PAY_ELEMENT_LINKS_PKG.CASCADE_INSERTION', 2);
123: --
124: if p_people_group_id is not null then
125: pay_asg_link_usages_pkg.insert_alu(
126: --
165: for update;
166: --
167: begin
168: --
169: hr_utility.set_location('PAY_ELEMENT_LINKS_PKG.CASCADE_DELETION', 1);
170: --
171: for fetched_entry in csr_links_entries LOOP
172: --
173: hr_entry_api.delete_element_entry (
177: fetched_entry.element_entry_id);
178: --
179: end loop;
180: --
181: hr_utility.set_location('PAY_ELEMENT_LINKS_PKG.CASCADE_DELETION', 2);
182: --
183: pay_asg_link_usages_pkg.cascade_link_deletion (
184: --
185: p_element_link_id,
201: ,p_payroll_action_id => null
202: );
203: end if;
204: --
205: hr_utility.set_location('PAY_ELEMENT_LINKS_PKG.CASCADE_DELETION', 3);
206: --
207: <
208: --
209: FOR fetched_input_value in csr_all_inputs_for_link LOOP
250: end if;
251: --
252: end loop remove_orphaned_input_values;
253: --
254: hr_utility.set_location('PAY_ELEMENT_LINKS_PKG.CASCADE_DELETION', 4);
255: --
256: end cascade_deletion;
257: --------------------------------------------------------------------------------
258: function LINK_END_DATE (p_link_id number) return date is
335: from sys.dual;
336: --
337: begin
338: --
339: hr_utility.set_location ('PAY_ELEMENT_LINKS_PKG.INSERT_ROW',1);
340: --
341: if p_element_link_id is null then
342: open csr_next_ID;
343: fetch csr_next_ID into p_element_link_id;
343: fetch csr_next_ID into p_element_link_id;
344: close csr_next_ID;
345: end if;
346: --
347: if p_costable_type = 'D' and pay_element_links_pkg.element_in_distribution_set (
348: p_element_type_id,
349: p_business_group_id,
350: p_legislation_code) then
351:
541: locked_row csr_locked_row%rowtype;
542: --
543: begin
544: --
545: hr_utility.set_location ('PAY_ELEMENT_LINKS_PKG.LOCK_ROW',1);
546: --
547: open csr_locked_row;
548: fetch csr_locked_row into locked_row;
549: if csr_locked_row%notfound then
752: p_attribute20 varchar2) is
753: --
754: begin
755: --
756: hr_utility.set_location ('PAY_ELEMENT_LINKS_PKG.UPDATE_ROW',1);
757: --
758: /*
759: p_effective_end_date := pay_element_links_pkg.max_end_date (
760: p_element_type_id,
755: --
756: hr_utility.set_location ('PAY_ELEMENT_LINKS_PKG.UPDATE_ROW',1);
757: --
758: /*
759: p_effective_end_date := pay_element_links_pkg.max_end_date (
760: p_element_type_id,
761: p_element_link_id,
762: p_effective_start_date,
763: p_effective_end_date,
784: );
785:
786: --
787: -- sbilling 874781,
788: -- pay_element_links_pkg.update_row(),
789: -- if updating an element link row with non-criteria information
790: -- (ie. Qualifying Conditions), then the EED
791: -- of the updated record or the newly created record should not exceed
792: -- the EED of the original element link row
794: --
795: p_effective_end_date :=
796: least(
797: p_effective_end_date,
798: pay_element_links_pkg.max_end_date (
799: p_element_type_id,
800: p_element_link_id,
801: p_effective_start_date,
802: p_effective_end_date,
815: hr_utility.trace ('|p_effective_end_date>' || p_effective_end_date || '<');
816:
817:
818: if p_costable_type = 'D'
819: and pay_element_links_pkg.element_in_distribution_set (
820: p_element_type_id,
821: p_business_group_id,
822: p_legislation_code) then
823:
897: v_effective_end_date date;
898: --
899: begin
900: --
901: hr_utility.set_location ('PAY_ELEMENT_LINKS_PKG.DELETE_ROW',1);
902: --
903: check_deletion_allowed ( p_element_link_id,
904: p_delete_mode,
905: p_validation_start_date);
903: check_deletion_allowed ( p_element_link_id,
904: p_delete_mode,
905: p_validation_start_date);
906: --
907: v_effective_end_date := pay_element_links_pkg.link_end_date (p_element_link_id);
908: --
909: -- Note that the cascade delete of any action other than PURGE/ZAP will
910: -- be done AFTER the deletion of the master record. This is due to a
911: -- quirk of datetrack in forms which means that up to the point of
1110: end link_differs_on;
1111:
1112: BEGIN
1113:
1114: hr_utility.set_location('PAY_ELEMENT_LINKS_PKG.LAST_EXCLUSIVE_DATE', 1);
1115:
1116: open csr_my_people_group;
1117: fetch csr_my_people_group into new_link;
1118:
1120: -- The link criteria being tested are made up of the parameters and the
1121: -- new_link record. If any of the link's criteria are matched in
1122: -- another link for the same element, then the link being tested must be
1123: -- given an end date just prior to the start date of the matching link. If this
1124: -- cannot be done, then an error will occur. A match is PAY_ELEMENT_LINKS_PKGd as either
1125: -- equality between the criteria items, or where one of the items is
1126: -- unspecified.
1127: -- NB It is more efficient to check for a non-match because a single
1128: -- non-matching item will satisfy the exclusivity for the whole record, whilst
1170: or (link_differs_on (existing_link.segment29, new_link.segment29))
1171: or (link_differs_on (existing_link.segment30, new_link.segment30)))
1172: then
1173: --
1174: hr_utility.set_location ('PAY_ELEMENT_LINKS_PKG.last_exclusive_date',2);
1175: --
1176: -- Set the end date to avoid clash; raise an error if that is not possible
1177: if (p_validation_start_date < existing_link.effective_start_date) then
1178: --
1175: --
1176: -- Set the end date to avoid clash; raise an error if that is not possible
1177: if (p_validation_start_date < existing_link.effective_start_date) then
1178: --
1179: hr_utility.set_location ('PAY_ELEMENT_LINKS_PKG.last_exclusive_date',3);
1180: v_last_exclusive_date := existing_link.effective_start_date - 1;
1181: exit LINK_TEST; -- The cursor ordering ensures that the date is that
1182: -- of the chronologically first matching link
1183: --
1253: from pay_payrolls_f
1254: where payroll_id = p_payroll_id;
1255: begin
1256: --
1257: hr_utility.set_location ('PAY_ELEMENT_LINKS_PKG.MAX_END_DATE',1);
1258: hr_utility.trace ('p_validation_start_date = '||p_validation_start_date);
1259: hr_utility.trace ('p_validation_end_date = '||p_validation_end_date);
1260: --
1261: -- If there is a named payroll, then take its last end date; if the link is to
1336: element_in_set boolean;
1337:
1338: begin
1339:
1340: hr_utility.set_location('PAY_ELEMENT_LINKS_PKG.CHECK_DISTRIBUTION_SET', 1);
1341:
1342: open csr_distribution_set;
1343: fetch csr_distribution_set into g_dummy;
1344: element_in_set := csr_distribution_set%found;
1366: from pay_element_entries_f
1367: where element_link_id = p_element_link_id;
1368: begin
1369: --
1370: hr_utility.set_location('PAY_ELEMENT_LINKS_PKG.ELEMENT_ENTRIES_EXIST', 1);
1371: --
1372: open csr_entries;
1373: fetch csr_entries into g_dummy;
1374: if csr_entries%found and p_error_if_true then
1445: and balance_entry.entry_type = 'B';
1446: --
1447: begin
1448: --
1449: hr_utility.set_location('PAY_ELEMENT_LINKS_PKG.CHECK_DELETION_ALLOWED', 10);
1450: --
1451: -- Bug 5512101. Changes for Batch Element Link support.
1452: -- We need to ensure that the element link is complete
1453: -- unless the delete mode is ZAP.
1459: );
1460: end if;
1461:
1462:
1463: hr_utility.set_location('PAY_ELEMENT_LINKS_PKG.CHECK_DELETION_ALLOWED', 20);
1464: --
1465: -- Bug 1490304 - if p_delete_mode in DELETE or ZAP then open both cursors
1466: -- else only open csr_entries.
1467: --
1503: p_element_entries_exist out nocopy boolean ) is
1504: --
1505: begin
1506: --
1507: hr_utility.set_location ('pay_element_links_pkg.check_relationships',1);
1508: --
1509: p_date_effectively_updated := date_effectively_updated (p_element_link_id,
1510: p_rowid );
1511: --
1552: return l_exists;
1553:
1554: end pay_basis_exists;
1555: --------------------------------------------------------------------------------
1556: end PAY_ELEMENT_LINKS_PKG;