/*********************************************************************************************************** * Prime * Name : PrefCenterCTRL * Created By : Prime Team (Krishna Casukhela & Jayakrishna) * Purpose : Preference Center that allows fans to modify their details, preferences & subscriptions * Created Date : May-15-2017 * * Date Modified Modified By Description of the update ---------------------------------------------------------------------------------------------------------- * 25-Jan-2018 [Jayakrishna, Sasi, Sanjan, Subba Reddy, Shivaram Raju] SON-640 * 15-Aug-2018 [Gopi, Ganesh] SON-846 * 15-Nov-2018 SON-907 * 29-July-2019 [Shivaram Raju] SON-951 [Added New Genre Value for UK Territory ] * 05-oct-2019 [Gopi,Venkat] SON-1093 [Retargeting checkbox] **********************************************************************************************************/ public class PrefCenterCTRL { public string userLangString { get; set; } public String fanInstagramHandle { get; set; } public String fanTwitterHandle { get; set; } public String fanCountry_Region { get; set; } public String fanPostalCode { get; set; } public String fanState { get; set; } public String fanCity { get; set; } public String fanGender { get; set; } public String fanDOB { get; set; } public string fanDOBUS { get { if (String.isNotBlank(fanDOBUS)) { List doblist = new List(); doblist.add(fanDOBUS); Map dobmap = DateUtil.convertToMMDD(doblist); String dobfinal = dobmap.get(fanDOBUS); return dobfinal; } else { return null; } } set; } public boolean selectedRetargetpanel { get; set; } public boolean showUK { get; set; } public boolean showUS { get; set; } public boolean showState { get; set; } public boolean showphone { get; set; } public boolean showaddress { get; set; } public boolean showaddress1 { get; set; } public String fanLastName { get; set; } public String fanFirstName { get; set; } public String fanMobile { get; set; } public String fan_Mobile { get; set; } public String fanEmail { get; set; } public String fan_email { get; set; } public String fanAddress { get; set; } public String fanAddress2 { get; set; } public string emailAddress; public String encryptedfanID; public String mid { get; set; } public fan__c fan { get; set; } public Preference__c pref; public boolean Genre_Alternative_Indie { get; set; } public boolean Genre_HipHop_Rap { get; set; } public boolean Genre_Classical { get; set; } public boolean Genre_Jazz { get; set; } public boolean Genre_Country { get; set; } public boolean Genre_Pop { get; set; } public boolean Genre_Dance_Electronic { get; set; } public boolean Genre_Rock { get; set; } public boolean Genre_Easy_Listening { get; set; } public boolean Genre_Soul_R_B { get; set; } /*--Sony Music UK BASED ON son -951 Macro/Micro segmentation comments--*/ public boolean Genre_Hip_Hop_RnB_Urban { get; set; } public boolean Segment_Genre_Alternative_Indie { get; set; } //public boolean Segment_Genre_HipHop_Rap { set; get; } public boolean Segment_Genre_Classical { get; set; } public boolean Segment_Genre_Jazz { get; set; } public boolean Segment_Genre_Country { get; set; } public boolean Segment_Genre_Pop { get; set; } public boolean Segment_Genre_Dance_Electronic { get; set; } public boolean Segment_Genre_Rock { get; set; } public boolean Segment_Genre_Easy_Listening { get; set; } public boolean Segment_Genre_Soul_R_B { get; set; } /*--Sony Music UK BASED ON son -951 Macro/Micro segmentation comments--*/ public boolean Segment_Genre_Hip_Hop_RnB_Urban { get; set; } /*--Sony Music US-Provident--SON-950 comments--*/ public boolean Provident_Alternative_Indie { get; set; } public boolean Provident_HipHop_Rap { get; set; } public boolean Provident_Christian { get; set; } public boolean Provident_Classical { get; set; } public boolean Provident_Jazz { get; set; } public boolean Provident_Country { get; set; } public boolean Provident_Pop { get; set; } public boolean Provident_Dance_Electronic { get; set; } public boolean Provident_Rock { get; set; } public boolean Provident_Easy_Listening { get; set; } public boolean Provident_Soul_R_B { get; set; } /*--Sony Music Germany--*/ public boolean Germany_Alternative_Indie { get; set; } public boolean Germany_HipHop_Rap { get; set; } public boolean Germany_Classical { get; set; } public boolean Germany_Jazz { get; set; } public boolean Germany_Country { get; set; } public boolean Germany_Pop { get; set; } public boolean Germany_Dance_Electronic { get; set; } public boolean Germany_Rock { get; set; } public boolean Germany_Easy_Listening { get; set; } public boolean Germany_Soul_R_B { get; set; } public boolean Germany_Metal { get; set; } public boolean Germany_Radio_Plays_Audio_Books { get; set; } /*--Century Media--*/ public boolean Century_Media_Alternative_Indie { get; set; } public boolean Century_Media_HipHop_Rap { get; set; } public boolean Century_Media_Classical { get; set; } public boolean Century_Media_Jazz { get; set; } public boolean Century_Media_Country { get; set; } public boolean Century_Media_Pop { get; set; } public boolean Century_Media_Dance_Electronic { get; set; } public boolean Century_Media_Rock { get; set; } public boolean Century_Media_Easy_Listening { get; set; } public boolean Century_Media_Soul_R_B { get; set; } public boolean Century_Media_Metal { get; set; } /*--Sony Music Germany [Family BU]--*/ public boolean Germany_Die_drei { get; set; } public boolean Germany_TKKG { get; set; } public boolean Germany_Funf_Freunde { get; set; } public boolean Germany_Hanni_Nanni { get; set; } public boolean Germany_Teufelskicker { get; set; } public boolean Germany_Hui_Buh { get; set; } /*--Sony Music Germany [Spassgesellschaft]--*/ public boolean Germany_Mario_Barth { get; set; } public boolean Germany_Harry_G { get; set; } public boolean Germany_Paul_Panzer { get; set; } public boolean Germany_Luke_Mockridge { get; set; } public boolean Germany_Carolin_Kebekus { get; set; } public boolean Germany_Kaya_Yanar { get; set; } public boolean Germany_Bastian_Pastewka { get; set; } public boolean Germany_Johann_Konig { get; set; } public boolean Germany_Chris_Tall { get; set; } public boolean Germany_Bulent_Ceylan { get; set; } /*--Sony Music Chile--*/ public boolean Chile_Pop { get; set; } public boolean Chile_Rock { get; set; } public boolean Chile_Electronica { get; set; } public boolean Chile_Baladas { get; set; } public boolean Chile_Reggaeton { get; set; } public boolean Chile_Trap { get; set; } /*--Sony Music Spain --*/ public boolean Spain_POP_ESPANOL { get; set; } public boolean Spain_NUEVO_POP { get; set; } public boolean Spain_POP_INGLES { get; set; } public boolean Spain_LATINO_REGGAETONL { get; set; } public boolean Spain_URBANO_TRAP_ANGLO { get; set; } public boolean Spain_URBANO_TRAP_LOCAL { get; set; } public boolean Spain_INDIE_ROCK_ESPANOL_E_INTERNACIONAL { get; set; } public boolean Spain_ELECTRONICA_DANCE { get; set; } /*--Sony Music Colombia --*/ public boolean Colombia_Pop { get; set; } public boolean Colombia_Rock { get; set; } public boolean Colombia_Dance_Electronic { get; set; } public boolean Colombia_Reggaeton { get; set; } public boolean Colombia_Trap { get; set; } public boolean Colombia_Vallenato { get; set; } public boolean Colombia_Salsa { get; set; } /*--Sony Music Mexico --*/ public boolean mexico_regional_mexicano { get; set; } public boolean mexico_rock_alternativo { get; set; } public boolean mexico_rap_hiphop { get; set; } public boolean mexico_pop_baladas { get; set; } public boolean mexico_musica_urbana_trap { get; set; } public boolean mexico_kpop { get; set; } public boolean mexico_otros_generos { get; set; } /*--Central America and Caribbean --*/ public boolean CAC_pop_baladas { get; set; } public boolean CAC_rap_hiphop { get; set; } public boolean CAC_musica_urbana_trap { get; set; } public boolean CAC_rock_alternativo { get; set; } public boolean CAC_otros_generos { get; set; } public boolean CAC_regional_mexicano { get; set; } /*--Sony Music Brazil--*/ public boolean BRAZIL_POP { get; set; } public boolean BRAZIL_EDM { get; set; } public boolean BRAZIL_ROCK { get; set; } public boolean BRAZIL_HIP { get; set; } public boolean BRAZIL_SAMBA { get; set; } public boolean BRAZIL_GOSPEL { get; set; } public boolean BRAZIL_SERTANJO { get; set; } public boolean BRAZIL_MPB { get; set; } public boolean BRAZIL_INFANTIL { get; set; } public boolean BRAZIL_FUNK { get; set; } /*--Sony Music US Latin--*/ public boolean USLatin_POP { get; set; } public boolean USLatin_Alternative_Indie { get; set; } public boolean USLatin_Ballad { get; set; } public boolean USLatin_Urbano { get; set; } public boolean USLatin_Tropical { get; set; } public boolean USLatin_Regional_Mexican { get; set; } /*-- US Lagacy--*/ public boolean UsLegacy_Alternative { get; set; } public boolean UsLegacy_Country { get; set; } public boolean UsLegacy_HipHop_Rap { get; set; } public boolean UsLegacy_Jazz { get; set; } public boolean UsLegacy_Pop { get; set; } public boolean UsLegacy_R_B { get; set; } public boolean UsLegacy_Rock { get; set; } public boolean UsLegacy_Metals { get; set; } public boolean UsLegacy_Blues { get; set; } public boolean UsLegacy_Folk { get; set; } /*--Legacy Records--*/ public boolean Legacy_Pop { get; set; } public boolean Legacy_Rock { get; set; } public boolean Legacy_Hip_Hop { get; set; } public boolean Legacy_Country { get; set; } public boolean Legacy_Jazz { get; set; } public boolean Legacy_R_B { get; set; } public boolean Legacy_Soul { get; set; } /**--US - Sony Music Now--**/ public boolean US_Sony_Music_Now_Pop { get; set; } public boolean US_Sony_Music_Now_Rock { get; set; } public boolean US_Sony_Music_Now_Hip_Hop { get; set; } public boolean US_Sony_Music_Now_Country { get; set; } public boolean US_Sony_Music_Now_EDM { get; set; } public boolean US_Sony_Music_Now_R_B { get; set; } public boolean US_Sony_Music_Now_Latin { get; set; } public boolean Era_Pre_1950 { get; set; } public boolean Era_1950s { get; set; } public boolean Era_1960s { get; set; } public boolean Era_1970s { get; set; } public boolean Era_1980s { get; set; } public boolean Era_1990s { get; set; } public boolean Era_2000s { get; set; } public boolean Era_2010s { get; set; } public boolean Era_BrandNewMusic { get; set; } /* Era options for SMGermany-Family BU */ public boolean Era_Kinder_ab_3_Jahren { get; set; } public boolean Era_Kinder_ab_6_Jahren { get; set; } public boolean Era_Kinder_ab_9_Jahren { get; set; } public boolean Era_Kinder_ab_12_Jahren { get; set; } public boolean Era_Erwachsene { get; set; } /* Era options for SMGermany-Spassgesellschaft BU */ public boolean Era_Beziehungsprobleme { get; set; } public boolean Era_Bayrische_Comedy { get; set; } public boolean Era_Alltagssituationen { get; set; } public boolean Era_Magie { get; set; } public boolean Era_Futball { get; set; } public boolean Format_Streaming { get; set; } public boolean Format_Streaming_Legacy { get; set; } public boolean Format_Streaming_SonyUS { get; set; } public boolean Format_CD_Legacy { get; set; } public boolean Format_CD_SonyUS { get; set; } public boolean Format_Vinyl_Legacy { get; set; } public boolean Format_Vinyl_SonyUS { get; set; } public boolean Format_Live_Event { get; set; } public boolean Format_Live_Event_US { get; set; } public boolean Format_Download { get; set; } public boolean Format_Video { get; set; } public boolean Format_CD { get; set; } public boolean Format_Vinyl { get; set; } public boolean Format_Live_Tickets { get; set; } public boolean Format_MC { get; set; } public boolean Format_Zusatzger_te_wie_z_B_Toniebox_Tigerbox_u { get; set; } public boolean Format_DVD { get; set; } public boolean Format_TV { get; set; } public boolean B1Format_Download { get; set; } public boolean B2Format_Download { get; set; } public boolean B1Format_Streaming { get; set; } public boolean B2Format_Streaming { get; set; } public boolean B1Format_Vinyl { get; set; } public boolean B1Format_CD { get; set; } public boolean Streaming_AppleMusic { get; set; } public boolean Streaming_AppleMusic_Legacy { get; set; } public boolean Streaming_AppleMusic_USNow { get; set; } public boolean Streaming_GooglePlay { get; set; } public boolean Streaming_Deezer { get; set; } public boolean Streaming_Tidal { get; set; } public boolean Streaming_Tidal_Legacy { get; set; } public boolean Streaming_Tidal_USNow { get; set; } public boolean Streaming_Spotify { get; set; } public boolean Streaming_Spotify_Legacy { get; set; } public boolean Streaming_Spotify_USNow { get; set; } public boolean Streaming_SoundCloud { get; set; } public boolean Streaming_Pandora { get; set; } public boolean Streaming_Pandora_Legacy { get; set; } public boolean Streaming_Pandora_USNow { get; set; } public boolean Streaming_YouTube { get; set; } public boolean Streaming_YouTube_Legacy { get; set; } public boolean Streaming_YouTube_USNow { get; set; } public boolean Streaming_Amazon_Music { get; set; } public boolean Streaming_Amazon_Music_Legacy { get; set; } public boolean Streaming_Amazon_Music_USNow { get; set; } /*--Sony Music UK - RG Live--*/ public boolean RG_LIVE_CLASSICAL { get; set; } public boolean RG_LIVE_DANCE { get; set; } public boolean RG_LIVE_CLUB { get; set; } public boolean RG_LIVE_ROCK_AND_POP { get; set; } public boolean RG_LIVE_SPEAKER { get; set; } public boolean RG_LIVE_ILLUMINATED_TRAILS { get; set; } public boolean RG_LIVE_FILM_AND_TV { get; set; } public boolean RG_LIVE_FESTIVAL_AND_OUTDOOR { get; set; } public boolean RG_LIVE_IMMERSIVE { get; set; } public boolean RG_LIVE_THEATRE { get; set; } public boolean RG_LIVE_FAMILY { get; set; } public boolean RG_LIVE_CHRISTMAS { get; set; } public boolean RG_LIVE_SPORT { get; set; } public boolean RG_LIVE_COMEDY { get; set; } public boolean Download_ITunes { get; set; } public boolean Download_Amazon { get; set; } public boolean Download_GooglePlay { get; set; } public boolean Video_Youtube { get; set; } public boolean Video_Apple { get; set; } public boolean Video_Vevo { get; set; } public boolean selectedRetarget { get; set; } public boolean deleterequest { get; set; } public boolean selectedsub { get; set; } public boolean showpanel { get; set; } public Boolean displayPopup { get; set; } //public Boolean displayfandelpop {get;set;} //public Boolean showfan {set;get;} public String SonyCRMDL; public String TerritoryCheck { get; set; } public string MCAddress { get; set; } List toAdd = new List(); @TestVisible set Genres = new Set(); @TestVisible set Eras = new Set(); @TestVisible set Formats = new Set(); @TestVisible set Streams = new Set(); @TestVisible set downloads = new Set(); @TestVisible set Videos = new Set(); list legacyrecords = new List{ '6383328', '6383329', '6383330', '6383331', '6383332', '6383333', '6383334', '6383335', '6383336', '6383337', '6383338', '6383339', '6383340', '6383341', '6383342', '6383343', '6383344', '6383345', '6383347', '6383349', '6383350', '6383351', '6383353', '6383354', '6383355', '6383356', '6383357', '6383358', '6383359', '6383360', '6383362', '6383363', '6383364', '6383365', '6383366', '6383367', '6383368', '6383369', '6383370', '6383371', '6383372', '6383373', '6383374', '6383375', '6383376', '6383377', '6383378', '6383379', '6383380', '6383381', '6383382', '6383383', '6383384', '6383385', '6383387', '6383388', '6383389', '6383390', '6383391', '6383392', '6383393', '6383394', '6383395', '6383396', '6383397', '6383398', '6383399', '6383400', '6383401', '6383402', '6383403', '6386149', '6386150', '6386151', '6386152', '6386153', '6391835', '6402398', '6406345', '6407353', '6413326', '6414505', '6417307', '6417498', '6418067', '6420958', '6424206', '6424207', '6424324', '6424448', '6383315' }; //Populates Country Codes public List countriesList { get { List countriesList = new List(); countriesList.add(new selectOption(' ', '--Select--')); map countryMap = Countries__c.getAll(); List countries = new List(); countries.addAll(countryMap.keySet()); countries.sort(); for (string country : countries) { Countries__c c = countryMap.get(country); countriesList.add(new selectOption(c.CountryCode__c, c.Name)); } return countriesList; } set; } //Populates States Codes public List statesList { get { List statesList = new List(); Map allstates = States__c.getAll(); Map states = new Map(); Map values = new Map(); for (States__c state : allstates.values()) { if (state.countryCode__c == fanCountry_Region) { states.put(state.SequenceNumber__c, state); values.put(state.SequenceNumber__c, state.name); } } List stateNames = new List(); stateNames.addAll(values.keySet()); stateNames.sort(); for (decimal stateName : stateNames) { States__c state = states.get(stateName); statesList.add(new SelectOption(state.StateCode__c, state.Name)); } if (statesList.size() > 0) { statesList.add(0, new SelectOption(' ', '-- Select One --')); } else { statesList.add(new SelectOption(' ', 'Not Required')); } return statesList; } set; } public List frts; public List subs; public List subsretarget; public TerritoryBusinessUnit__c tlBU; public List wrapls = new List(); public List subList { get { wrapls.sort(); return wrapls; } set; } public PrefCenterCTRL() { selectedRetargetpanel = false; selectedRetarget = false; deleterequest = false; encryptedfanID = ApexPages.currentpage().getparameters().get('id'); mid = ApexPages.currentpage().getparameters().get('mid'); showUK = true; showUS = false; showphone = true; showaddress = true; showaddress1 = false; showpanel = false; //showfan = false; pref = new Preference__c(); SonyCRMDL = System.Label.Sony_CRM_Email_DL; for (String s1 : SonyCRMDL.split(',')) { toAdd.add(s1); } //***** Language Specific ********** /*if(ApexPages.currentPage().getParameters().get('mid') != null){ userLangString = [SELECT ID,Name, MID__c FROM TerritoryBusinessUnit__c WHERE MID__c=:ApexPages.currentpage().getparameters().get('mid')].Preferred_Language__c; }*/ //***** Language Specific ********** userLangString = 'FÜNF FREUNDE'; if (ApexPages.currentPage().getCookies().get('lang') != null) { // lang is a custom cookie defined. Cookie userLang = ApexPages.currentPage().getCookies().get('lang'); userLangString = userLang.getValue(); } if (String.isBlank(userLangString)) { userLangString = 'el'; } String browserLanguage = ApexPages.currentPage().getHeaders().get('Accept-Language'); if (!String.isBlank(browserLanguage) && browserLanguage.contains(',')) { userLangString = browserLanguage.subString(0, browserLanguage.indexOf(',')); } if (!String.isBlank(browserLanguage) && browserLanguage.contains(',') && browserLanguage.contains('es')) { userLangString = browserLanguage.subString(0, browserLanguage.indexOf('es')); } else { userLangString = browserLanguage; } //******************************************************************************** if (String.isBlank(encryptedfanID)) { ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.INFO, 'Invalid Id.'); ApexPages.addMessage(myMsg); return; } else { try { fetchfanvalues(); if (fanCountry_Region != null || fanCountry_Region == ' ') { if (statesList.size() > 1) showState = true; } else { if (!(statesList.size() == 1)) showState = false; } } catch (System.QueryException ex) { Apexpages.addMessage(new Apexpages.Message(Apexpages.Severity.ERROR, 'No Record')); } } } public void showState() { if (fanCountry_Region != null || fanCountry_Region == ' ') { if (statesList.size() > 1) showState = true; else showState = false; } } public void fetchfanvalues() { fan = new fan__c(); fan = [ SELECT id, Email__c, Mobile_Phone__c, First_Name__c, Last_Name__c, Birthdate__c, Gender__c, City__c, State__c, Address_1__c, Address_2__c, Postal_Code__c, Country_Region__c, Twitter_Handle__c, Instagram_Handle__c, Birthday_mm_dd__c, Delete_My_Information__c FROM fan__c WHERE Encrypted_ID__c = :encryptedfanID LIMIT 1 ]; if (fan != null) { fan_email = fan.Email__c; if (fan_email != null && fan_email != '') { fanEmail = maskEmail(fan_email); } if (!string.isBlank(fan.Mobile_Phone__c)) { fan_Mobile = fan.Mobile_Phone__c; if (fan_Mobile != '' || fan_Mobile != null) { fanMobile = maskPhone(fan_Mobile); } } else { fanMobile = fan.Mobile_Phone__c; } if (!string.isBlank(fan.First_Name__c)) fanFirstName = fan.First_Name__c; if (!string.isBlank(fan.Last_Name__c)) fanLastName = fan.Last_Name__c; try { if (fan.Birthdate__c != null) { fanDOB = fan.Birthdate__c.day() + '/' + fan.Birthdate__c.month() + '/' + fan.Birthdate__c.year(); } } catch (Exception e) { system.debug('Date Displaying Error'); } if (fan.Birthday_mm_dd__c != null) fanDOBUS = fan.Birthday_mm_dd__c; if (!string.isBlank(fan.Gender__c)) fanGender = fan.Gender__c; if (!string.isBlank(fan.City__c)) fanCity = fan.City__c; if (!string.isBlank(fan.State__c)) fanState = fan.State__c; if (!string.isBlank(fan.Postal_Code__c)) fanPostalCode = fan.Postal_Code__c; if (!string.isBlank(fan.Address_1__c)) fanAddress = fan.Address_1__c; if (!string.isBlank(fan.Address_2__c)) fanAddress2 = fan.Address_2__c; if (!string.isBlank(fan.Country_Region__c)) fanCountry_Region = fan.Country_Region__c; if (!string.isBlank(fan.Twitter_Handle__c)) fanTwitterHandle = fan.Twitter_Handle__c; if (!string.isBlank(fan.Instagram_Handle__c)) fanInstagramHandle = fan.Instagram_Handle__c; if (fan.Delete_My_Information__c) { showpanel = false; //showfan = true; } else { showpanel = true; //showfan = false; } // *** Load the Preferences data try { pref = [ SELECT Preferred_Genre__c, Preferred_Era__c, Preferred_Format__c, Streaming_Platform_Preference__c, Download_Store_Preference__c, Video_Platform_Preference__c FROM Preference__c WHERE Fan_Id__c = :fan.Id ORDER BY CreatedDate LIMIT 1 ]; if (pref.Preferred_Genre__c != null) Genres.addAll(pref.Preferred_Genre__c.split(';')); if (pref.Preferred_Era__c != null) Eras.addAll(pref.Preferred_Era__c.split(';')); if (pref.Preferred_Format__c != null) Formats.addAll(pref.Preferred_Format__c.split(';')); if (pref.Streaming_Platform_Preference__c != null) Streams.addAll(pref.Streaming_Platform_Preference__c.split(';')); if (pref.Download_Store_Preference__c != null) downloads.addAll(pref.Download_Store_Preference__c.split(';')); if (pref.Video_Platform_Preference__c != null) Videos.addAll(pref.Video_Platform_Preference__c.split(';')); /*--Sony Music Chile--*/ if (mid == '6416056') { if (Genres.contains('POP')) { Chile_Pop = true; Genres.remove('POP'); } if (Genres.contains('ROCK')) { Chile_Rock = true; Genres.remove('ROCK'); } if (Genres.contains('DANCE / ELECTRONIC')) { Chile_Electronica = true; Genres.remove('DANCE / ELECTRONIC'); } if (Genres.contains('BALADAS')) { Chile_Baladas = true; Genres.remove('BALADAS'); } if (Genres.contains('REGGAETON')) { Chile_Reggaeton = true; Genres.remove('REGGAETON'); } if (Genres.contains('TRAP')) { Chile_Trap = true; Genres.remove('TRAP'); } /*--Sony Music Spain --*/ } else if (mid == '6399706') { if (Genres.contains('POP ESPAÑOL')) { Spain_POP_ESPANOL = true; Genres.remove('POP ESPAÑOL'); } if (Genres.contains('NUEVO POP')) { Spain_NUEVO_POP = true; Genres.remove('NUEVO POP'); } if (Genres.contains('POP INGLES')) { Spain_POP_INGLES = true; Genres.remove('POP INGLES'); } if (Genres.contains('LATINO / REGGAETON')) { Spain_LATINO_REGGAETONL = true; Genres.remove('LATINO / REGGAETON'); } if (Genres.contains('URBANO / TRAP ANGLO')) { Spain_URBANO_TRAP_ANGLO = true; Genres.remove('URBANO / TRAP ANGLO'); } if (Genres.contains('URBANO / TRAP LOCAL')) { Spain_URBANO_TRAP_LOCAL = true; Genres.remove('URBANO / TRAP LOCAL'); } if (Genres.contains('INDIE/ROCK ESPAÑOL E INTERNACIONAL')) { Spain_INDIE_ROCK_ESPANOL_E_INTERNACIONAL = true; Genres.remove('INDIE/ROCK ESPAÑOL E INTERNACIONAL'); } if (Genres.contains('ELECTRÓNICA & DANCE')) { Spain_ELECTRONICA_DANCE = true; Genres.remove('ELECTRÓNICA & DANCE'); } /*--Sony Music Mexico --*/ } else if (mid == '6403493' || mid == '520001903') { if (Genres.contains('REGIONAL MEXICANO')) { mexico_regional_mexicano = true; Genres.remove('REGIONAL MEXICANO'); } if (Genres.contains('ROCK / ALTERNATIVO')) { mexico_rock_alternativo = true; Genres.remove('ROCK / ALTERNATIVO'); } if (Genres.contains('RAP / HIP HOP')) { mexico_rap_hiphop = true; Genres.remove('RAP / HIP HOP'); } if (Genres.contains('POP / BALADAS')) { mexico_pop_baladas = true; Genres.remove('POP / BALADAS'); } if (Genres.contains('MÚSICA URBANA / TRAP')) { mexico_musica_urbana_trap = true; Genres.remove('MÚSICA URBANA / TRAP'); } if (Genres.contains('KPOP')) { mexico_kpop = true; Genres.remove('KPOP'); } if (Genres.contains('OTROS GÉNEROS')) { mexico_otros_generos = true; Genres.remove('OTROS GÉNEROS'); } } else if (mid == '6414758') { /*********Central America and Caribbean********/ if (Genres.contains('POP / BALADAS')) { CAC_pop_baladas = true; Genres.remove('POP / BALADAS'); } if (Genres.contains('RAP / HIP HOP')) { CAC_rap_hiphop = true; Genres.remove('RAP / HIP HOP'); } if (Genres.contains('MÚSICA URBANA / TRAP')) { CAC_musica_urbana_trap = true; Genres.remove('MÚSICA URBANA / TRAP'); } if (Genres.contains('ROCK / ALTERNATIVO')) { CAC_rock_alternativo = true; Genres.remove('ROCK / ALTERNATIVO'); } if (Genres.contains('OTROS GÉNEROS')) { CAC_otros_generos = true; Genres.remove('OTROS GÉNEROS'); } if (Genres.contains('REGIONAL MEXICANO')) { CAC_regional_mexicano = true; Genres.remove('REGIONAL MEXICANO'); } } else if ( mid == '6401830' || mid == '6401824' || mid == '6401825' || mid == '6401837' || mid == '6401831' || mid == '6401823' || mid == '6401829' || mid == '6401826' || mid == '6401822' || mid == '6401834' || mid == '6401833' || mid == '6401828' ) { /*--Sony Music Germany --*/ if (Genres.contains('ALTERNATIVE / INDIE')) { Germany_Alternative_Indie = true; Genres.remove('ALTERNATIVE / INDIE'); } if (Genres.contains('CLASSICAL')) { Germany_Classical = true; Genres.remove('CLASSICAL'); } if (Genres.contains('COUNTRY')) { Germany_Country = true; Genres.remove('COUNTRY'); } if (Genres.contains('DANCE / ELECTRONIC')) { Germany_Dance_Electronic = true; Genres.remove('DANCE / ELECTRONIC'); } if (Genres.contains('EASY LISTENING')) { Germany_Easy_Listening = true; Genres.remove('EASY LISTENING'); } if (Genres.contains('HIP HOP / RAP')) { Germany_HipHop_Rap = true; Genres.remove('HIP HOP / RAP'); } if (Genres.contains('JAZZ')) { Germany_Jazz = true; Genres.remove('JAZZ'); } if (Genres.contains('POP')) { Germany_Pop = true; Genres.remove('POP'); } if (Genres.contains('ROCK')) { Germany_Rock = true; Genres.remove('ROCK'); } if (Genres.contains('SOUL / R&B')) { Germany_Soul_R_B = true; Genres.remove('SOUL / R&B'); } if (Genres.contains('METAL')) { Germany_Metal = true; Genres.remove('METAL'); } if (Genres.contains('RADIO PLAYS / AUDIO BOOKS')) { Germany_Radio_Plays_Audio_Books = true; Genres.remove('RADIO PLAYS / AUDIO BOOKS'); } } else if (mid == '6401832') { if (Genres.contains('DIE DREI ???')) { Germany_Die_drei = true; Genres.remove('DIE DREI ???'); } if (Genres.contains('TKKG')) { Germany_TKKG = true; Genres.remove('TKKG'); } if (Genres.contains('FÜNF FREUNDE')) { Germany_Funf_Freunde = true; Genres.remove('FÜNF FREUNDE'); } if (Genres.contains('HANNI & NANNI')) { Germany_Hanni_Nanni = true; Genres.remove('HANNI & NANNI'); } if (Genres.contains('TEUFELSKICKER')) { Germany_Teufelskicker = true; Genres.remove('TEUFELSKICKER'); } if (Genres.contains('HUI BUH')) { Germany_Hui_Buh = true; Genres.remove('HUI BUH'); } } else if (mid == '6401838') { if (Genres.contains('MARIO BARTH')) { Germany_Mario_Barth = true; Genres.remove('MARIO BARTH'); } if (Genres.contains('HARRY G')) { Germany_Harry_G = true; Genres.remove('HARRY G'); } if (Genres.contains('PAUL PANZER')) { Germany_Paul_Panzer = true; Genres.remove('PAUL PANZER'); } if (Genres.contains('LUKE MOCKRIDGE')) { Germany_Luke_Mockridge = true; Genres.remove('LUKE MOCKRIDGE'); } if (Genres.contains('CAROLIN KEBEKUS')) { Germany_Carolin_Kebekus = true; Genres.remove('CAROLIN KEBEKUS'); } if (Genres.contains('KAYA YANAR')) { Germany_Kaya_Yanar = true; Genres.remove('KAYA YANAR'); } if (Genres.contains('BASTIAN PASTEWKA')) { Germany_Bastian_Pastewka = true; Genres.remove('BASTIAN PASTEWKA'); } if (Genres.contains('JOHANN KÖNIG')) { Germany_Johann_Konig = true; Genres.remove('JOHANN KÖNIG'); } if (Genres.contains('CHRIS TALL')) { Germany_Chris_Tall = true; Genres.remove('CHRIS TALL'); } if (Genres.contains('BÜLENT CEYLAN')) { Germany_Bulent_Ceylan = true; Genres.remove('BÜLENT CEYLAN'); } } else if ( mid == '6420610' || mid == '6420607' || mid == '6420606' || mid == '6420608' || mid == '6420605' || mid == '6420609' || mid == '6420611' ) { /*--Century Media --*/ System.debug('1'); if (Genres.contains('ALTERNATIVE / INDIE')) { Century_Media_Alternative_Indie = true; Genres.remove('ALTERNATIVE / INDIE'); } if (Genres.contains('CLASSICAL')) { Century_Media_Classical = true; Genres.remove('CLASSICAL'); } if (Genres.contains('COUNTRY')) { Century_Media_Country = true; Genres.remove('COUNTRY'); } if (Genres.contains('DANCE / ELECTRONIC')) { Century_Media_Dance_Electronic = true; Genres.remove('DANCE / ELECTRONIC'); } if (Genres.contains('EASY LISTENING')) { Century_Media_Easy_Listening = true; Genres.remove('EASY LISTENING'); } if (Genres.contains('HIP HOP / RAP')) { Century_Media_HipHop_Rap = true; Genres.remove('HIP HOP / RAP'); } if (Genres.contains('JAZZ')) { Century_Media_Jazz = true; Genres.remove('JAZZ'); } if (Genres.contains('POP')) { Century_Media_Pop = true; Genres.remove('POP'); } if (Genres.contains('ROCK')) { Century_Media_Rock = true; Genres.remove('ROCK'); } if (Genres.contains('SOUL / R&B')) { Century_Media_Soul_R_B = true; Genres.remove('SOUL / R&B'); } if (Genres.contains('METAL')) { Century_Media_Metal = true; Genres.remove('METAL'); } } else if (mid == '6402379') { /*--Sony Music Colombia --*/ if (Genres.contains('POP')) { Colombia_Pop = true; Genres.remove('POP'); } if (Genres.contains('ROCK')) { Colombia_Rock = true; Genres.remove('ROCK'); } if (Genres.contains('DANCE / ELECTRONIC')) { Colombia_Dance_Electronic = true; Genres.remove('DANCE / ELECTRONIC'); } if (Genres.contains('REGGAETON')) { Colombia_Reggaeton = true; Genres.remove('REGGAETON'); } if (Genres.contains('TRAP')) { Colombia_Trap = true; Genres.remove('TRAP'); } if (Genres.contains('VALLENATO')) { Colombia_Vallenato = true; Genres.remove('VALLENATO'); } if (Genres.contains('SALSA')) { Colombia_Salsa = true; Genres.remove('SALSA'); } /*--Sony Music Brazil --*/ } else if (mid == '6402378') { if (Genres.contains('POP')) { BRAZIL_POP = true; Genres.remove('POP'); } if (Genres.contains('ROCK')) { BRAZIL_ROCK = true; Genres.remove('ROCK'); } if (Genres.contains('DANCE / ELECTRONIC')) { BRAZIL_EDM = true; Genres.remove('DANCE / ELECTRONIC'); } if (Genres.contains('HIP HOP / RAP')) { BRAZIL_HIP = true; Genres.remove('HIP HOP / RAP'); } if (Genres.contains('SAMBA/PAGODE')) { BRAZIL_SAMBA = true; Genres.remove('SAMBA/PAGODE'); } if (Genres.contains('GOSPEL')) { BRAZIL_GOSPEL = true; Genres.remove('GOSPEL'); } if (Genres.contains('SERTANEJO')) { BRAZIL_SERTANJO = true; Genres.remove('SERTANEJO'); } if (Genres.contains('MPB')) { BRAZIL_MPB = true; Genres.remove('MPB'); } if (Genres.contains('INFANTIL')) { BRAZIL_INFANTIL = true; Genres.remove('INFANTIL'); } if (Genres.contains('FUNK')) { BRAZIL_FUNK = true; Genres.remove('FUNK'); } /*--Sony Music US Latin --*/ } else if (mid == '6402177') { if (Genres.contains('POP')) { USLatin_POP = true; Genres.remove('POP'); } if (Genres.contains('ALTERNATIVE / INDIE')) { USLatin_Alternative_Indie = true; Genres.remove('ALTERNATIVE / INDIE'); } if (Genres.contains('BALLAD')) { USLatin_Ballad = true; Genres.remove('BALLAD'); } if (Genres.contains('URBANO')) { USLatin_Urbano = true; Genres.remove('URBANO'); } if (Genres.contains('TROPICAL')) { USLatin_Tropical = true; Genres.remove('TROPICAL'); } if (Genres.contains('REGIONAL MEXICAN')) { USLatin_Regional_Mexican = true; Genres.remove('REGIONAL MEXICAN'); } } else if (mid == '6402404') { /*--Sony Music US-Provident--as per SON-950 Comments--*/ if (Genres.contains('ALTERNATIVE / INDIE')) { Provident_Alternative_Indie = true; Genres.remove('ALTERNATIVE / INDIE'); } if (Genres.contains('CHRISTIAN')) { Provident_Christian = true; Genres.remove('CHRISTIAN'); } if (Genres.contains('CLASSICAL')) { Provident_Classical = true; Genres.remove('CLASSICAL'); } if (Genres.contains('COUNTRY')) { Provident_Country = true; Genres.remove('COUNTRY'); } if (Genres.contains('DANCE / ELECTRONIC')) { Provident_Dance_Electronic = true; Genres.remove('DANCE / ELECTRONIC'); } if (Genres.contains('EASY LISTENING')) { Provident_Easy_Listening = true; Genres.remove('EASY LISTENING'); } if (Genres.contains('HIP HOP / RAP')) { Provident_HipHop_Rap = true; Genres.remove('HIP HOP / RAP'); } if (Genres.contains('JAZZ')) { Provident_Jazz = true; Genres.remove('JAZZ'); } if (Genres.contains('POP')) { Provident_Pop = true; Genres.remove('POP'); } if (Genres.contains('ROCK')) { Provident_Rock = true; Genres.remove('ROCK'); } if (Genres.contains('SOUL / R&B')) { Provident_Soul_R_B = true; Genres.remove('SOUL / R&B'); } } else if (mid == '6402403') { /*-- Sony Music US Legacy --*/ if (Genres.contains('ALTERNATIVE / INDIE')) { UsLegacy_Alternative = true; Genres.remove('ALTERNATIVE / INDIE'); } if (Genres.contains('SOUL / R&B')) { UsLegacy_R_B = true; Genres.remove('SOUL / R&B'); } if (Genres.contains('HIP HOP / RAP')) { UsLegacy_HipHop_Rap = true; Genres.remove('HIP HOP / RAP'); } if (Genres.contains('COUNTRY')) { UsLegacy_Country = true; Genres.remove('COUNTRY'); } if (Genres.contains('POP')) { UsLegacy_Pop = true; Genres.remove('POP'); } if (Genres.contains('ROCK')) { UsLegacy_Rock = true; Genres.remove('ROCK'); } if (Genres.contains('JAZZ')) { UsLegacy_Jazz = true; Genres.remove('JAZZ'); } if (Genres.contains('METAL')) { UsLegacy_Metals = true; Genres.remove('METAL'); } if (Genres.contains('BLUES')) { UsLegacy_Blues = true; Genres.remove('BLUES'); } if (Genres.contains('FOLK')) { UsLegacy_Folk = true; Genres.remove('FOLK'); } } else if (legacyrecords.contains(mid)) { /**-- Legacy Records --*/ if (Genres.contains('POP')) { Legacy_Pop = true; Genres.remove('POP'); } if (Genres.contains('ROCK')) { Legacy_Rock = true; Genres.remove('ROCK'); } if (Genres.contains('HIP HOP')) { Legacy_Hip_Hop = true; Genres.remove('HIP HOP'); } if (Genres.contains('COUNTRY')) { Legacy_Country = true; Genres.remove('COUNTRY'); } if (Genres.contains('JAZZ')) { Legacy_Jazz = true; Genres.remove('JAZZ'); } if (Genres.contains('R&B')) { Legacy_R_B = true; Genres.remove('R&B'); } if (Genres.contains('SOUL')) { Legacy_Soul = true; Genres.remove('SOUL'); } } else if (mid == '6425029') { /**--US - Sony Music Now--*/ if (Genres.contains('POP')) { US_Sony_Music_Now_Pop = true; Genres.remove('POP'); } if (Genres.contains('ROCK')) { US_Sony_Music_Now_Rock = true; Genres.remove('ROCK'); } if (Genres.contains('HIP HOP')) { US_Sony_Music_Now_Hip_Hop = true; Genres.remove('HIP HOP'); } if (Genres.contains('COUNTRY')) { US_Sony_Music_Now_Country = true; Genres.remove('COUNTRY'); } if (Genres.contains('EDM')) { US_Sony_Music_Now_EDM = true; Genres.remove('EDM'); } if (Genres.contains('R&B')) { US_Sony_Music_Now_R_B = true; Genres.remove('R&B'); } if (Genres.contains('LATIN')) { US_Sony_Music_Now_Latin = true; Genres.remove('LATIN'); } } else if (mid == '520002950') { if (Genres.contains('CLASSICAL')) { RG_LIVE_CLASSICAL = true; Genres.remove('CLASSICAL'); } if (Genres.contains('CLUB')) { RG_LIVE_CLUB = true; Genres.remove('CLUB'); } if (Genres.contains('DANCE')) { RG_LIVE_DANCE = true; Genres.remove('DANCE'); } if (Genres.contains('ROCK & POP')) { RG_LIVE_ROCK_AND_POP = true; Genres.remove('ROCK & POP'); } if (Genres.contains('SPEAKER')) { RG_LIVE_SPEAKER = true; Genres.remove('SPEAKER'); } if (Genres.contains('ILLUMINATED TRAILS')) { RG_LIVE_ILLUMINATED_TRAILS = true; Genres.remove('ILLUMINATED TRAILS'); } if (Genres.contains('FILM & TV')) { RG_LIVE_FILM_AND_TV = true; Genres.remove('FILM & TV'); } if (Genres.contains('FESTIVAL & OUTDOOR')) { RG_LIVE_FESTIVAL_AND_OUTDOOR = true; Genres.remove('FESTIVAL & OUTDOOR'); } if (Genres.contains('IMMERSIVE')) { RG_LIVE_IMMERSIVE = true; Genres.remove('IMMERSIVE'); } if (Genres.contains('THEATRE')) { RG_LIVE_THEATRE = true; Genres.remove('THEATRE'); } if (Genres.contains('FAMILY')) { RG_LIVE_FAMILY = true; Genres.remove('FAMILY'); } if (Genres.contains('CHRISTMAS')) { RG_LIVE_CHRISTMAS = true; Genres.remove('CHRISTMAS'); } if (Genres.contains('SPORT')) { RG_LIVE_SPORT = true; Genres.remove('SPORT'); } if (Genres.contains('COMEDY')) { RG_LIVE_COMEDY = true; Genres.remove('COMEDY'); } } else if ( mid == '6393800' || mid == '6414047' || mid == '6393789' || mid == '6407919' || mid == '6396087' || mid == '6393787' || mid == '6396081' || mid == '6396082' || mid == '6393791' || mid == '6416186' || mid == '6414043' || mid == '6393801' || mid == '6414044' || mid == '6393790' || mid == '6393793' || mid == '6393788' || mid == '6393803' || mid == '8866800' || mid == '6422479' ) { /*--Sony Music UK-- SON-951 Comments--*/ if (Genres.contains('ALTERNATIVE / INDIE')) { Segment_Genre_Alternative_Indie = true; Genres.remove('ALTERNATIVE / INDIE'); } if (Genres.contains('CLASSICAL')) { Segment_Genre_Classical = true; Genres.remove('CLASSICAL'); } if (Genres.contains('COUNTRY')) { Segment_Genre_Country = true; Genres.remove('COUNTRY'); } if (Genres.contains('DANCE / ELECTRONIC')) { Segment_Genre_Dance_Electronic = true; Genres.remove('DANCE / ELECTRONIC'); } if (Genres.contains('EASY LISTENING')) { Segment_Genre_Easy_Listening = true; Genres.remove('EASY LISTENING'); } if (Genres.contains('JAZZ')) { Segment_Genre_Jazz = true; Genres.remove('JAZZ'); } if (Genres.contains('POP')) { Segment_Genre_Pop = true; Genres.remove('POP'); } if (Genres.contains('ROCK')) { Segment_Genre_Rock = true; Genres.remove('ROCK'); } if (Genres.contains('HIP HOP / R&B / URBAN')) { Segment_Genre_Hip_Hop_RnB_Urban = true; Genres.remove('HIP HOP / R&B / URBAN'); } } else { if (Genres.contains('ALTERNATIVE / INDIE')) { Genre_Alternative_Indie = true; Genres.remove('ALTERNATIVE / INDIE'); } if (Genres.contains('CLASSICAL')) { Genre_Classical = true; Genres.remove('CLASSICAL'); } if (Genres.contains('COUNTRY')) { Genre_Country = true; Genres.remove('COUNTRY'); } if (Genres.contains('DANCE / ELECTRONIC')) { Genre_Dance_Electronic = true; Genres.remove('DANCE / ELECTRONIC'); } if (Genres.contains('EASY LISTENING')) { Genre_Easy_Listening = true; Genres.remove('EASY LISTENING'); } if (Genres.contains('HIP HOP / RAP')) { Genre_HipHop_Rap = true; Genres.remove('HIP HOP / RAP'); } if (Genres.contains('JAZZ')) { Genre_Jazz = true; Genres.remove('JAZZ'); } if (Genres.contains('POP')) { Genre_Pop = true; Genres.remove('POP'); } if (Genres.contains('ROCK')) { Genre_Rock = true; Genres.remove('ROCK'); } if (Genres.contains('SOUL / R&B')) { Genre_Soul_R_B = true; Genres.remove('SOUL / R&B'); } } if (Eras.contains('PRE 1950')) { Era_Pre_1950 = true; Eras.remove('PRE 1950'); } if (Eras.contains('1950s')) { Era_1950s = true; Eras.remove('1950s'); } if (Eras.contains('1960s')) { Era_1960s = true; Eras.remove('1960s'); } if (Eras.contains('1970s')) { Era_1970s = true; Eras.remove('1970s'); } if (Eras.contains('1980s')) { Era_1980s = true; Eras.remove('1980s'); } if (Eras.contains('1990s')) { Era_1990s = true; Eras.remove('1990s'); } if (Eras.contains('2000s')) { Era_2000s = true; Eras.remove('2000s'); } if (Eras.contains('2010s')) { Era_2010s = true; Eras.remove('2010s'); } //if(Eras.contains('2020s')) Era_2020s = true; // Removed as part of UK team comments if (Eras.contains('BRAND NEW MUSIC')) { Era_BrandNewMusic = true; Eras.remove('BRAND NEW MUSIC'); } if (Eras.contains('KIDS FROM 3 YEARS')) { Era_Kinder_ab_3_Jahren = true; Eras.remove('KIDS FROM 3 YEARS'); } if (Eras.contains('KIDS FROM 6 YEARS')) { Era_Kinder_ab_6_Jahren = true; Eras.remove('KIDS FROM 6 YEARS'); } if (Eras.contains('KIDS FROM 9 YEARS')) { Era_Kinder_ab_9_Jahren = true; Eras.remove('KIDS FROM 9 YEARS'); } if (Eras.contains('KIDS FROM 12 YEARS')) { Era_Kinder_ab_12_Jahren = true; Eras.remove('KIDS FROM 12 YEARS'); } if (Eras.contains('ADULTS')) { Era_Erwachsene = true; Eras.remove('ADULTS'); } if (Eras.contains('RELATIONSHIP PROBLEMS')) { Era_Beziehungsprobleme = true; Eras.remove('RELATIONSHIP PROBLEMS'); } if (Eras.contains('BAVARIAN COMEDY')) { Era_Bayrische_Comedy = true; Eras.remove('BAVARIAN COMEDY'); } if (Eras.contains('EVERYDAY SITUATIONS')) { Era_Alltagssituationen = true; Eras.remove('EVERYDAY SITUATIONS'); } if (Eras.contains('MAGIC')) { Era_Magie = true; Eras.remove('MAGIC'); } if (Eras.contains('SOCCER')) { Era_Futball = true; Eras.remove('SOCCER'); } if (Formats.contains('STREAMING')) { if (mid == '6401832') { B1Format_Streaming = true; } else if (mid == '6401838') { B2Format_Streaming = true; } else if (legacyrecords.contains(mid)) { Format_Streaming_Legacy = true; } else if (mid == '6425029') { Format_Streaming_SonyUS = true; } else { Format_Streaming = true; } Formats.remove('STREAMING'); } if (Formats.contains('DOWNLOAD')) { if (mid == '6401832') { B1Format_Download = true; } else if (mid == '6401838') { B2Format_Download = true; } else { Format_Download = true; } Formats.remove('DOWNLOAD'); } if (Formats.contains('VIDEO')) { Format_Video = true; Formats.remove('VIDEO'); } if (Formats.contains('CD')) { if (mid == '6401832') { B1Format_CD = true; } else if (legacyrecords.contains(mid)) { Format_CD_Legacy = true; } else if (mid == '6425029') { Format_CD_SonyUS = true; } else { Format_CD = true; } Formats.remove('CD'); } if (Formats.contains('VINYL')) { if (mid == '6401832') { B1Format_Vinyl = true; } else if (legacyrecords.contains(mid)) { Format_Vinyl_Legacy = true; } else if (mid == '6425029') { Format_Vinyl_SonyUs = true; } else { Format_Vinyl = true; } Formats.remove('VINYL'); } if (Formats.contains('LIVE / TICKETS')) { Format_Live_Tickets = true; Formats.remove('LIVE / TICKETS'); } if (Formats.contains('LIVE EVENT')) { if (mid == '6425029') { Format_Live_Event_US = true; } else { Format_Live_Event = true; } Formats.remove('LIVE EVENT'); } if (Formats.contains('MC')) { Format_MC = true; Formats.remove('MC'); } if (Formats.contains('ADDITIONAL DEVICES, E.G. TONIEBOX, TIGERBOX, ETC.')) { Format_Zusatzger_te_wie_z_B_Toniebox_Tigerbox_u = true; Formats.remove('ADDITIONAL DEVICES, E.G. TONIEBOX, TIGERBOX, ETC.'); } if (Formats.contains('DVD')) { Format_DVD = true; Formats.remove('DVD'); } if (Formats.contains('TV')) { Format_TV = true; Formats.remove('TV'); } if (Streams.contains('APPLE MUSIC')) { if (legacyrecords.contains(mid)) { Streaming_AppleMusic_Legacy = true; } else if (mid == '6425029') { Streaming_AppleMusic_USNow = true; } else { Streaming_AppleMusic = true; } Streams.remove('APPLE MUSIC'); } if (Streams.contains('DEEZER')) { Streaming_Deezer = true; Streams.remove('DEEZER'); } if (Streams.contains('SPOTIFY')) { if (legacyrecords.contains(mid)) { Streaming_Spotify_Legacy = true; } else if (mid == '6425029') { Streaming_Spotify_USNow = true; } else { Streaming_Spotify = true; } Streams.remove('SPOTIFY'); } if (Streams.contains('PANDORA')) { if (legacyrecords.contains(mid)) { Streaming_Pandora_Legacy = true; } else if (mid == '6425029') { Streaming_Pandora_USNow = true; } else { Streaming_Pandora = true; } Streams.remove('PANDORA'); } if (Streams.contains('GOOGLE PLAY')) { Streaming_GooglePlay = true; Streams.remove('GOOGLE PLAY'); } if (Streams.contains('TIDAL')) { if (legacyrecords.contains(mid)) { Streaming_Tidal_Legacy = true; } else if (mid == '6425029') { Streaming_Tidal_USNow = true; } else { Streaming_Tidal = true; } Streams.remove('TIDAL'); } if (Streams.contains('SOUNDCLOUD')) { Streaming_SoundCloud = true; Streams.remove('SOUNDCLOUD'); } if (Streams.contains('YOUTUBE')) { if (legacyrecords.contains(mid)) { Streaming_YouTube_Legacy = true; } else if (mid == '6425029') { Streaming_YouTube_USNow = true; } else { Streaming_YouTube = true; } Streams.remove('YOUTUBE'); } if (Streams.contains('AMAZON MUSIC')) { if (legacyrecords.contains(mid)) { Streaming_Amazon_Music_Legacy = true; } else if (mid == '6425029') { Streaming_Amazon_Music_USNow = true; } else { Streaming_Amazon_Music = true; } Streams.remove('AMAZON MUSIC'); } if (downloads.contains('ITUNES')) { Download_ITunes = true; downloads.remove('ITUNES'); } if (downloads.contains('GOOGLE PLAY')) { Download_GooglePlay = true; downloads.remove('GOOGLE PLAY'); } if (downloads.contains('AMAZON')) { Download_Amazon = true; downloads.remove('AMAZON'); } if (Videos.contains('YOUTUBE')) { Video_Youtube = true; Videos.remove('YOUTUBE'); } if (Videos.contains('VEVO')) { Video_Vevo = true; Videos.remove('VEVO'); } if (Videos.contains('APPLE')) { Video_Apple = true; Videos.remove('APPLE'); } } catch (system.Exception ex) { system.debug('No Preference Record'); } loadSubscriptions(); } } public string maskEmail(string address) { string beforeEmailAddress = address.substringBefore('@'); string afterEmailAddress = address.substringAfter('@'); if (beforeEmailAddress.contains('.')) { string emailNameBeforeDot = beforeEmailAddress.substringBefore('.'); string emailNameAfterDot = beforeEmailAddress.substringAfter('.'); emailAddress = emailNameBeforeDot.substring(0, 1); for (integer i = 0; i < emailNameBeforeDot.length() - 1; i++) { emailAddress += '*'; } emailAddress += '.'; emailAddress += emailNameAfterDot.substring(0, 1); for (integer i = 0; i < emailNameAfterDot.length() - 1; i++) { emailAddress += '*'; } emailAddress += '@'; } else { emailAddress = beforeEmailAddress.substring(0, 1); for (integer i = 0; i < beforeEmailAddress.length() - 1; i++) { emailAddress += '*'; } emailAddress += +'@'; } if (afterEmailAddress.contains('.')) { string beforeEAddress = afterEmailAddress.substringBefore('.'); string afterEAddress = afterEmailAddress.substringAfter('.'); string eAddress = beforeEAddress.substring(0, 1); for (integer i = 0; i < beforeEAddress.length() - 1; i++) { eAddress += '*'; } eAddress += '.' + afterEAddress; emailAddress += eAddress; } return emailAddress; } private String maskPhone(String sPhone) { String sMaskedMobilePhone = '*'; for (integer i = 0; i < sPhone.length() - 1; i++) { sMaskedMobilePhone += '*'; } return sMaskedMobilePhone; } //******* Masking the Email & Mobile while Profile Save button is Clicked ********** public void LoadMaskedValues() { if (fan != null) { fan = [SELECT id, Email__c, Mobile_Phone__c FROM fan__c WHERE Encrypted_ID__c = :encryptedfanID]; if (!string.isBlank(fan.Email__c)) { fan_email = fan.Email__c; fanEmail = maskEmail(fan.Email__c); } if (!string.isBlank(fan.Mobile_Phone__c)) { fan_Mobile = fan.Mobile_Phone__c; if (fan_Mobile != '' || fan_Mobile != null) { fanMobile = maskPhone(fan_Mobile); } } else { fanMobile = fan.Mobile_Phone__c; } } } //**** Saving the Preferences ******* public void SavePreferences() { /*------Genres-------- */ /*--Sony Music Chile--*/ if (mid == '6416056') { if (Chile_Pop) Genres.add('POP'); if (Chile_Rock) Genres.add('ROCK'); if (Chile_Electronica) Genres.add('DANCE / ELECTRONIC'); if (Chile_Baladas) Genres.add('BALADAS'); if (Chile_Reggaeton) Genres.add('REGGAETON'); if (Chile_Trap) Genres.add('TRAP'); /*--Sony Music Spain --*/ } else if (mid == '6399706') { if (Spain_POP_ESPANOL) Genres.add('POP ESPAÑOL'); if (Spain_NUEVO_POP) Genres.add('NUEVO POP'); if (Spain_POP_INGLES) Genres.add('POP INGLES'); if (Spain_LATINO_REGGAETONL) Genres.add('LATINO / REGGAETON'); if (Spain_URBANO_TRAP_ANGLO) Genres.add('URBANO / TRAP ANGLO'); if (Spain_URBANO_TRAP_LOCAL) Genres.add('URBANO / TRAP LOCAL'); if (Spain_INDIE_ROCK_ESPANOL_E_INTERNACIONAL) Genres.add('INDIE/ROCK ESPAÑOL E INTERNACIONAL'); if (Spain_ELECTRONICA_DANCE) Genres.add('ELECTRÓNICA & DANCE'); } else if ( mid == '6401830' || mid == '6401824' || mid == '6401825' || mid == '6401837' || mid == '6401831' || mid == '6401823' || mid == '6401829' || mid == '6401826' || mid == '6401822' || mid == '6401834' || mid == '6401833' || mid == '6401828' ) { /*--Sony Music Germany --*/ system.debug('Germany Genre 1' + Germany_Alternative_Indie); if (Germany_Alternative_Indie) Genres.add('ALTERNATIVE / INDIE'); system.debug('Germany Genre 2' + Germany_Alternative_Indie); if (Germany_Classical) Genres.add('CLASSICAL'); if (Germany_Country) Genres.add('COUNTRY'); if (Germany_Dance_Electronic) Genres.add('DANCE / ELECTRONIC'); if (Germany_Easy_Listening) Genres.add('EASY LISTENING'); if (Germany_HipHop_Rap) Genres.add('HIP HOP / RAP'); if (Germany_Jazz) Genres.add('JAZZ'); if (Germany_Pop) Genres.add('POP'); if (Germany_Rock) Genres.add('ROCK'); if (Germany_Soul_R_B) Genres.add('SOUL / R&B'); if (Germany_Metal) Genres.add('METAL'); if (Germany_Radio_Plays_Audio_Books) Genres.add('RADIO PLAYS / AUDIO BOOKS'); } else if (mid == '6401832') { /*--Sony Music Germany Family --*/ if (Germany_Die_drei) Genres.add('DIE DREI ???'); if (Germany_TKKG) Genres.add('TKKG'); if (Germany_Funf_Freunde) Genres.add('FÜNF FREUNDE'); if (Germany_Hanni_Nanni) Genres.add('HANNI & NANNI'); if (Germany_Teufelskicker) Genres.add('TEUFELSKICKER'); if (Germany_Hui_Buh) Genres.add('HUI BUH'); } else if (mid == '6401838') { /*--Sony Music Germany Spassgesellschaft --*/ if (Germany_Mario_Barth) Genres.add('MARIO BARTH'); if (Germany_Harry_G) Genres.add('HARRY G'); if (Germany_Paul_Panzer) Genres.add('PAUL PANZER'); if (Germany_Luke_Mockridge) Genres.add('LUKE MOCKRIDGE'); if (Germany_Carolin_Kebekus) Genres.add('CAROLIN KEBEKUS'); if (Germany_Kaya_Yanar) Genres.add('KAYA YANAR'); if (Germany_Bastian_Pastewka) Genres.add('BASTIAN PASTEWKA'); if (Germany_Johann_Konig) Genres.add('JOHANN KÖNIG'); if (Germany_Chris_Tall) Genres.add('CHRIS TALL'); if (Germany_Bulent_Ceylan) Genres.add('BÜLENT CEYLAN'); } else if ( mid == '6420610' || mid == '6420607' || mid == '6420606' || mid == '6420608' || mid == '6420605' || mid == '6420609' || mid == '6420611' ) { /*--Century Media--*/ if (Century_Media_Alternative_Indie) Genres.add('ALTERNATIVE / INDIE'); if (Century_Media_Classical) Genres.add('CLASSICAL'); if (Century_Media_Country) Genres.add('COUNTRY'); if (Century_Media_Dance_Electronic) Genres.add('DANCE / ELECTRONIC'); if (Century_Media_Easy_Listening) Genres.add('EASY LISTENING'); if (Century_Media_HipHop_Rap) Genres.add('HIP HOP / RAP'); if (Century_Media_Jazz) Genres.add('JAZZ'); if (Century_Media_Pop) Genres.add('POP'); if (Century_Media_Rock) Genres.add('ROCK'); if (Century_Media_Soul_R_B) Genres.add('SOUL / R&B'); if (Century_Media_Metal) Genres.add('METAL'); } else if (mid == '6403493' || mid == '520001903') { /*--Sony Music Mexico --*/ if (mexico_regional_mexicano) Genres.add('REGIONAL MEXICANO'); if (mexico_rock_alternativo) Genres.add('ROCK / ALTERNATIVO'); if (mexico_rap_hiphop) Genres.add('RAP / HIP HOP'); if (mexico_pop_baladas) Genres.add('POP / BALADAS'); if (mexico_musica_urbana_trap) Genres.add('MÚSICA URBANA / TRAP'); if (mexico_kpop) Genres.add('KPOP'); if (mexico_otros_generos) Genres.add('OTROS GÉNEROS'); } else if (mid == '6414758') { /*********Central America and Caribbean********/ if (CAC_pop_baladas) Genres.add('POP / BALADAS'); if (CAC_rap_hiphop) Genres.add('RAP / HIP HOP'); if (CAC_musica_urbana_trap) Genres.add('MÚSICA URBANA / TRAP'); if (CAC_rock_alternativo) Genres.add('ROCK / ALTERNATIVO'); if (CAC_otros_generos) Genres.add('OTROS GÉNEROS'); if (CAC_regional_mexicano) Genres.add('REGIONAL MEXICANO'); } else if (mid == '6402379') { /*--Sony Music Colombia --*/ if (Colombia_Pop) Genres.add('POP'); if (Colombia_Rock) Genres.add('ROCK'); if (Colombia_Dance_Electronic) Genres.add('DANCE / ELECTRONIC'); if (Colombia_Reggaeton) Genres.add('REGGAETON'); if (Colombia_Trap) Genres.add('TRAP'); if (Colombia_Vallenato) Genres.add('VALLENATO'); if (Colombia_Salsa) Genres.add('SALSA'); /*--Sony Music Brazil --*/ } else if (mid == '6402378') { if (BRAZIL_POP) Genres.add('POP'); if (BRAZIL_ROCK) Genres.add('ROCK'); if (BRAZIL_EDM) Genres.add('DANCE / ELECTRONIC'); if (BRAZIL_HIP) Genres.add('HIP HOP / RAP'); if (BRAZIL_SAMBA) Genres.add('SAMBA/PAGODE'); if (BRAZIL_GOSPEL) Genres.add('GOSPEL'); if (BRAZIL_SERTANJO) Genres.add('SERTANEJO'); if (BRAZIL_MPB) Genres.add('MPB'); if (BRAZIL_INFANTIL) Genres.add('INFANTIL'); if (BRAZIL_FUNK) Genres.add('FUNK'); /*--Sony Music US Latin--*/ } else if (mid == '6402177') { if (USLatin_POP) Genres.add('POP'); if (USLatin_Alternative_Indie) Genres.add('ALTERNATIVE / INDIE'); if (USLatin_Ballad) Genres.add('BALLAD'); if (USLatin_Urbano) Genres.add('URBANO'); if (USLatin_Tropical) Genres.add('TROPICAL'); if (USLatin_Regional_Mexican) Genres.add('REGIONAL MEXICAN'); } else if (mid == '6402404') { /*--Sony Music US-Provident--as per SON-950 Comments--*/ if (Provident_Alternative_Indie) Genres.add('ALTERNATIVE / INDIE'); if (Provident_Christian) Genres.add('CHRISTIAN'); if (Provident_Classical) Genres.add('CLASSICAL'); if (Provident_Country) Genres.add('COUNTRY'); if (Provident_Dance_Electronic) Genres.add('DANCE / ELECTRONIC'); if (Provident_Easy_Listening) Genres.add('EASY LISTENING'); if (Provident_HipHop_Rap) Genres.add('HIP HOP / RAP'); if (Provident_Jazz) Genres.add('JAZZ'); if (Provident_Pop) Genres.add('POP'); if (Provident_Rock) Genres.add('ROCK'); if (Provident_Soul_R_B) Genres.add('SOUL / R&B'); } else if (mid == '6402403') { if (UsLegacy_Alternative) Genres.add('ALTERNATIVE / INDIE'); if (UsLegacy_R_B) Genres.add('SOUL / R&B'); if (UsLegacy_HipHop_Rap) Genres.add('HIP HOP / RAP'); if (UsLegacy_Country) Genres.add('COUNTRY'); if (UsLegacy_Pop) Genres.add('POP'); if (UsLegacy_Rock) Genres.add('ROCK'); if (UsLegacy_Jazz) Genres.add('JAZZ'); if (UsLegacy_Metals) Genres.add('METAL'); if (UsLegacy_Blues) Genres.add('BLUES'); if (UsLegacy_Folk) Genres.add('FOLK'); } else if (legacyrecords.contains(mid)) { if (Legacy_Pop) Genres.add('POP'); if (Legacy_Rock) Genres.add('ROCK'); if (Legacy_Hip_Hop) Genres.add('HIP HOP'); if (Legacy_Country) Genres.add('COUNTRY'); if (Legacy_Jazz) Genres.add('JAZZ'); if (Legacy_R_B) Genres.add('R&B'); if (Legacy_Soul) Genres.add('SOUL'); } else if (mid == '6425029') { /**--US - Sony Music Now--**/ if (US_Sony_Music_Now_Pop) Genres.add('POP'); if (US_Sony_Music_Now_Rock) Genres.add('ROCK'); if (US_Sony_Music_Now_Hip_Hop) Genres.add('HIP HOP'); if (US_Sony_Music_Now_Country) Genres.add('COUNTRY'); if (US_Sony_Music_Now_EDM) Genres.add('EDM'); if (US_Sony_Music_Now_R_B) Genres.add('R&B'); if (US_Sony_Music_Now_Latin) Genres.add('LATIN'); } else if (mid == '520002950') { if (RG_LIVE_CLASSICAL) Genres.add('CLASSICAL'); if (RG_LIVE_DANCE) Genres.add('DANCE'); if (RG_LIVE_CLUB) Genres.add('CLUB'); if (RG_LIVE_ROCK_AND_POP) Genres.add('ROCK & POP'); if (RG_LIVE_SPEAKER) Genres.add('SPEAKER'); if (RG_LIVE_ILLUMINATED_TRAILS) Genres.add('ILLUMINATED TRAILS'); if (RG_LIVE_FILM_AND_TV) Genres.add('FILM & TV'); if (RG_LIVE_FESTIVAL_AND_OUTDOOR) Genres.add('FESTIVAL & OUTDOOR'); if (RG_LIVE_IMMERSIVE) Genres.add('IMMERSIVE'); if (RG_LIVE_THEATRE) Genres.add('THEATRE'); if (RG_LIVE_FAMILY) Genres.add('FAMILY'); if (RG_LIVE_CHRISTMAS) Genres.add('CHRISTMAS'); if (RG_LIVE_SPORT) Genres.add('SPORT'); if (RG_LIVE_COMEDY) Genres.add('COMEDY'); } else { /*--Sony Music UK SON- 951-MICRO/MACRO Comments --*/ /* else if(mid=='6393800'||mid=='6393789'|| mid=='6414047' ||mid=='6407919'||mid=='6396087'||mid=='6393787'||mid=='6396081'||mid=='6396082'||mid=='6393791'||mid=='6416186'||mid=='6414043'||mid=='6393801'||mid=='6414044'||mid=='6393790'||mid=='6393793'||mid=='6393788'||mid=='6393803'||mid=='8866800'||mid=='6422479'){ if(Segment_Genre_Alternative_Indie) Genres.add('ALTERNATIVE / INDIE'); if(Segment_Genre_Classical) Genres.add('CLASSICAL'); if(Segment_Genre_Country) Genres.add('COUNTRY'); if(Segment_Genre_Dance_Electronic) Genres.add('DANCE / ELECTRONIC'); if(Segment_Genre_Easy_Listening) Genres.add('EASY LISTENING'); if(Segment_Genre_Jazz) Genres.add('JAZZ'); if(Segment_Genre_Pop) Genres.add('POP'); if(Segment_Genre_Rock) Genres.add('ROCK'); if(Segment_Genre_Hip_Hop_RnB_Urban) Genres.add('HIP HOP / R&B / URBAN'); }*/ if (Genre_Alternative_Indie) Genres.add('ALTERNATIVE / INDIE'); if (Genre_Classical) Genres.add('CLASSICAL'); if (Genre_Country) Genres.add('COUNTRY'); if (Genre_Dance_Electronic) Genres.add('DANCE / ELECTRONIC'); if (Genre_Easy_Listening) Genres.add('EASY LISTENING'); if (Genre_HipHop_Rap) Genres.add('HIP HOP / RAP'); if (Genre_Jazz) Genres.add('JAZZ'); if (Genre_Pop) Genres.add('POP'); if (Genre_Rock) Genres.add('ROCK'); if (Genre_Soul_R_B) Genres.add('SOUL / R&B'); } system.debug('Genres ' + Genres); /*------Eras-------- */ if (Era_Pre_1950) Eras.add('PRE 1950'); if (Era_1950s) Eras.add('1950s'); if (Era_1960s) Eras.add('1960s'); if (Era_1970s) Eras.add('1970s'); if (Era_1980s) Eras.add('1980s'); if (Era_1990s) Eras.add('1990s'); if (Era_2000s) Eras.add('2000s'); if (Era_2010s) Eras.add('2010s'); if (Era_BrandNewMusic) Eras.add('BRAND NEW MUSIC'); /*------Eras For Family BU-------- */ if (Era_Kinder_ab_3_Jahren) Eras.add('KIDS FROM 3 YEARS'); if (Era_Kinder_ab_6_Jahren) Eras.add('KIDS FROM 6 YEARS'); if (Era_Kinder_ab_9_Jahren) Eras.add('KIDS FROM 9 YEARS'); if (Era_Kinder_ab_12_Jahren) Eras.add('KIDS FROM 12 YEARS'); if (Era_Erwachsene) Eras.add('ADULTS'); /*------Eras For Spassgesellschaft BU-------- */ if (Era_Beziehungsprobleme) Eras.add('RELATIONSHIP PROBLEMS'); if (Era_Bayrische_Comedy) Eras.add('BAVARIAN COMEDY'); if (Era_Alltagssituationen) Eras.add('EVERYDAY SITUATIONS'); if (Era_Magie) Eras.add('MAGIC'); if (Era_Futball) Eras.add('SOCCER'); /*------Formats-------- */ if ( Format_Streaming || B1Format_Streaming || B2Format_Streaming || Format_Streaming_Legacy || Format_Streaming_SonyUS ) Formats.add('STREAMING'); if (Format_Download || B1Format_Download || B2Format_Download) Formats.add('DOWNLOAD'); if (Format_Video) Formats.add('VIDEO'); if (Format_CD || B1Format_CD || Format_CD_Legacy || Format_CD_SonyUS) Formats.add('CD'); if (Format_Vinyl || B1Format_Vinyl || Format_Vinyl_Legacy || Format_Vinyl_SonyUs) Formats.add('VINYL'); if (Format_Live_Tickets) Formats.add('LIVE / TICKETS'); if (Format_Live_Event || Format_Live_Event_US) Formats.add('LIVE EVENT'); if (Format_MC) Formats.add('MC'); if (Format_Zusatzger_te_wie_z_B_Toniebox_Tigerbox_u) Formats.add('ADDITIONAL DEVICES, E.G. TONIEBOX, TIGERBOX, ETC.'); if (Format_DVD) Formats.add('DVD'); if (Format_TV) Formats.add('TV'); /*------Streaming Format-------- */ if (Streaming_AppleMusic || Streaming_AppleMusic_Legacy || Streaming_AppleMusic_USNow) Streams.add('APPLE MUSIC'); if (Streaming_Deezer) Streams.add('DEEZER'); if (Streaming_Spotify || Streaming_Spotify_Legacy || Streaming_Spotify_USNow) Streams.add('SPOTIFY'); if (Streaming_Pandora || Streaming_Pandora_Legacy || Streaming_Pandora_USNow) Streams.add('PANDORA'); if (Streaming_GooglePlay) Streams.add('GOOGLE PLAY'); if (Streaming_Tidal || Streaming_Tidal_Legacy || Streaming_Tidal_USNow) Streams.add('TIDAL'); if (Streaming_SoundCloud) Streams.add('SOUNDCLOUD'); if (Streaming_YouTube || Streaming_YouTube_Legacy || Streaming_YouTube_USNow) Streams.add('YOUTUBE'); if (Streaming_Amazon_Music || Streaming_Amazon_Music_Legacy || Streaming_Amazon_Music_USNow) Streams.add('AMAZON MUSIC'); /*------Downloading-------- */ if (Download_ITunes) downloads.add('ITUNES'); if (Download_GooglePlay) downloads.add('GOOGLE PLAY'); if (Download_Amazon) downloads.add('AMAZON'); /*------Videos-------- */ if (Video_Youtube) Videos.add('YOUTUBE'); if (Video_Vevo) Videos.add('VEVO'); if (Video_Apple) Videos.add('APPLE'); try { pref.Preferred_Genre__c = string.join(new List(Genres), ';'); pref.Preferred_Era__c = string.join(new List(Eras), ';'); pref.Preferred_Format__c = string.join(new List(Formats), ';'); pref.Streaming_Platform_Preference__c = string.join(new List(Streams), ';'); pref.Download_Store_Preference__c = string.join(new List(downloads), ';'); pref.Video_Platform_Preference__c = string.join(new List(Videos), ';'); pref.fan_id__c = fan.Id; system.debug('Try lo genres ' + Genres); system.debug('Try lo prefered genres ' + pref.Preferred_Genre__c); if (pref.id != null) { update pref; } if (pref.id == null) { insert pref; } fetchfanvalues(); } catch (System.DMLException ex) { Apexpages.addMessage(new Apexpages.Message(Apexpages.Severity.ERROR, ex.getMessage())); } } public void loadSubscriptions() { //---------**** Fetching Subscriptions based on fanID ****--------------- subs = [ SELECT Id, Name, Active__c, Mailing_List_ID__c, Mailing_List_Name__c, Fan_ID__c, Fan_id__r.Delete_My_Information__c, Mailing_List_ID__r.TLA_ID__c, Mailing_List_ID__r.TLA_ID__r.Active__c, Mailing_List_ID__r.Territory__c, Mailing_List_ID__r.Label__c, Mailing_List_ID__r.TLA_Id__r.TL_Id__r.Label_Name__c, Promo_Id__c, Mailing_List_ID__r.TLA_ID__r.SubBU_MC_Member_ID__c, Mailing_List_ID__r.Mailing_List_Name__c FROM Subscription__c WHERE Fan_Id__c = :fan.Id AND Mailing_List_ID__r.TLA_ID__r.Active__c = TRUE ]; tlBU = [ SELECT ID, Name, TerritoryLabel__c, MID__c, FetchType__c, Address__c FROM TerritoryBusinessUnit__c WHERE MID__c = :ApexPages.currentpage().getparameters().get('mid') ]; frts = [ SELECT Fan_ID__c, Id, Retargeting_Consent_Acquired_Date__c, Retargeting_Consent_Disabled_Date__c, Retargeting_Consent__c, Retargeting_Source_Campaign__c, Territory_Id__c, Territory_id__r.Territory__c FROM Fan_Retarget__c WHERE Fan_ID__c = :fan.Id AND Territory_id__r.Territory__c = :tlBU.Name AND Retargeting_Consent__c = TRUE ]; if (frts.size() > 0) { selectedRetarget = false; selectedRetargetpanel = true; } else { selectedRetarget = false; selectedRetargetpanel = false; } //---------**** Territory Id & Territory Name of the Territory Business Unit ****----------- try { if ( tlBU.Name == 'Sony Music US' || tlBU.Name == 'The Orchard - US' || tlBU.Name == 'Provident' || legacyrecords.contains(tlBU.MID__c) || tlBU.Name == 'Legacy' ) { showUS = true; showUK = false; } else if (tlBU.Name == 'Sony Music Germany') { showphone = false; showaddress = true; showaddress1 = true; } else { showUS = false; showUK = true; } wrapls.clear(); if (tlBu.FetchType__c == 'T') { TerritoryCheck = tlBU.Name; MCAddress = tlBU.Address__c; for (Subscription__c s : subs) { if (tlBu.Name == s.Mailing_List_ID__r.Territory__c) { wrapls.add(new wrap(s.active__c, s)); } } } if (tlBu.FetchType__c == 'L') { TerritoryCheck = tlBU.Name + '-' + tlBU.TerritoryLabel__c; MCAddress = tlBU.Address__c; for (Subscription__c s : subs) { if ( (tlBu.Name == s.Mailing_List_ID__r.Territory__c) && (tlBu.TerritoryLabel__c == s.Mailing_List_ID__r.Label__c) ) { wrapls.add(new wrap(s.active__c, s)); } else { if ( (tlBu.Name == s.Mailing_List_ID__r.Territory__c) && (s.Mailing_List_ID__r.TLA_Id__r.Active__c == true) ) { if (tlBu.TerritoryLabel__c == s.Mailing_List_ID__r.TLA_Id__r.TL_Id__r.Label_Name__c) { wrapls.add(new wrap(s.active__c, s)); } } } } } if (tlBu.FetchType__c == 'TLA') { TerritoryCheck = tlBU.TerritoryLabel__c; MCAddress = tlBU.Address__c; for (Subscription__c s : subs) { if ( (tlBu.Name == s.Mailing_List_ID__r.Mailing_List_Name__c) || (tlBu.TerritoryLabel__c == s.Mailing_List_ID__r.Label__c) || (tlBu.TerritoryLabel__c == s.Mailing_List_ID__r.TLA_Id__r.TL_Id__r.Label_Name__c) ) { wrapls.add(new wrap(s.active__c, s)); } } } } catch (System.QueryException ex) { system.debug('No record found'); } } public void btn_subscription_saveChanges() { TriggerControl.disableNewFunctionality(); List shList = new List(); List frtListnew = new List(); System.debug('size' + wrapls.size()); Boolean selection1; for (wrap w : wrapls) { if (w.selection == false) { if (w.sub.active__c == true) { Subscription_History__c sh = new Subscription_History__c(); sh.Fan_ID__c = w.sub.Fan_Id__c; sh.Mailing_List_ID__c = w.sub.Mailing_List_Id__c; sh.Source__c = 'Preference Center'; sh.Subscription_ID__c = w.sub.Id; sh.TLA_ID__c = w.sub.Mailing_List_Id__r.TLA_Id__c; sh.Promo_ID__c = w.sub.Promo_Id__c; sh.Action__c = 'Unsub'; shList.add(sh); } } else if (w.selection == true) { if (w.sub.active__c == false) { Subscription_History__c sh = new Subscription_History__c(); sh.Fan_ID__c = w.sub.Fan_Id__c; sh.Mailing_List_ID__c = w.sub.Mailing_List_Id__c; sh.Source__c = 'Preference Center'; sh.Subscription_ID__c = w.sub.Id; sh.TLA_ID__c = w.sub.Mailing_List_Id__r.TLA_Id__c; sh.Promo_ID__c = w.sub.Promo_Id__c; sh.Action__c = 'Sign up'; shList.add(sh); } } } for (Subscription_History__c s : shList) { if (s.Action__c == 'Unsub') { displayPopup = true; } else { displayPopup = false; } } /* if(shList.size()>0){ displayPopup = true; } else{ displayPopup = false; }*/ try { insert shList; } catch (System.DmlException ex) { system.debug('insert failed'); } /* subsretarget= [SELECT id from Subscription__c where Active__c=true AND Fan_Id__c =:fan.Id AND Mailing_List_Id__r.Tla_Id__r.Territory_Id__r.Territory__c=:tlBU.Name AND Fan_Id__c IN(Select Fan_Id__c from Fan_Retarget__c where Territory_Id__r.Territory__c=:tlBU.Name AND Retargeting_Consent__c=true)]; if(subsretarget.size()==0){ selectedRetarget=true; } */ loadSubscriptions(); } public void btn_profile_saveChanges() { try { if (fan.id != null) { if (!fanEmail.contains('*')) { fanEmail = fanEmail.trim(); integer count = [SELECT COUNT() FROM Fan__c WHERE Email__c = :fanEmail]; if (count > 0) { Apexpages.addMessage( new Apexpages.Message( Apexpages.Severity.Info, System.Label.PC_This_Fan_Already_Exists_In_The_System ) ); fanEmail = maskEmail(fan.Email__c); return; } else if (string.isEmpty(fanEmail)) { ApexPages.addmessage( new ApexPages.message(ApexPages.severity.INFO, System.Label.PC_Email_Cannot_Be_Blank) ); fanEmail = maskEmail(fan.Email__c); return; } else if ( !Pattern.matches( '^[a-zA-Z0-9._|\\\\%#~`=?&/$^*!}{+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$', fanEmail.trim() ) ) { ApexPages.addmessage( new ApexPages.message(ApexPages.severity.INFO, System.Label.PC_Invalid_Email) ); fanEmail = maskEmail(fan.Email__c); return; } else { fan.Email__c = fanEmail; } } /*if(!fanMobile.contains('*')){ if(string.isNotBlank(fanMobile) && fanMobile.length()>=5){ fan.Mobile_Phone__c = fanMobile; } else{ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, 'Please enter a valid Mobile Number')); return; } }*/ if (!fanMobile.contains('*')) { if (string.isNotBlank(fanMobile)) { if (fanMobile.length() >= 5) { fan.Mobile_Phone__c = fanMobile; } else { ApexPages.addmessage( new ApexPages.message( ApexPages.severity.INFO, System.Label.PC_Please_enter_a_valid_Mobile_Number ) ); return; } } else if (string.isBlank(fanMobile)) { fan.Mobile_Phone__c = fanMobile; } } fan.First_Name__c = fanFirstName; fan.Last_Name__c = fanLastName; try { if (!string.isBlank(fanDOB)) { if (userLangString.substringBefore('-') == 'en') { string[] str = fanDOB.split('/'); string dd = str[0]; string mm = str[1]; string yy = str[2]; fanDOB = mm + '/' + dd + '/' + yy; fan.Birthdate__c = Date.parse(fanDOB); } if ( userLangString.substringBefore('-') == 'es' || userLangString.substringBefore('-') == 'pt' ) { fan.Birthdate__c = Date.parse(fanDOB); } if (userLangString.substringBefore('-') == 'de') { fan.Birthdate__c = Date.parse(fanDOB.replace('/', '.')); } } } catch (Exception e) { system.debug('Date Loading Error Occured' + e.getMessage()); } fan.Birthday_mm_dd__c = fanDOBUS; fan.Gender__c = fanGender; fan.City__c = fanCity; fan.State__c = fanState; if (!(statesList.size() > 1)) fan.State__c = ''; fan.Postal_Code__c = fanPostalCode; fan.Address_1__c = fanAddress; fan.Address_2__c = fanAddress2; fan.Country_Region__c = fanCountry_Region; fan.Twitter_Handle__c = fanTwitterHandle; fan.Instagram_Handle__c = fanInstagramHandle; Fan__c fan1 = [ SELECT id, Delete_My_Information__c FROM fan__c WHERE Encrypted_ID__c = :encryptedfanID LIMIT 1 ]; fan.Delete_My_Information__c = fan1.Delete_My_Information__c; update fan; } } catch (System.Exception ex) { Apexpages.addMessage(new Apexpages.Message(Apexpages.Severity.INFO, 'Cannot Update the Record.')); //SMELogger.logError(ex); } LoadMaskedValues(); } public void btn_preferences_saveChanges() { SavePreferences(); } public void btn_yes_Uncheck_rt() { List frtList = new List(); if (selectedRetarget == true) { for (Fan_Retarget__c f : frts) { if (f.Retargeting_Consent__c == true) { Fan_Retarget__c fr = new Fan_Retarget__c(); fr.id = f.id; fr.Fan_ID__c = f.Fan_Id__c; fr.Retargeting_Consent_Disabled_Date__c = system.now(); fr.Retargeting_Consent__c = false; frtList.add(fr); } } } try { update frtList; } catch (System.DmlException ex) { SMELogger.logError(ex); } loadSubscriptions(); } public void btn_yes_Delete() { displayPopup = true; Fan__c delfan = new Fan__c(); delfan = [SELECT Email__c FROM Fan__c WHERE Encrypted_ID__c = :encryptedfanID]; delfan.Delete_My_Information__c = true; delFan.Delete_Reason__c = UtilConstants.FAN_DELETE_REASON_FAN_REQUESTED; delfan.Delete_Request_From_MID__c = mid; delfan.Delete_Request_Date__c = System.now(); update delfan; messaging.SingleEmailMessage mail = new messaging.SingleEmailMessage(); if (toAdd.size() > 0) { mail.setToAddresses(toAdd); mail.setSenderDisplayName('PreferenceCenterDeleteRequest'); mail.setSubject('Fan Delete Data Request'); mail.setHtmlBody( '

' + 'Hi,

We have received a request from the following fan to delete their data from our Sony Music CRM systems:' + '


' + 'Email: ' + delfan.Email__c + '
Fan ID: ' + delfan.Id + '

Date of request: ' + (System.today()).month() + '-' + (System.today()).day() + '-' + (System.today()).year() ); Messaging.sendEmail(new List{ mail }); } } public void btn_yes_Unsubscribe() { TriggerControl.disableNewFunctionality(); List shList = new List(); /* if(subList.size()>0){ showtabs = false; }else{ showtabs = true; }*/ for (wrap w : subList) { if (w.selection == true || w.selection == false) { if (w.sub.Active__c == true) { Subscription_History__c sh = new Subscription_History__c(); sh.Fan_ID__c = w.sub.Fan_Id__c; sh.Mailing_List_ID__c = w.sub.Mailing_List_Id__c; sh.Source__c = 'Preference Center'; sh.Subscription_ID__c = w.sub.Id; sh.TLA_ID__c = w.sub.Mailing_List_Id__r.TLA_Id__c; sh.Promo_ID__c = w.sub.Promo_Id__c; sh.Action__c = 'Unsub'; shList.add(sh); } } } try { insert shList; } catch (System.DmlException ex) { system.debug('insert failed'); } displayPopup = true; loadSubscriptions(); } /*****************************/ public void closePopup() { displayPopup = false; } public PageReference redirectPopup() { displayPopup = false; //displayfandelpop=false; return null; } /******************************/ public void btn_UNSUBSCRIBE() { system.debug('Unsubscribe Button Called'); } public void btn_UnRetarget() { system.debug('Unsubscribe Button Called'); } public PageReference btn_cancel_Unsubscribe() { displayPopup = false; return null; } public void btn_cancel_Uncheck_rt() { //selectedRetarget = true; } public void btn_DELETE() { system.debug('Delete Button Called'); } public PageReference btn_cancel_DELETE() { displayPopup = false; return null; } // Wrapper Class - binds both selection(Toggle) and subscriptions public class wrap implements Comparable { public boolean selection { get; set; } public subscription__c sub { get; set; } public wrap(boolean sel, subscription__c s) { selection = sel; sub = s; } public Integer compareTo(Object Compareobj) { wrap compare = (wrap) Compareobj; if (sub.Mailing_List_Name__c > compare.sub.Mailing_List_Name__c) return 1; else if (sub.Mailing_List_Name__c == compare.sub.Mailing_List_Name__c) return 0; return -1; } } }