use of edu.cornell.kfs.fp.businessobject.DisbursementVoucherWireTransferExtendedAttribute 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();
}
}
Aggregations