Search in sources :

Example 1 with ApproveDocumentEvent

use of org.kuali.kfs.krad.rules.rule.event.ApproveDocumentEvent in project cu-kfs by CU-CommunityApps.

the class PurchasingDocumentBase method prepareForSave.

/**
 * Overrides the method in PurchasingAccountsPayableDocumentBase to remove the
 * purchasingCapitalAssetSystem when the system type is either ONE or MULT.
 */
@Override
public void prepareForSave(KualiDocumentEvent event) {
    super.prepareForSave(event);
    if (StringUtils.isNotBlank(this.getCapitalAssetSystemTypeCode())) {
        if (this.getCapitalAssetSystemTypeCode().equals(PurapConstants.CapitalAssetSystemTypes.ONE_SYSTEM) || this.getCapitalAssetSystemTypeCode().equals(PurapConstants.CapitalAssetSystemTypes.MULTIPLE)) {
            // If the system state is ONE or MULT, we have to remove all the systems on the items because it's not applicable.
            for (PurchasingCapitalAssetItem camsItem : this.getPurchasingCapitalAssetItems()) {
                camsItem.setPurchasingCapitalAssetSystem(null);
            }
        }
    }
    if (event instanceof RouteDocumentEvent || event instanceof ApproveDocumentEvent) {
        boolean defaultUseTaxIndicatorValue = SpringContext.getBean(PurchasingService.class).getDefaultUseTaxIndicatorValue(this);
        SpringContext.getBean(PurapService.class).updateUseTaxIndicator(this, defaultUseTaxIndicatorValue);
    }
    // KFSUPGRADE-583
    checkForFederalAccount();
}
Also used : ApproveDocumentEvent(org.kuali.kfs.krad.rules.rule.event.ApproveDocumentEvent) PurapService(org.kuali.kfs.module.purap.document.service.PurapService) PurchasingCapitalAssetItem(org.kuali.kfs.module.purap.businessobject.PurchasingCapitalAssetItem) RouteDocumentEvent(org.kuali.kfs.krad.rules.rule.event.RouteDocumentEvent) PurchasingService(org.kuali.kfs.module.purap.document.service.PurchasingService)

Aggregations

ApproveDocumentEvent (org.kuali.kfs.krad.rules.rule.event.ApproveDocumentEvent)1 RouteDocumentEvent (org.kuali.kfs.krad.rules.rule.event.RouteDocumentEvent)1 PurchasingCapitalAssetItem (org.kuali.kfs.module.purap.businessobject.PurchasingCapitalAssetItem)1 PurapService (org.kuali.kfs.module.purap.document.service.PurapService)1 PurchasingService (org.kuali.kfs.module.purap.document.service.PurchasingService)1