use of org.kuali.kfs.module.purap.document.PurchasingDocument in project cu-kfs by CU-CommunityApps.
the class PurchasingActionBase method selectSystem.
public ActionForward selectSystem(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
PurchasingAccountsPayableFormBase purchasingForm = (PurchasingAccountsPayableFormBase) form;
PurchasingDocument document = (PurchasingDocument) purchasingForm.getDocument();
String errorPath = PurapConstants.CAPITAL_ASSET_TAB_ERRORS;
// validate entry is selected for each field
if (StringUtils.isEmpty(document.getCapitalAssetSystemTypeCode())) {
GlobalVariables.getMessageMap().putError(errorPath, KFSKeyConstants.ERROR_CUSTOM, "Capital Asset System Type and Capital Asset System State are both required to proceed");
} else if (StringUtils.isEmpty(document.getCapitalAssetSystemStateCode())) {
GlobalVariables.getMessageMap().putError(errorPath, KFSKeyConstants.ERROR_CUSTOM, "Capital Asset System Type and Capital Asset System State are both required to proceed");
} else {
document.refreshReferenceObject(PurapPropertyConstants.CAPITAL_ASSET_SYSTEM_TYPE);
document.refreshReferenceObject(PurapPropertyConstants.CAPITAL_ASSET_SYSTEM_STATE);
if (validateCapitalAssetSystemStateAllowed(document.getCapitalAssetSystemType(), document.getCapitalAssetSystemState())) {
SpringContext.getBean(PurchasingService.class).setupCapitalAssetSystem(document);
SpringContext.getBean(PurchasingService.class).setupCapitalAssetItems(document);
if (!document.getPurchasingCapitalAssetItems().isEmpty()) {
saveDocumentNoValidationUsingClearErrorMap(document);
} else {
// TODO: extract this and above strings to app resources
GlobalVariables.getMessageMap().putError(errorPath, KFSKeyConstants.ERROR_CUSTOM, "No items were found that met the requirements for Capital Asset data collection");
}
saveDocumentNoValidationUsingClearErrorMap(document);
} else {
// Blank out type selection, otherwise UI marks it read only
document.setCapitalAssetSystemStateCode(null);
document.setCapitalAssetSystemState(null);
}
}
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
use of org.kuali.kfs.module.purap.document.PurchasingDocument in project cu-kfs by CU-CommunityApps.
the class PurchasingFormBase method getPurchasingCapitalAssetSystemCommentsAvailability.
public String getPurchasingCapitalAssetSystemCommentsAvailability() {
String availability = PurapConstants.CapitalAssetAvailability.NONE;
PurchasingDocument pd = (PurchasingDocument) this.getDocument();
if ((PurapConstants.CapitalAssetSystemTypes.ONE_SYSTEM.equals(pd.getCapitalAssetSystemTypeCode()) || PurapConstants.CapitalAssetSystemTypes.MULTIPLE.equals(pd.getCapitalAssetSystemTypeCode()))) {
availability = PurapConstants.CapitalAssetAvailability.ONCE;
} else if (PurapConstants.CapitalAssetSystemTypes.INDIVIDUAL.equals(pd.getCapitalAssetSystemTypeCode())) {
availability = PurapConstants.CapitalAssetAvailability.EACH;
}
return availability;
}
use of org.kuali.kfs.module.purap.document.PurchasingDocument in project cu-kfs by CU-CommunityApps.
the class PurchasingFormBase method getPurchasingCapitalAssetCountAssetNumberAvailability.
public String getPurchasingCapitalAssetCountAssetNumberAvailability() {
String availability = PurapConstants.CapitalAssetAvailability.NONE;
PurchasingDocument pd = (PurchasingDocument) this.getDocument();
if ((PurapConstants.CapitalAssetSystemTypes.ONE_SYSTEM.equals(pd.getCapitalAssetSystemTypeCode()) && PurapConstants.CapitalAssetSystemStates.NEW.equals(pd.getCapitalAssetSystemStateCode()))) {
availability = PurapConstants.CapitalAssetAvailability.ONCE;
}
return availability;
}
use of org.kuali.kfs.module.purap.document.PurchasingDocument in project cu-kfs by CU-CommunityApps.
the class PurchasingFormBase method getPurchasingCapitalAssetSystemDescriptionAvailability.
public String getPurchasingCapitalAssetSystemDescriptionAvailability() {
String availability = PurapConstants.CapitalAssetAvailability.NONE;
PurchasingDocument pd = (PurchasingDocument) this.getDocument();
if ((PurapConstants.CapitalAssetSystemTypes.ONE_SYSTEM.equals(pd.getCapitalAssetSystemTypeCode()) && PurapConstants.CapitalAssetSystemStates.NEW.equals(pd.getCapitalAssetSystemStateCode())) || (PurapConstants.CapitalAssetSystemTypes.MULTIPLE.equals(pd.getCapitalAssetSystemTypeCode()) && PurapConstants.CapitalAssetSystemStates.NEW.equals(pd.getCapitalAssetSystemStateCode()))) {
availability = PurapConstants.CapitalAssetAvailability.ONCE;
}
return availability;
}
use of org.kuali.kfs.module.purap.document.PurchasingDocument in project cu-kfs by CU-CommunityApps.
the class CuRequisitionAction method addItem.
@SuppressWarnings("unchecked")
@Override
public ActionForward addItem(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
PurchasingFormBase purchasingForm = (PurchasingFormBase) form;
PurApItem item = purchasingForm.getNewPurchasingItemLine();
RequisitionItem requisitionItem = (RequisitionItem) item;
PurchasingDocument purDocument = (PurchasingDocument) purchasingForm.getDocument();
if (StringUtils.isBlank(requisitionItem.getPurchasingCommodityCode())) {
boolean commCodeParam = SpringContext.getBean(ParameterService.class).getParameterValueAsBoolean(CuRequisitionDocument.class, PurapParameterConstants.ENABLE_DEFAULT_VENDOR_COMMODITY_CODE_IND);
if (commCodeParam) {
if (purchasingForm instanceof RequisitionForm) {
CuRequisitionDocument reqs = (CuRequisitionDocument) purchasingForm.getDocument();
VendorDetail dtl = reqs.getVendorDetail();
if (ObjectUtils.isNotNull(dtl)) {
List<VendorCommodityCode> vcc = dtl.getVendorCommodities();
String defaultCommodityCode = "";
Iterator<VendorCommodityCode> it = vcc.iterator();
while (it.hasNext()) {
VendorCommodityCode commodity = it.next();
if (commodity.isCommodityDefaultIndicator()) {
defaultCommodityCode = commodity.getPurchasingCommodityCode();
requisitionItem.setPurchasingCommodityCode(defaultCommodityCode);
}
}
}
}
}
}
boolean rulePassed = SpringContext.getBean(KualiRuleService.class).applyRules(new AttributedAddPurchasingAccountsPayableItemEvent("", purDocument, item));
if (rulePassed) {
item = purchasingForm.getAndResetNewPurchasingItemLine();
purDocument.addItem(item);
// KFSPTS-985
if (((PurchasingDocumentBase) (purDocument)).isIntegratedWithFavoriteAccount()) {
populatePrimaryFavoriteAccount(item.getSourceAccountingLines(), getAccountClassFromNewPurApAccountingLine(purchasingForm));
}
}
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
Aggregations