diff --git a/Modules/mip_debug.pck b/Modules/mip_debug.pck index 86069ad..bf6ce98 100644 --- a/Modules/mip_debug.pck +++ b/Modules/mip_debug.pck @@ -4,18 +4,18 @@ CREATE OR REPLACE PACKAGE mip_debug IS -- Created : 06/03/2008 09:07:01 -- Purpose : provide debug output functionality - PROCEDURE pl(p_unit IN VARCHAR + PROCEDURE pl(p_unit IN VARCHAR2 ,p_in VARCHAR2 ,p_line IN NUMBER DEFAULT NULL); END mip_debug; / CREATE OR REPLACE PACKAGE BODY mip_debug IS - PROCEDURE pl(p_unit IN VARCHAR + PROCEDURE pl(p_unit IN VARCHAR2 ,p_in VARCHAR2 ,p_line IN NUMBER DEFAULT NULL) IS l_fh utl_file.file_type; - l_output VARCHAR2(400); + l_output VARCHAR2(4000); BEGIN dbms_application_info.set_module(p_unit diff --git a/Modules/mip_helper_special_cases.pck b/Modules/mip_helper_special_cases.pck index e13e630..ab1a81d 100644 --- a/Modules/mip_helper_special_cases.pck +++ b/Modules/mip_helper_special_cases.pck @@ -24,10 +24,11 @@ CREATE OR REPLACE PACKAGE BODY mip_helper_special_cases IS ,p_field_name => 'INSTALL_SUB_BUILDING' ,p_error_message => 'At least one of Building or Sub-Building must be completed.'); END IF; - + -- O-M2 IF p_rec.enty_code IN ('STD INSTALL', 'STD EXCHANGE') THEN - IF p_rec.required_mesc_code = 'OTHER' THEN + IF (p_rec.required_mesc_code IS NULL OR + p_rec.required_mesc_code = 'OTHER') THEN IF p_rec.qmax IS NULL THEN mip_mandatory.add_error(p_mandatory_checks => p_mandatory_checks ,p_field_name => 'QMAX' @@ -35,14 +36,13 @@ CREATE OR REPLACE PACKAGE BODY mip_helper_special_cases IS END IF; END IF; END IF; - + -- O-M3 IF p_rec.enty_code IN ('INSTALL', 'OFMAT', 'REMOVE', 'ADVERSARIAL', 'ALTERATION', 'CHANGE CAPACITY', 'ADDON', 'OTHER') AND p_rec.required_svcp_code = 'IP' - AND - (p_rec.required_ip_details IS NULL) THEN + AND (p_rec.required_ip_details IS NULL) THEN mip_mandatory.add_error(p_mandatory_checks => p_mandatory_checks ,p_field_name => 'REQUIRED_SVCP_CODE' ,p_error_message => 'Required IP Details must be completed when a Service Pressure of ''IP'' is requested.'); @@ -50,7 +50,7 @@ CREATE OR REPLACE PACKAGE BODY mip_helper_special_cases IS ,p_field_name => 'REQUIRED_IP_DETAILS' ,p_error_message => 'Required IP Details must be completed when a Service Pressure of ''IP'' is requested.'); END IF; - + -- O-M4 IF p_rec.enty_code IN ('INSTALL', 'STD INSTALL') AND (p_rec.mprn IS NULL AND p_rec.mprn_alt IS NULL) THEN @@ -61,11 +61,11 @@ CREATE OR REPLACE PACKAGE BODY mip_helper_special_cases IS ,p_field_name => 'MPRN_ALT' ,p_error_message => 'Either MPRN or Additional Information must be completed.'); END IF; - + -- O-M5 -- Tripartite Agreement and AMR -- this is a specific example of the Tripartite and addons -- This is handled through the mip_tripartite.addon functionality - + -- O-M6 IF p_rec.enty_code IN ('OFMAT', 'EXCHANGE', 'STD EXCHANGE', 'REMOVE', 'STD REMOVE', 'ADVERSARIAL', 'CHANGE CAPACITY') diff --git a/Modules/mip_quotation.pck b/Modules/mip_quotation.pck index f380a73..5bf12bd 100644 --- a/Modules/mip_quotation.pck +++ b/Modules/mip_quotation.pck @@ -1308,22 +1308,30 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.'); END return_mandatory_messages; PROCEDURE add_quote_reason(p_enqu_id IN enquiries.id%TYPE - ,p_reason IN quote_reasoning.reason%TYPE + ,p_reason IN VARCHAR2 --quote_reasoning.reason%TYPE ,p_internal_or_external IN quote_reasoning.internal_or_external%TYPE DEFAULT gc_external_reason) IS BEGIN pl('add_quote_reason:' || p_enqu_id || ':' || p_reason ,$$PLSQL_LINE); - INSERT INTO quote_reasoning - (enqu_id - ,reason - ,internal_or_external - ,id) - VALUES - (p_enqu_id - ,p_reason - ,p_internal_or_external - ,qure_seq.NEXTVAL); - + BEGIN + INSERT INTO quote_reasoning + (enqu_id + ,reason + ,internal_or_external + ,id) + VALUES + (p_enqu_id + ,substr(p_reason + ,1 + ,239) + ,p_internal_or_external + ,qure_seq.NEXTVAL); + EXCEPTION + WHEN OTHERS THEN + pl('add_quote_reason:' || SQLERRM + ,$$PLSQL_LINE); + RAISE; + END; END add_quote_reason; FUNCTION get_u_meter_size(p_qmax IN NUMBER) @@ -2068,7 +2076,9 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.'); l_existing_rec_metr_details.mety_code || ':' || l_existing_rec_metr_details.prty_id ,$$PLSQL_LINE); - add_quote_reason('Existing meter details. Meter model is ' || + + add_quote_reason(p_enqu.id + ,'Existing meter details. Meter model is ' || nvl(l_existing_rec_metr_details.code ,'UNKNOWN') || ', meter size code is ' || nvl(l_existing_rec_metr_details.mesc_code @@ -2088,7 +2098,19 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.'); IF p_enqu.required_svcp_code = 'LP' AND l_existing_rec_metr_details.mety_code = 'DIAPHRAGM' THEN -- no restrictions - l_required_qmax := p_enqu.qmax; + pl('Existing LP Diaphragm - no restriction' + ,$$PLSQL_LINE); + pl('Required Meter Size' || p_enqu.required_mesc_code + ,$$PLSQL_LINE); + pl('Required Qmax' || p_enqu.qmax + ,$$PLSQL_LINE); + IF p_enqu.required_mesc_code IS NOT NULL + AND p_enqu.required_mesc_code <> 'OTHER' THEN + l_required_qmax := get_qmax_from_mesc(p_enqu.required_mesc_code); + ELSE + l_required_qmax := p_enqu.qmax; + END IF; + ELSIF p_enqu.required_svcp_code = 'MP' AND l_existing_rec_metr_details.mety_code = 'DIAPHRAGM' THEN -- can quote for specific meter size @@ -2123,6 +2145,10 @@ RECEIVED AT THIS ADDRESS CANNOT BE RESPONDED TO.'); ,'Site Survey is required for exchange of meter.'); END IF; ELSE + pl('required_mesc_code=' || p_enqu.required_mesc_code + ,$$PLSQL_UNIT); + pl('qmax=' || p_enqu.qmax + ,$$PLSQL_UNIT); -- the user can only request meter sizes of: -- 'U' meter size code, these have associated Qmax values; OR -- 'OTHER' - the user didn't know the meter size code!