use of org.kuali.kfs.integration.purap.CapitalAssetSystem in project cu-kfs by CU-CommunityApps.
the class PurchasingActionBase method useOffCampusAssetLocationBuildingByDocument.
public ActionForward useOffCampusAssetLocationBuildingByDocument(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 systemIndex = 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);
CapitalAssetSystem system = document.getPurchasingCapitalAssetSystems().get(Integer.parseInt(systemIndex));
if ("new".equals(assetLocationIndex)) {
useOffCampusAssetLocationBuilding(baseForm.getNewPurchasingCapitalAssetLocationLine());
} else {
useOffCampusAssetLocationBuilding(system.getCapitalAssetLocations().get(Integer.parseInt(assetLocationIndex)));
}
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
use of org.kuali.kfs.integration.purap.CapitalAssetSystem 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);
}
use of org.kuali.kfs.integration.purap.CapitalAssetSystem 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.integration.purap.CapitalAssetSystem in project cu-kfs by CU-CommunityApps.
the class PurchasingActionBase method selectNotCurrentYearByItem.
public ActionForward selectNotCurrentYearByItem(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(true);
system.setCapitalAssetTypeCode(SpringContext.getBean(PurchasingService.class).getDefaultAssetTypeCodeNotThisFiscalYear());
}
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
use of org.kuali.kfs.integration.purap.CapitalAssetSystem in project cu-kfs by CU-CommunityApps.
the class PurchaseOrderDocument method populatePurchaseOrderFromRequisition.
/**
* Populates this Purchase Order from the related Requisition Document.
*
* @param requisitionDocument the Requisition Document from which field values are copied.
*/
public void populatePurchaseOrderFromRequisition(RequisitionDocument requisitionDocument) {
this.setPurchaseOrderCreateTimestamp(SpringContext.getBean(DateTimeService.class).getCurrentTimestamp());
this.getDocumentHeader().setOrganizationDocumentNumber(requisitionDocument.getDocumentHeader().getOrganizationDocumentNumber());
this.getDocumentHeader().setDocumentDescription(requisitionDocument.getDocumentHeader().getDocumentDescription());
this.getDocumentHeader().setExplanation(requisitionDocument.getDocumentHeader().getExplanation());
this.setBillingName(requisitionDocument.getBillingName());
this.setBillingLine1Address(requisitionDocument.getBillingLine1Address());
this.setBillingLine2Address(requisitionDocument.getBillingLine2Address());
this.setBillingCityName(requisitionDocument.getBillingCityName());
this.setBillingStateCode(requisitionDocument.getBillingStateCode());
this.setBillingPostalCode(requisitionDocument.getBillingPostalCode());
this.setBillingCountryCode(requisitionDocument.getBillingCountryCode());
this.setBillingPhoneNumber(requisitionDocument.getBillingPhoneNumber());
this.setBillingEmailAddress(requisitionDocument.getBillingEmailAddress());
this.setReceivingName(requisitionDocument.getReceivingName());
this.setReceivingCityName(requisitionDocument.getReceivingCityName());
this.setReceivingLine1Address(requisitionDocument.getReceivingLine1Address());
this.setReceivingLine2Address(requisitionDocument.getReceivingLine2Address());
this.setReceivingStateCode(requisitionDocument.getReceivingStateCode());
this.setReceivingPostalCode(requisitionDocument.getReceivingPostalCode());
this.setReceivingCountryCode(requisitionDocument.getReceivingCountryCode());
this.setAddressToVendorIndicator(requisitionDocument.getAddressToVendorIndicator());
this.setDeliveryBuildingCode(requisitionDocument.getDeliveryBuildingCode());
this.setDeliveryBuildingRoomNumber(requisitionDocument.getDeliveryBuildingRoomNumber());
this.setDeliveryBuildingName(requisitionDocument.getDeliveryBuildingName());
this.setDeliveryCampusCode(requisitionDocument.getDeliveryCampusCode());
this.setDeliveryCityName(requisitionDocument.getDeliveryCityName());
this.setDeliveryCountryCode(requisitionDocument.getDeliveryCountryCode());
this.setDeliveryInstructionText(requisitionDocument.getDeliveryInstructionText());
this.setDeliveryBuildingLine1Address(requisitionDocument.getDeliveryBuildingLine1Address());
this.setDeliveryBuildingLine2Address(requisitionDocument.getDeliveryBuildingLine2Address());
this.setDeliveryPostalCode(requisitionDocument.getDeliveryPostalCode());
this.setDeliveryRequiredDate(requisitionDocument.getDeliveryRequiredDate());
this.setDeliveryRequiredDateReasonCode(requisitionDocument.getDeliveryRequiredDateReasonCode());
this.setDeliveryStateCode(requisitionDocument.getDeliveryStateCode());
this.setDeliveryToEmailAddress(requisitionDocument.getDeliveryToEmailAddress());
this.setDeliveryToName(requisitionDocument.getDeliveryToName());
this.setDeliveryToPhoneNumber(requisitionDocument.getDeliveryToPhoneNumber());
this.setDeliveryBuildingOtherIndicator(requisitionDocument.isDeliveryBuildingOtherIndicator());
this.setPurchaseOrderBeginDate(requisitionDocument.getPurchaseOrderBeginDate());
this.setPurchaseOrderCostSourceCode(requisitionDocument.getPurchaseOrderCostSourceCode());
this.setPostingYear(requisitionDocument.getPostingYear());
this.setPurchaseOrderEndDate(requisitionDocument.getPurchaseOrderEndDate());
this.setChartOfAccountsCode(requisitionDocument.getChartOfAccountsCode());
this.setDocumentFundingSourceCode(requisitionDocument.getDocumentFundingSourceCode());
this.setInstitutionContactEmailAddress(requisitionDocument.getInstitutionContactEmailAddress());
this.setInstitutionContactName(requisitionDocument.getInstitutionContactName());
this.setInstitutionContactPhoneNumber(requisitionDocument.getInstitutionContactPhoneNumber());
this.setNonInstitutionFundAccountNumber(requisitionDocument.getNonInstitutionFundAccountNumber());
this.setNonInstitutionFundChartOfAccountsCode(requisitionDocument.getNonInstitutionFundChartOfAccountsCode());
this.setNonInstitutionFundOrgChartOfAccountsCode(requisitionDocument.getNonInstitutionFundOrgChartOfAccountsCode());
this.setNonInstitutionFundOrganizationCode(requisitionDocument.getNonInstitutionFundOrganizationCode());
this.setOrganizationCode(requisitionDocument.getOrganizationCode());
this.setRecurringPaymentTypeCode(requisitionDocument.getRecurringPaymentTypeCode());
this.setRequestorPersonEmailAddress(requisitionDocument.getRequestorPersonEmailAddress());
this.setRequestorPersonName(requisitionDocument.getRequestorPersonName());
this.setRequestorPersonPhoneNumber(requisitionDocument.getRequestorPersonPhoneNumber());
this.setRequisitionIdentifier(requisitionDocument.getPurapDocumentIdentifier());
this.setPurchaseOrderTotalLimit(requisitionDocument.getPurchaseOrderTotalLimit());
this.setPurchaseOrderTransmissionMethodCode(requisitionDocument.getPurchaseOrderTransmissionMethodCode());
this.setUseTaxIndicator(requisitionDocument.isUseTaxIndicator());
this.setVendorCityName(requisitionDocument.getVendorCityName());
this.setVendorContractGeneratedIdentifier(requisitionDocument.getVendorContractGeneratedIdentifier());
this.setVendorCountryCode(requisitionDocument.getVendorCountryCode());
this.setVendorCustomerNumber(requisitionDocument.getVendorCustomerNumber());
this.setVendorAttentionName(requisitionDocument.getVendorAttentionName());
this.setVendorDetailAssignedIdentifier(requisitionDocument.getVendorDetailAssignedIdentifier());
this.setVendorFaxNumber(requisitionDocument.getVendorFaxNumber());
this.setVendorHeaderGeneratedIdentifier(requisitionDocument.getVendorHeaderGeneratedIdentifier());
this.setVendorLine1Address(requisitionDocument.getVendorLine1Address());
this.setVendorLine2Address(requisitionDocument.getVendorLine2Address());
this.setVendorAddressInternationalProvinceName(requisitionDocument.getVendorAddressInternationalProvinceName());
this.setVendorName(requisitionDocument.getVendorName());
this.setVendorNoteText(requisitionDocument.getVendorNoteText());
this.setVendorPhoneNumber(requisitionDocument.getVendorPhoneNumber());
this.setVendorPostalCode(requisitionDocument.getVendorPostalCode());
this.setVendorStateCode(requisitionDocument.getVendorStateCode());
this.setVendorRestrictedIndicator(requisitionDocument.getVendorRestrictedIndicator());
this.setJustification(requisitionDocument.getJustification());
// KFSPTS-1458, KFSPTS-16990: Also copy vendorEmailAddress from Requisition to PO
this.setVendorEmailAddress(requisitionDocument.getVendorEmailAddress());
this.setExternalOrganizationB2bSupplierIdentifier(requisitionDocument.getExternalOrganizationB2bSupplierIdentifier());
this.setRequisitionSourceCode(requisitionDocument.getRequisitionSourceCode());
this.setAccountsPayablePurchasingDocumentLinkIdentifier(requisitionDocument.getAccountsPayablePurchasingDocumentLinkIdentifier());
this.setReceivingDocumentRequiredIndicator(requisitionDocument.isReceivingDocumentRequiredIndicator());
this.setPaymentRequestPositiveApprovalIndicator(requisitionDocument.isPaymentRequestPositiveApprovalIndicator());
setApplicationDocumentStatus(PurchaseOrderStatuses.APPDOC_IN_PROCESS);
this.setAccountDistributionMethod(requisitionDocument.getAccountDistributionMethod());
// Copy items from requisition (which will copy the item's accounts and capital assets)
List<PurchaseOrderItem> items = new ArrayList<>();
for (PurApItem reqItem : ((PurchasingAccountsPayableDocument) requisitionDocument).getItems()) {
RequisitionCapitalAssetItem reqCamsItem = (RequisitionCapitalAssetItem) requisitionDocument.getPurchasingCapitalAssetItemByItemIdentifier(reqItem.getItemIdentifier());
items.add(new PurchaseOrderItem((RequisitionItem) reqItem, this, reqCamsItem));
}
this.setItems(items);
// Copy capital asset information that is directly off the document.
this.setCapitalAssetSystemTypeCode(requisitionDocument.getCapitalAssetSystemTypeCode());
this.setCapitalAssetSystemStateCode(requisitionDocument.getCapitalAssetSystemStateCode());
for (CapitalAssetSystem capitalAssetSystem : requisitionDocument.getPurchasingCapitalAssetSystems()) {
this.getPurchasingCapitalAssetSystems().add(new PurchaseOrderCapitalAssetSystem(capitalAssetSystem));
}
this.fixItemReferences();
// KFSUPGRADE-346/KITI-727
if (ObjectUtils.isNull(getPurapDocumentIdentifier())) {
// need retrieve the next available PO id to save in GL entries (only do if purap id is null which should be on first
// save)
SequenceAccessorService sas = SpringContext.getBean(SequenceAccessorService.class);
Long poSequenceNumber = sas.getNextAvailableSequenceNumber("PO_ID", this.getClass());
setPurapDocumentIdentifier(poSequenceNumber.intValue());
}
// KFSUPGRADE-337/KITI-2414 : checking for duplicate sensitive data types
Set<String> currentSensitiveDataCodes = new HashSet<String>();
if (purchaseOrderSensitiveData != null) {
for (PurchaseOrderSensitiveData sensitiveData : purchaseOrderSensitiveData) {
currentSensitiveDataCodes.add(sensitiveData.getSensitiveDataCode());
}
}
if (requisitionDocument.isSensitive()) {
for (PurchasingItemBase pib : (List<PurchasingItemBase>) requisitionDocument.getItems()) {
CommodityCode cc = pib.getCommodityCode();
if (cc != null && cc.getSensitiveDataCode() != null && currentSensitiveDataCodes.add(cc.getSensitiveDataCode())) {
if (purchaseOrderSensitiveData == null) {
boolean addNewData = true;
purchaseOrderSensitiveData = getPurchaseOrderSensitiveData();
for (PurchaseOrderSensitiveData sensitiveData : purchaseOrderSensitiveData) {
if (!currentSensitiveDataCodes.add(sensitiveData.getSensitiveDataCode())) {
addNewData = false;
}
}
if (addNewData) {
purchaseOrderSensitiveData.add(new PurchaseOrderSensitiveData(getPurapDocumentIdentifier(), getRequisitionIdentifier(), cc.getSensitiveDataCode()));
}
} else {
purchaseOrderSensitiveData.add(new PurchaseOrderSensitiveData(getPurapDocumentIdentifier(), getRequisitionIdentifier(), cc.getSensitiveDataCode()));
}
}
}
}
if (purchaseOrderSensitiveData != null) {
SpringContext.getBean(BusinessObjectService.class).save(purchaseOrderSensitiveData);
}
}
Aggregations