44: orig_system_id = origSystemIdIn) or
45: (origSystemIn = ame_util.fndUserOrigSystem and
46: orig_system = ame_util.perOrigSystem and
47: orig_system_id = (select employee_id
48: from fnd_user
49: where user_id = origSystemIdIn)))
50: and status = 'ACTIVE'
51: and (orig_system not in (ame_util.fndUserOrigSystem,ame_util.perOrigSystem)
52: or exists
50: and status = 'ACTIVE'
51: and (orig_system not in (ame_util.fndUserOrigSystem,ame_util.perOrigSystem)
52: or exists
53: (select null
54: from fnd_user u
55: where u.user_name = wf_local_roles.name))
56: and not exists (
57: select null from wf_local_roles wf2
58: where wf_local_roles.orig_system = wf2.orig_system
133: errorCode integer;
134: errorMessage ame_util.longestStringType;
135: begin
136: /*
137: If an fnd_user entry has a non-null employee_id (person ID) value, it gets
138: converted to the PER originating system in wf_roles; otherwise, it gets
139: converted to the FND_USR originating system. As just one of these will
140: happen, we can match both originating systems in a single-row query.
141: The order-by-name clause and rownum < 2 condition are necessary because we
150: orig_system_id = origSystemIdIn) or
151: (origSystemIn = ame_util.fndUserOrigSystem and
152: orig_system = ame_util.perOrigSystem and
153: orig_system_id = (select employee_id
154: from fnd_user
155: where
156: user_id = origSystemIdIn and
157: sysdate between
158: start_date and
161: (expiration_date is null or
162: sysdate < expiration_date) and
163: (orig_system not in (ame_util.fndUserOrigSystem,ame_util.perOrigSystem)
164: or exists (select null
165: from fnd_user u
166: where u.user_name = wf_roles.name
167: and trunc(sysdate) between u.start_date
168: and nvl(u.end_date,trunc(sysdate)))) and
169: not exists (
577: errorMessage ame_util.longestStringType;
578: name wf_roles.name%type;
579: begin
580: /*
581: If an fnd_user entry has a non-null employee_id (person ID) value, it gets
582: converted to the PER originating system in wf_roles; otherwise, it gets
583: converted to the FND_USR originating system. As just one of these will
584: happen, we can match both originating systems in a single-row query.
585: The order-by-name clause and rownum < 2 condition are necessary because we
594: orig_system_id = origSystemIdIn) or
595: (origSystemIn = ame_util.fndUserOrigSystem and
596: orig_system = ame_util.perOrigSystem and
597: orig_system_id = (select employee_id
598: from fnd_user
599: where
600: user_id = origSystemIdIn and
601: sysdate between
602: start_date and
605: (expiration_date is null or
606: sysdate < expiration_date) and
607: (orig_system not in (ame_util.fndUserOrigSystem,ame_util.perOrigSystem)
608: or exists (select null
609: from fnd_user u
610: where u.user_name = wf_roles.name
611: and trunc(sysdate) between u.start_date
612: and nvl(u.end_date,trunc(sysdate)))) and
613: not exists (
821: /* The compiler forces passing arguments by position in the following function calls. */
822: getWfRolesName(ame_util.fndUserOrigSystem, user_id) approver_name,
823: getApproverDescription(getWfRolesName(ame_util.fndUserOrigSystem, user_id)) approver_description
824: from
825: fnd_user,
826: wf_roles
827: where
828: wf_roles.orig_system_id = fnd_user.user_id and
829: wf_roles.orig_system = ame_util.fndUserOrigSystem and
824: from
825: fnd_user,
826: wf_roles
827: where
828: wf_roles.orig_system_id = fnd_user.user_id and
829: wf_roles.orig_system = ame_util.fndUserOrigSystem and
830: wf_roles.status = 'ACTIVE' and
831: wf_roles.name = fnd_user.user_name and
832: (userNameIn is null or
827: where
828: wf_roles.orig_system_id = fnd_user.user_id and
829: wf_roles.orig_system = ame_util.fndUserOrigSystem and
830: wf_roles.status = 'ACTIVE' and
831: wf_roles.name = fnd_user.user_name and
832: (userNameIn is null or
833: upper(fnd_user.user_name) like upper(replace(userNameIn, '''', '''''')) || '%') and
834: (emailAddressIn is null or
835: upper(fnd_user.email_address) like upper(replace(emailAddressIn, '''', '''''')) || '%') and
829: wf_roles.orig_system = ame_util.fndUserOrigSystem and
830: wf_roles.status = 'ACTIVE' and
831: wf_roles.name = fnd_user.user_name and
832: (userNameIn is null or
833: upper(fnd_user.user_name) like upper(replace(userNameIn, '''', '''''')) || '%') and
834: (emailAddressIn is null or
835: upper(fnd_user.email_address) like upper(replace(emailAddressIn, '''', '''''')) || '%') and
836: truncatedSysdateIn between
837: fnd_user.start_date and
831: wf_roles.name = fnd_user.user_name and
832: (userNameIn is null or
833: upper(fnd_user.user_name) like upper(replace(userNameIn, '''', '''''')) || '%') and
834: (emailAddressIn is null or
835: upper(fnd_user.email_address) like upper(replace(emailAddressIn, '''', '''''')) || '%') and
836: truncatedSysdateIn between
837: fnd_user.start_date and
838: nvl(fnd_user.end_date, truncatedSysdateIn) and
839: rownum < 52 + rowsToExcludeIn /* This prevents oversized fetches. */
833: upper(fnd_user.user_name) like upper(replace(userNameIn, '''', '''''')) || '%') and
834: (emailAddressIn is null or
835: upper(fnd_user.email_address) like upper(replace(emailAddressIn, '''', '''''')) || '%') and
836: truncatedSysdateIn between
837: fnd_user.start_date and
838: nvl(fnd_user.end_date, truncatedSysdateIn) and
839: rownum < 52 + rowsToExcludeIn /* This prevents oversized fetches. */
840: order by fnd_user.user_name;
841: /* local variables */
834: (emailAddressIn is null or
835: upper(fnd_user.email_address) like upper(replace(emailAddressIn, '''', '''''')) || '%') and
836: truncatedSysdateIn between
837: fnd_user.start_date and
838: nvl(fnd_user.end_date, truncatedSysdateIn) and
839: rownum < 52 + rowsToExcludeIn /* This prevents oversized fetches. */
840: order by fnd_user.user_name;
841: /* local variables */
842: approverNames ame_util.longStringList;
836: truncatedSysdateIn between
837: fnd_user.start_date and
838: nvl(fnd_user.end_date, truncatedSysdateIn) and
839: rownum < 52 + rowsToExcludeIn /* This prevents oversized fetches. */
840: order by fnd_user.user_name;
841: /* local variables */
842: approverNames ame_util.longStringList;
843: approverDescriptions ame_util.longStringList;
844: errorCode integer;
1477: wf_roles.orig_system_id = per_all_assignments_f.supervisor_id and
1478: wf_roles.status = 'ACTIVE' and
1479: (wf_roles.expiration_date is null or sysdate < wf_roles.expiration_date) and
1480: exists (select null
1481: from fnd_user u
1482: where u.user_name = wf_roles.name
1483: and trunc(sysdate) between u.start_date
1484: and nvl(u.end_date,trunc(sysdate))) and
1485: not exists (
1520: wf_roles.orig_system_id = per_all_assignments_f.supervisor_id and
1521: wf_roles.status = 'ACTIVE' and
1522: (wf_roles.expiration_date is null or sysdate < wf_roles.expiration_date) and
1523: exists (select null
1524: from fnd_user u
1525: where u.user_name = wf_roles.name
1526: and trunc(sysdate) between u.start_date
1527: and nvl(u.end_date,trunc(sysdate))) and
1528: per_all_assignments_f.person_id =
1526: and trunc(sysdate) between u.start_date
1527: and nvl(u.end_date,trunc(sysdate))) and
1528: per_all_assignments_f.person_id =
1529: (select employee_id
1530: from fnd_user
1531: where
1532: user_id = approverIn.orig_system_id and
1533: rownum < 2) and
1534: per_all_assignments_f.primary_flag = 'Y' and
1672: wf_roles.orig_system_id = per_all_assignments_f.supervisor_id and
1673: wf_roles.status = 'ACTIVE' and
1674: (wf_roles.expiration_date is null or sysdate < wf_roles.expiration_date) and
1675: exists (select null
1676: from fnd_user u
1677: where u.user_name = wf_roles.name
1678: and trunc(sysdate) between u.start_date
1679: and nvl(u.end_date,trunc(sysdate))) and
1680: not exists (
1713: wf_roles.orig_system = ame_util.perOrigSystem and
1714: wf_roles.orig_system_id = per_all_assignments_f.supervisor_id and
1715: wf_roles.status = 'ACTIVE' and
1716: exists (select null
1717: from fnd_user u
1718: where u.user_name = wf_roles.name
1719: and trunc(sysdate) between u.start_date
1720: and nvl(u.end_date,trunc(sysdate))) and
1721: (wf_roles.expiration_date is null or sysdate < wf_roles.expiration_date) and
1720: and nvl(u.end_date,trunc(sysdate))) and
1721: (wf_roles.expiration_date is null or sysdate < wf_roles.expiration_date) and
1722: per_all_assignments_f.person_id =
1723: (select employee_id
1724: from fnd_user
1725: where
1726: user_id = origSystemIdIn and
1727: rownum < 2) and
1728: per_all_assignments_f.primary_flag = 'Y' and
1847: This procedure should select the input approver's wf_roles.display_name, NOT the
1848: display name of the input approver's orig_system.
1849: */
1850: /*
1851: If an fnd_user entry has a non-null employee_id (person ID) value, it gets
1852: converted to the PER originating system in wf_roles; otherwise, it gets
1853: converted to the FND_USR originating system. As just one of these will
1854: happen, we can match both originating systems in a single-row query.
1855: The order-by-name clause and rownum < 2 condition are necessary because we
1868: orig_system_id = origSystemIdIn) or
1869: (origSystemIn = ame_util.fndUserOrigSystem and
1870: orig_system = ame_util.perOrigSystem and
1871: orig_system_id = (select employee_id
1872: from fnd_user
1873: where
1874: user_id = origSystemIdIn and
1875: sysdate between
1876: start_date and
1879: (expiration_date is null or
1880: sysdate < expiration_date) and
1881: (orig_system not in (ame_util.fndUserOrigSystem,ame_util.perOrigSystem)
1882: or exists (select null
1883: from fnd_user u
1884: where u.user_name = wf_roles.name
1885: and trunc(sysdate) between u.start_date
1886: and nvl(u.end_date,trunc(sysdate)))) and
1887: not exists (
2011: and wfr.orig_system_id = pap.person_id
2012: and wfr.orig_system = ame_util.perOrigSystem
2013: and wfr.status = 'ACTIVE'
2014: and exists (select null
2015: from fnd_user u
2016: where u.user_name = wfr.name
2017: and truncatedSysdateIn between u.start_date
2018: and nvl(u.end_date,truncatedSysdateIn))
2019: and (firstNameIn is null or upper(pap.first_name) like upper(replace(firstNameIn, '''', '''''')) || '%')