From a5dbe5b167e38b2810e26bfe85419a0b926e81e9 Mon Sep 17 00:00:00 2001 From: PriestJ Date: Tue, 15 Jan 2008 12:55:12 +0000 Subject: [PATCH] is_tripartite function used to quickly determine if Market participant is a tripartite member or not. Used when determining things like whether AMR or certain types of jobs are available to users git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@3244 248e525c-4dfb-0310-94bc-949c084e9493 --- Modules/mip_parties.pck | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/Modules/mip_parties.pck b/Modules/mip_parties.pck index b60e225..84e2032 100644 --- a/Modules/mip_parties.pck +++ b/Modules/mip_parties.pck @@ -1,12 +1,6 @@ CREATE OR REPLACE PACKAGE mip_parties AS - /* - PROCEDURE add_party - - allows an admin user to create new parties for use in the system - %param p_username - the name of the user to create - %param p_password - the password of the party - %p_role - the party's role in the system - */ + FUNCTION is_tripartite(p_mktp_ref IN VARCHAR2) RETURN BOOLEAN; FUNCTION get_user_id(p_username IN VARCHAR2) RETURN NUMBER; FUNCTION get_user_role(p_username IN VARCHAR2) RETURN VARCHAR2; -- @@ -192,6 +186,27 @@ CREATE OR REPLACE PACKAGE mip_parties AS END mip_parties; / CREATE OR REPLACE PACKAGE BODY mip_parties AS + /* + FUNCTION is_tripartite + - This function searches the parties table with the supplied + - mktp_ref and returns true if the tripartite member column is yes. + %param p_mktp_ref - the market participant (supplier) to check. + */ + FUNCTION is_tripartite(p_mktp_ref IN VARCHAR2) RETURN BOOLEAN AS + l_tripartite_status varchar2(3); + CURSOR c_tripartite IS + SELECT distinct tripartite_member FROM parties WHERE upper(mktp_ref) = upper(p_mktp_ref); + BEGIN + OPEN c_tripartite; + FETCH c_tripartite + INTO l_tripartite_status; + CLOSE c_tripartite; + if upper(l_tripartite_status) = 'YES' then + return TRUE; + else + return FALSE; + end if; + END is_tripartite; /* FUNCTION get_user_id - gets the primary key for a supplied username. This function searches the parties