general update?!

git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@2891 248e525c-4dfb-0310-94bc-949c084e9493
This commit is contained in:
PriestJ
2007-11-27 11:52:30 +00:00
parent 2920f4d016
commit 4ab118215c
3 changed files with 92 additions and 3 deletions

View File

@@ -12,6 +12,7 @@ CREATE OR REPLACE PACKAGE mip_parties AS
RETURN NUMBER;
FUNCTION get_user_role(p_username IN VARCHAR2)
return varchar2;
FUNCTION has_supplier(p_username IN VARCHAR2, p_supplierid IN VARCHAR) return boolean;
PROCEDURE add_address(p_address addresses%ROWTYPE);
PROCEDURE add_partyaddress(p_addr_code IN VARCHAR2, p_prty_id IN INTEGER);
PROCEDURE add_partyrole(p_role_code IN VARCHAR2, p_prty_id IN NUMBER);
@@ -321,7 +322,29 @@ CREATE OR REPLACE PACKAGE BODY mip_parties AS
--
--
/*
FUNCTION has_supplier
- Returns true if a supplier is found for a supplied username. Searches the parties
- table for a matching username, if the name is found the users id is returned.
- That id is used to search the party_roles table to get the role keycode.
%param p_username - the name of the user you want to find the supplier for.
%param p_supplierid - the id of the supplier you want to check the user against.
*/
FUNCTION has_supplier(p_username IN VARCHAR2, p_supplierid IN VARCHAR) return boolean as
cursor c_userrole is select ID
from PARTIES p, PARTY_RELATIONSHIPS pr
where p.ID = pr.TO_PARL_PRTY_ID
and pr.FROM_PARL_PRTY_ID = get_user_id(p_username)
and pr.TO_PARL_RT_CODE = 'SUPP'
and pr.FROM_PARL_RT_CODE = 'AGENT';
begin
for userrole_rec in c_userrole loop
if p_supplierid = userrole_rec.id then
return true;
end if;
end loop;
return false;
end has_supplier;
END mip_parties;
/