use of org.kuali.kfs.module.ld.document.LaborExpenseTransferDocumentBase in project cu-kfs by CU-CommunityApps.
the class LaborExpenseTransferAccountTypesValidation method validate.
/**
* Validates before the document routes
* @see org.kuali.kfs.validation.Validation#validate(java.lang.Object[])
*/
@SuppressWarnings("unchecked")
public boolean validate(AttributedDocumentEvent event) {
boolean isValid = true;
if (getParameterService().getParameterValueAsBoolean(LaborConstants.LABOR_MODULE_CODE, ParameterConstants.DOCUMENT_COMPONENT, LdParameterConstants.VALIDATE_TRANSFER_ACCOUNT_TYPES_IND) && !hasExceptionPermission()) {
Document documentForValidation = getDocumentForValidation();
LaborExpenseTransferDocumentBase expenseTransferDocument = (LaborExpenseTransferDocumentBase) documentForValidation;
List<AccountingLine> sourceLines = (List<AccountingLine>) expenseTransferDocument.getSourceAccountingLines();
List<AccountingLine> targetLines = (List<AccountingLine>) expenseTransferDocument.getTargetAccountingLines();
setInvalidTransferAccountTypesMap();
if (CollectionUtils.isNotEmpty(sourceLines) && CollectionUtils.isNotEmpty(targetLines) && invalidTransferAccountTypesMap.size() > 0) {
if (isInvalidTransferBetweenAccountTypes(sourceLines, targetLines)) {
GlobalVariables.getMessageMap().putError(KFSPropertyConstants.SOURCE_ACCOUNTING_LINES, CuLaborKeyConstants.INVALID_ACCOUNTTRANSFER_ERROR);
isValid = false;
}
}
}
return isValid;
}
use of org.kuali.kfs.module.ld.document.LaborExpenseTransferDocumentBase in project cu-kfs by CU-CommunityApps.
the class SalaryExpenseTransferAccountingLinesNotEmpty method hasEmptyAccountingLines.
@SuppressWarnings("unchecked")
protected boolean hasEmptyAccountingLines(AccountingDocument accountingDocument) {
LaborExpenseTransferDocumentBase expenseTransferDocument = (LaborExpenseTransferDocumentBase) accountingDocument;
List<ExpenseTransferSourceAccountingLine> sourceAccountingLines = expenseTransferDocument.getSourceAccountingLines();
List<ExpenseTransferTargetAccountingLine> targetAccountingLines = expenseTransferDocument.getTargetAccountingLines();
// If the lines are emoty the validation results should be false
boolean sourceAccountingLinesValidationResult = !sourceAccountingLines.isEmpty();
boolean targetAccountingLinesValidationResult = !targetAccountingLines.isEmpty();
if (!sourceAccountingLinesValidationResult) {
GlobalVariables.getMessageMap().putError(KFSPropertyConstants.SOURCE_ACCOUNTING_LINES, CuLaborKeyConstants.ERROR_ACCOUNTING_LINE_EMPTY);
}
if (!targetAccountingLinesValidationResult) {
GlobalVariables.getMessageMap().putError(KFSPropertyConstants.TARGET_ACCOUNTING_LINES, CuLaborKeyConstants.ERROR_ACCOUNTING_LINE_EMPTY);
}
return sourceAccountingLinesValidationResult && targetAccountingLinesValidationResult;
}
Aggregations