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);
}
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);
}
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);
}
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();
}
Aggregations