The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT supervisor_id
FROM per_assignments_f
WHERE person_id = p_person_id
AND assignment_number = p_assignment_number
AND sysdate between effective_start_date and effective_end_date;
SELECT paf1.supervisor_id
FROM per_assignments_f paf1
WHERE paf1.person_id = p_person_id
AND paf1.assignment_number = p_assignment_number
AND paf1.effective_end_date = (SELECT max(paf2.effective_end_date)
FROM per_assignments_f paf2
WHERE paf2.assignment_id = paf1.assignment_id);
SELECT count(*)
INTO l_valid_supervisor
-- FROM per_people_f ppf Commented for Bug 3741272
FROM per_all_people_f ppf
WHERE ppf.person_id = p_supervisor_id
AND trunc(sysdate) between ppf.effective_start_date and ppf.effective_end_date
AND current_employee_flag = 'Y';
/*Procedure UPDATE_ADJUSTMENT_CONTROL_TABLE updated the table
PSP_ADJUSTMENT_CONTROL_TABLE with the */
/*approver's UserID. */
/**************************************************************************/
PROCEDURE update_adj_ctrl_table(p_batch_name IN VARCHAR2,
p_approver_userID IN NUMBER,
p_comments IN VARCHAR2,
return_code OUT NOCOPY NUMBER) IS
BEGIN
UPDATE psp_adjustment_control_table
SET approver_id = p_approver_userID,
approval_date = SYSDATE, -- Added to fix bug 1661405. approval_date is a new column added to table
comments = p_comments
WHERE adjustment_batch_name = p_batch_name;
update psp_payroll_controls
set status_code = 'N'
where batch_name = p_batch_name
and source_type = 'A'
and status_code = 'C';
END update_adj_ctrl_table;
** Procedure SELECT_APPROVER is called by "Select Approver" activity in the
** distribution adjustment workflow process.
** By default, the supervisor is the approver.
** If customization is needed, enter your code in
** PSP_WF_ADJ_CUSTOM.select_approver_custom.
****************************************************************************/
PROCEDURE select_approver(itemtype IN VARCHAR2,
itemkey IN VARCHAR2,
actid IN NUMBER,
funcmode IN VARCHAR2,
result OUT NOCOPY VARCHAR2)
IS
l_person_id NUMBER;
** to customize the program to select the approver.
** Customize code can be entered in psp_wf_adj_custom.select_approver_custom
** procedure and returns the appropriate supervisior id.
**---------------------------------------------------------------------*/
l_supervisor_id := get_supervisor(l_person_id, l_assignment_number);
psp_wf_adj_custom.select_approver_custom(itemtype,
itemkey,
actid,
funcmode,
l_person_id,
l_assignment_number,
l_custom_supervisor_id);
wf_core.context('PSP_WF_ADJ_PKG', 'SELECT_APPROVER', itemtype, itemkey, to_char(actid), funcmode);
END select_approver;
SELECT responder
FROM wf_notifications
WHERE notification_id =
-- Introduced the following for bug fix 3263333
(SELECT ias.notification_id
FROM wf_lookups l_at,
wf_lookups l_as,
wf_activities_vl a,
wf_process_activities pa,
wf_item_types_vl it,
wf_items i,
wf_item_activity_statuses ias
WHERE ias.item_type = itemtype
AND ias.item_key = itemkey
AND i.item_type = itemtype
AND i.item_key = itemkey
AND i.begin_date between a.begin_date AND nvl(a.end_date, i.begin_date)
AND i.item_type = it.name
AND ias.process_activity = pa.instance_id
AND pa.activity_name = a.name
AND pa.activity_item_type = a.item_type
AND l_at.lookup_type = 'WFENG_ACTIVITY_TYPE'
AND l_at.lookup_code = a.type
AND l_as.lookup_type = 'WFENG_STATUS'
AND l_as.lookup_code = ias.activity_status
AND a.name = 'NOT_APPROVAL_REQUIRED');
--(SELECT MAX(notification_id) Commented for bug fix 3263333
(SELECT notification_id -- Introduced for bug fix 3263333
FROM wf_item_activity_statuses -- changed to base table for bug fix 3263333
WHERE item_type = 'PSPADJWF' AND
item_key = itemkey AND
process_activity = actid); -- Introduced for bug fix 3263333
SELECT user_id
FROM fnd_user
WHERE user_name = l_approver_username;
update_adj_ctrl_table(l_batch_name, l_approver_userID,l_comments, l_return_code);
SELECT user_id
into l_creator_user_id
FROM fnd_user
WHERE user_name = l_creator_username;
update_adj_ctrl_table(l_batch_name, l_creator_user_id,l_comments, l_return_code);