Addresses #130
git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@3626 248e525c-4dfb-0310-94bc-949c084e9493
This commit is contained in:
@@ -812,6 +812,7 @@ CREATE OR REPLACE PACKAGE BODY mip_parties AS
|
||||
p_contact_value IN VARCHAR2) IS
|
||||
l_current_come_id contact_mechanisms.id%TYPE;
|
||||
l_current_come_value VARCHAR2(100);
|
||||
l_contact_mechanism_exists BOOLEAN;
|
||||
BEGIN
|
||||
BEGIN
|
||||
SELECT vccm.come_id, vccm.Contact_value
|
||||
@@ -819,21 +820,27 @@ CREATE OR REPLACE PACKAGE BODY mip_parties AS
|
||||
FROM v_current_contact_mechanisms vccm
|
||||
WHERE vccm.PRTY_ID = p_prty_id
|
||||
AND vccm.CODE = p_contact_mech_type;
|
||||
l_contact_mechanism_exists := TRUE;
|
||||
EXCEPTION
|
||||
WHEN no_data_found THEN --no current come exists, therefore just create one.
|
||||
create_party_contact_details(p_prty_id => p_prty_id,
|
||||
p_contact_mech_type => p_contact_mech_type,
|
||||
p_contact_value => p_contact_value);
|
||||
WHEN no_data_found THEN
|
||||
l_contact_mechanism_exists := FALSE;
|
||||
END;
|
||||
|
||||
--check if it's a different value, if so, end this one and create a new one.
|
||||
IF l_current_come_value = p_contact_value THEN
|
||||
NULL; -- no change to store
|
||||
IF l_contact_mechanism_exists THEN
|
||||
--check if it's a different value, if so, end this one and create a new one.
|
||||
IF l_current_come_value = p_contact_value THEN
|
||||
NULL; -- no change to store
|
||||
ELSE
|
||||
UPDATE party_contact_mechanisms pcome
|
||||
SET pcome.end_date = SYSDATE
|
||||
WHERE pcome.come_id = l_current_come_id;
|
||||
|
||||
create_party_contact_details(p_prty_id => p_prty_id,
|
||||
p_contact_mech_type => p_contact_mech_type,
|
||||
p_contact_value => p_contact_value);
|
||||
END IF;
|
||||
ELSE
|
||||
UPDATE party_contact_mechanisms pcome
|
||||
SET pcome.end_date = SYSDATE
|
||||
WHERE pcome.come_id = l_current_come_id;
|
||||
|
||||
-- there is no previous contact mechanism value
|
||||
create_party_contact_details(p_prty_id => p_prty_id,
|
||||
p_contact_mech_type => p_contact_mech_type,
|
||||
p_contact_value => p_contact_value);
|
||||
|
||||
Reference in New Issue
Block a user