50: reason_code ,
51: status ,
52: created_by_module ,
53: contact_type
54: FROM HZ_CONTACT_PREFERENCES pref
55: WHERE pref.CONTACT_LEVEL_TABLE_ID = l_party_id
56: AND pref.CONTACT_LEVEL_TABLE = 'HZ_PARTIES'
57: AND pref.preference_topic_type_code = l_purpose_code -- this will be l_purpose_code
58: AND pref.preference_topic_type = 'FND_BUSINESS_PURPOSES_B' -- this will be FND_BUSINESS_PURPOSES
184: FOR r_bus_purp in c_bus_purp
185: LOOP
186: IF(r_bus_purp.purpose_default_code = 'N')
187: THEN
188: -- if the default option is No choice then there will not be any records in HZ_CONTACT_PREFERENCES
189: null;
190: ELSIF(r_bus_purp.purpose_default_code = 'O')
191: THEN
192: -- if the default option is Opt Out, and a party opt in record exists in HZ_CONTACT_PREFERENCES
188: -- if the default option is No choice then there will not be any records in HZ_CONTACT_PREFERENCES
189: null;
190: ELSIF(r_bus_purp.purpose_default_code = 'O')
191: THEN
192: -- if the default option is Opt Out, and a party opt in record exists in HZ_CONTACT_PREFERENCES
193: -- the record has to be deleted
194: open c_cont_pref(l_party_id,
195: r_bus_purp.purpose_code);
196: fetch c_cont_pref into r_cont_pref;
198:
199: -- if a opt in record exists then that has to be deleted
200: IF(r_cont_pref.preference_code = 'DO')
201: THEN
202: delete hz_contact_preferences
203: where contact_preference_id = r_cont_pref.contact_preference_id;
204: END IF; -- end of DO check
205:
206: ELSIF(r_bus_purp.purpose_default_code = 'I')
204: END IF; -- end of DO check
205:
206: ELSIF(r_bus_purp.purpose_default_code = 'I')
207: THEN
208: -- if the default option is opt in, and a party opt out record DOES NOT exist in HZ_CONTACT_PREFERENCES
209: -- then create an opt-out record for the Business Purpose and Party
210: open c_cont_pref(l_party_id,
211: r_bus_purp.purpose_code);
212: fetch c_cont_pref into r_cont_pref;
397: IF (l_party_id is not null)
398: THEN
399: /* as the default options are to be set for the party, so all opt-in/opt-out records from contact
400: preferences will have to be removed */
401: delete HZ_CONTACT_PREFERENCES pref
402: WHERE pref.CONTACT_LEVEL_TABLE_ID = l_party_id
403: AND pref.CONTACT_LEVEL_TABLE = 'HZ_PARTIES'
404: AND pref.preference_topic_type = 'FND_BUSINESS_PURPOSES_B'
405: AND pref.contact_type = 'PRIV_PREF';
486: l_purpose_code in varchar2)
487: IS
488: select contact_preference_id,
489: preference_code
490: FROM HZ_CONTACT_PREFERENCES pref
491: WHERE pref.CONTACT_LEVEL_TABLE_ID = l_party_id
492: AND pref.CONTACT_LEVEL_TABLE = 'HZ_PARTIES'
493: --AND pref.preference_topic_type_id = l_purpose_code
494: AND pref.preference_topic_type_code = l_purpose_code
564: ELSIF(p_option(i).purpose_default_code in ('I', 'O'))
565: THEN
566: IF(p_option(i).user_option = p_option(i).purpose_default_code )
567: THEN
568: -- if user option is same as default code then delete any opt-in/opt-out from hz_contact_preferences table
569: -- check to see if any record already exists .
570: r_cont_pref := null;
571: open c_cont_pref(l_party_id, p_option(i).purpose_code);
572: fetch c_cont_pref into r_cont_pref;
573: if(c_cont_pref%FOUND)
574: THEN
575: l_all_flag := 'Y';
576:
577: delete HZ_CONTACT_PREFERENCES pref
578: WHERE pref.CONTACT_LEVEL_TABLE_ID = l_party_id
579: AND pref.CONTACT_LEVEL_TABLE = 'HZ_PARTIES'
580: AND pref.preference_topic_type = 'FND_BUSINESS_PURPOSES_B'
581: AND pref.contact_type = 'PRIV_PREF'
600: ELSIF(r_cont_pref.preference_code = 'DO_NOT')
601: THEN
602: l_all_flag := 'Y';
603: -- delete the OPT-OUT record , in the unlikely case that it exisrs
604: delete HZ_CONTACT_PREFERENCES pref
605: where pref.contact_preference_id = r_cont_pref.contact_preference_id;
606: ELSE
607: l_all_flag := 'Y';
608: -- insert the OPT-IN record
663: ELSIF(r_cont_pref.preference_code = 'DO')
664: THEN
665: l_all_flag := 'Y';
666: -- delete the OPT-OUT record , in the unlikely case that it exisrs
667: delete HZ_CONTACT_PREFERENCES pref
668: where pref.contact_preference_id = r_cont_pref.contact_preference_id;
669: ELSE
670: l_all_flag := 'Y';
671: -- insert the OPT-IN record
720: -- check to see the l_all_flag. If value is Y then delete the record for opt-out-of-all-purposes button switch
721: -- this flag is used to keep track that some change has been made to the user option for privacy preferences
722: IF(l_all_flag = 'Y')
723: THEN
724: delete HZ_CONTACT_PREFERENCES pref
725: WHERE pref.CONTACT_LEVEL_TABLE_ID = l_party_id
726: AND pref.CONTACT_LEVEL_TABLE = 'HZ_PARTIES'
727: AND pref.preference_topic_type = 'FND_BUSINESS_PURPOSES_B'
728: AND pref.contact_type = 'PRIV_PREF'