use of org.kuali.kfs.vnd.businessobject.VendorDetail in project cu-kfs by CU-CommunityApps.
the class CuVendorMaintainableImpl method doRouteStatusChange.
@Override
public void doRouteStatusChange(DocumentHeader header) {
LOG.debug("doRouteStatusChange: entering");
super.doRouteStatusChange(header);
VendorDetail vendorDetail = (VendorDetail) getBusinessObject();
WorkflowDocument workflowDoc = header.getWorkflowDocument();
if (workflowDoc.isProcessed()) {
LOG.debug("doRouteStatusChange: workflow is processed");
this.saveBusinessObject();
if (recordPvenRouteStatusChangeForPaymentWorksIsEnabled()) {
performPaymentWorksApprovalProcessingForVendor(vendorDetail, this.getDocumentNumber(), this.getMaintenanceAction());
}
} else if (workflowDoc.isDisapproved() || workflowDoc.isCanceled()) {
LOG.debug("doRouteStatusChange: disapproved or canceled");
if (recordPvenRouteStatusChangeForPaymentWorksIsEnabled()) {
performPaymentWorksDisapprovalCancelProcessingForVendor(vendorDetail, this.getDocumentNumber(), this.getMaintenanceAction());
}
}
}
use of org.kuali.kfs.vnd.businessobject.VendorDetail in project cu-kfs by CU-CommunityApps.
the class CuDisbursementVoucherAction method refreshAfterPayeeSelection.
protected ActionForward refreshAfterPayeeSelection(ActionMapping mapping, CuDisbursementVoucherForm dvForm, HttpServletRequest request) {
String refreshCaller = dvForm.getRefreshCaller();
CuDisbursementVoucherDocument document = (CuDisbursementVoucherDocument) dvForm.getDocument();
boolean isPayeeLookupable = KFSConstants.KUALI_DISBURSEMENT_PAYEE_LOOKUPABLE_IMPL.equals(refreshCaller);
boolean isAddressLookupable = KFSConstants.KUALI_VENDOR_ADDRESS_LOOKUPABLE_IMPL.equals(refreshCaller);
boolean isKualiLookupable = KFSConstants.KUALI_LOOKUPABLE_IMPL.equals(refreshCaller);
// if a cancel occurred on address lookup we need to reset the payee id and type, rest of fields will still have correct information
if (refreshCaller == null && hasFullEdit(document)) {
dvForm.setPayeeIdNumber(dvForm.getTempPayeeIdNumber());
dvForm.setHasMultipleAddresses(false);
document.getDvPayeeDetail().setDisbVchrPayeeIdNumber(dvForm.getTempPayeeIdNumber());
document.getDvPayeeDetail().setDisbursementVoucherPayeeTypeCode(dvForm.getOldPayeeType());
return null;
}
// do not execute the further refreshing logic if the refresh caller is not a lookupable
if (!isPayeeLookupable && !isAddressLookupable && !isKualiLookupable) {
return null;
}
// do not execute the further refreshing logic if a payee is not selected
String payeeIdNumber = document.getDvPayeeDetail().getDisbVchrPayeeIdNumber();
if (payeeIdNumber == null) {
return null;
}
dvForm.setPayeeIdNumber(payeeIdNumber);
dvForm.setHasMultipleAddresses(false);
// determine whether the selected vendor has multiple addresses. If so, redirect to the address selection screen
if (isPayeeLookupable) {
if (dvForm.isVendor()) {
VendorDetail refreshVendorDetail = new VendorDetail();
refreshVendorDetail.setVendorNumber(payeeIdNumber);
refreshVendorDetail = (VendorDetail) SpringContext.getBean(BusinessObjectService.class).retrieve(refreshVendorDetail);
VendorAddress defaultVendorAddress = null;
if (refreshVendorDetail != null) {
List<VendorAddress> vendorAddresses = refreshVendorDetail.getVendorAddresses();
boolean hasMultipleAddresses = vendorAddresses != null && vendorAddresses.size() > 1;
dvForm.setHasMultipleAddresses(hasMultipleAddresses);
if (vendorAddresses != null && !vendorAddresses.isEmpty()) {
defaultVendorAddress = vendorAddresses.get(0);
}
}
if (dvForm.hasMultipleAddresses()) {
return renderVendorAddressSelection(mapping, request, dvForm);
} else if (defaultVendorAddress != null) {
setupPayeeAsVendor(dvForm, payeeIdNumber, defaultVendorAddress.getVendorAddressGeneratedIdentifier().toString());
}
return null;
} else if (dvForm.isEmployee()) {
this.setupPayeeAsEmployee(dvForm, payeeIdNumber);
} else if (dvForm.isStudent()) {
this.setupPayeeAsStudent(dvForm, payeeIdNumber);
} else if (dvForm.isAlumni()) {
this.setupPayeeAsAlumni(dvForm, payeeIdNumber);
}
}
String payeeAddressIdentifier = request.getParameter(KFSPropertyConstants.VENDOR_ADDRESS_GENERATED_ID);
if (isAddressLookupable && StringUtils.isNotBlank(payeeAddressIdentifier)) {
setupPayeeAsVendor(dvForm, payeeIdNumber, payeeAddressIdentifier);
}
// check for multiple custom addresses
if (isPayeeLookupable && dvForm.isCustomer()) {
AccountsReceivableCustomer customer = SpringContext.getBean(AccountsReceivableModuleService.class).findCustomer(payeeIdNumber);
AccountsReceivableCustomerAddress defaultCustomerAddress = null;
if (customer != null) {
defaultCustomerAddress = customer.getPrimaryAddress();
Map<String, String> addressSearch = new HashMap<String, String>();
addressSearch.put(KFSPropertyConstants.CUSTOMER_NUMBER, payeeIdNumber);
List<AccountsReceivableCustomerAddress> customerAddresses = (List<AccountsReceivableCustomerAddress>) SpringContext.getBean(AccountsReceivableModuleService.class).searchForCustomerAddresses(addressSearch);
if (customerAddresses != null && !customerAddresses.isEmpty()) {
if (customerAddresses.size() > 1) {
dvForm.setHasMultipleAddresses(true);
} else if (defaultCustomerAddress == null) {
defaultCustomerAddress = customerAddresses.get(0);
}
}
}
if (dvForm.hasMultipleAddresses()) {
return renderCustomerAddressSelection(mapping, request, dvForm);
} else if (defaultCustomerAddress != null) {
setupPayeeAsCustomer(dvForm, payeeIdNumber, defaultCustomerAddress.getCustomerAddressIdentifier().toString());
}
}
String customerAddressIdentifier = request.getParameter(KFSPropertyConstants.CUSTOMER_ADDRESS_IDENTIFIER);
if (isKualiLookupable && StringUtils.isNotBlank(customerAddressIdentifier)) {
setupPayeeAsCustomer(dvForm, payeeIdNumber, customerAddressIdentifier);
}
String paymentReasonCode = document.getDvPayeeDetail().getDisbVchrPaymentReasonCode();
addPaymentCodeWarningMessage(dvForm, paymentReasonCode);
return null;
}
use of org.kuali.kfs.vnd.businessobject.VendorDetail in project cu-kfs by CU-CommunityApps.
the class PaymentGroup method setPayeeOwnerCdFromVendor.
/**
* @param string
*/
public void setPayeeOwnerCdFromVendor(String string) {
// payeeOwnerCd = string;
BusinessObjectService bos = SpringContext.getBean(BusinessObjectService.class);
String[] headerDetails = payeeId.split("-");
Map<String, String> fieldValues = new HashMap<String, String>();
fieldValues.put("vendorHeaderGeneratedIdentifier", headerDetails[0]);
fieldValues.put("vendorDetailAssignedIdentifier", headerDetails[1]);
List<VendorDetail> details = (List<VendorDetail>) bos.findMatching(VendorDetail.class, fieldValues);
if (details.size() == 1) {
payeeOwnerCd = details.get(0).getVendorHeader().getVendorOwnershipCode();
} else {
throw new RuntimeException("Could not locate Vendor Ownership Code for payeeId [ " + string + " ]");
}
}
use of org.kuali.kfs.vnd.businessobject.VendorDetail in project cu-kfs by CU-CommunityApps.
the class PaymentWorksDataProcessingIntoKfsServiceImpl method buildVendorMaintenanceDocument.
private MaintenanceDocument buildVendorMaintenanceDocument(PaymentWorksVendor paymentWorksVendor, KfsVendorDataWrapper kfsVendorDataWrapper) throws WorkflowException {
boolean isNewVendor = true;
MaintenanceDocument vendorMaintDoc = buildVendorMaintenanceDocumentBase(kfsVendorDataWrapper.getVendorDetail(), new VendorDetail(), KFSConstants.MAINTENANCE_NEW_ACTION, isNewVendor, kfsVendorDataWrapper.getVendorNotes());
return vendorMaintDoc;
}
use of org.kuali.kfs.vnd.businessobject.VendorDetail in project cu-kfs by CU-CommunityApps.
the class CuVendorServiceImplTest method testGetVendorByVendorName.
public void testGetVendorByVendorName() {
VendorDetail anakFixtureDetail = VendorDetailFixture.ANAK_INC.createVendorDetail();
VendorDetail anakDBDetail = cuVendorService.getVendorByVendorName("Anak Inc");
VendorDetail addFixtureDetail = VendorDetailFixture.ADD_ASSOCIATES_INC.createVendorDetail();
VendorDetail addDBDetail = cuVendorService.getVendorByVendorName("ADD Associates Inc");
assertEquals(anakFixtureDetail.isVendorParentIndicator(), anakDBDetail.isVendorParentIndicator());
assertEquals(anakFixtureDetail.getVendorDetailAssignedIdentifier(), anakDBDetail.getVendorDetailAssignedIdentifier());
assertEquals(addFixtureDetail.isVendorParentIndicator(), addDBDetail.isVendorParentIndicator());
assertEquals(addFixtureDetail.getVendorDetailAssignedIdentifier(), addDBDetail.getVendorDetailAssignedIdentifier());
}
Aggregations