use of org.kuali.kfs.module.purap.document.PurchasingDocument in project cu-kfs by CU-CommunityApps.
the class PurchasingActionBase method approve.
/**
* Overrides the superclass method so that it will also do proration for trade in and full order discount when the user clicks
* on the approve button.
*
* @see org.kuali.kfs.kns.web.struts.action.KualiDocumentActionBase#approve(org.apache.struts.action.ActionMapping,
* org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
@Override
public ActionForward approve(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
PurchasingFormBase purchasingForm = (PurchasingFormBase) form;
PurchasingDocument purDoc = (PurchasingDocument) purchasingForm.getDocument();
if (isAttachmentSizeExceedSqLimit(form, "approve") || isReasonToChangeRequired(form)) {
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
boolean isCreatingReasonNote = isCreatingReasonNote(form);
if (isCreatingReasonNote) {
// save here, so it can be picked up in b2b
SpringContext.getBean(NoteService.class).saveNoteList(purDoc.getNotes());
}
// call prorateDiscountTradeIn
SpringContext.getBean(PurapService.class).prorateForTradeInAndFullOrderDiscount(purDoc);
ActionForward forward = super.approve(mapping, form, request, response);
if (GlobalVariables.getMessageMap().hasNoErrors() && isCreatingReasonNote) {
createReasonNote(form);
}
return forward;
}
use of org.kuali.kfs.module.purap.document.PurchasingDocument in project cu-kfs by CU-CommunityApps.
the class PurchasingActionBase method downItem.
/**
* Moves the selected item down one position (These two methods up/down could easily be consolidated. For now, it seems more
* straightforward to keep them separate.)
*
* @param mapping An ActionMapping
* @param form An ActionForm
* @param request The HttpServletRequest
* @param response The HttpServletResponse
* @return An ActionForward
* @throws Exception
*/
public ActionForward downItem(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
PurchasingAccountsPayableFormBase purchasingForm = (PurchasingAccountsPayableFormBase) form;
PurchasingDocument purDocument = (PurchasingDocument) purchasingForm.getDocument();
int line = getSelectedLine(request);
purDocument.itemSwap(line, line + 1);
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
use of org.kuali.kfs.module.purap.document.PurchasingDocument 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);
}
use of org.kuali.kfs.module.purap.document.PurchasingDocument in project cu-kfs by CU-CommunityApps.
the class PurchasingActionBase method upItem.
/**
* Moves the selected item up one position.
*
* @param mapping An ActionMapping
* @param form An ActionForm
* @param request The HttpServletRequest
* @param response The HttpServletResponse
* @return An ActionForward
* @throws Exception
*/
public ActionForward upItem(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
PurchasingAccountsPayableFormBase purchasingForm = (PurchasingAccountsPayableFormBase) form;
PurchasingDocument purDocument = (PurchasingDocument) purchasingForm.getDocument();
int line = getSelectedLine(request);
purDocument.itemSwap(line, line - 1);
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
use of org.kuali.kfs.module.purap.document.PurchasingDocument in project cu-kfs by CU-CommunityApps.
the class PurchasingActionBase method clearNotCurrentYearByDocument.
public ActionForward clearNotCurrentYearByDocument(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(false);
system.setCapitalAssetTypeCode("");
}
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
Aggregations