/** * @see * org.kuali.kfs.module.ar.document.service.AccountsReceivableTaxService#getPostalCodeForTaxation(org.kuali.kfs.module.ar.document.CustomerInvoiceDocument) */ @Override public String getPostalCodeForTaxation(CustomerInvoiceDocument document) { String postalCode = null; String customerNumber = document.getAccountsReceivableDocumentHeader().getCustomerNumber(); Integer shipToAddressIdentifier = document.getCustomerShipToAddressIdentifier(); // if customer number or ship to address id isn't provided, go to org options if (ObjectUtils.isNotNull(shipToAddressIdentifier) && StringUtils.isNotEmpty(customerNumber)) { CustomerAddressService customerAddressService = SpringContext.getBean(CustomerAddressService.class); CustomerAddress customerShipToAddress = customerAddressService.getByPrimaryKey(customerNumber, shipToAddressIdentifier); if (ObjectUtils.isNotNull(customerShipToAddress)) { postalCode = customerShipToAddress.getCustomerZipCode(); } } else { Map<String, String> criteria = new HashMap<String, String>(); criteria.put("chartOfAccountsCode", document.getBillByChartOfAccountCode()); criteria.put("organizationCode", document.getBilledByOrganizationCode()); OrganizationOptions organizationOptions = (OrganizationOptions) businessObjectService.findByPrimaryKey(OrganizationOptions.class, criteria); if (ObjectUtils.isNotNull(organizationOptions)) { postalCode = organizationOptions.getOrganizationPostalZipCode(); } } return postalCode; }
/** * Gets the payee's email address from KIM data if the payee type is Employee or Entity; * otherwise, returns the stored field value. * * @return Returns the payeeEmailAddress */ public String getPayeeEmailAddress() { // for Employee, retrieve from Person table by employee ID if (StringUtils.equalsIgnoreCase(payeeIdentifierTypeCode, PayeeIdTypeCodes.EMPLOYEE)) { Person person = SpringContext.getBean(PersonService.class).getPersonByEmployeeId(payeeIdNumber); if (ObjectUtils.isNotNull(person)) { return person.getEmailAddress(); } } // for Entity, retrieve from Entity table by entity ID then from Person table else if (StringUtils.equalsIgnoreCase(payeeIdentifierTypeCode, PayeeIdTypeCodes.ENTITY)) { if (ObjectUtils.isNotNull(payeeIdNumber)) { EntityDefault entity = KimApiServiceLocator.getIdentityService().getEntityDefault(payeeIdNumber); if (ObjectUtils.isNotNull(entity)) { List<Principal> principals = entity.getPrincipals(); if (principals.size() > 0 && ObjectUtils.isNotNull(principals.get(0))) { String principalId = principals.get(0).getPrincipalId(); Person person = SpringContext.getBean(PersonService.class).getPerson(principalId); if (ObjectUtils.isNotNull(person)) { return person.getEmailAddress(); } } } } } // otherwise returns the field value return payeeEmailAddress; }
/** * This method calculates the total credits for the customers. * * @param cgMapByCustomer * @param knownCustomers */ private void calculateTotalCreditsForCustomers( Map<String, List<ContractsGrantsInvoiceDocument>> cgMapByCustomer, Map<String, ContractsAndGrantsAgingReport> knownCustomers) { Set<String> customerIds = cgMapByCustomer.keySet(); KualiDecimal credits = KualiDecimal.ZERO; for (String customer : customerIds) { ContractsAndGrantsAgingReport agingReportDetail = pickContractsGrantsAgingReportDetail(knownCustomers, customer); List<ContractsGrantsInvoiceDocument> cgDocs = cgMapByCustomer.get(customer); if (ObjectUtils.isNotNull(cgDocs) && !cgDocs.isEmpty()) { credits = KualiDecimal.ZERO; for (ContractsGrantsInvoiceDocument cgDoc : cgDocs) { Collection<CustomerCreditMemoDocument> creditDocs = customerCreditMemoDocumentService.getCustomerCreditMemoDocumentByInvoiceDocument( cgDoc.getDocumentNumber()); if (ObjectUtils.isNotNull(creditDocs) && !creditDocs.isEmpty()) { for (CustomerCreditMemoDocument cm : creditDocs) { for (CustomerCreditMemoDetail cmDetail : cm.getCreditMemoDetails()) { credits = credits.add(cmDetail.getCreditMemoItemTotalAmount()); } } } } } agingReportDetail.setTotalCredits(credits); totalCredits = totalCredits.add(credits); } }
/** * Set Multiple system capital asset transaction type code and asset numbers. * * @param poId * @param purApDocs */ protected void setMultipleSystemFromPurAp( Integer poId, List<PurchasingAccountsPayableDocument> purApDocs, String capitalAssetSystemStateCode) { List<CapitalAssetSystem> capitalAssetSystems = this.getPurchaseOrderService().retrieveCapitalAssetSystemsForMultipleSystem(poId); if (ObjectUtils.isNotNull(capitalAssetSystems) && !capitalAssetSystems.isEmpty()) { // PurAp doesn't support multiple system asset information for KFS3.0. It works as one system // for 3.0. CapitalAssetSystem capitalAssetSystem = capitalAssetSystems.get(0); if (ObjectUtils.isNotNull(capitalAssetSystem)) { String capitalAssetTransactionType = getCapitalAssetTransTypeForOneSystem(poId); // if modify existing asset, acquire the assets from Purap List<ItemCapitalAsset> purApCapitalAssets = null; if (PurapConstants.CapitalAssetSystemStates.MODIFY.equalsIgnoreCase( capitalAssetSystemStateCode)) { purApCapitalAssets = getAssetsFromItemCapitalAsset(capitalAssetSystem.getItemCapitalAssets()); } // set TransactionTypeCode, itemCapitalAssets and system identifier for each item for (PurchasingAccountsPayableDocument purApDoc : purApDocs) { setItemAssetsCamsTransaction( capitalAssetSystem.getCapitalAssetSystemIdentifier(), capitalAssetTransactionType, purApCapitalAssets, purApDoc.getPurchasingAccountsPayableItemAssets()); } } } }
/** * Validates a single collection activity document detail object. * * @param event The object to get validated. * @return Returns true if all validations succeed otherwise false. */ public boolean validateEvent(Event event) { MessageMap errorMap = GlobalVariables.getMessageMap(); boolean isValid = true; int originalErrorCount = errorMap.getErrorCount(); // call the DD validation which checks basic data integrity SpringContext.getBean(DictionaryValidationService.class).validateBusinessObject(event); isValid = (errorMap.getErrorCount() == originalErrorCount); if (ObjectUtils.isNotNull(event.isFollowup()) && event.isFollowup() && event.getFollowupDate() == null) { errorMap.putError( ArPropertyConstants.EventFields.FOLLOW_UP_DATE, ArKeyConstants.CollectionActivityDocumentErrors.ERROR_FOLLOW_UP_DATE_REQUIRED); isValid = false; } if (ObjectUtils.isNotNull(event.isCompleted()) && event.isCompleted() && event.getCompletedDate() == null) { errorMap.putError( ArPropertyConstants.EventFields.COMPLETED_DATE, ArKeyConstants.CollectionActivityDocumentErrors.ERROR_COMPLETED_DATE_REQUIRED); isValid = false; } return isValid; }
/** * @see * org.kuali.kfs.module.ar.document.service.CustomerInvoiceDocumentService#loadCustomerAddressesForCustomerInvoiceDocument(org.kuali.kfs.module.ar.document.CustomerInvoiceDocument) */ @Override public void loadCustomerAddressesForCustomerInvoiceDocument( CustomerInvoiceDocument customerInvoiceDocument) { // if address identifier is provided, try to refresh customer address data if (ObjectUtils.isNotNull(customerInvoiceDocument.getAccountsReceivableDocumentHeader())) { CustomerAddress customerShipToAddress = customerAddressService.getByPrimaryKey( customerInvoiceDocument.getAccountsReceivableDocumentHeader().getCustomerNumber(), customerInvoiceDocument.getCustomerShipToAddressIdentifier()); CustomerAddress customerBillToAddress = customerAddressService.getByPrimaryKey( customerInvoiceDocument.getAccountsReceivableDocumentHeader().getCustomerNumber(), customerInvoiceDocument.getCustomerBillToAddressIdentifier()); if (ObjectUtils.isNotNull(customerShipToAddress)) { customerInvoiceDocument.setCustomerShipToAddress(customerShipToAddress); customerInvoiceDocument.setCustomerShipToAddressOnInvoice(customerShipToAddress); } if (ObjectUtils.isNotNull(customerBillToAddress)) { customerInvoiceDocument.setCustomerBillToAddress(customerBillToAddress); customerInvoiceDocument.setCustomerBillToAddressOnInvoice(customerBillToAddress); } } }
/** * Update Traveler information (name, id, network id) after looking up the Profile * * @param refreshCaller * @param fieldValues * @param document */ protected void updateFieldsFromProfileRefresh( String refreshCaller, Map fieldValues, MaintenanceDocument document) { if (StringUtils.isNotEmpty(refreshCaller) && refreshCaller.equals(TemConstants.TEM_PROFILE_LOOKUPABLE)) { AgencyStagingDataMaintainable newMaintainable = (AgencyStagingDataMaintainable) document.getNewMaintainableObject(); AgencyStagingData agencyData = (AgencyStagingData) newMaintainable.getBusinessObject(); TemProfile profile = agencyData.getProfile(); if (ObjectUtils.isNotNull(profile)) { if (StringUtils.isNotEmpty(profile.getEmployeeId())) { agencyData.setTravelerId(profile.getEmployeeId()); } else if (StringUtils.isNotEmpty(profile.getCustomerNumber())) { agencyData.setTravelerId(profile.getCustomerNumber()); } else { agencyData.setTravelerId(""); } agencyData.setTravelerName(profile.getFirstName() + " " + profile.getLastName()); if (ObjectUtils.isNotNull(profile.getPrincipal())) { agencyData.setTravelerNetworkId(profile.getPrincipal().getPrincipalName()); } else { agencyData.setTravelerNetworkId(""); } } } }
/** * This method returns the invoice pre tax amount * * @return */ public KualiDecimal getInvoiceItemPreTaxAmount() { if (ObjectUtils.isNotNull(invoiceItemUnitPrice) && ObjectUtils.isNotNull(invoiceItemQuantity)) { BigDecimal bd = invoiceItemUnitPrice.multiply(invoiceItemQuantity); bd = bd.setScale(KualiDecimal.SCALE, KualiDecimal.ROUND_BEHAVIOR); return new KualiDecimal(bd); } else { return KualiDecimal.ZERO; } }
/** * Gets the fieldInfo attribute. * * @return Returns the fieldInfo. */ protected List<Map<String, String>> getFieldInfo(List<EffortCertificationDetail> detailLines) { LOG.debug("getFieldInfo(List<EffortCertificationDetail>) start"); List<Map<String, String>> fieldInfo = new ArrayList<Map<String, String>>(); EffortCertificationDocument document = (EffortCertificationDocument) this.getDocument(); KualiDecimal totalOriginalPayrollAmount = document.getTotalOriginalPayrollAmount(); for (EffortCertificationDetail detailLine : detailLines) { detailLine.refreshNonUpdateableReferences(); Map<String, String> fieldInfoForAttribute = new HashMap<String, String>(); fieldInfoForAttribute.put( KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE, detailLine.getChartOfAccounts().getFinChartOfAccountDescription()); String accountInfo = buildAccountInfo(detailLine.getAccount()); fieldInfoForAttribute.put(KFSPropertyConstants.ACCOUNT_NUMBER, accountInfo); SubAccount subAccount = detailLine.getSubAccount(); if (ObjectUtils.isNotNull(subAccount)) { fieldInfoForAttribute.put( KFSPropertyConstants.SUB_ACCOUNT_NUMBER, subAccount.getSubAccountName()); } ObjectCode objectCode = detailLine.getFinancialObject(); if (ObjectUtils.isNotNull(objectCode)) { fieldInfoForAttribute.put( KFSPropertyConstants.FINANCIAL_OBJECT_CODE, objectCode.getFinancialObjectCodeName()); } Account sourceAccount = detailLine.getSourceAccount(); if (ObjectUtils.isNotNull(sourceAccount)) { fieldInfoForAttribute.put( EffortPropertyConstants.SOURCE_ACCOUNT_NUMBER, sourceAccount.getAccountName()); } Chart sourceChart = detailLine.getSourceChartOfAccounts(); if (ObjectUtils.isNotNull(sourceChart)) { fieldInfoForAttribute.put( EffortPropertyConstants.SOURCE_CHART_OF_ACCOUNTS_CODE, sourceChart.getFinChartOfAccountDescription()); } KualiDecimal originalPayrollAmount = detailLine.getEffortCertificationOriginalPayrollAmount(); String actualOriginalPercent = PayrollAmountHolder.recalculateEffortPercentAsString( totalOriginalPayrollAmount, originalPayrollAmount); fieldInfoForAttribute.put( EffortPropertyConstants.EFFORT_CERTIFICATION_CALCULATED_OVERALL_PERCENT, actualOriginalPercent); fieldInfo.add(fieldInfoForAttribute); } return fieldInfo; }
/** * This method prepare the report model object to display on jsp page. * * @param invoices * @param results */ protected void populateReportDetails( List<ContractsGrantsInvoiceDocument> invoices, List results) { for (ContractsGrantsInvoiceDocument invoice : invoices) { ContractsGrantsAgingOpenInvoicesReport detail = new ContractsGrantsAgingOpenInvoicesReport(); // Document Type detail.setDocumentType( invoice.getDocumentHeader().getWorkflowDocument().getDocumentTypeName()); // Document Number detail.setDocumentNumber(invoice.getDocumentNumber()); // Document Description String documentDescription = invoice.getDocumentHeader().getDocumentDescription(); if (ObjectUtils.isNotNull(documentDescription)) { detail.setDocumentDescription(documentDescription); } else { detail.setDocumentDescription(""); } // Billing Date detail.setBillingDate(invoice.getBillingDate()); // Due Date detail.setDueApprovedDate(invoice.getInvoiceDueDate()); // Document Payment Amount detail.setDocumentPaymentAmount( invoice.getFinancialSystemDocumentHeader().getFinancialDocumentTotalAmount()); // Unpaid/Unapplied Amount detail.setUnpaidUnappliedAmount( customerInvoiceDocumentService.getOpenAmountForCustomerInvoiceDocument(invoice)); detail.setFinalInvoice( !ObjectUtils.isNull(invoice.getInvoiceGeneralDetail()) && invoice.getInvoiceGeneralDetail().isFinalBillIndicator() ? KFSConstants.ParameterValues.STRING_YES : KFSConstants.ParameterValues.STRING_NO); // set agency number, proposal number, account number if (!ObjectUtils.isNull(invoice.getInvoiceGeneralDetail()) && !ObjectUtils.isNull(invoice.getInvoiceGeneralDetail().getProposalNumber())) { detail.setProposalNumber(invoice.getInvoiceGeneralDetail().getProposalNumber().toString()); } // Set Agency Number ContractsAndGrantsBillingAgency cgAgency = this.getAgencyByCustomer( invoice.getAccountsReceivableDocumentHeader().getCustomerNumber()); if (ObjectUtils.isNotNull(cgAgency)) { detail.setAgencyNumber(cgAgency.getAgencyNumber()); } // Set Account number List<CustomerInvoiceDetail> details = invoice.getSourceAccountingLines(); String accountNum = (CollectionUtils.isNotEmpty(details) && ObjectUtils.isNotNull(details.get(0))) ? details.get(0).getAccountNumber() : ""; detail.setAccountNumber(accountNum); results.add(detail); } }
/** * Get capitalAssetTransactionTypeCode for one system from PurAp. * * @param poId * @return */ protected String getCapitalAssetTransTypeForOneSystem(Integer poId) { PurchaseOrderDocument poDoc = getCurrentDocumentForPurchaseOrderIdentifier(poId); if (ObjectUtils.isNotNull(poDoc)) { List<PurchasingCapitalAssetItem> capitalAssetItems = poDoc.getPurchasingCapitalAssetItems(); if (ObjectUtils.isNotNull(capitalAssetItems) && capitalAssetItems.get(0) != null) { return capitalAssetItems.get(0).getCapitalAssetTransactionTypeCode(); } } return null; }
/** @return a List of the CustomerInvoiceDetails associated with a given Account Number */ @SuppressWarnings("unchecked") public Collection<CustomerInvoiceDetail> getCustomerInvoiceDetailsByAccountNumber( String accountChartCode, String accountNumber) { Map args = new HashMap(); if (ObjectUtils.isNotNull(accountNumber) && StringUtils.isNotEmpty(accountNumber)) { args.put(KFSPropertyConstants.ACCOUNT_NUMBER, accountNumber); } if (ObjectUtils.isNotNull(accountChartCode) && StringUtils.isNotEmpty(accountChartCode)) { args.put(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE, accountChartCode); } return businessObjectService.findMatching(CustomerInvoiceDetail.class, args); }
// mjmc // ************************************************************************************************* private PurchaseOrderDocument copyNotesAndAttachmentsToPO( RequisitionDocument reqDoc, PurchaseOrderDocument poDoc) { purapService.saveDocumentNoValidation(poDoc); List<Note> notes = (List<Note>) reqDoc.getNotes(); int noteLength = notes.size(); if (noteLength > 0) { for (Note note : notes) { try { Note copyingNote = SpringContext.getBean(DocumentService.class) .createNoteFromDocument(poDoc, note.getNoteText()); purapService.saveDocumentNoValidation(poDoc); copyingNote.setNotePostedTimestamp(note.getNotePostedTimestamp()); copyingNote.setAuthorUniversalIdentifier(note.getAuthorUniversalIdentifier()); copyingNote.setNoteTopicText(note.getNoteTopicText()); Attachment originalAttachment = SpringContext.getBean(AttachmentService.class) .getAttachmentByNoteId(note.getNoteIdentifier()); NoteExtendedAttribute noteExtendedAttribute = (NoteExtendedAttribute) note.getExtension(); if (originalAttachment != null || (ObjectUtils.isNotNull(noteExtendedAttribute) && noteExtendedAttribute.isCopyNoteIndicator())) { if (originalAttachment != null) { Attachment newAttachment = SpringContext.getBean(AttachmentService.class) .createAttachment( (PersistableBusinessObject) copyingNote, originalAttachment.getAttachmentFileName(), originalAttachment.getAttachmentMimeTypeCode(), originalAttachment.getAttachmentFileSize().intValue(), originalAttachment.getAttachmentContents(), originalAttachment.getAttachmentTypeCode()); // new Attachment(); if (ObjectUtils.isNotNull(originalAttachment) && ObjectUtils.isNotNull(newAttachment)) { copyingNote.addAttachment(newAttachment); } } poDoc.addNote(copyingNote); } } catch (Exception e) { throw new RuntimeException(e); } } } purapService.saveDocumentNoValidation(poDoc); return poDoc; } // mjmc end
/** * @see * org.kuali.kfs.module.tem.batch.service.CreditCardDataImportService#isDuplicate(org.kuali.kfs.module.tem.businessobject.CreditCardStagingData, * java.util.List) */ @Override public boolean isDuplicate( CreditCardStagingData creditCardData, List<ErrorMessage> errorMessages) { Map<String, Object> fieldValues = new HashMap<String, Object>(); if (StringUtils.isNotEmpty(creditCardData.getCreditCardKey())) { fieldValues.put(TemPropertyConstants.CREDIT_CARD_KEY, creditCardData.getCreditCardKey()); } if (StringUtils.isNotEmpty(creditCardData.getReferenceNumber())) { fieldValues.put(TemPropertyConstants.REFERENCE_NUMBER, creditCardData.getReferenceNumber()); } if (ObjectUtils.isNotNull(creditCardData.getTransactionAmount())) { fieldValues.put( TemPropertyConstants.TRANSACTION_AMOUNT, creditCardData.getTransactionAmount()); } if (ObjectUtils.isNotNull(creditCardData.getTransactionDate())) { fieldValues.put(TemPropertyConstants.TRANSACTION_DATE, creditCardData.getTransactionDate()); } if (ObjectUtils.isNotNull(creditCardData.getBankPostDate())) { fieldValues.put(TemPropertyConstants.BANK_POSTED_DATE, creditCardData.getBankPostDate()); } if (StringUtils.isNotEmpty(creditCardData.getMerchantName())) { fieldValues.put(TemPropertyConstants.MERCHANT_NAME, creditCardData.getMerchantName()); } List<CreditCardStagingData> creditCardDataList = (List<CreditCardStagingData>) businessObjectService.findMatching(CreditCardStagingData.class, fieldValues); if (ObjectUtils.isNull(creditCardDataList) || creditCardDataList.size() == 0) { return false; } LOG.error( "Found a duplicate entry for credit card. Matching credit card id: " + creditCardDataList.get(0).getId()); SimpleDateFormat format = new SimpleDateFormat(); ErrorMessage error = new ErrorMessage( TemKeyConstants.MESSAGE_CREDIT_CARD_DATA_DUPLICATE_RECORD, creditCardData.getCreditCardKey(), creditCardData.getReferenceNumber(), creditCardData.getTransactionAmount().toString(), format.format(creditCardData.getTransactionDate()), format.format(creditCardData.getBankPostDate()), creditCardData.getMerchantName()); errorMessages.add(error); return true; }
/** * @see * org.kuali.kfs.module.ar.document.service.InvoiceRecurrenceService#isValidMaximumNumberOfRecurrences(int,String) */ @Override public boolean isValidMaximumNumberOfRecurrences( Integer totalRecurrenceNumber, String intervalCode) { if (ObjectUtils.isNull(intervalCode) || ObjectUtils.isNull(totalRecurrenceNumber)) { return true; } Integer maximumRecurrencesByInterval; if (ObjectUtils.isNotNull(intervalCode)) { List<String> maximumRecurrences = new ArrayList<String>( SpringContext.getBean(ParameterService.class) .getSubParameterValuesAsString( InvoiceRecurrence.class, ArConstants.MAXIMUM_RECURRENCES_BY_INTERVAL, intervalCode)); if (maximumRecurrences.size() > 0 && StringUtils.isNotBlank(maximumRecurrences.get(0))) { maximumRecurrencesByInterval = Integer.valueOf(maximumRecurrences.get(0)); if (totalRecurrenceNumber > maximumRecurrencesByInterval) { return false; } } } return true; }
/** * summary the valid origin entries for the General Ledger * * @param laborOriginEntry the current entry to check for summarization * @param laborLedgerUnitOfWork the current (in process) summarized entry for the GL * @param runDate the data when the process is running * @param lineNumber the line in the input file (used for error message only) */ protected LaborOriginEntry summarizeLaborGLEntries( LaborOriginEntry laborOriginEntry, LaborLedgerUnitOfWork laborLedgerUnitOfWork, Date runDate, int lineNumber, Map<String, Integer> glEntryReportSummary) { // KFSMI-5308: Description update moved here due to requirement for this to happen before // consolidation if (ObjectUtils.isNotNull(laborOriginEntry)) { String description = laborTransactionDescriptionService.getTransactionDescription(laborOriginEntry); if (StringUtils.isNotEmpty(description)) { laborOriginEntry.setTransactionLedgerEntryDescription(description); } } LaborOriginEntry summarizedEntry = null; if (laborLedgerUnitOfWork.canContain(laborOriginEntry)) { laborLedgerUnitOfWork.addEntryIntoUnit(laborOriginEntry); updateReportSummary(glEntryReportSummary, ORIGN_ENTRY, KFSConstants.OperationType.SELECT); } else { summarizedEntry = laborLedgerUnitOfWork.getWorkingEntry(); laborLedgerUnitOfWork.resetLaborLedgerUnitOfWork(laborOriginEntry); } return summarizedEntry; }
public ActionForward editIntellectualPropertyReview( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { InstitutionalProposalForm institutionalProposalForm = (InstitutionalProposalForm) form; InstitutionalProposalDocument institutionalProposalDocument = (InstitutionalProposalDocument) institutionalProposalForm.getDocument(); institutionalProposalDocument .getInstitutionalProposal() .getProposalIpReviewJoin() .refreshReferenceObject("intellectualPropertyReview"); if (ObjectUtils.isNotNull( institutionalProposalDocument .getInstitutionalProposal() .getProposalIpReviewJoin() .getIntellectualPropertyReview())) { response.sendRedirect( "kr/maintenance.do?businessObjectClassName=org.kuali.kra.institutionalproposal.ipreview.IntellectualPropertyReview&methodToCall=copy&ipReviewId=" + institutionalProposalDocument .getInstitutionalProposal() .getProposalIpReviewJoin() .getIntellectualPropertyReview() .getIpReviewId() + "&proposalId=" + institutionalProposalDocument.getInstitutionalProposal().getProposalId()); } return null; }
/** @param invoiceItemUnitPrice */ public void setInvoiceItemUnitPrice(KualiDecimal invoiceItemUnitPrice) { if (ObjectUtils.isNotNull(invoiceItemUnitPrice)) { this.invoiceItemUnitPrice = invoiceItemUnitPrice.bigDecimalValue(); } else { this.invoiceItemUnitPrice = BigDecimal.ZERO; } }
/** * @see * org.kuali.rice.kns.web.struts.action.KualiLookupAction#execute(org.apache.struts.action.ActionMapping, * org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, * javax.servlet.http.HttpServletResponse) */ @Override public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String sortIndexParameter = request.getParameter("d-16544-s"); if (sortIndexParameter != null) { // to store how many times user clicks sort links Integer clickedSession = ObjectUtils.isNull( GlobalVariables.getUserSession() .retrieveObject(ArConstants.NUM_SORT_INDEX_CLICK_SESSION_KEY)) ? new Integer(1) : (Integer) GlobalVariables.getUserSession() .retrieveObject(ArConstants.NUM_SORT_INDEX_CLICK_SESSION_KEY); if (ObjectUtils.isNotNull( GlobalVariables.getUserSession().retrieveObject(ArConstants.SORT_INDEX_SESSION_KEY)) && GlobalVariables.getUserSession() .retrieveObject(ArConstants.SORT_INDEX_SESSION_KEY) .toString() .equals(sortIndexParameter)) { GlobalVariables.getUserSession() .addObject( ArConstants.NUM_SORT_INDEX_CLICK_SESSION_KEY, new Integer(clickedSession + 1)); } GlobalVariables.getUserSession() .addObject(ArConstants.SORT_INDEX_SESSION_KEY, sortIndexParameter); } return super.execute(mapping, form, request, response); }
/** * This method will create a maintenance document for CG account create, set its description and * then sets the account business object in it. The document will then be tried to route, save or * blanket approve automatically based on the system parameter. If successful, the method returns * the newly created document number to the caller. * * @return documentNumber returns the documentNumber * @see * org.kuali.kfs.coa.document.service.CreateAccountService#createAutomaticCGAccountMaintenanceDocument() */ protected void createAutomaticCGAccountMaintenanceDocument( Account account, AccountCreationStatusDTO accountCreationStatus) { // create a new maintenance document MaintenanceDocument maintenanceAccountDocument = (MaintenanceDocument) createCGAccountMaintenanceDocument(accountCreationStatus); if (ObjectUtils.isNotNull(maintenanceAccountDocument)) { // set document header description... maintenanceAccountDocument .getDocumentHeader() .setDocumentDescription( KcConstants.AccountCreationService .AUTOMATCICG_ACCOUNT_MAINTENANCE_DOCUMENT_DESCRIPTION); // set the account object in the maintenance document. maintenanceAccountDocument.getNewMaintainableObject().setBusinessObject(account); maintenanceAccountDocument .getNewMaintainableObject() .setMaintenanceAction(KRADConstants.MAINTENANCE_NEW_ACTION); // the maintenance document will now be routed based on the system parameter value for // routing. createRouteAutomaticCGAccountDocument(maintenanceAccountDocument, accountCreationStatus); } }
/** * @see org.kuali.kfs.sys.document.FinancialSystemMaintainable#populateChartOfAccountsCodeFields() * <p>Special treatment is needed to populate the chart code from the account number field in * IndirectCostRecoveryRateDetails, as the potential reference account doesn't exist in the * collection due to wild cards, which also needs special handling. */ @Override protected void populateChartOfAccountsCodeFields() { // calling super method in case there're reference accounts/collections other than ICR rates super.populateChartOfAccountsCodeFields(); PersistableBusinessObject bo = getBusinessObject(); AccountService acctService = SpringContext.getBean(AccountService.class); PersistableBusinessObject newAccount = getNewCollectionLine(KFSPropertyConstants.INDIRECT_COST_RECOVERY_RATE_DETAILS); String accountNumber = (String) ObjectUtils.getPropertyValue(newAccount, KFSPropertyConstants.ACCOUNT_NUMBER); String coaCode = null; // if accountNumber is wild card, populate chart code with the same wild card if (GeneralLedgerConstants.PosterService.SYMBOL_USE_EXPENDITURE_ENTRY.equals(accountNumber) || GeneralLedgerConstants.PosterService.SYMBOL_USE_ICR_FROM_ACCOUNT.equals(accountNumber)) { coaCode = accountNumber; } // otherwise do the normal account lookup else { Account account = acctService.getUniqueAccountForAccountNumber(accountNumber); if (ObjectUtils.isNotNull(account)) { coaCode = account.getChartOfAccountsCode(); } } // populate chart code field try { ObjectUtils.setObjectProperty( newAccount, KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE, coaCode); } catch (Exception e) { LOG.error( "Error in setting property value for " + KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE); } }
/** * @see * org.kuali.kfs.module.ar.document.service.InvoiceRecurrenceService#isInvoiceApproved(String) */ @Override public boolean isInvoiceApproved(String invoiceNumber) { boolean success = true; if (ObjectUtils.isNull(invoiceNumber)) { return success; } CustomerInvoiceDocument customerInvoiceDocument = null; try { customerInvoiceDocument = (CustomerInvoiceDocument) SpringContext.getBean(DocumentService.class).getByDocumentHeaderId(invoiceNumber); } catch (WorkflowException e) { } if (ObjectUtils.isNotNull(customerInvoiceDocument)) { WorkflowDocument workflowDocument = customerInvoiceDocument.getDocumentHeader().getWorkflowDocument(); if (!(workflowDocument.isApproved())) { success = false; } } else { success = false; } return success; }
/** * Sets the encumbrance code of the line based on the balance type. * * @param sourceLine - line to set code on */ protected void populateSourceAccountingLineEncumbranceCode(SourceAccountingLine sourceLine) { BalanceType selectedBalanceType = getSelectedBalanceType(); if (ObjectUtils.isNotNull(selectedBalanceType)) { selectedBalanceType.refresh(); sourceLine.setBalanceTyp(selectedBalanceType); sourceLine.setBalanceTypeCode(selectedBalanceType.getCode()); // set the encumbrance update code appropriately // KFSMI-5565 remove the default encumbrance code // no more default encumbrance code // if // (KFSConstants.BALANCE_TYPE_EXTERNAL_ENCUMBRANCE.equals(selectedBalanceType.getCode())) { // // sourceLine.setEncumbranceUpdateCode(KFSConstants.JOURNAL_VOUCHER_ENCUMBRANCE_UPDATE_CODE_BALANCE_TYPE_EXTERNAL_ENCUMBRANCE); // } // else { // sourceLine.setEncumbranceUpdateCode(null); // } } else { // it's the first time in, the form will be empty the first time in // set up default selection value selectedBalanceType = getPopulatedBalanceTypeInstance(KFSConstants.BALANCE_TYPE_ACTUAL); setSelectedBalanceType(selectedBalanceType); setOriginalBalanceType(selectedBalanceType.getCode()); sourceLine.setEncumbranceUpdateCode(null); } }
@Override public boolean validate(AttributedDocumentEvent event) { boolean valid = true; GlobalVariables.getMessageMap().clearErrorPath(); TravelEntertainmentDocument document = (TravelEntertainmentDocument) event.getDocument(); boolean entertainmentHostAttached = false; List<Note> notes = document.getNotes(); for (Note note : notes) { if (ObjectUtils.isNotNull(note.getAttachment()) && TemConstants.AttachmentTypeCodes.ATTACHMENT_TYPE_ENT_HOST_CERT.equals( note.getAttachment().getAttachmentTypeCode())) { entertainmentHostAttached = true; break; } } // if host is not as payee than entertainment host certification is required ; otherwise not if (!document.getHostAsPayee() && !entertainmentHostAttached) { valid = addError(); } return valid; }
public boolean processSyncModularBusinessRules(Document document) { if (!(document instanceof BudgetDocument)) { return false; } boolean valid = true; BudgetDocument budgetDocument = (BudgetDocument) document; GlobalVariables.getMessageMap().addToErrorPath("document"); List budgetPeriods = budgetDocument.getBudget().getBudgetPeriods(); if (ObjectUtils.isNotNull(budgetPeriods) || budgetPeriods.size() >= 1) { BudgetPeriod period1 = (BudgetPeriod) budgetPeriods.get(0); if (ObjectUtils.isNull(period1.getBudgetLineItems()) || period1.getBudgetLineItems().isEmpty()) { valid = false; } } else { valid = false; } if (!valid) { GlobalVariables.getMessageMap() .putError("modularBudget", KeyConstants.ERROR_NO_DETAILED_BUDGET); } GlobalVariables.getMessageMap().removeFromErrorPath("document"); return valid; }
public List<Long> retrieveValidAssetNumberForLocking( Integer poId, String capitalAssetSystemTypeCode, PurApItem purApItem) { List<Long> capitalAssetNumbers = new ArrayList<Long>(); CapitalAssetSystem capitalAssetSystem = null; if (PurapConstants.CapitalAssetTabStrings.INDIVIDUAL_ASSETS.equalsIgnoreCase( capitalAssetSystemTypeCode)) { // If PurAp sets the CAMS as INDIVIDUAL system capitalAssetSystem = getCapitalAssetSystemForIndividual(poId, purApItem); } else if (PurapConstants.CapitalAssetTabStrings.ONE_SYSTEM.equalsIgnoreCase( capitalAssetSystemTypeCode)) { capitalAssetSystem = this.getPurchaseOrderService().retrieveCapitalAssetSystemForOneSystem(poId); } else if (PurapConstants.CapitalAssetTabStrings.MULTIPLE_SYSTEMS.equalsIgnoreCase( capitalAssetSystemTypeCode)) { List<CapitalAssetSystem> capitalAssetSystems = this.getPurchaseOrderService().retrieveCapitalAssetSystemsForMultipleSystem(poId); if (ObjectUtils.isNotNull(capitalAssetSystems) && !capitalAssetSystems.isEmpty()) { // PurAp doesn't support multiple system asset information for KFS3.0. It works as One // system. capitalAssetSystem = capitalAssetSystems.get(0); } } if (ObjectUtils.isNotNull(capitalAssetSystem) && capitalAssetSystem.getItemCapitalAssets() != null && !capitalAssetSystem.getItemCapitalAssets().isEmpty()) { for (ItemCapitalAsset itemCapitalAsset : capitalAssetSystem.getItemCapitalAssets()) { if (itemCapitalAsset.getCapitalAssetNumber() != null) { Map pKeys = new HashMap<String, Object>(); // Asset must be valid and capital active 'A','C','S','U' pKeys.put( CamsPropertyConstants.Asset.CAPITAL_ASSET_NUMBER, itemCapitalAsset.getCapitalAssetNumber()); Asset asset = (Asset) businessObjectService.findByPrimaryKey(Asset.class, pKeys); if (ObjectUtils.isNotNull(asset) && getAssetService().isCapitalAsset(asset) && !getAssetService().isAssetRetired(asset)) { capitalAssetNumbers.add(itemCapitalAsset.getCapitalAssetNumber()); } } } } return capitalAssetNumbers; }
/** * For fringe transaction types checks if the account accepts fringe benefits. If not, retrieves * the alternative account, then calls expiration checking on either the alternative account or * the account passed in. */ protected Message checkAccountFringeIndicator( LaborOriginEntry laborOriginEntry, LaborOriginEntry laborWorkingEntry, Account account, UniversityDate universityRunDate, LaborAccountingCycleCachingService laborAccountingCycleCachingService) { // check for fringe tranaction type // LaborObject laborObject = (LaborObject) // businessObjectService.findByPrimaryKey(LaborObject.class, fieldValues); LaborObject laborObject = laborAccountingCycleCachingService.getLaborObject( laborOriginEntry.getUniversityFiscalYear(), laborOriginEntry.getChartOfAccountsCode(), laborOriginEntry.getFinancialObjectCode()); boolean isFringeTransaction = laborObject != null && org.apache.commons.lang.StringUtils.equals( LaborConstants.BenefitExpenseTransfer.LABOR_LEDGER_BENEFIT_CODE, laborObject.getFinancialObjectFringeOrSalaryCode()); // alternative account handling for non fringe accounts if (isFringeTransaction && !account.isAccountsFringesBnftIndicator()) { Account altAccount = accountService.getByPrimaryId( laborOriginEntry.getAccount().getReportsToChartOfAccountsCode(), laborOriginEntry.getAccount().getReportsToAccountNumber()); if (ObjectUtils.isNotNull(altAccount)) { laborWorkingEntry.setAccount(altAccount); laborWorkingEntry.setAccountNumber(altAccount.getAccountNumber()); laborWorkingEntry.setChartOfAccountsCode(altAccount.getChartOfAccountsCode()); Message err = handleExpiredClosedAccount( altAccount, laborOriginEntry, laborWorkingEntry, universityRunDate); if (err == null) { err = MessageBuilder.buildMessageWithPlaceHolder( LaborKeyConstants.MESSAGE_FRINGES_MOVED_TO, Message.TYPE_WARNING, new Object[] {altAccount.getAccountNumber()}); } return err; } // no alt acct, use suspense acct if active boolean suspenseAccountLogicInd = parameterService.getParameterValueAsBoolean( LaborScrubberStep.class, LaborConstants.Scrubber.SUSPENSE_ACCOUNT_LOGIC_PARAMETER); if (suspenseAccountLogicInd) { return useSuspenseAccount(laborWorkingEntry); } return MessageBuilder.buildMessage( LaborKeyConstants.ERROR_NON_FRINGE_ACCOUNT_ALTERNATIVE_NOT_FOUND, Message.TYPE_FATAL); } return handleExpiredClosedAccount( account, laborOriginEntry, laborWorkingEntry, universityRunDate); }
@Override public void recalculateCustomerCreditMemoDocument( CustomerCreditMemoDocument customerCreditMemoDocument, boolean blanketApproveDocumentEventFlag) { KualiDecimal customerCreditMemoDetailItemAmount; BigDecimal itemQuantity; String invDocumentNumber = customerCreditMemoDocument.getFinancialDocumentReferenceInvoiceNumber(); List<CustomerCreditMemoDetail> customerCreditMemoDetails = customerCreditMemoDocument.getCreditMemoDetails(); if (!blanketApproveDocumentEventFlag) { customerCreditMemoDocument.resetTotals(); } for (CustomerCreditMemoDetail customerCreditMemoDetail : customerCreditMemoDetails) { // no data entered for the current credit memo detail -> no processing needed itemQuantity = customerCreditMemoDetail.getCreditMemoItemQuantity(); customerCreditMemoDetailItemAmount = customerCreditMemoDetail.getCreditMemoItemTotalAmount(); if (ObjectUtils.isNull(itemQuantity) && ObjectUtils.isNull(customerCreditMemoDetailItemAmount)) { if (!blanketApproveDocumentEventFlag) { customerCreditMemoDetail.setDuplicateCreditMemoItemTotalAmount(null); } continue; } // if item amount was entered, it takes precedence, if not, use the item quantity to re-calc // amount if (ObjectUtils.isNotNull(customerCreditMemoDetailItemAmount)) { customerCreditMemoDetail.recalculateBasedOnEnteredItemAmount(customerCreditMemoDocument); } // if item quantity was entered else { customerCreditMemoDetail.recalculateBasedOnEnteredItemQty(customerCreditMemoDocument); if (!blanketApproveDocumentEventFlag) { customerCreditMemoDetailItemAmount = customerCreditMemoDetail.getCreditMemoItemTotalAmount(); } } if (!blanketApproveDocumentEventFlag) { customerCreditMemoDetail.setDuplicateCreditMemoItemTotalAmount( customerCreditMemoDetailItemAmount); boolean isCustomerInvoiceDetailTaxable = accountsReceivableTaxService.isCustomerInvoiceDetailTaxable( customerCreditMemoDocument.getInvoice(), customerCreditMemoDetail.getCustomerInvoiceDetail()); customerCreditMemoDocument.recalculateTotals( customerCreditMemoDetailItemAmount, isCustomerInvoiceDetailTaxable); } } // force the docHeader docTotal customerCreditMemoDocument .getFinancialSystemDocumentHeader() .setFinancialDocumentTotalAmount(customerCreditMemoDocument.getCrmTotalAmount()); }
/** * This overridden method ... * * @see * org.kuali.kfs.sys.document.web.struts.FinancialSystemTransactionalDocumentFormBase#getExtraButtons() */ public List<ExtraButton> getExtraButtons() { extraButtons.clear(); String wizard = (String) getEditingMode().get("wizard"); String customerDataStep = (String) getEditingMode().get(CUPurapConstants.IWantDocumentSteps.CUSTOMER_DATA_STEP); String itemsAndAcctStep = (String) getEditingMode().get(CUPurapConstants.IWantDocumentSteps.ITEMS_AND_ACCT_DATA_STEP); String vendorDataStep = (String) getEditingMode().get(CUPurapConstants.IWantDocumentSteps.VENDOR_STEP); String routingStep = (String) getEditingMode().get(CUPurapConstants.IWantDocumentSteps.ROUTING_STEP); if (ObjectUtils.isNotNull(customerDataStep) && wizard.equalsIgnoreCase(customerDataStep)) { extraButtons.add(createContinueToItemsButton()); // extraButtons.add(createClearInitFieldsButton()); } else if (ObjectUtils.isNotNull(itemsAndAcctStep) && wizard.equalsIgnoreCase(itemsAndAcctStep)) { extraButtons.add(createBackToCustomerDataButton()); extraButtons.add(createContinueToVendorButton()); } else if (ObjectUtils.isNotNull(vendorDataStep) && wizard.equalsIgnoreCase(vendorDataStep)) { extraButtons.add(createBackToItemsButton()); extraButtons.add(createContinueToRoutingButton()); } else if (ObjectUtils.isNotNull(routingStep) && wizard.equalsIgnoreCase(routingStep)) { extraButtons.add(createBackToVendorButton()); extraButtons.add(createSubmitButton()); } if (getEditingMode().containsKey(CUPurapConstants.IWNT_DOC_CREATE_REQ)) { extraButtons.add(createCreateRequisitionButton()); } if (getEditingMode().containsKey(CUPurapConstants.IWNT_DOC_CREATE_DV)) { // KFSPTS-2527 add create DV button extraButtons.add(createCreateDVButton()); } return extraButtons; }
/** * @param customerInvoiceDetail * @param paymentApplicationDocument * @return */ public static boolean validateAmountAppliedToCustomerInvoiceDetailByPaymentApplicationDocument( CustomerInvoiceDetail customerInvoiceDetail, PaymentApplicationDocument paymentApplicationDocument, KualiDecimal totalFromControl) throws WorkflowException { boolean isValid = true; // This let's us highlight a specific invoice detail line String propertyName = MessageFormat.format( ArPropertyConstants.PaymentApplicationDocumentFields.AMOUNT_TO_BE_APPLIED_LINE_N, customerInvoiceDetail.getSequenceNumber().toString()); KualiDecimal amountAppliedByAllOtherDocuments = customerInvoiceDetail.getAmountAppliedExcludingAnyAmountAppliedBy( paymentApplicationDocument.getDocumentNumber()); KualiDecimal amountAppliedByThisDocument = customerInvoiceDetail.getAmountAppliedBy(paymentApplicationDocument.getDocumentNumber()); KualiDecimal totalAppliedAmount = amountAppliedByAllOtherDocuments.add(amountAppliedByThisDocument); // Can't apply more than the total amount of the detail if (!totalAppliedAmount.isLessEqual(totalFromControl)) { isValid = false; GlobalVariables.getMessageMap() .putError( propertyName, ArKeyConstants.PaymentApplicationDocumentErrors .AMOUNT_TO_BE_APPLIED_EXCEEDS_AMOUNT_OUTSTANDING); } // Can't apply a negative amount. if (KualiDecimal.ZERO.isGreaterThan(amountAppliedByThisDocument)) { isValid = false; GlobalVariables.getMessageMap() .putError( propertyName, ArKeyConstants.PaymentApplicationDocumentErrors .AMOUNT_TO_BE_APPLIED_MUST_BE_GREATER_THAN_ZERO); } // Can't apply more than the total amount outstanding on the cash control document. CashControlDocument cashControlDocument = paymentApplicationDocument.getCashControlDocument(); if (ObjectUtils.isNotNull(cashControlDocument)) { if (cashControlDocument.getCashControlTotalAmount().isLessThan(amountAppliedByThisDocument)) { isValid = false; GlobalVariables.getMessageMap() .putError( propertyName, ArKeyConstants.PaymentApplicationDocumentErrors .CANNOT_APPLY_MORE_THAN_BALANCE_TO_BE_APPLIED); } } return isValid; }