| | |
| | | if(Trigger.isInsert&&a.Ignore_Same_Name__c==false){ |
| | | FirstNameList.add(a.firstname); |
| | | LastnameList.add(a.Lastname); |
| | | LastnameEncryptedList.add(a.LastName_Encrypted__c); |
| | | //zhj MEBG新方案改造 2022-11-28 start |
| | | //LastnameEncryptedList.add(a.LastName_Encrypted__c); |
| | | ACCOUNT_id_list.add(a.Accountid); |
| | | mapCon.put(a.LastName_Encrypted__c,a); |
| | | //mapCon.put(a.LastName_Encrypted__c,a); |
| | | system.debug('========1111111'); |
| | | //zhj MEBG新方案改造 2022-11-28 end |
| | | } |
| | | |
| | | } |
| | |
| | | Hospital_id_list.add( acc.Id ); |
| | | } |
| | | } |
| | | List<Contact> CntingList = [ select |
| | | id, |
| | | Name, |
| | | Department__c, |
| | | Account.Parent.Name, |
| | | Account.name, |
| | | Account.Parent.Parent.Name |
| | | from |
| | | Contact |
| | | where |
| | | // firstname in:FirstNameList |
| | | // and |
| | | // Lastname in:LastnameList |
| | | LastName_Encrypted__c in : LastnameEncryptedList |
| | | and |
| | | ( |
| | | Account.Parent.Parentid in:Hospital_id_list |
| | | or |
| | | Account.Parentid in:Hospital_id_list |
| | | or |
| | | Account.id in:Hospital_id_list |
| | | ) |
| | | ]; |
| | | //zhj MEBG新方案改造 2022-11-28 start |
| | | // List<Contact> CntingList = [ select |
| | | // id, |
| | | // Name, |
| | | // Department__c, |
| | | // Account.Parent.Name, |
| | | // Account.name, |
| | | // Account.Parent.Parent.Name |
| | | // from |
| | | // Contact |
| | | // where |
| | | // // firstname in:FirstNameList |
| | | // // and |
| | | // // Lastname in:LastnameList |
| | | // LastName_Encrypted__c in : LastnameEncryptedList |
| | | // and |
| | | // ( |
| | | // Account.Parent.Parentid in:Hospital_id_list |
| | | // or |
| | | // Account.Parentid in:Hospital_id_list |
| | | // or |
| | | // Account.id in:Hospital_id_list |
| | | // ) |
| | | // ]; |
| | | system.debug('========1212121212'+FirstNameList); |
| | | system.debug('========1212121212'+LastnameList); |
| | | system.debug('========1212121212'+LastnameEncryptedList); |
| | | //system.debug('========1212121212'+LastnameEncryptedList); |
| | | system.debug('========1212121212'+Hospital_id_list); |
| | | if(CntingList.size()>0){ |
| | | system.debug('========2222222'+CntingList.size()); |
| | | Contact Cnting = CntingList[0]; |
| | | for(Contact a : Trigger.new) { |
| | | system.debug('========3333333'); |
| | | if(mapCon.containsKey(a.LastName_Encrypted__c)){ |
| | | //For PIPL testing by Li Jun 20220308 Start |
| | | // system.debug('========333333'); |
| | | // if( Cnting.Account.Parent.Parent.Name != null ){ |
| | | // a.addError('该客户人员名字已存在,在'+Cnting.Account.Parent.Parent.Name+'医院下属 '+Cnting.Account.Parent.Name+'战略科室的 '+Cnting.Account.Name+'科室,请修改,或者勾选“不是重复的客户名”后,再次点击保存'); |
| | | // } else if ( Cnting.Account.Parent.Name !=null ){ |
| | | // a.addError('该客户人员名字已存在,在'+Cnting.Account.Parent.Name+'医院的 '+Cnting.Account.Name+' 战略科室下,请修改,或者勾选“不是重复的客户名”后,再次点击保存'); |
| | | // } else if ( Cnting.Account.Name != null ){ |
| | | // a.addError('该客户人员名字已存在,在'+Cnting.Account.Name+'医院,请修改,或者勾选“不是重复的客户名”后,再次点击保存'); |
| | | // } |
| | | //For PIPL testing by Li Jun 20220308 End |
| | | } |
| | | } |
| | | } |
| | | |
| | | // if(CntingList.size()>0){ |
| | | // system.debug('========2222222'+CntingList.size()); |
| | | // Contact Cnting = CntingList[0]; |
| | | // for(Contact a : Trigger.new) { |
| | | // system.debug('========3333333'); |
| | | // if(mapCon.containsKey(a.LastName_Encrypted__c)){ |
| | | // //For PIPL testing by Li Jun 20220308 Start |
| | | // // system.debug('========333333'); |
| | | // // if( Cnting.Account.Parent.Parent.Name != null ){ |
| | | // // a.addError('该客户人员名字已存在,在'+Cnting.Account.Parent.Parent.Name+'医院下属 '+Cnting.Account.Parent.Name+'战略科室的 '+Cnting.Account.Name+'科室,请修改,或者勾选“不是重复的客户名”后,再次点击保存'); |
| | | // // } else if ( Cnting.Account.Parent.Name !=null ){ |
| | | // // a.addError('该客户人员名字已存在,在'+Cnting.Account.Parent.Name+'医院的 '+Cnting.Account.Name+' 战略科室下,请修改,或者勾选“不是重复的客户名”后,再次点击保存'); |
| | | // // } else if ( Cnting.Account.Name != null ){ |
| | | // // a.addError('该客户人员名字已存在,在'+Cnting.Account.Name+'医院,请修改,或者勾选“不是重复的客户名”后,再次点击保存'); |
| | | // // } |
| | | // //For PIPL testing by Li Jun 20220308 End |
| | | // } |
| | | // } |
| | | // } |
| | | } |
| | | //zhj MEBG新方案改造 2022-11-28 end |
| | | //***************************************INSERT 2016-12-14 By ZDF EDN************************************* |
| | | // 增加“新增客户人员入例规则” |
| | | //***************************************INSERT 2016-12-14 By ZDF EDN************************************* |