Search in sources :

Example 6 with PurchasingCapitalAssetItem

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

the class PurchasingDocumentBase method deleteItem.

/**
 * @see org.kuali.kfs.module.purap.document.PurchasingAccountsPayableDocument#deleteItem(int lineNum)
 */
@Override
public void deleteItem(int lineNum) {
    // remove associated asset items
    PurApItem item = items.get(lineNum);
    if (ObjectUtils.isNotNull(item) && item.getItemIdentifier() != null) {
        PurchasingCapitalAssetItem purchasingCapitalAssetItem = getPurchasingCapitalAssetItemByItemIdentifier(item.getItemIdentifier());
        if (ObjectUtils.isNotNull(purchasingCapitalAssetItem)) {
            getPurchasingCapitalAssetItems().remove(purchasingCapitalAssetItem);
        }
        // no more capital asset items, clear cap asset fields
        if (getPurchasingCapitalAssetItems().size() == 0) {
            clearCapitalAssetFields();
        }
    }
    super.deleteItem(lineNum);
}
Also used : PurApItem(org.kuali.kfs.module.purap.businessobject.PurApItem) PurchasingCapitalAssetItem(org.kuali.kfs.module.purap.businessobject.PurchasingCapitalAssetItem)

Example 7 with PurchasingCapitalAssetItem

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

the class PurchasingDocumentBase method buildListOfDeletionAwareLists.

/**
 * @see org.kuali.kfs.module.purap.document.PurchasingAccountsPayableDocumentBase#buildListOfDeletionAwareLists()
 */
@Override
public List buildListOfDeletionAwareLists() {
    List managedLists = new ArrayList<List>();
    managedLists.add(getDeletionAwareAccountingLines());
    managedLists.add(getDeletionAwareUseTaxItems());
    if (allowDeleteAwareCollection) {
        List<ItemCapitalAsset> assetLists = new ArrayList<ItemCapitalAsset>();
        if (StringUtils.equals(this.getCapitalAssetSystemTypeCode(), PurapConstants.CapitalAssetSystemTypes.INDIVIDUAL)) {
            for (PurchasingCapitalAssetItem capitalAssetItem : this.getPurchasingCapitalAssetItems()) {
                // just let the assetLists be empty ArrayList.
                if (capitalAssetItem.getPurchasingCapitalAssetSystem() != null) {
                    assetLists.addAll(capitalAssetItem.getPurchasingCapitalAssetSystem().getItemCapitalAssets());
                }
            }
        } else {
            for (CapitalAssetSystem system : this.getPurchasingCapitalAssetSystems()) {
                assetLists.addAll(system.getItemCapitalAssets());
            }
        }
        managedLists.add(assetLists);
        managedLists.add(this.getPurchasingCapitalAssetSystems());
        managedLists.add(this.getPurchasingCapitalAssetItems());
        managedLists.add(this.getItems());
    }
    return managedLists;
}
Also used : PurchasingCapitalAssetItem(org.kuali.kfs.module.purap.businessobject.PurchasingCapitalAssetItem) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) ItemCapitalAsset(org.kuali.kfs.integration.purap.ItemCapitalAsset) CapitalAssetSystem(org.kuali.kfs.integration.purap.CapitalAssetSystem)

Example 8 with PurchasingCapitalAssetItem

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

the class PurchasingActionBase method deleteItemCapitalAssetByItem.

public ActionForward deleteItemCapitalAssetByItem(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 = true;
    if (rulePassed) {
        String fullParameter = (String) request.getAttribute(KFSConstants.METHOD_TO_CALL_ATTRIBUTE);
        String assetIndex = StringUtils.substringBetween(fullParameter, KFSConstants.METHOD_TO_CALL_PARM2_LEFT_DEL, KFSConstants.METHOD_TO_CALL_PARM2_RIGHT_DEL);
        PurchasingCapitalAssetSystemBase system = (PurchasingCapitalAssetSystemBase) assetItem.getPurchasingCapitalAssetSystem();
        system.getItemCapitalAssets().remove(Integer.parseInt(assetIndex));
    }
    return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
Also used : PurchasingCapitalAssetItem(org.kuali.kfs.module.purap.businessobject.PurchasingCapitalAssetItem) PurchasingDocument(org.kuali.kfs.module.purap.document.PurchasingDocument) PurchasingCapitalAssetSystemBase(org.kuali.kfs.module.purap.businessobject.PurchasingCapitalAssetSystemBase) ItemCapitalAsset(org.kuali.kfs.integration.purap.ItemCapitalAsset)

Example 9 with PurchasingCapitalAssetItem

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

the class PurchasingActionBase method clearNotCurrentYearByItem.

public ActionForward clearNotCurrentYearByItem(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(false);
        system.setCapitalAssetTypeCode("");
    }
    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 10 with PurchasingCapitalAssetItem

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

the class PurchasingActionBase method useOffCampusAssetLocationBuildingByItem.

public ActionForward useOffCampusAssetLocationBuildingByItem(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    PurchasingFormBase baseForm = (PurchasingFormBase) form;
    PurchasingDocument document = (PurchasingDocument) baseForm.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 assetLocationIndex = StringUtils.substringBetween(fullParameter, KFSConstants.METHOD_TO_CALL_PARM2_LEFT_DEL, KFSConstants.METHOD_TO_CALL_PARM2_RIGHT_DEL);
    PurchasingCapitalAssetItem assetItem = document.getPurchasingCapitalAssetItems().get(Integer.parseInt(assetItemIndex));
    CapitalAssetSystem system = assetItem.getPurchasingCapitalAssetSystem();
    if ("new".equals(assetLocationIndex)) {
        useOffCampusAssetLocationBuilding(system.getNewPurchasingCapitalAssetLocationLine());
    } else {
        useOffCampusAssetLocationBuilding(system.getCapitalAssetLocations().get(Integer.parseInt(assetLocationIndex)));
    }
    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)

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