Search in sources :

Example 6 with CapitalAssetSystem

use of org.kuali.kfs.integration.purap.CapitalAssetSystem 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 7 with CapitalAssetSystem

use of org.kuali.kfs.integration.purap.CapitalAssetSystem 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 8 with CapitalAssetSystem

use of org.kuali.kfs.integration.purap.CapitalAssetSystem in project cu-kfs by CU-CommunityApps.

the class PurchasingActionBase method selectNotCurrentYearByDocument.

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

Example 9 with CapitalAssetSystem

use of org.kuali.kfs.integration.purap.CapitalAssetSystem in project cu-kfs by CU-CommunityApps.

the class PurchasingActionBase method addCapitalAssetLocationByDocument.

public ActionForward addCapitalAssetLocationByDocument(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    PurchasingFormBase purchasingForm = (PurchasingFormBase) form;
    CapitalAssetLocation location = purchasingForm.getAndResetNewPurchasingCapitalAssetLocationLine();
    PurchasingDocument purDocument = (PurchasingDocument) purchasingForm.getDocument();
    boolean rulePassed = SpringContext.getBean(KualiRuleService.class).applyRules(new AttributedAddPurchasingCapitalAssetLocationEvent("", purDocument, location));
    rulePassed = rulePassed && SpringContext.getBean(PurchasingService.class).checkCapitalAssetLocation(location);
    if (rulePassed) {
        // get specific asset item and grab system as well and attach asset number
        CapitalAssetSystem system = purDocument.getPurchasingCapitalAssetSystems().get(getSelectedLine(request));
        location.setCapitalAssetSystemIdentifier(system.getCapitalAssetSystemIdentifier());
        system.getCapitalAssetLocations().add(location);
    }
    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) PurchasingDocument(org.kuali.kfs.module.purap.document.PurchasingDocument) PurchasingService(org.kuali.kfs.module.purap.document.service.PurchasingService) CapitalAssetSystem(org.kuali.kfs.integration.purap.CapitalAssetSystem)

Example 10 with CapitalAssetSystem

use of org.kuali.kfs.integration.purap.CapitalAssetSystem in project cu-kfs by CU-CommunityApps.

the class PurchasingActionBase method deleteCapitalAssetLocationByDocument.

public ActionForward deleteCapitalAssetLocationByDocument(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 systemIndex = 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
    CapitalAssetSystem system = purDocument.getPurchasingCapitalAssetSystems().get(Integer.parseInt(systemIndex));
    system.getCapitalAssetLocations().remove(Integer.parseInt(locationIndex));
    return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
Also used : PurchasingDocument(org.kuali.kfs.module.purap.document.PurchasingDocument) CapitalAssetSystem(org.kuali.kfs.integration.purap.CapitalAssetSystem)

Aggregations

CapitalAssetSystem (org.kuali.kfs.integration.purap.CapitalAssetSystem)16 PurchasingDocument (org.kuali.kfs.module.purap.document.PurchasingDocument)14 PurchasingCapitalAssetItem (org.kuali.kfs.module.purap.businessobject.PurchasingCapitalAssetItem)8 KualiRuleService (org.kuali.kfs.krad.service.KualiRuleService)4 CapitalAssetLocation (org.kuali.kfs.integration.purap.CapitalAssetLocation)3 ItemCapitalAsset (org.kuali.kfs.integration.purap.ItemCapitalAsset)2 AttributedAddPurchasingCapitalAssetLocationEvent (org.kuali.kfs.module.purap.document.validation.event.AttributedAddPurchasingCapitalAssetLocationEvent)2 AttributedAddPurchasingItemCapitalAssetEvent (org.kuali.kfs.module.purap.document.validation.event.AttributedAddPurchasingItemCapitalAssetEvent)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 List (java.util.List)1 BusinessObjectService (org.kuali.kfs.krad.service.BusinessObjectService)1 SequenceAccessorService (org.kuali.kfs.krad.service.SequenceAccessorService)1 PurApItem (org.kuali.kfs.module.purap.businessobject.PurApItem)1 PurchaseOrderCapitalAssetSystem (org.kuali.kfs.module.purap.businessobject.PurchaseOrderCapitalAssetSystem)1 PurchaseOrderItem (org.kuali.kfs.module.purap.businessobject.PurchaseOrderItem)1 PurchaseOrderSensitiveData (org.kuali.kfs.module.purap.businessobject.PurchaseOrderSensitiveData)1 PurchasingItemBase (org.kuali.kfs.module.purap.businessobject.PurchasingItemBase)1 RequisitionCapitalAssetItem (org.kuali.kfs.module.purap.businessobject.RequisitionCapitalAssetItem)1 RequisitionItem (org.kuali.kfs.module.purap.businessobject.RequisitionItem)1