1: PACKAGE BODY PAY_ELEMENT_SETS_PKG as
2: /* $Header: pyels01t.pkb 120.1 2005/09/30 00:32:03 tvankayl noship $ */
3: --
4: /*==========================================================================+
5: | Copyright (c) 1993 Oracle Corporation |
6: | Redwood Shores, California, USA |
7: | All rights reserved. |
8: +===========================================================================+
9: Name
10: pay_element_sets_pkg
11: Purpose
12: Supports the ELS block in the form PAYWSDRP (Define Element and
13: Distributuion Set.
14: Notes
50: ) is
51: --
52: cursor csr_element_set is
53: select els.element_set_id
54: from pay_element_sets els
55: where els.element_set_id = p_element_set_id
56: for update;
57: --
58: v_dummy number;
64: if csr_element_set%notfound then
65: close csr_element_set;
66: hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
67: hr_utility.set_message_token('PROCEDURE',
68: 'pay_element_sets_pkg.lock_element_set');
69: hr_utility.set_message_token('STEP','1');
70: hr_utility.raise_error;
71: else
72: close csr_element_set;
181: ) is
182: --
183: cursor csr_unique_set is
184: select els.element_set_id
185: from pay_element_sets els
186: where upper(els.element_set_name) = upper(p_element_set_name)
187: and nvl(els.business_group_id,nvl(p_business_group_id,0)) =
188: nvl(p_business_group_id,0)
189: and nvl(els.legislation_code,nvl(p_legislation_code,' ')) =
352: -- Extra Columns
353: X_Session_Business_Group_Id NUMBER,
354: X_Session_Legislation_Code VARCHAR2) IS
355: --
356: CURSOR C IS SELECT rowid FROM pay_element_sets
357: WHERE element_set_id = X_Element_Set_Id;
358: --
359: CURSOR C2 IS SELECT pay_element_sets_s.nextval FROM sys.dual;
360: --
355: --
356: CURSOR C IS SELECT rowid FROM pay_element_sets
357: WHERE element_set_id = X_Element_Set_Id;
358: --
359: CURSOR C2 IS SELECT pay_element_sets_s.nextval FROM sys.dual;
360: --
361: BEGIN
362: --
363: check_unique_set
378: X_Element_Set_Name,
379: X_Business_Group_Id,
380: X_Legislation_Code);
381: ---
382: INSERT INTO pay_element_sets
383: (element_set_id,
384: business_group_id,
385: legislation_code,
386: element_set_name,
407: if (C%NOTFOUND) then
408: CLOSE C;
409: hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
410: hr_utility.set_message_token('PROCEDURE',
411: 'pay_element_sets_pkg.insert_row');
412: hr_utility.set_message_token('STEP','1');
413: hr_utility.raise_error;
414: end if;
415: CLOSE C;
435: X_Element_Set_Name VARCHAR2,
436: X_Element_Set_Type VARCHAR2,
437: X_Comments VARCHAR2) IS
438: --
439: CURSOR C IS SELECT * FROM pay_element_sets
440: WHERE rowid = X_Rowid FOR UPDATE of Element_Set_Id NOWAIT;
441: --
442: Recinfo C%ROWTYPE;
443: --
448: if (C%NOTFOUND) then
449: CLOSE C;
450: hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
451: hr_utility.set_message_token('PROCEDURE',
452: 'pay_element_sets_pkg.lock_row');
453: hr_utility.set_message_token('STEP','1');
454: hr_utility.raise_error;
455: end if;
456: CLOSE C;
518: X_Session_Business_Group_Id,
519: X_Session_Legislation_Code,
520: X_Element_Set_Name);
521: --
522: UPDATE pay_element_sets
523: SET element_set_id = X_Element_Set_Id,
524: business_group_id = X_Business_Group_Id,
525: legislation_code = X_Legislation_Code,
526: element_set_name = X_Element_Set_Name,
538: X_Element_Set_Name,
539: X_Business_Group_Id,
540: X_Legislation_Code);
541: ---
542: UPDATE pay_element_sets
543: SET element_set_id = X_Element_Set_Id,
544: business_group_id = X_Business_Group_Id,
545: legislation_code = X_Legislation_Code,
546: element_set_name = X_Base_Element_Set_Name,
554: --
555: if (SQL%NOTFOUND) then
556: hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
557: hr_utility.set_message_token('PROCEDURE',
558: 'pay_element_sets_pkg.update_row');
559: hr_utility.set_message_token('STEP','1');
560: hr_utility.raise_error;
561: end if;
562: --
592: pay_est_del.del_tl(x_element_set_id);
593: end if;
594: --------------------------------------------------------------------------------
595: --
596: DELETE FROM pay_element_sets
597: WHERE rowid = X_Rowid;
598: --
599: if (SQL%NOTFOUND) then
600: hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
598: --
599: if (SQL%NOTFOUND) then
600: hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
601: hr_utility.set_message_token('PROCEDURE',
602: 'pay_element_sets_pkg.delete_row');
603: hr_utility.set_message_token('STEP','1');
604: hr_utility.raise_error;
605: end if;
606: --
610: --
611: procedure ADD_LANGUAGE
612: is
613: begin
614: delete from PAY_ELEMENT_SETS_TL T
615: where not exists
616: (select NULL
617: from PAY_ELEMENT_SETS B
618: where B.ELEMENT_SET_ID = T.ELEMENT_SET_ID
613: begin
614: delete from PAY_ELEMENT_SETS_TL T
615: where not exists
616: (select NULL
617: from PAY_ELEMENT_SETS B
618: where B.ELEMENT_SET_ID = T.ELEMENT_SET_ID
619: );
620: update PAY_ELEMENT_SETS_TL T
621: set (ELEMENT_SET_NAME) =
616: (select NULL
617: from PAY_ELEMENT_SETS B
618: where B.ELEMENT_SET_ID = T.ELEMENT_SET_ID
619: );
620: update PAY_ELEMENT_SETS_TL T
621: set (ELEMENT_SET_NAME) =
622: (select B.ELEMENT_SET_NAME
623: from PAY_ELEMENT_SETS_TL B
624: where B.ELEMENT_SET_ID = T.ELEMENT_SET_ID
619: );
620: update PAY_ELEMENT_SETS_TL T
621: set (ELEMENT_SET_NAME) =
622: (select B.ELEMENT_SET_NAME
623: from PAY_ELEMENT_SETS_TL B
624: where B.ELEMENT_SET_ID = T.ELEMENT_SET_ID
625: and B.LANGUAGE = T.SOURCE_LANG)
626: where (T.ELEMENT_SET_ID,T.LANGUAGE) in
627: (select SUBT.ELEMENT_SET_ID,SUBT.LANGUAGE
624: where B.ELEMENT_SET_ID = T.ELEMENT_SET_ID
625: and B.LANGUAGE = T.SOURCE_LANG)
626: where (T.ELEMENT_SET_ID,T.LANGUAGE) in
627: (select SUBT.ELEMENT_SET_ID,SUBT.LANGUAGE
628: from PAY_ELEMENT_SETS_TL SUBB, PAY_ELEMENT_SETS_TL SUBT
629: where SUBB.ELEMENT_SET_ID = SUBT.ELEMENT_SET_ID
630: and SUBB.LANGUAGE = SUBT.SOURCE_LANG
631: and (SUBB.ELEMENT_SET_NAME <> SUBT.ELEMENT_SET_NAME
632: ));
630: and SUBB.LANGUAGE = SUBT.SOURCE_LANG
631: and (SUBB.ELEMENT_SET_NAME <> SUBT.ELEMENT_SET_NAME
632: ));
633:
634: insert into PAY_ELEMENT_SETS_TL (
635: ELEMENT_SET_ID,
636: ELEMENT_SET_NAME,
637: LAST_UPDATE_DATE,
638: LAST_UPDATED_BY,
650: B.CREATED_BY,
651: B.CREATION_DATE,
652: L.LANGUAGE_CODE,
653: B.SOURCE_LANG
654: from PAY_ELEMENT_SETS_TL B, FND_LANGUAGES L
655: where L.INSTALLED_FLAG in ('I', 'B')
656: and B.LANGUAGE = userenv('LANG')
657: and not exists
658: (select NULL
655: where L.INSTALLED_FLAG in ('I', 'B')
656: and B.LANGUAGE = userenv('LANG')
657: and not exists
658: (select NULL
659: from PAY_ELEMENT_SETS_TL T
660: where T.ELEMENT_SET_ID = B.ELEMENT_SET_ID
661: and T.LANGUAGE = L.LANGUAGE_CODE);
662: end ADD_LANGUAGE;
663:
666: X_B_LEGISLATION_CODE in VARCHAR2,
667: X_ELEMENT_SET_NAME in VARCHAR2,
668: X_OWNER in VARCHAR2) is
669: begin
670: UPDATE PAY_ELEMENT_SETS_TL
671: SET ELEMENT_SET_NAME = nvl(X_ELEMENT_SET_NAME,ELEMENT_SET_NAME),
672: last_update_date = SYSDATE,
673: last_updated_by = decode(x_owner,'SEED',1,0),
674: last_update_login = 0,
675: source_lang = userenv('LANG')
676: WHERE userenv('LANG') IN (language,source_lang)
677: AND ELEMENT_SET_ID in
678: (select ELEMENT_SET_ID
679: from PAY_ELEMENT_SETS
680: where nvl(ELEMENT_SET_NAME,'~null~')=nvl(X_B_ELEMENT_SET_NAME,'~null~')
681: and nvl(LEGISLATION_CODE,'~null~') = nvl(X_B_LEGISLATION_CODE,'~null~')
682: and BUSINESS_GROUP_ID is NULL);
683: if (sql%notfound) then
717: p_element_set_id IN NUMBER,
718: p_bus_grp_id IN NUMBER,
719: p_leg_code IN varchar2) IS
720: SELECT 1
721: FROM pay_element_sets_tl est,
722: pay_element_sets els
723: WHERE upper(est.element_set_name)=upper(p_element_set_name)
724: AND est.element_set_id = els.element_set_id
725: AND est.language = p_language
718: p_bus_grp_id IN NUMBER,
719: p_leg_code IN varchar2) IS
720: SELECT 1
721: FROM pay_element_sets_tl est,
722: pay_element_sets els
723: WHERE upper(est.element_set_name)=upper(p_element_set_name)
724: AND est.element_set_id = els.element_set_id
725: AND est.language = p_language
726: AND (els.element_set_id <> p_element_set_id OR p_element_set_id IS NULL)
731: l_business_group_id NUMBER;
732: l_legislation_code VARCHAR2(150);
733:
734: BEGIN
735: l_package_name := 'PAY_ELEMENT_SETS_PKG.VALIDATE_TRANSLATION';
736: l_business_group_id := p_business_group_id;
737: l_legislation_code := p_legislation_code;
738: hr_utility.set_location (l_package_name,10);
739: OPEN c_translation(language, element_set_name,element_set_id,
761: return g_dml_status;
762: end return_dml_status;
763: --
764: --
765: END PAY_ELEMENT_SETS_PKG;