Search in sources :

Example 1 with BankStatementLineId

use of de.metas.banking.BankStatementLineId in project metasfresh-webui-api by metasfresh.

the class BankStatementBasedProcess method checkSingleLineSelectedWhichIsNotReconciled.

protected final ProcessPreconditionsResolution checkSingleLineSelectedWhichIsNotReconciled(@NonNull final IProcessPreconditionsContext context) {
    // there should be a single line selected
    final Set<TableRecordReference> bankStatemementLineRefs = context.getSelectedIncludedRecords();
    if (bankStatemementLineRefs.size() != 1) {
        return ProcessPreconditionsResolution.rejectBecauseNotSingleSelection();
    }
    final TableRecordReference bankStatemementLineRef = bankStatemementLineRefs.iterator().next();
    final BankStatementLineId bankStatementLineId = BankStatementLineId.ofRepoId(bankStatemementLineRef.getRecord_ID());
    final I_C_BankStatementLine line = bankStatementBL.getLineById(bankStatementLineId);
    if (line.isReconciled()) {
        return ProcessPreconditionsResolution.reject(msgBL.getTranslatableMsgText(MSG_LineIsAlreadyReconciled));
    }
    return ProcessPreconditionsResolution.accept();
}
Also used : TableRecordReference(org.adempiere.util.lang.impl.TableRecordReference) I_C_BankStatementLine(org.compiere.model.I_C_BankStatementLine) BankStatementLineId(de.metas.banking.BankStatementLineId)

Example 2 with BankStatementLineId

use of de.metas.banking.BankStatementLineId in project metasfresh-webui-api by metasfresh.

the class C_BankStatement_UnReconcileLine method checkSingleLineSelectedWhichIsReconciled.

private final ProcessPreconditionsResolution checkSingleLineSelectedWhichIsReconciled(@NonNull final IProcessPreconditionsContext context) {
    // there should be a single line selected
    final Set<TableRecordReference> bankStatemementLineRefs = context.getSelectedIncludedRecords();
    if (bankStatemementLineRefs.size() != 1) {
        return ProcessPreconditionsResolution.rejectWithInternalReason("a single line shall be selected");
    }
    final TableRecordReference bankStatemementLineRef = bankStatemementLineRefs.iterator().next();
    final BankStatementLineId bankStatementLineId = BankStatementLineId.ofRepoId(bankStatemementLineRef.getRecord_ID());
    final I_C_BankStatementLine line = bankStatementBL.getLineById(bankStatementLineId);
    if (!line.isReconciled()) {
        return ProcessPreconditionsResolution.rejectWithInternalReason("line shall be reconciled");
    }
    return ProcessPreconditionsResolution.accept();
}
Also used : TableRecordReference(org.adempiere.util.lang.impl.TableRecordReference) I_C_BankStatementLine(org.compiere.model.I_C_BankStatementLine) BankStatementLineId(de.metas.banking.BankStatementLineId)

Aggregations

BankStatementLineId (de.metas.banking.BankStatementLineId)2 TableRecordReference (org.adempiere.util.lang.impl.TableRecordReference)2 I_C_BankStatementLine (org.compiere.model.I_C_BankStatementLine)2