use of org.kuali.kfs.core.api.parameter.ParameterEvaluator 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, FPParameterConstants.USE_DEFAULT_EMPLOYEE_ADDRESS) && parameterService.getParameterValueAsBoolean(DisbursementVoucherDocument.class, FPParameterConstants.USE_DEFAULT_EMPLOYEE_ADDRESS)) {
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().setDisbVchrNonresidentPaymentCode(false);
}
}
// Determine if student is a research subject
ParameterEvaluator researchPaymentReasonCodeEvaluator = SpringContext.getBean(ParameterEvaluatorService.class).getParameterEvaluator(DisbursementVoucherDocument.class, FPParameterConstants.RESEARCH_PAYMENT_REASONS);
if (researchPaymentReasonCodeEvaluator.evaluationSucceeds()) {
if (getParameterService().parameterExists(DisbursementVoucherDocument.class, FPParameterConstants.RESEARCH_NON_VENDOR_PAY_LIMIT_AMOUNT)) {
String researchPayLimit = getParameterService().getParameterValueAsString(DisbursementVoucherDocument.class, FPParameterConstants.RESEARCH_NON_VENDOR_PAY_LIMIT_AMOUNT);
if (StringUtils.isNotBlank(researchPayLimit)) {
KualiDecimal payLimit = new KualiDecimal(researchPayLimit);
if (getDisbVchrCheckTotalAmount().isLessThan(payLimit)) {
this.getDvPayeeDetail().setDvPayeeSubjectPaymentCode(true);
}
}
}
}
this.disbVchrPayeeTaxControlCode = "";
this.disbVchrPayeeW9CompleteCode = true;
}
use of org.kuali.kfs.core.api.parameter.ParameterEvaluator in project cu-kfs by CU-CommunityApps.
the class CuDisbursementVoucherDocument method isCampusReviewRequired.
protected boolean isCampusReviewRequired() {
List<ActionTaken> actions = RouteContext.getCurrentRouteContext().getDocument().getActionsTaken();
List<String> people = new ArrayList<String>();
for (ActionTaken atv : actions) {
if (!people.contains(atv.getPrincipalId())) {
people.add(atv.getPrincipalId());
}
}
if (people.size() < 2) {
return true;
}
List<AccountingLine> theList = (List<AccountingLine>) this.sourceAccountingLines;
for (AccountingLine alb : theList) {
ParameterEvaluator objectCodes = SpringContext.getBean(ParameterEvaluatorService.class).getParameterEvaluator("KFS-FP", "DisbursementVoucher", OBJECT_CODES_REQUIRING_CAMPUS_REVIEW, alb.getFinancialObjectCode());
if (objectCodes.evaluationSucceeds()) {
LOG.info("Object Code " + alb.getFinancialObjectCode() + " requires this document to undergo Campus review.");
return true;
}
}
ParameterEvaluator paymentReasons = SpringContext.getBean(ParameterEvaluatorService.class).getParameterEvaluator("KFS-FP", "DisbursementVoucher", PAYMENT_REASONS_REQUIRING_CAMPUS_REVIEW, this.dvPayeeDetail.getDisbVchrPaymentReasonCode());
if (paymentReasons.evaluationSucceeds()) {
return true;
}
String dollarThreshold = getParameterService().getParameterValueAsString("KFS-FP", "DisbursementVoucher", DOLLAR_THRESHOLD_REQUIRING_CAMPUS_REVIEW);
KualiDecimal dollarThresholdDecimal = new KualiDecimal(dollarThreshold);
if (this.disbVchrCheckTotalAmount.isGreaterEqual(dollarThresholdDecimal)) {
return true;
}
return false;
}
use of org.kuali.kfs.core.api.parameter.ParameterEvaluator in project cu-kfs by CU-CommunityApps.
the class CuDisbursementVoucherDocument method isCAndGReviewRequired.
protected boolean isCAndGReviewRequired() {
String awardThreshold = getParameterService().getParameterValueAsString("KFS-FP", "DisbursementVoucher", DOLLAR_THRESHOLD_REQUIRING_AWARD_REVIEW);
KualiDecimal dollarThresholdDecimal = new KualiDecimal(awardThreshold);
if (this.disbVchrCheckTotalAmount.isGreaterEqual(dollarThresholdDecimal)) {
return true;
}
List<AccountingLine> theList = (List<AccountingLine>) this.sourceAccountingLines;
for (AccountingLine alb : theList) {
ParameterEvaluator objectCodes = SpringContext.getBean(ParameterEvaluatorService.class).getParameterEvaluator("KFS-FP", "DisbursementVoucher", OBJECT_CODES_REQUIRING_AWARD_REVIEW, alb.getFinancialObjectCode());
if (objectCodes.evaluationSucceeds()) {
LOG.info("Object Code " + alb.getFinancialObjectCode() + " requires this document to undergo Award review.");
return true;
}
}
return false;
}
use of org.kuali.kfs.core.api.parameter.ParameterEvaluator in project cu-kfs by CU-CommunityApps.
the class CuDisbursementVoucherDocument method populateDocumentForRouting.
@Override
public void populateDocumentForRouting() {
CuDisbursementVoucherPayeeDetail payeeDetail = getDvPayeeDetail();
if (payeeDetail.isVendor()) {
payeeDetail.setDisbVchrPayeeEmployeeCode(getVendorService().isVendorInstitutionEmployee(payeeDetail.getDisbVchrVendorHeaderIdNumberAsInteger()));
payeeDetail.setDvPayeeSubjectPaymentCode(getVendorService().isSubjectPaymentVendor(payeeDetail.getDisbVchrVendorHeaderIdNumberAsInteger()));
} else if (payeeDetail.isEmployee() || payeeDetail.isStudent() || payeeDetail.isAlumni()) {
// Determine if employee student or alumni is a research subject
ParameterEvaluator researchPaymentReasonCodeEvaluator = /*REFACTORME*/
SpringContext.getBean(ParameterEvaluatorService.class).getParameterEvaluator(DisbursementVoucherDocument.class, FPParameterConstants.RESEARCH_PAYMENT_REASONS, payeeDetail.getDisbVchrPaymentReasonCode());
if (researchPaymentReasonCodeEvaluator.evaluationSucceeds() && getParameterService().parameterExists(DisbursementVoucherDocument.class, FPParameterConstants.RESEARCH_NON_VENDOR_PAY_LIMIT_AMOUNT)) {
String researchPayLimit = getParameterService().getParameterValueAsString(DisbursementVoucherDocument.class, FPParameterConstants.RESEARCH_NON_VENDOR_PAY_LIMIT_AMOUNT);
if (StringUtils.isNotBlank(researchPayLimit)) {
KualiDecimal payLimit = new KualiDecimal(researchPayLimit);
if (getDisbVchrCheckTotalAmount().isLessThan(payLimit)) {
payeeDetail.setDvPayeeSubjectPaymentCode(true);
}
}
}
}
// Call last, serializes to XML
super.populateDocumentForRouting();
}
use of org.kuali.kfs.core.api.parameter.ParameterEvaluator in project cu-kfs by CU-CommunityApps.
the class CuAccountsPayableBankCodeValidation method isDocumentTypeUsingBankCode.
// This method is private on the superclass, so it has been copied into this class and tweaked accordingly.
protected boolean isDocumentTypeUsingBankCode(AccountsPayableDocumentBase apDocument) {
String documentTypeName = apDocument.getDocumentHeader().getWorkflowDocument().getDocumentTypeName();
ParameterEvaluator evaluator = getParameterEvaluatorService().getParameterEvaluator(Bank.class, KFSParameterKeyConstants.BANK_CODE_DOCUMENT_TYPES, documentTypeName);
return evaluator.evaluationSucceeds();
}
Aggregations