| | |
| | | trigger ContentDocumentLink on ContentDocumentLink (before insert,after insert,before delete,after delete, before update, after update) { |
| | | trigger ContentDocumentLink on ContentDocumentLink (before insert,after insert,after delete, before update, after update) { |
| | | List<String> rentalIds = new List<String>(); |
| | | List<String> attIds = new List<String>(); |
| | | List<String> rentaldelIds = new List<String>(); |
| | | List<String> attdelIds = new List<String>(); |
| | | List<String> rentalApplyIds = new List<String>(); |
| | | List<String> accIds = new List<String>(); |
| | | //20221014 yc 医院审批优化 start |
| | |
| | | //20221014 yc 医院审批优化 end |
| | | // LHJ CHAN-BCLD4P 20190618 Start |
| | | List<String> specIds = new List<String>(); |
| | | List<String> specDelIds = new List<String>(); |
| | | // LHJ CHAN-BCLD4P 20190618 End |
| | | |
| | | // MZY SWAG-BXXBKA 2021-02-19 start |
| | |
| | | |
| | | //CHAN-BCNCRB ---XHL----End----- |
| | | if (Trigger.isAfter && Trigger.isInsert) { |
| | | List<Id> idList = new List<Id>(); |
| | | for (ContentDocumentLink link : Trigger.new) { |
| | | ContentVersion version = [select Id,Title from ContentVersion where ContentDocumentId =: link.ContentDocumentId]; |
| | | idList.add(link.ContentDocumentId); |
| | | } |
| | | List<ContentVersion> version = [select Id,Title from ContentVersion where ContentDocumentId in: idList]; |
| | | for (ContentDocumentLink link : Trigger.new) { |
| | | //if (att.Name.toUpperCase() == '合同书.PDF' && String.valueOf(att.ParentId).startsWith('a0t')) { |
| | | // 添付した契約書のファイル名は指定できない |
| | | if (String.valueOf(link.LinkedEntityId).startsWith('a2K')) { |
| | | rentalIds.add(link.LinkedEntityId); |
| | | attIds.add(version.Id); |
| | | attIds.add(version[0].Id); |
| | | } |
| | | if (String.valueOf(link.LinkedEntityId).startsWith('a0t')) { |
| | | rentalApplyIds.add(link.LinkedEntityId); |
| | |
| | | accAppIds.add(link.LinkedEntityId); |
| | | } |
| | | //20221014 yc 医院审批优化 end |
| | | System.debug(link.LinkedEntityId +'陈京武'); |
| | | if(String.valueOf(link.LinkedEntityId).startsWith(System.Label.Oppor_sepKey)){ |
| | | OpporFileIds.add(link.LinkedEntityId); |
| | | } |
| | |
| | | // MZY SWAG-BXXBKA 2021-02-19 start |
| | | if(String.valueOf(link.LinkedEntityId).startsWith('a3E')){ |
| | | opdIds.add(link.LinkedEntityId); |
| | | opdMap.put(link.LinkedEntityId,version.Title); |
| | | opdMap.put(link.LinkedEntityId,version[0].Title); |
| | | } |
| | | // MZY SWAG-BXXBKA 2021-02-19 end |
| | | |
| | |
| | | if(parentLabel.equals('Rental_Apply_Fault__c')){ |
| | | rentalApplyFaultIds.add(link.LinkedEntityId); |
| | | if(trentalImages.containskey(link.LinkedEntityId)){ |
| | | trentalImages.get(link.LinkedEntityId).add(version.Id); |
| | | trentalImages.get(link.LinkedEntityId).add(version[0].Id); |
| | | }else{ |
| | | List<Id> temp = new List<Id>(); |
| | | temp.add(version.Id); |
| | | temp.add(version[0].Id); |
| | | trentalImages.put(link.LinkedEntityId,temp); |
| | | } |
| | | } |
| | |
| | | //2023-2-10 sx备品 备品检测分析报告 end |
| | | |
| | | |
| | | if (rentaldelIds.size() > 0) { |
| | | List<Consumable_accessories_invoice__c> rentaldelList = new List<Consumable_accessories_invoice__c>(); |
| | | for (Consumable_accessories_invoice__c ra : [select Id from Consumable_accessories_invoice__c where Invoice_code__c in :rentaldelIds and Attachment_ID__c in :attdelIds]) { |
| | | rentaldelList.add(ra); |
| | | } |
| | | ControllerUtil.delConsumableAccessoriesInvoiceSet(rentaldelList); |
| | | } |
| | | |
| | | if (rentalIds.size() > 0) { |
| | | List<Consumable_order__c> rentalList = new List<Consumable_order__c>(); |
| | |
| | | //20221207 lt 医院审批优化 end |
| | | |
| | | } |
| | | try { |
| | | if (updAccAppList.size() > 0) update updAccAppList; |
| | | } catch (Exception e) { |
| | | linkList[0].addError(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | //20221014 yc 医院审批优化 end |
| | | |
| | |
| | | if(Trigger.isInsert){ |
| | | for(ContentDocumentLink link : Trigger.new){ |
| | | if(OpporFileUndeleteMap.containsKey(link.LinkedEntityId)){ |
| | | ContentDocument doc = [select Id from ContentDocument where Id =: link.ContentDocumentId]; |
| | | doc.addError('备货已审批,不可删除附件'); |
| | | // ContentDocument doc = [select Id from ContentDocument where Id =: link.ContentDocumentId]; |
| | | link.addError('备货已审批,不可删除附件'); |
| | | // link.addError('备货已审批,不可删除附件'); |
| | | |
| | | System.debug(Trigger.isBefore+'陈京武'); |
| | | return; |
| | | }else{ |
| | | System.debug(Trigger.isBefore+'武'); |
| | | DeleteReIds.add(link.LinkedEntityId); |
| | | } |
| | | } |
| | |
| | | ofc.Last_upload_user__c = OppordeleteReUserMap.get(ofc.id); |
| | | System.debug(ofc+'233333333'); |
| | | } |
| | | if(Trigger.isInsert && Trigger.isAfter){ |
| | | update reDateList; |
| | | } |
| | | |
| | | } |
| | | }else{ |
| | | List<Opportunity_File__c> reDateList = [select id,Last_upload_time__c, |
| | |
| | | } |
| | | } |
| | | // DB202304087063 SFDC系统附件上传自动通知功能开发需求 start |
| | | if (Trigger.isInsert && Trigger.isAfter && false) { |
| | | AttachmentReQisHandler handler = new AttachmentReQisHandler(); |
| | | if (Trigger.isInsert && Trigger.isAfter) { |
| | | NotetoPdfHandler handler = new NotetoPdfHandler(); |
| | | handler.run(); |
| | | } |
| | | // DB202304087063 SFDC系统附件上传自动通知功能开发需求 end |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |