Search in sources :

Example 1 with AmountTotaling

use of org.kuali.kfs.sys.document.AmountTotaling in project cu-kfs by CU-CommunityApps.

the class FinancialSystemSearchableAttribute method extractDocumentAttributes.

@Override
public List<DocumentAttribute> extractDocumentAttributes(ExtensionDefinition extensionDefinition, DocumentWithContent documentWithContent) {
    if (LOG.isDebugEnabled()) {
        LOG.debug("extractDocumentAttributes( " + extensionDefinition + ", " + documentWithContent + " )");
    }
    List<DocumentAttribute> searchAttrValues = super.extractDocumentAttributes(extensionDefinition, documentWithContent);
    String docId = documentWithContent.getDocument().getDocumentId();
    DocumentService docService = SpringContext.getBean(DocumentService.class);
    Document doc = null;
    try {
        doc = docService.getByDocumentHeaderIdSessionless(docId);
    } catch (WorkflowException we) {
    }
    if (doc != null) {
        if (doc instanceof AmountTotaling && ((AmountTotaling) doc).getTotalDollarAmount() != null) {
            DocumentAttributeDecimal.Builder searchableAttributeValue = DocumentAttributeDecimal.Builder.create(KFSPropertyConstants.FINANCIAL_DOCUMENT_TOTAL_AMOUNT);
            searchableAttributeValue.setValue(((AmountTotaling) doc).getTotalDollarAmount().bigDecimalValue());
            searchAttrValues.add(searchableAttributeValue.build());
        }
        if (doc instanceof AccountingDocument) {
            AccountingDocument accountingDoc = (AccountingDocument) doc;
            searchAttrValues.addAll(harvestAccountingDocumentSearchableAttributes(accountingDoc));
        }
        boolean indexedLedgerDoc = false;
        if (doc instanceof LaborLedgerPostingDocumentForSearching) {
            LaborLedgerPostingDocumentForSearching LLPostingDoc = (LaborLedgerPostingDocumentForSearching) doc;
            searchAttrValues.addAll(harvestLLPDocumentSearchableAttributes(LLPostingDoc));
            indexedLedgerDoc = true;
        }
        if (doc instanceof GeneralLedgerPostingDocument && !indexedLedgerDoc) {
            GeneralLedgerPostingDocument GLPostingDoc = (GeneralLedgerPostingDocument) doc;
            searchAttrValues.addAll(harvestGLPDocumentSearchableAttributes(GLPostingDoc));
        }
        DocumentHeader docHeader = doc.getDocumentHeader();
        if (ObjectUtils.isNotNull(docHeader) && ObjectUtils.isNotNull(docHeader.getWorkflowDocument()) && CUKFSConstants.GACC_DOCUMENT_TYPE.equalsIgnoreCase(docHeader.getWorkflowDocument().getDocumentTypeName())) {
            for (AccountGlobalDetail detail : ((AccountGlobal) ((AccountGlobalMaintainableImpl) ((FinancialSystemMaintenanceDocument) doc).getNewMaintainableObject()).getBusinessObject()).getAccountGlobalDetails()) {
                if (!StringUtils.isBlank(detail.getAccountNumber())) {
                    DocumentAttributeString.Builder searchableAttributeValue = DocumentAttributeString.Builder.create(KFSPropertyConstants.ACCOUNT_NUMBER);
                    searchableAttributeValue.setValue(detail.getAccountNumber());
                    searchAttrValues.add(searchableAttributeValue.build());
                }
            }
        }
    }
    return searchAttrValues;
}
Also used : WorkflowException(org.kuali.rice.kew.api.exception.WorkflowException) DocumentAttributeDecimal(org.kuali.rice.kew.api.document.attribute.DocumentAttributeDecimal) DocumentAttributeString(org.kuali.rice.kew.api.document.attribute.DocumentAttributeString) Document(org.kuali.kfs.krad.document.Document) GeneralLedgerPostingDocument(org.kuali.kfs.sys.document.GeneralLedgerPostingDocument) FinancialSystemMaintenanceDocument(org.kuali.kfs.sys.document.FinancialSystemMaintenanceDocument) AccountingDocument(org.kuali.kfs.sys.document.AccountingDocument) DocumentHeader(org.kuali.kfs.krad.bo.DocumentHeader) FinancialSystemDocumentHeader(org.kuali.kfs.sys.businessobject.FinancialSystemDocumentHeader) DocumentService(org.kuali.kfs.krad.service.DocumentService) LaborLedgerPostingDocumentForSearching(org.kuali.kfs.integration.ld.LaborLedgerPostingDocumentForSearching) FinancialSystemMaintenanceDocument(org.kuali.kfs.sys.document.FinancialSystemMaintenanceDocument) GeneralLedgerPostingDocument(org.kuali.kfs.sys.document.GeneralLedgerPostingDocument) AccountGlobal(org.kuali.kfs.coa.businessobject.AccountGlobal) DocumentAttribute(org.kuali.rice.kew.api.document.attribute.DocumentAttribute) AccountingDocument(org.kuali.kfs.sys.document.AccountingDocument) AccountGlobalDetail(org.kuali.kfs.coa.businessobject.AccountGlobalDetail) DocumentAttributeString(org.kuali.rice.kew.api.document.attribute.DocumentAttributeString) AmountTotaling(org.kuali.kfs.sys.document.AmountTotaling)

Example 2 with AmountTotaling

use of org.kuali.kfs.sys.document.AmountTotaling in project cu-kfs by CU-CommunityApps.

the class CuAdvanceDepositDocumentPresentationController method getEditModes.

@Override
public Set<String> getEditModes(Document document) {
    Set<String> editModes = super.getEditModes(document);
    if (document instanceof AmountTotaling) {
        editModes.add(KFSConstants.AMOUNT_TOTALING_EDITING_MODE);
    }
    editModes.add(KFSConstants.BANK_ENTRY_VIEWABLE_EDITING_MODE);
    AccountingDocument accountingDocument = (AccountingDocument) document;
    WorkflowDocument workflowDocument = accountingDocument.getDocumentHeader().getWorkflowDocument();
    if (workflowDocument.isInitiated() || workflowDocument.isSaved()) {
        editModes.add(CUKFSAuthorizationConstants.AdvanceDepositEditMode.EDITABLE_ADVANCE_DEPOSITS);
    }
    return editModes;
}
Also used : WorkflowDocument(org.kuali.rice.kew.api.WorkflowDocument) AccountingDocument(org.kuali.kfs.sys.document.AccountingDocument) AmountTotaling(org.kuali.kfs.sys.document.AmountTotaling)

Example 3 with AmountTotaling

use of org.kuali.kfs.sys.document.AmountTotaling in project cu-kfs by CU-CommunityApps.

the class CuDisbursementVoucherDocument method prepareForSave.

@Override
public void prepareForSave() {
    if (this instanceof AmountTotaling) {
        if (getFinancialSystemDocumentHeader().getFinancialDocumentStatusCode().equals(KFSConstants.DocumentStatusCodes.ENROUTE) && !getFinancialSystemDocumentHeader().getWorkflowDocument().isCompletionRequested()) {
            if (getParameterService().parameterExists(KfsParameterConstants.FINANCIAL_SYSTEM_DOCUMENT.class, UPDATE_TOTAL_AMOUNT_IN_POST_PROCESSING_PARAMETER_NAME) && getParameterService().getParameterValueAsBoolean(KfsParameterConstants.FINANCIAL_SYSTEM_DOCUMENT.class, UPDATE_TOTAL_AMOUNT_IN_POST_PROCESSING_PARAMETER_NAME)) {
                getFinancialSystemDocumentHeader().setFinancialDocumentTotalAmount(((AmountTotaling) this).getTotalDollarAmount());
            }
        } else {
            getFinancialSystemDocumentHeader().setFinancialDocumentTotalAmount(((AmountTotaling) this).getTotalDollarAmount());
        }
    }
    captureWorkflowHeaderInformation();
    if (wireTransfer != null) {
        wireTransfer.setDocumentNumber(this.documentNumber);
        ((DisbursementVoucherWireTransferExtendedAttribute) wireTransfer.getExtension()).setDocumentNumber(this.documentNumber);
    }
    if (dvNonResidentAlienTax != null) {
        dvNonResidentAlienTax.setDocumentNumber(this.documentNumber);
    }
    dvPayeeDetail.setDocumentNumber(this.documentNumber);
    ((CuDisbursementVoucherPayeeDetailExtension) dvPayeeDetail.getExtension()).setDocumentNumber(this.documentNumber);
    if (dvNonEmployeeTravel != null) {
        dvNonEmployeeTravel.setDocumentNumber(this.documentNumber);
        dvNonEmployeeTravel.setTotalTravelAmount(dvNonEmployeeTravel.getTotalTravelAmount());
    }
    if (dvPreConferenceDetail != null) {
        dvPreConferenceDetail.setDocumentNumber(this.documentNumber);
        dvPreConferenceDetail.setDisbVchrConferenceTotalAmt(dvPreConferenceDetail.getDisbVchrConferenceTotalAmt());
    }
    if (shouldClearSpecialHandling()) {
        clearSpecialHandling();
    }
    // CU Customization: Also perform check below when an ENROUTE doc is at the initial "AdHoc" node.
    if (getDocumentHeader().getWorkflowDocument().isInitiated() || getDocumentHeader().getWorkflowDocument().isSaved() || (getDocumentHeader().getWorkflowDocument().isEnroute() && getDocumentHeader().getWorkflowDocument().getCurrentNodeNames().contains("AdHoc"))) {
        // need to check whether the user has the permission to edit the bank code
        // if so, don't synchronize since we can't tell whether the value coming in
        // was entered by the user or not.
        DocumentAuthorizer docAuth = getDocumentHelperService().getDocumentAuthorizer(this);
        if (!docAuth.isAuthorizedByTemplate(this, KFSConstants.ParameterNamespaces.KFS, KFSConstants.PermissionTemplate.EDIT_BANK_CODE.name, GlobalVariables.getUserSession().getPrincipalId())) {
            synchronizeBankCodeWithPaymentMethod();
        } else {
            refreshReferenceObject("bank");
        }
        refreshPayeeTypeSuffixIfPaymentIsEditable();
    }
}
Also used : DisbursementVoucherWireTransferExtendedAttribute(edu.cornell.kfs.fp.businessobject.DisbursementVoucherWireTransferExtendedAttribute) CuDisbursementVoucherPayeeDetailExtension(edu.cornell.kfs.fp.businessobject.CuDisbursementVoucherPayeeDetailExtension) TransactionalDocumentAuthorizer(org.kuali.kfs.kns.document.authorization.TransactionalDocumentAuthorizer) DocumentAuthorizer(org.kuali.kfs.kns.document.authorization.DocumentAuthorizer) AmountTotaling(org.kuali.kfs.sys.document.AmountTotaling)

Aggregations

AmountTotaling (org.kuali.kfs.sys.document.AmountTotaling)3 AccountingDocument (org.kuali.kfs.sys.document.AccountingDocument)2 CuDisbursementVoucherPayeeDetailExtension (edu.cornell.kfs.fp.businessobject.CuDisbursementVoucherPayeeDetailExtension)1 DisbursementVoucherWireTransferExtendedAttribute (edu.cornell.kfs.fp.businessobject.DisbursementVoucherWireTransferExtendedAttribute)1 AccountGlobal (org.kuali.kfs.coa.businessobject.AccountGlobal)1 AccountGlobalDetail (org.kuali.kfs.coa.businessobject.AccountGlobalDetail)1 LaborLedgerPostingDocumentForSearching (org.kuali.kfs.integration.ld.LaborLedgerPostingDocumentForSearching)1 DocumentAuthorizer (org.kuali.kfs.kns.document.authorization.DocumentAuthorizer)1 TransactionalDocumentAuthorizer (org.kuali.kfs.kns.document.authorization.TransactionalDocumentAuthorizer)1 DocumentHeader (org.kuali.kfs.krad.bo.DocumentHeader)1 Document (org.kuali.kfs.krad.document.Document)1 DocumentService (org.kuali.kfs.krad.service.DocumentService)1 FinancialSystemDocumentHeader (org.kuali.kfs.sys.businessobject.FinancialSystemDocumentHeader)1 FinancialSystemMaintenanceDocument (org.kuali.kfs.sys.document.FinancialSystemMaintenanceDocument)1 GeneralLedgerPostingDocument (org.kuali.kfs.sys.document.GeneralLedgerPostingDocument)1 WorkflowDocument (org.kuali.rice.kew.api.WorkflowDocument)1 DocumentAttribute (org.kuali.rice.kew.api.document.attribute.DocumentAttribute)1 DocumentAttributeDecimal (org.kuali.rice.kew.api.document.attribute.DocumentAttributeDecimal)1 DocumentAttributeString (org.kuali.rice.kew.api.document.attribute.DocumentAttributeString)1 WorkflowException (org.kuali.rice.kew.api.exception.WorkflowException)1