PL SQL Developer
PL SQL Developer
l_check_id ap_checks_all.check_id%type;
l_org_id ap_checks_all.org_id%type;
l_check_number ap_checks_all.check_number%type;
l_check_date varchar2(20);
l_currency_code ap_checks_all.currency_code%type;
l_payment_amount ap_checks_all.amount%type;
l_email_address IBY_EXTERNAL_PAYEES_ALL.remit_advice_email%type;
l_message_lines1 varchar2(4000):='';
l_message_lines2 varchar2(4000):='';
l_message_lines3 varchar2(4000):='';
l_message_lines4 varchar2(4000):='';
l_message_lines5 varchar2(4000):='';
l_message_lines6 varchar2(4000):='';
l_message_lines7 varchar2(4000):='';
l_message_lines8 varchar2(4000):='';
l_message_lines9 varchar2(4000):='';
l_message_lines10 varchar2(4000):='';
l_message_line varchar2(200):='';
l_role varchar2(100);
l_display_role_name varchar2(100);
--Bug#11774150
l_calendar_aware_alt NUMBER :=2;
l_calendar_aware NUMBER := 1;
l_calendar_unaware NUMBER := 0;
BEGIN
l_check_id := wf_engine.getitemattrnumber(p_item_type,
p_item_key,
'CHECK_ID');
l_org_id := wf_engine.getitemattrnumber(p_item_type,
p_item_key,
'ORG_ID');
end if;
OPEN c_message_lines;
LOOP
END LOOP;
CLOSE c_message_lines;
l_role := null;
l_display_role_name := null;
END get_check_info;
-------------------------------------------------------------------------------
------- Procedure get_remit_email_address returns the Remittance Email Address
------- of the Supplier. This procedure is called by get_check_info and rule_function
------- procedures
-------------------------------------------------------------------------------
l_vendor_id po_vendor_sites_all.vendor_id%type;
l_vendor_site_id po_vendor_sites_all.vendor_site_id%type;
BEGIN
SELECT vendor_id,
vendor_site_id
INTO l_vendor_id,
l_vendor_site_id
FROM ap_checks
WHERE check_id = p_check_id;
--bug6119080, changed the query to fetch the email address from the
--correct table.
SELECT remit_advice_email
INTO p_email_address
FROM IBY_EXTERNAL_PAYEES_ALL
WHERE supplier_site_id = l_vendor_site_id;
END get_remit_email_address;
-------------------------------------------------------------------------------
------- Procedure get_remit_email_address returns the Remittance Email Address
------- of the Supplier. This procedure is called by get_check_info and rule_function
------- procedures
-------------------------------------------------------------------------------------------
BEGIN
SELECT status_lookup_code
INTO p_check_status
FROM ap_checks
WHERE check_id = p_check_id;
END get_check_status;
------ Procedure rule_function is called by the Subscription program. Rule Function determines
------ whether WorkFlow Program should be called.
------ Rule Defined is that to call the Workflow program only if the Remittance Email Address
------ is available for the Supplier.
-------------------------------------------------------------------------------------------
l_rule VARCHAR2(20);
l_parameter_list wf_parameter_list_t := wf_parameter_list_t();
l_parameter_t wf_parameter_t:= wf_parameter_t(null, null);
i_parameter_name l_parameter_t.name%type;
i_parameter_value l_parameter_t.value%type;
i pls_integer;
l_check_id l_parameter_t.value%type;
l_org_id l_parameter_t.value%type;
l_email_address IBY_EXTERNAL_PAYEES_ALL.remit_advice_email%type;
l_check_status ap_checks_all.status_lookup_code%type;
BEGIN
l_parameter_list := p_event.getParameterList();
if l_parameter_list is not null
then
i := l_parameter_list.FIRST;
while ( i <= l_parameter_list.LAST )
loop
i_parameter_name := null;
i_parameter_value := null;
i_parameter_name := l_parameter_list(i).getName();
i_parameter_value := l_parameter_list(i).getValue();
end if;
--bug6119080, commented the existing code and added the new the code
--to properly set the org context.
-- fnd_client_info.set_org_context(l_org_id);
mo_global.set_policy_context('S',l_org_id);
end if;
get_remit_email_address(to_number(l_check_id),l_email_address);
get_check_status(to_number(l_check_id),l_check_status);
l_rule := wf_rule.default_rule(p_subscription,p_event);
end if;
end if;
return ('SUCCESS');
END rule_function;
END AP_PAYMENT_EVENT_WF_PKG;