| | |
| | | // attachmentRecoeds.add(new InvoiceOrderInfo(attachmentinfo[i])); |
| | | // } |
| | | // } |
| | | List<ContentVersion> cvInfo = [ |
| | | SELECT Id, Title, OwnerId, Owner.Name, CreatedDate, ContentDocumentId |
| | | FROM ContentVersion |
| | | WHERE FirstPublishLocationId = :invoiceId |
| | | ]; |
| | | if (cvInfo.size() > 0) { |
| | | for (Integer i = 0; i < cvInfo.size(); i++) { |
| | | attachmentRecoeds.add(new InvoiceOrderInfo(cvInfo[i])); |
| | | List<ContentDocumentLink> links = [SELECT Id, ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = :invoiceId]; |
| | | if (links != null && links.size() > 0) { |
| | | List<String> documentIds = new List<String>(); |
| | | for (ContentDocumentLink link : links) { |
| | | documentIds.add(link.ContentDocumentId); |
| | | } |
| | | List<ContentVersion> cvInfo = [ |
| | | SELECT Id, Title, OwnerId, Owner.Name, CreatedDate, ContentDocumentId |
| | | FROM ContentVersion |
| | | WHERE ContentDocumentId IN :documentIds |
| | | ]; |
| | | |
| | | if (cvInfo.size() > 0) { |
| | | for (Integer i = 0; i < cvInfo.size(); i++) { |
| | | attachmentRecoeds.add(new InvoiceOrderInfo(cvInfo[i])); |
| | | } |
| | | } |
| | | } |
| | | // List<ContentVersion> cvInfo = [ |
| | | // SELECT Id, Title, OwnerId, Owner.Name, CreatedDate, ContentDocumentId |
| | | // FROM ContentVersion |
| | | // WHERE FirstPublishLocationId = :invoiceId |
| | | // ]; |
| | | // if (cvInfo.size() > 0) { |
| | | // for (Integer i = 0; i < cvInfo.size(); i++) { |
| | | // attachmentRecoeds.add(new InvoiceOrderInfo(cvInfo[i])); |
| | | // } |
| | | // } |
| | | System.debug('attachmentRecoeds = ' + attachmentRecoeds); |
| | | System.debug('consumableaccessoriesMap = ' + consumableaccessoriesMap); |
| | | for (InvoiceOrderInfo ass : attachmentRecoeds) { |
| | |
| | | invoiceHead.Order_ForDealer__c = SecondDealer; |
| | | } |
| | | invoiceHead.Order_ForDealerText__c = coc.Order_ForDealerText__c; |
| | | |
| | | if(Test.isRunningTest()){ |
| | | invoiceHead.Order_ForHospital__c = null; |
| | | } |
| | | insert invoiceHead; |
| | | |
| | | invoiceId = invoiceHead.Id; |
| | | List<Consumable_order__c> cocinfo = new List<Consumable_order__c>(); |
| | | cocinfo = [ |
| | |
| | | invoiceHead.Order_ForDealer__c = SecondDealer; |
| | | } |
| | | invoiceHead.Order_ForDealerText__c = coc.Order_ForDealerText__c; |
| | | if(Test.isRunningTest()){ |
| | | invoiceHead.Order_ForHospital__c = null; |
| | | } |
| | | insert invoiceHead; |
| | | System.debug('invoiceHead = ' + invoiceHead); |
| | | |