Search in sources :

Example 1 with PurchasingCapitalAssetItem

use of org.kuali.kfs.module.purap.businessobject.PurchasingCapitalAssetItem in project cu-kfs by CU-CommunityApps.

the class PurchasingActionBase method addItemCapitalAssetByItem.

public ActionForward addItemCapitalAssetByItem(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    PurchasingFormBase purchasingForm = (PurchasingFormBase) form;
    PurchasingDocument purDocument = (PurchasingDocument) purchasingForm.getDocument();
    // get specific asset item
    PurchasingCapitalAssetItem assetItem = purDocument.getPurchasingCapitalAssetItems().get(getSelectedLine(request));
    ItemCapitalAsset asset = assetItem.getNewPurchasingItemCapitalAssetLine();
    boolean rulePassed = SpringContext.getBean(KualiRuleService.class).applyRules(new AttributedAddPurchasingItemCapitalAssetEvent("", purDocument, asset));
    if (rulePassed) {
        // grab system as well and attach asset number
        CapitalAssetSystem system = assetItem.getPurchasingCapitalAssetSystem();
        asset = assetItem.getAndResetNewPurchasingItemCapitalAssetLine();
        asset.setCapitalAssetSystemIdentifier(system.getCapitalAssetSystemIdentifier());
        if (capitalAssetSystemHasAssetItem(system, asset)) {
            GlobalVariables.getMessageMap().putError(PurapConstants.CAPITAL_ASSET_TAB_ERRORS, PurapKeyConstants.ERROR_CAPITAL_ASSET_DUPLICATE_ASSET);
        } else {
            system.getItemCapitalAssets().add(asset);
        }
    }
    return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
Also used : KualiRuleService(org.kuali.kfs.krad.service.KualiRuleService) PurchasingCapitalAssetItem(org.kuali.kfs.module.purap.businessobject.PurchasingCapitalAssetItem) PurchasingDocument(org.kuali.kfs.module.purap.document.PurchasingDocument) ItemCapitalAsset(org.kuali.kfs.integration.purap.ItemCapitalAsset) AttributedAddPurchasingItemCapitalAssetEvent(org.kuali.kfs.module.purap.document.validation.event.AttributedAddPurchasingItemCapitalAssetEvent) CapitalAssetSystem(org.kuali.kfs.integration.purap.CapitalAssetSystem)

Example 2 with PurchasingCapitalAssetItem

use of org.kuali.kfs.module.purap.businessobject.PurchasingCapitalAssetItem in project cu-kfs by CU-CommunityApps.

the class PurchasingActionBase method deleteCapitalAssetLocationByItem.

public ActionForward deleteCapitalAssetLocationByItem(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    PurchasingFormBase purchasingForm = (PurchasingFormBase) form;
    PurchasingDocument purDocument = (PurchasingDocument) purchasingForm.getDocument();
    String fullParameter = (String) request.getAttribute(KFSConstants.METHOD_TO_CALL_ATTRIBUTE);
    String assetItemIndex = StringUtils.substringBetween(fullParameter, KFSConstants.METHOD_TO_CALL_PARM1_LEFT_DEL, KFSConstants.METHOD_TO_CALL_PARM1_RIGHT_DEL);
    String locationIndex = StringUtils.substringBetween(fullParameter, KFSConstants.METHOD_TO_CALL_PARM2_LEFT_DEL, KFSConstants.METHOD_TO_CALL_PARM2_RIGHT_DEL);
    // get specific asset item and grab system as well and attach asset number
    PurchasingCapitalAssetItem assetItem = purDocument.getPurchasingCapitalAssetItems().get(Integer.parseInt(assetItemIndex));
    CapitalAssetSystem system = assetItem.getPurchasingCapitalAssetSystem();
    system.getCapitalAssetLocations().remove(Integer.parseInt(locationIndex));
    return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
Also used : PurchasingCapitalAssetItem(org.kuali.kfs.module.purap.businessobject.PurchasingCapitalAssetItem) PurchasingDocument(org.kuali.kfs.module.purap.document.PurchasingDocument) CapitalAssetSystem(org.kuali.kfs.integration.purap.CapitalAssetSystem)

Example 3 with PurchasingCapitalAssetItem

use of org.kuali.kfs.module.purap.businessobject.PurchasingCapitalAssetItem in project cu-kfs by CU-CommunityApps.

the class PurchasingActionBase method addCapitalAssetLocationByItem.

public ActionForward addCapitalAssetLocationByItem(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    PurchasingFormBase purchasingForm = (PurchasingFormBase) form;
    PurchasingDocument purDocument = (PurchasingDocument) purchasingForm.getDocument();
    CapitalAssetLocation location = purDocument.getPurchasingCapitalAssetItems().get(getSelectedLine(request)).getPurchasingCapitalAssetSystem().getNewPurchasingCapitalAssetLocationLine();
    boolean rulePassed = SpringContext.getBean(KualiRuleService.class).applyRules(new AttributedAddPurchasingCapitalAssetLocationEvent("", purDocument, location));
    if (rulePassed) {
        // get specific asset item and grab system as well and attach asset location
        PurchasingCapitalAssetItem assetItem = purDocument.getPurchasingCapitalAssetItems().get(getSelectedLine(request));
        CapitalAssetSystem system = assetItem.getPurchasingCapitalAssetSystem();
        location.setCapitalAssetSystemIdentifier(system.getCapitalAssetSystemIdentifier());
        system.getCapitalAssetLocations().add(location);
        // now reset the location as all the rules are passed successfully
        purDocument.getPurchasingCapitalAssetItems().get(getSelectedLine(request)).getPurchasingCapitalAssetSystem().resetNewPurchasingCapitalAssetLocationLine();
    }
    return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
Also used : KualiRuleService(org.kuali.kfs.krad.service.KualiRuleService) AttributedAddPurchasingCapitalAssetLocationEvent(org.kuali.kfs.module.purap.document.validation.event.AttributedAddPurchasingCapitalAssetLocationEvent) CapitalAssetLocation(org.kuali.kfs.integration.purap.CapitalAssetLocation) PurchasingCapitalAssetItem(org.kuali.kfs.module.purap.businessobject.PurchasingCapitalAssetItem) PurchasingDocument(org.kuali.kfs.module.purap.document.PurchasingDocument) CapitalAssetSystem(org.kuali.kfs.integration.purap.CapitalAssetSystem)

Example 4 with PurchasingCapitalAssetItem

use of org.kuali.kfs.module.purap.businessobject.PurchasingCapitalAssetItem in project cu-kfs by CU-CommunityApps.

the class PurchasingActionBase method selectNotCurrentYearByItem.

public ActionForward selectNotCurrentYearByItem(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    PurchasingAccountsPayableFormBase purchasingForm = (PurchasingAccountsPayableFormBase) form;
    PurchasingDocument document = (PurchasingDocument) purchasingForm.getDocument();
    PurchasingCapitalAssetItem assetItem = document.getPurchasingCapitalAssetItems().get(getSelectedLine(request));
    CapitalAssetSystem system = assetItem.getPurchasingCapitalAssetSystem();
    if (system != null) {
        system.setCapitalAssetNotReceivedCurrentFiscalYearIndicator(true);
        system.setCapitalAssetTypeCode(SpringContext.getBean(PurchasingService.class).getDefaultAssetTypeCodeNotThisFiscalYear());
    }
    return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
Also used : PurchasingCapitalAssetItem(org.kuali.kfs.module.purap.businessobject.PurchasingCapitalAssetItem) PurchasingDocument(org.kuali.kfs.module.purap.document.PurchasingDocument) CapitalAssetSystem(org.kuali.kfs.integration.purap.CapitalAssetSystem)

Example 5 with PurchasingCapitalAssetItem

use of org.kuali.kfs.module.purap.businessobject.PurchasingCapitalAssetItem 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

PurchasingCapitalAssetItem (org.kuali.kfs.module.purap.businessobject.PurchasingCapitalAssetItem)14 PurchasingDocument (org.kuali.kfs.module.purap.document.PurchasingDocument)10 CapitalAssetSystem (org.kuali.kfs.integration.purap.CapitalAssetSystem)9 ItemCapitalAsset (org.kuali.kfs.integration.purap.ItemCapitalAsset)4 CapitalAssetLocation (org.kuali.kfs.integration.purap.CapitalAssetLocation)2 KualiRuleService (org.kuali.kfs.krad.service.KualiRuleService)2 PurchasingCapitalAssetSystemBase (org.kuali.kfs.module.purap.businessobject.PurchasingCapitalAssetSystemBase)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Map (java.util.Map)1 Note (org.kuali.kfs.krad.bo.Note)1 PersistableBusinessObject (org.kuali.kfs.krad.bo.PersistableBusinessObject)1 ApproveDocumentEvent (org.kuali.kfs.krad.rules.rule.event.ApproveDocumentEvent)1 RouteDocumentEvent (org.kuali.kfs.krad.rules.rule.event.RouteDocumentEvent)1 BusinessObjectService (org.kuali.kfs.krad.service.BusinessObjectService)1 MessageMap (org.kuali.kfs.krad.util.MessageMap)1 CapitalAssetSystemType (org.kuali.kfs.module.purap.businessobject.CapitalAssetSystemType)1 PurApItem (org.kuali.kfs.module.purap.businessobject.PurApItem)1 PurchaseOrderAmendmentDocument (org.kuali.kfs.module.purap.document.PurchaseOrderAmendmentDocument)1 PurchaseOrderDocument (org.kuali.kfs.module.purap.document.PurchaseOrderDocument)1