use of edu.cornell.kfs.fp.businessobject.CuDisbursementVoucherPayeeDetailExtension in project cu-kfs by CU-CommunityApps.
the class CuDisbursementVoucherDocument method refreshPayeeTypeSuffixIfPaymentIsEditable.
public void refreshPayeeTypeSuffixIfPaymentIsEditable() {
TransactionalDocumentAuthorizer docAuthorizer = getDvDocumentAuthorizer();
if (docAuthorizer.canEdit(this, GlobalVariables.getUserSession().getPerson())) {
Set<String> editModes = getDvDocumentPresentationController().getEditModes(this);
editModes = docAuthorizer.getEditModes(this, GlobalVariables.getUserSession().getPerson(), editModes);
if (editModes.contains(KfsAuthorizationConstants.DisbursementVoucherEditMode.PAYEE_ENTRY)) {
String newSuffix;
if (getDvPayeeDetail().isVendor()) {
VendorDetail vendor = getVendorService().getByVendorNumber(getDvPayeeDetail().getDisbVchrPayeeIdNumber());
if (ObjectUtils.isNotNull(vendor)) {
newSuffix = createVendorPayeeTypeSuffix(vendor.getVendorHeader().getVendorType());
} else {
newSuffix = StringUtils.EMPTY;
}
} else {
newSuffix = StringUtils.EMPTY;
}
((CuDisbursementVoucherPayeeDetailExtension) getDvPayeeDetail().getExtension()).setPayeeTypeSuffix(newSuffix);
}
}
}
use of edu.cornell.kfs.fp.businessobject.CuDisbursementVoucherPayeeDetailExtension in project cu-kfs by CU-CommunityApps.
the class CuDisbursementVoucherDocument method prepareForSave.
@Override
public void prepareForSave() {
if (this instanceof AmountTotaling) {
if (getFinancialSystemDocumentHeader().getFinancialDocumentStatusCode().equals(KFSConstants.DocumentStatusCodes.ENROUTE) && !getFinancialSystemDocumentHeader().getWorkflowDocument().isCompletionRequested()) {
if (getParameterService().parameterExists(KfsParameterConstants.FINANCIAL_SYSTEM_DOCUMENT.class, UPDATE_TOTAL_AMOUNT_IN_POST_PROCESSING_PARAMETER_NAME) && getParameterService().getParameterValueAsBoolean(KfsParameterConstants.FINANCIAL_SYSTEM_DOCUMENT.class, UPDATE_TOTAL_AMOUNT_IN_POST_PROCESSING_PARAMETER_NAME)) {
getFinancialSystemDocumentHeader().setFinancialDocumentTotalAmount(((AmountTotaling) this).getTotalDollarAmount());
}
} else {
getFinancialSystemDocumentHeader().setFinancialDocumentTotalAmount(((AmountTotaling) this).getTotalDollarAmount());
}
}
captureWorkflowHeaderInformation();
if (wireTransfer != null) {
wireTransfer.setDocumentNumber(this.documentNumber);
((DisbursementVoucherWireTransferExtendedAttribute) wireTransfer.getExtension()).setDocumentNumber(this.documentNumber);
}
if (dvNonResidentAlienTax != null) {
dvNonResidentAlienTax.setDocumentNumber(this.documentNumber);
}
dvPayeeDetail.setDocumentNumber(this.documentNumber);
((CuDisbursementVoucherPayeeDetailExtension) dvPayeeDetail.getExtension()).setDocumentNumber(this.documentNumber);
if (dvNonEmployeeTravel != null) {
dvNonEmployeeTravel.setDocumentNumber(this.documentNumber);
dvNonEmployeeTravel.setTotalTravelAmount(dvNonEmployeeTravel.getTotalTravelAmount());
}
if (dvPreConferenceDetail != null) {
dvPreConferenceDetail.setDocumentNumber(this.documentNumber);
dvPreConferenceDetail.setDisbVchrConferenceTotalAmt(dvPreConferenceDetail.getDisbVchrConferenceTotalAmt());
}
if (shouldClearSpecialHandling()) {
clearSpecialHandling();
}
// CU Customization: Also perform check below when an ENROUTE doc is at the initial "AdHoc" node.
if (getDocumentHeader().getWorkflowDocument().isInitiated() || getDocumentHeader().getWorkflowDocument().isSaved() || (getDocumentHeader().getWorkflowDocument().isEnroute() && getDocumentHeader().getWorkflowDocument().getCurrentNodeNames().contains("AdHoc"))) {
// need to check whether the user has the permission to edit the bank code
// if so, don't synchronize since we can't tell whether the value coming in
// was entered by the user or not.
DocumentAuthorizer docAuth = getDocumentHelperService().getDocumentAuthorizer(this);
if (!docAuth.isAuthorizedByTemplate(this, KFSConstants.ParameterNamespaces.KFS, KFSConstants.PermissionTemplate.EDIT_BANK_CODE.name, GlobalVariables.getUserSession().getPrincipalId())) {
synchronizeBankCodeWithPaymentMethod();
} else {
refreshReferenceObject("bank");
}
refreshPayeeTypeSuffixIfPaymentIsEditable();
}
}
use of edu.cornell.kfs.fp.businessobject.CuDisbursementVoucherPayeeDetailExtension in project cu-kfs by CU-CommunityApps.
the class CuDisbursementVoucherDocument method templateStudent.
/**
* Convenience method to set dv payee detail fields based on a given student.
*
* @param student
*/
public void templateStudent(Person student) {
if (student == null) {
return;
}
this.getDvPayeeDetail().setDisbursementVoucherPayeeTypeCode(CuDisbursementVoucherConstants.DV_PAYEE_TYPE_STUDENT);
this.getDvPayeeDetail().setDisbVchrPayeeIdNumber(student.getPrincipalId());
((CuDisbursementVoucherPayeeDetailExtension) this.getDvPayeeDetail().getExtension()).setDisbVchrPayeeIdType(CuDisbursementVoucherConstants.DV_PAYEE_ID_TYP_ENTITY);
((CuDisbursementVoucherPayeeDetailExtension) this.getDvPayeeDetail().getExtension()).setPayeeTypeSuffix(StringUtils.EMPTY);
this.getDvPayeeDetail().setDisbVchrPayeePersonName(student.getNameUnmasked());
final ParameterService parameterService = this.getParameterService();
// Use the same parameter as for employees even though this is a student as basic intention is the same
if (parameterService.parameterExists(DisbursementVoucherDocument.class, DisbursementVoucherDocument.USE_DEFAULT_EMPLOYEE_ADDRESS_PARAMETER_NAME) && parameterService.getParameterValueAsBoolean(DisbursementVoucherDocument.class, DisbursementVoucherDocument.USE_DEFAULT_EMPLOYEE_ADDRESS_PARAMETER_NAME)) {
this.getDvPayeeDetail().setDisbVchrPayeeLine1Addr(student.getAddressLine1Unmasked());
this.getDvPayeeDetail().setDisbVchrPayeeLine2Addr(student.getAddressLine2Unmasked());
this.getDvPayeeDetail().setDisbVchrPayeeCityName(student.getAddressCityUnmasked());
this.getDvPayeeDetail().setDisbVchrPayeeStateCode(student.getAddressStateProvinceCodeUnmasked());
this.getDvPayeeDetail().setDisbVchrPayeeZipCode(student.getAddressPostalCodeUnmasked());
this.getDvPayeeDetail().setDisbVchrPayeeCountryCode(student.getAddressCountryCodeUnmasked());
} else {
final EntityAddress address = getNonDefaultAddress(student);
if (address != null) {
this.getDvPayeeDetail().setDisbVchrPayeeLine1Addr(address.getLine1Unmasked());
this.getDvPayeeDetail().setDisbVchrPayeeLine2Addr(address.getLine2Unmasked());
this.getDvPayeeDetail().setDisbVchrPayeeCityName(address.getCityUnmasked());
this.getDvPayeeDetail().setDisbVchrPayeeStateCode(address.getStateProvinceCodeUnmasked());
this.getDvPayeeDetail().setDisbVchrPayeeZipCode(student.getAddressPostalCodeUnmasked());
this.getDvPayeeDetail().setDisbVchrPayeeCountryCode(address.getCountryCodeUnmasked());
} else {
this.getDvPayeeDetail().setDisbVchrPayeeLine1Addr("");
this.getDvPayeeDetail().setDisbVchrPayeeLine2Addr("");
this.getDvPayeeDetail().setDisbVchrPayeeCityName("");
this.getDvPayeeDetail().setDisbVchrPayeeStateCode("");
this.getDvPayeeDetail().setDisbVchrPayeeZipCode("");
this.getDvPayeeDetail().setDisbVchrPayeeCountryCode("");
}
}
// I'm assuming that if a tax id type code other than 'TAX' is present, then the student must be foreign
for (String externalIdentifierTypeCode : student.getExternalIdentifiers().keySet()) {
if (KimConstants.PersonExternalIdentifierTypes.TAX.equals(externalIdentifierTypeCode)) {
this.getDvPayeeDetail().setDisbVchrAlienPaymentCode(false);
}
}
// Determine if student is a research subject
ParameterEvaluator researchPaymentReasonCodeEvaluator = SpringContext.getBean(ParameterEvaluatorService.class).getParameterEvaluator(DisbursementVoucherDocument.class, DisbursementVoucherConstants.RESEARCH_PAYMENT_REASONS_PARM_NM);
if (researchPaymentReasonCodeEvaluator.evaluationSucceeds()) {
if (getParameterService().parameterExists(DisbursementVoucherDocument.class, DisbursementVoucherConstants.RESEARCH_NON_VENDOR_PAY_LIMIT_AMOUNT_PARM_NM)) {
String researchPayLimit = getParameterService().getParameterValueAsString(DisbursementVoucherDocument.class, DisbursementVoucherConstants.RESEARCH_NON_VENDOR_PAY_LIMIT_AMOUNT_PARM_NM);
if (StringUtils.isNotBlank(researchPayLimit)) {
KualiDecimal payLimit = new KualiDecimal(researchPayLimit);
if (getDisbVchrCheckTotalAmount().isLessThan(payLimit)) {
this.getDvPayeeDetail().setDvPayeeSubjectPaymentCode(true);
}
}
}
}
this.disbVchrPayeeTaxControlCode = "";
this.disbVchrPayeeW9CompleteCode = true;
}
use of edu.cornell.kfs.fp.businessobject.CuDisbursementVoucherPayeeDetailExtension in project cu-kfs by CU-CommunityApps.
the class CuDisbursementVoucherDocument method templateVendor.
public void templateVendor(VendorDetail vendor, VendorAddress vendorAddress) {
if (vendor == null) {
return;
}
this.getDvPayeeDetail().setDisbursementVoucherPayeeTypeCode(KFSConstants.PaymentPayeeTypes.VENDOR);
this.getDvPayeeDetail().setDisbVchrPayeeIdNumber(vendor.getVendorNumber());
((CuDisbursementVoucherPayeeDetailExtension) this.getDvPayeeDetail().getExtension()).setDisbVchrPayeeIdType(CuDisbursementVoucherConstants.DV_PAYEE_ID_TYP_VENDOR);
((CuDisbursementVoucherPayeeDetailExtension) this.getDvPayeeDetail().getExtension()).setPayeeTypeSuffix(createVendorPayeeTypeSuffix(vendor.getVendorHeader().getVendorType()));
this.getDvPayeeDetail().setDisbVchrPayeePersonName(vendor.getVendorName());
this.getDvPayeeDetail().setDisbVchrAlienPaymentCode(vendor.getVendorHeader().getVendorForeignIndicator());
if (ObjectUtils.isNotNull(vendorAddress) && ObjectUtils.isNotNull(vendorAddress.getVendorAddressGeneratedIdentifier())) {
this.getDvPayeeDetail().setDisbVchrVendorAddressIdNumber(vendorAddress.getVendorAddressGeneratedIdentifier().toString());
this.getDvPayeeDetail().setDisbVchrPayeeLine1Addr(vendorAddress.getVendorLine1Address());
this.getDvPayeeDetail().setDisbVchrPayeeLine2Addr(vendorAddress.getVendorLine2Address());
this.getDvPayeeDetail().setDisbVchrPayeeCityName(vendorAddress.getVendorCityName());
this.getDvPayeeDetail().setDisbVchrPayeeStateCode(vendorAddress.getVendorStateCode());
this.getDvPayeeDetail().setDisbVchrPayeeZipCode(vendorAddress.getVendorZipCode());
this.getDvPayeeDetail().setDisbVchrPayeeCountryCode(vendorAddress.getVendorCountryCode());
} else {
this.getDvPayeeDetail().setDisbVchrVendorAddressIdNumber(StringUtils.EMPTY);
this.getDvPayeeDetail().setDisbVchrPayeeLine1Addr(StringUtils.EMPTY);
this.getDvPayeeDetail().setDisbVchrPayeeLine2Addr(StringUtils.EMPTY);
this.getDvPayeeDetail().setDisbVchrPayeeCityName(StringUtils.EMPTY);
this.getDvPayeeDetail().setDisbVchrPayeeStateCode(StringUtils.EMPTY);
this.getDvPayeeDetail().setDisbVchrPayeeZipCode(StringUtils.EMPTY);
this.getDvPayeeDetail().setDisbVchrPayeeCountryCode(StringUtils.EMPTY);
}
this.getDvPayeeDetail().setDisbVchrAlienPaymentCode(vendor.getVendorHeader().getVendorForeignIndicator());
this.getDvPayeeDetail().setDvPayeeSubjectPaymentCode(VendorConstants.VendorTypes.SUBJECT_PAYMENT.equals(vendor.getVendorHeader().getVendorTypeCode()));
this.getDvPayeeDetail().setDisbVchrEmployeePaidOutsidePayrollCode(getVendorService().isVendorInstitutionEmployee(vendor.getVendorHeaderGeneratedIdentifier()));
this.getDvPayeeDetail().setHasMultipleVendorAddresses(1 < vendor.getVendorAddresses().size());
boolean w9AndW8Checked = false;
if ((ObjectUtils.isNotNull(vendor.getVendorHeader().getVendorW9ReceivedIndicator()) && vendor.getVendorHeader().getVendorW9ReceivedIndicator() == true) || (ObjectUtils.isNotNull(vendor.getVendorHeader().getVendorW8BenReceivedIndicator()) && vendor.getVendorHeader().getVendorW8BenReceivedIndicator() == true)) {
w9AndW8Checked = true;
}
this.disbVchrPayeeW9CompleteCode = w9AndW8Checked;
Date vendorFederalWithholdingTaxBeginDate = vendor.getVendorHeader().getVendorFederalWithholdingTaxBeginningDate();
Date vendorFederalWithholdingTaxEndDate = vendor.getVendorHeader().getVendorFederalWithholdingTaxEndDate();
java.util.Date today = getDateTimeService().getCurrentDate();
if ((vendorFederalWithholdingTaxBeginDate != null && vendorFederalWithholdingTaxBeginDate.before(today)) && (vendorFederalWithholdingTaxEndDate == null || vendorFederalWithholdingTaxEndDate.after(today))) {
this.disbVchrPayeeTaxControlCode = CuDisbursementVoucherConstants.TAX_CONTROL_CODE_BEGIN_WITHHOLDING;
}
// if vendor is foreign, default alien payment code to true
if (getVendorService().isVendorForeign(vendor.getVendorHeaderGeneratedIdentifier())) {
getDvPayeeDetail().setDisbVchrAlienPaymentCode(true);
}
// KFSPTS-1891
if (vendor != null) {
if (ObjectUtils.isNotNull(vendor.getExtension()) && vendor.getExtension() instanceof VendorDetailExtension) {
if (StringUtils.isNotBlank(((VendorDetailExtension) vendor.getExtension()).getDefaultB2BPaymentMethodCode())) {
disbVchrPaymentMethodCode = ((VendorDetailExtension) vendor.getExtension()).getDefaultB2BPaymentMethodCode();
}
}
}
}
use of edu.cornell.kfs.fp.businessobject.CuDisbursementVoucherPayeeDetailExtension in project cu-kfs by CU-CommunityApps.
the class CuDisbursementVoucherDocument method templateAlumni.
/**
* Convenience method to set dv payee detail fields based on a given Alumnus.
*
* @param alumni
*/
public void templateAlumni(Person alumni) {
if (alumni == null) {
return;
}
this.getDvPayeeDetail().setDisbursementVoucherPayeeTypeCode(CuDisbursementVoucherConstants.DV_PAYEE_TYPE_ALUMNI);
this.getDvPayeeDetail().setDisbVchrPayeeIdNumber(alumni.getPrincipalId());
((CuDisbursementVoucherPayeeDetailExtension) this.getDvPayeeDetail().getExtension()).setDisbVchrPayeeIdType(CuDisbursementVoucherConstants.DV_PAYEE_ID_TYP_ENTITY);
((CuDisbursementVoucherPayeeDetailExtension) this.getDvPayeeDetail().getExtension()).setPayeeTypeSuffix(StringUtils.EMPTY);
// Changed this from employee.getName to employee.getNameUnmasked() otherwise "Xxxxxx" appears on the DV!
this.getDvPayeeDetail().setDisbVchrPayeePersonName(alumni.getNameUnmasked());
final ParameterService parameterService = this.getParameterService();
// Use the same parameter as for employees even though this is a alumni as basic intention is the same
if (parameterService.parameterExists(DisbursementVoucherDocument.class, DisbursementVoucherDocument.USE_DEFAULT_EMPLOYEE_ADDRESS_PARAMETER_NAME) && parameterService.getParameterValueAsBoolean(DisbursementVoucherDocument.class, DisbursementVoucherDocument.USE_DEFAULT_EMPLOYEE_ADDRESS_PARAMETER_NAME)) {
this.getDvPayeeDetail().setDisbVchrPayeeLine1Addr(alumni.getAddressLine1Unmasked());
this.getDvPayeeDetail().setDisbVchrPayeeLine2Addr(alumni.getAddressLine2Unmasked());
this.getDvPayeeDetail().setDisbVchrPayeeCityName(alumni.getAddressCityUnmasked());
this.getDvPayeeDetail().setDisbVchrPayeeStateCode(alumni.getAddressStateProvinceCodeUnmasked());
this.getDvPayeeDetail().setDisbVchrPayeeZipCode(alumni.getAddressPostalCodeUnmasked());
this.getDvPayeeDetail().setDisbVchrPayeeCountryCode(alumni.getAddressCountryCodeUnmasked());
} else {
final EntityAddress address = getNonDefaultAddress(alumni);
if (address != null) {
this.getDvPayeeDetail().setDisbVchrPayeeLine1Addr(address.getLine1Unmasked());
this.getDvPayeeDetail().setDisbVchrPayeeLine2Addr(address.getLine2Unmasked());
this.getDvPayeeDetail().setDisbVchrPayeeCityName(address.getCityUnmasked());
this.getDvPayeeDetail().setDisbVchrPayeeStateCode(address.getStateProvinceCodeUnmasked());
this.getDvPayeeDetail().setDisbVchrPayeeZipCode(alumni.getAddressPostalCodeUnmasked());
this.getDvPayeeDetail().setDisbVchrPayeeCountryCode(address.getCountryCodeUnmasked());
} else {
this.getDvPayeeDetail().setDisbVchrPayeeLine1Addr("");
this.getDvPayeeDetail().setDisbVchrPayeeLine2Addr("");
this.getDvPayeeDetail().setDisbVchrPayeeCityName("");
this.getDvPayeeDetail().setDisbVchrPayeeStateCode("");
this.getDvPayeeDetail().setDisbVchrPayeeZipCode("");
this.getDvPayeeDetail().setDisbVchrPayeeCountryCode("");
}
}
// I'm assuming that if a tax id type code other than 'TAX' is present, then the alumni must be foreign
for (String externalIdentifierTypeCode : alumni.getExternalIdentifiers().keySet()) {
if (KimConstants.PersonExternalIdentifierTypes.TAX.equals(externalIdentifierTypeCode)) {
this.getDvPayeeDetail().setDisbVchrAlienPaymentCode(false);
}
}
// Determine if alumni is a research subject
ParameterEvaluator researchPaymentReasonCodeEvaluator = SpringContext.getBean(ParameterEvaluatorService.class).getParameterEvaluator(DisbursementVoucherDocument.class, DisbursementVoucherConstants.RESEARCH_PAYMENT_REASONS_PARM_NM, this.getDvPayeeDetail().getDisbVchrPaymentReasonCode());
if (researchPaymentReasonCodeEvaluator.evaluationSucceeds()) {
if (getParameterService().parameterExists(DisbursementVoucherDocument.class, DisbursementVoucherConstants.RESEARCH_NON_VENDOR_PAY_LIMIT_AMOUNT_PARM_NM)) {
String researchPayLimit = getParameterService().getParameterValueAsString(DisbursementVoucherDocument.class, DisbursementVoucherConstants.RESEARCH_NON_VENDOR_PAY_LIMIT_AMOUNT_PARM_NM);
if (StringUtils.isNotBlank(researchPayLimit)) {
KualiDecimal payLimit = new KualiDecimal(researchPayLimit);
if (getDisbVchrCheckTotalAmount().isLessThan(payLimit)) {
this.getDvPayeeDetail().setDvPayeeSubjectPaymentCode(true);
}
}
}
}
this.disbVchrPayeeTaxControlCode = "";
this.disbVchrPayeeW9CompleteCode = true;
}
Aggregations