Search in sources :

Example 6 with PurchasingDocumentBase

use of org.kuali.kfs.module.purap.document.PurchasingDocumentBase in project cu-kfs by CU-CommunityApps.

the class PurchasingActionBase method populateBuilding.

public ActionForward populateBuilding(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    PurchasingFormBase purForm = (PurchasingFormBase) form;
    PurchasingDocumentBase document = (PurchasingDocumentBase) purForm.getDocument();
    updateAssetBuildingLocations(purForm, request, document);
    return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
Also used : PurchasingDocumentBase(org.kuali.kfs.module.purap.document.PurchasingDocumentBase)

Example 7 with PurchasingDocumentBase

use of org.kuali.kfs.module.purap.document.PurchasingDocumentBase in project cu-kfs by CU-CommunityApps.

the class PurchasingActionBase method setupAccountDistribution.

/**
 * Reveals the account distribution section.
 *
 * @param mapping An ActionMapping
 * @param form An ActionForm
 * @param request The HttpServletRequest
 * @param response The HttpServletResponse
 * @return An ActionForward
 * @throws Exception
 */
@SuppressWarnings("unchecked")
public ActionForward setupAccountDistribution(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    PurchasingFormBase purchasingForm = (PurchasingFormBase) form;
    PurchasingDocumentBase document = (PurchasingDocumentBase) purchasingForm.getDocument();
    purchasingForm.setHideDistributeAccounts(false);
    // KFSPTS-985
    if (document.isIntegratedWithFavoriteAccount()) {
        populatePrimaryFavoriteAccount(purchasingForm.getAccountDistributionsourceAccountingLines(), getAccountClassFromNewPurApAccountingLine(purchasingForm));
    }
    return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
Also used : PurchasingDocumentBase(org.kuali.kfs.module.purap.document.PurchasingDocumentBase)

Example 8 with PurchasingDocumentBase

use of org.kuali.kfs.module.purap.document.PurchasingDocumentBase in project cu-kfs by CU-CommunityApps.

the class PurchasingActionBase method addFavoriteAccount.

/*
     * KFSPTS-985 : add favorite account.
     * This is a copy from requisitionaction.  to be shared by both req & po
     */
public ActionForward addFavoriteAccount(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    PurchasingFormBase poForm = (PurchasingFormBase) form;
    PurchasingDocumentBase document = (PurchasingDocumentBase) poForm.getDocument();
    int itemIdx = getSelectedLine(request);
    final int DISTRIBUTION_INDEX = -2;
    PurchasingFavoriteAccountLineBuilderBase<? extends PurApAccountingLine> favoriteAccountBuilder;
    // Initialize the correct builder based on whether the Favorite Account is for an item in the list or for account distribution.
    if (itemIdx >= 0) {
        PurchasingItemBase item = (PurchasingItemBase) document.getItem(itemIdx);
        favoriteAccountBuilder = new PurchasingFavoriteAccountLineBuilderForLineItem<PurApAccountingLine>(item, itemIdx, poForm.setupNewPurchasingAccountingLine());
    } else if (itemIdx == DISTRIBUTION_INDEX) {
        favoriteAccountBuilder = new PurchasingFavoriteAccountLineBuilderForDistribution<PurApAccountingLine>(document, poForm.getAccountDistributionsourceAccountingLines(), poForm.setupNewAccountDistributionAccountingLine());
    } else {
        return mapping.findForward(KFSConstants.MAPPING_BASIC);
    }
    // Add a new Favorite-Account-derived accounting line to the list, with errors inserted into the message map as appropriate.
    favoriteAccountBuilder.addNewFavoriteAccountLineToListIfPossible();
    return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
Also used : PurchasingFavoriteAccountLineBuilderForDistribution(edu.cornell.kfs.module.purap.util.PurchasingFavoriteAccountLineBuilderForDistribution) PurApAccountingLine(org.kuali.kfs.module.purap.businessobject.PurApAccountingLine) PurchasingItemBase(org.kuali.kfs.module.purap.businessobject.PurchasingItemBase) PurchasingDocumentBase(org.kuali.kfs.module.purap.document.PurchasingDocumentBase)

Example 9 with PurchasingDocumentBase

use of org.kuali.kfs.module.purap.document.PurchasingDocumentBase in project cu-kfs by CU-CommunityApps.

the class GroupTitleLineRenderer method buildFavoriteAccounts.

private String buildFavoriteAccounts(String accountPrefix) {
    int itemIdx = getItemIdx(accountPrefix);
    Integer accountLineId = null;
    if (isDocumentIntegratedFavoriteAccount()) {
        if (itemIdx >= 0) {
            accountLineId = ((PurchasingItemBase) ((PurchasingDocumentBase) this.getAccountingDocument()).getItem(itemIdx)).getFavoriteAccountLineIdentifier();
        } else {
            accountLineId = ((PurchasingDocumentBase) this.getAccountingDocument()).getFavoriteAccountLineIdentifier();
        }
    }
    StringBuffer favoriteAccountLine = new StringBuffer();
    favoriteAccountLine.append("<tr>");
    favoriteAccountLine.append("<th colspan=\"2\" align=\"right\" valign=\"middle\" class=\"bord-l-b\">");
    favoriteAccountLine.append("<div  align=\"right\">");
    favoriteAccountLine.append("Favorite Account");
    favoriteAccountLine.append("</div>");
    favoriteAccountLine.append("</th>");
    if (StringUtils.isBlank(accountPrefix)) {
        accountPrefix = "document.";
    }
    favoriteAccountLine.append("<td colspan=\"7\" class=\"infoline\">");
    favoriteAccountLine.append("<select name=\"").append(accountPrefix).append("favoriteAccountLineIdentifier\" id=\"").append(accountPrefix).append("favoriteAccountLineIdentifier\" title=\"* Favorite Account\">");
    FavoriteAccountValuesFinder accounts = new FavoriteAccountValuesFinder();
    for (KeyValue keyValue : (List<KeyValue>) accounts.getKeyValues()) {
        favoriteAccountLine.append("<option value=\"").append(keyValue.getKey());
        if (checkToAddError(accountPrefix + "favoriteAccountLineIdentifier")) {
            favoriteAccountLine.append(getSelected(accountLineId, keyValue.getKey()));
        } else {
            favoriteAccountLine.append("\" >");
        }
        favoriteAccountLine.append(keyValue.getValue());
        favoriteAccountLine.append("</option>\n");
    }
    favoriteAccountLine.append("</select>");
    if (checkToAddError(accountPrefix + "favoriteAccountLineIdentifier")) {
        favoriteAccountLine.append(getErrorIconImageTag());
    }
    favoriteAccountLine.append("</td>");
    favoriteAccountLine.append("<td valign=\"top\" class=\"infoline\">");
    favoriteAccountLine.append("<div style=\"text-align: center;\">");
    favoriteAccountLine.append("<input type=\"image\" name=\"methodToCall.addFavoriteAccount.line").append(itemIdx).append(".anchorFavoriteAnchor\" src=\"kr/static/images/tinybutton-add1.gif\" tabindex=\"0\" class=\"tinybutton\"");
    favoriteAccountLine.append(" title=\"Add Favorite  Accounting Line\" alt=\"Add Favorite Accounting Line\">");
    favoriteAccountLine.append("</input>");
    favoriteAccountLine.append("<br></div></td>");
    favoriteAccountLine.append("</tr>");
    return favoriteAccountLine.toString();
}
Also used : KeyValue(org.kuali.rice.core.api.util.KeyValue) ArrayList(java.util.ArrayList) List(java.util.List) PurchasingDocumentBase(org.kuali.kfs.module.purap.document.PurchasingDocumentBase) FavoriteAccountValuesFinder(edu.cornell.kfs.sys.businessobject.options.FavoriteAccountValuesFinder)

Aggregations

PurchasingDocumentBase (org.kuali.kfs.module.purap.document.PurchasingDocumentBase)9 KualiRuleService (org.kuali.kfs.krad.service.KualiRuleService)2 PurApItem (org.kuali.kfs.module.purap.businessobject.PurApItem)2 PurchasingDocument (org.kuali.kfs.module.purap.document.PurchasingDocument)2 AttributedAddPurchasingAccountsPayableItemEvent (org.kuali.kfs.module.purap.document.validation.event.AttributedAddPurchasingAccountsPayableItemEvent)2 CuRequisitionDocument (edu.cornell.kfs.module.purap.document.CuRequisitionDocument)1 PurchaseOrderTransmissionMethodDataRulesServiceImpl (edu.cornell.kfs.module.purap.document.service.impl.PurchaseOrderTransmissionMethodDataRulesServiceImpl)1 PurchasingFavoriteAccountLineBuilderForDistribution (edu.cornell.kfs.module.purap.util.PurchasingFavoriteAccountLineBuilderForDistribution)1 FavoriteAccountValuesFinder (edu.cornell.kfs.sys.businessobject.options.FavoriteAccountValuesFinder)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 ParameterService (org.kuali.kfs.coreservice.framework.parameter.ParameterService)1 PersistableBusinessObject (org.kuali.kfs.krad.bo.PersistableBusinessObject)1 MessageMap (org.kuali.kfs.krad.util.MessageMap)1 PurApAccountingLine (org.kuali.kfs.module.purap.businessobject.PurApAccountingLine)1 PurchasingItemBase (org.kuali.kfs.module.purap.businessobject.PurchasingItemBase)1 RequisitionItem (org.kuali.kfs.module.purap.businessobject.RequisitionItem)1 PurchaseOrderAmendmentDocument (org.kuali.kfs.module.purap.document.PurchaseOrderAmendmentDocument)1 PurchaseOrderDocument (org.kuali.kfs.module.purap.document.PurchaseOrderDocument)1 RequisitionDocument (org.kuali.kfs.module.purap.document.RequisitionDocument)1