Fix for #442(SC1006) added a new function to return if the enquiry has quotes or not. Used by the delete quotes button on the enquiry form to hide the button if there are no quotes to delete.

git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@4740 248e525c-4dfb-0310-94bc-949c084e9493
This commit is contained in:
PriestJ
2008-04-08 16:47:53 +00:00
parent 30cda4ff29
commit 3dcf390ee9

View File

@@ -15,6 +15,8 @@ CREATE OR REPLACE PACKAGE mip_enquiry IS
,required_mesc_code meters.mesc_code%TYPE);
-- Public function and procedure declarations
FUNCTION enquiry_has_quotes(p_enquiryid IN NUMBER) RETURN BOOLEAN;
FUNCTION can_enquiry_be_deleted(p_enquiryid IN NUMBER) RETURN BOOLEAN;
FUNCTION get_enquiry_status(p_enquiryid IN NUMBER) RETURN VARCHAR2;
@@ -106,11 +108,37 @@ CREATE OR REPLACE PACKAGE BODY mip_enquiry IS
,p_in => p_in);
/* $END*/
END pl;
/*
FUNCTION enquiry_has_quotes
- This function returns true if the enquiry has quotes
%param p_enquiryid - the enquiry we want to find quotes from.
%return boolean - true if the enquiry has quotes
*/
FUNCTION enquiry_has_quotes(p_enquiryid IN NUMBER) RETURN BOOLEAN AS
-- cursor to get the current enquiry
CURSOR c_count_all_quotes(cp_enqu_id NUMBER) IS
SELECT COUNT(id)
FROM quotes
WHERE enqu_id = cp_enqu_id;
l_quotes_num NUMBER := 0;
BEGIN
IF NOT c_count_all_quotes%ISOPEN THEN
OPEN c_count_all_quotes(p_enquiryid);
END IF;
FETCH c_count_all_quotes
INTO l_quotes_num;
CLOSE c_count_all_quotes;
IF l_quotes_num > 0 THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
END enquiry_has_quotes;
/*
FUNCTION can_enquiry_be_deleted
- This function returns the status of the enquiry provided
- and associated quotes to see if it can be deleted
- This function returns the status of the enquiry's
- associated quotes to see if it can be deleted
%param p_enquiryid - the enquiry we want to find the role from.
%return boolean - true if the enquiry can be deleted
*/