| | |
| | | // Mail 页面初始化 Start |
| | | List<String> mailIdList = new List<String>(); |
| | | |
| | | List<Attachment> attList = new List<Attachment>(); |
| | | Map<String, List<Attachment>> attMap = new Map<String, List<Attachment>>(); |
| | | List<FileAddress__c> attList = new List<FileAddress__c>(); |
| | | Map<String, List<FileAddress__c>> attMap = new Map<String, List<FileAddress__c>>(); |
| | | |
| | | Map<String, Mail_Merge__c> mailMap = new Map<String, Mail_Merge__c>([select id, FROM__c, ccName__c, SUBJECT__c, MESSAGE__c, DATE__c, toName__c, EMAIL_SENT__c from Mail_Merge__c where Quotes__c = :Id order by id]); |
| | | |
| | |
| | | if (mailMap != null) { |
| | | mailIdList.addAll(mailMap.keySet()); |
| | | |
| | | attList = [select id, Name, ParentId from Attachment where ParentId in :mailIdList order by ParentId, id]; |
| | | attList = [select id, Name, FileName__c,ParentRecordId__c from FileAddress__c where ParentRecordId__c in :mailIdList order by ParentRecordId__c, id]; |
| | | if (attList.size() > 0) { |
| | | for (Attachment att : attList) { |
| | | if (attMap.containsKey(att.ParentId)) { |
| | | attMap.get(att.ParentId).add(att); |
| | | for (FileAddress__c att : attList) { |
| | | if (attMap.containsKey(att.ParentRecordId__c)) { |
| | | attMap.get(att.ParentRecordId__c).add(att); |
| | | } else { |
| | | List<Attachment> a = new List<Attachment>(); |
| | | List<FileAddress__c> a = new List<FileAddress__c>(); |
| | | a.add(att); |
| | | attMap.put(att.ParentId, a); |
| | | attMap.put(att.ParentRecordId__c, a); |
| | | } |
| | | } |
| | | } |
| | |
| | | public class EmailInfo { |
| | | |
| | | public Mail_Merge__c mm {get; set; } |
| | | public List<Attachment> attList {get; set; } |
| | | public List<FileAddress__c> attList {get; set; } |
| | | public String haveAtt {get; set;} |
| | | public EmailInfo() { |
| | | |
| | | } |
| | | public EmailInfo(Mail_Merge__c mm_in, List<Attachment> attList_in) { |
| | | public EmailInfo(Mail_Merge__c mm_in, List<FileAddress__c> attList_in) { |
| | | mm = mm_in; |
| | | if (attList_in == null || attList_in.size() == 0) { |
| | | haveAtt = 'No'; |
| | | attList = new List<Attachment>(); |
| | | attList = new List<FileAddress__c>(); |
| | | } else { |
| | | attList = attList_in; |
| | | haveAtt = 'Yes'; |