/** * @see * org.kuali.kfs.module.ar.document.service.CustomerInvoiceDocumentService#setupDefaultValuesForCopiedCustomerInvoiceDocument(org.kuali.kfs.module.ar.document.CustomerInvoiceDocument) */ @Override public void setupDefaultValuesForCopiedCustomerInvoiceDocument(CustomerInvoiceDocument document) { setupBasicDefaultValuesForCustomerInvoiceDocument(document); // Save customer number since it will get overwritten when we retrieve the accounts receivable // document header from service String customerNumber = document.getAccountsReceivableDocumentHeader().getCustomerNumber(); // Set up the default values for the AR DOC Header AccountsReceivableDocumentHeader accountsReceivableDocumentHeader = accountsReceivableDocumentHeaderService .getNewAccountsReceivableDocumentHeaderForCurrentUser(); accountsReceivableDocumentHeader.setDocumentNumber(document.getDocumentNumber()); accountsReceivableDocumentHeader.setCustomerNumber(customerNumber); document.setAccountsReceivableDocumentHeader(accountsReceivableDocumentHeader); // set up the primary key for AR_INV_RCURRNC_DTL_T CustomerInvoiceRecurrenceDetails recurrenceDetails = new CustomerInvoiceRecurrenceDetails(); recurrenceDetails.setInvoiceNumber(document.getDocumentNumber()); // recurrenceDetails.setCustomerNumber(document.getAccountsReceivableDocumentHeader().getCustomerNumber()); document.setCustomerInvoiceRecurrenceDetails(recurrenceDetails); // make open invoice indicator to true document.setOpenInvoiceIndicator(true); document.setPrintDate(null); document.setBillingDate(dateTimeService.getCurrentSqlDateMidnight()); }
/** * This method creates a payment application document based on the passed in fixture array * * @param paymentFixture * @param customerInvoiceDetailFixtures * @return */ public PaymentApplicationDocument createPaymentApplicationDocument() { PaymentApplicationDocument paymentApplicationDocument = null; try { paymentApplicationDocument = (PaymentApplicationDocument) DocumentTestUtils.createDocument( SpringContext.getBean(DocumentService.class), PaymentApplicationDocument.class); } catch (WorkflowException e) { throw new RuntimeException("Document creation failed."); } // set AR doc Header AccountsReceivableDocumentHeader arDocHeader = new AccountsReceivableDocumentHeader(); AccountsReceivableDocumentHeaderService accountsReceivableDocumentHeaderService = SpringContext.getBean(AccountsReceivableDocumentHeaderService.class); arDocHeader.setDocumentNumber(paymentApplicationDocument.getDocumentNumber()); arDocHeader.setCustomerNumber(customerNumber); arDocHeader.setDocumentNumber(paymentApplicationDocument.getDocumentNumber()); paymentApplicationDocument.setAccountsReceivableDocumentHeader(arDocHeader); return paymentApplicationDocument; }