From 2d273d82781c593894af6d64ef569d1b4ddd300c Mon Sep 17 00:00:00 2001 From: Ricardo Rodrigues Date: Tue, 27 Oct 2020 18:39:54 +0000 Subject: [PATCH] Preventing registering payments in the future ACDM-1815 #resolve --- .../domain/accounting/AccountingTransactionDetail.java | 4 ++++ .../resources/resources/ApplicationResources_en.properties | 1 + .../resources/resources/ApplicationResources_pt.properties | 1 + 3 files changed, 6 insertions(+) diff --git a/src/main/java/org/fenixedu/academic/domain/accounting/AccountingTransactionDetail.java b/src/main/java/org/fenixedu/academic/domain/accounting/AccountingTransactionDetail.java index 5115726650c..fee1756ec92 100644 --- a/src/main/java/org/fenixedu/academic/domain/accounting/AccountingTransactionDetail.java +++ b/src/main/java/org/fenixedu/academic/domain/accounting/AccountingTransactionDetail.java @@ -40,6 +40,10 @@ private void checkParameters(DateTime whenRegistered, PaymentMethod paymentMetho if (whenRegistered == null) { throw new DomainException("error.accounting.AccountingTransactionDetail.whenRegistered.cannot.be.null"); } + + if (whenRegistered.isAfter(new DateTime())) { + throw new DomainException("error.accounting.AccountingTransactionDetail.whenRegistered.cannot.be.after.now"); + } if (paymentMethod == null) { throw new DomainException("error.accounting.AccountingTransactionDetail.paymentMethod.cannot.be.null"); diff --git a/src/main/resources/resources/ApplicationResources_en.properties b/src/main/resources/resources/ApplicationResources_en.properties index c37748bdb59..f7feb872e4b 100644 --- a/src/main/resources/resources/ApplicationResources_en.properties +++ b/src/main/resources/resources/ApplicationResources_en.properties @@ -439,6 +439,7 @@ email.request.room.subject.edit = Change : [{0}] Room request for {1} employee = Employee enderecoWeb = Homepage erasmus.label.email.confirmation = Confirm Email +error.accounting.AccountingTransactionDetail.whenRegistered.cannot.be.after.now = The payment can not be registered in the future. error.AccountingEventsManager.invalid.degree.curricular.plan.type = Can not create debt for old plans error.AdministrativeOfficeDocument.registration.not.found = Can't find registration for document. Please contact the support team. error.AlreadyAcceptedProposal = The discipline which is making the proposal is already part of the chairs that have this grouping, as has already been realized and accepted this proposal. diff --git a/src/main/resources/resources/ApplicationResources_pt.properties b/src/main/resources/resources/ApplicationResources_pt.properties index 246f3944d08..9648ae86d6c 100644 --- a/src/main/resources/resources/ApplicationResources_pt.properties +++ b/src/main/resources/resources/ApplicationResources_pt.properties @@ -440,6 +440,7 @@ employee = Funcionário enderecoWeb = Homepage erasmus.label.email.confirmation = Confirm Email error.AdministrativeOfficeDocument.registration.not.found = Não é possível encontrar a matrícula para este pedido. Por favor contacte o suporte. +error.accounting.AccountingTransactionDetail.whenRegistered.cannot.be.after.now = O pagamento não pode ser registado no futuro. error.AccountingEventsManager.invalid.degree.curricular.plan.type = Não é possível criar dívidas para os planos antigos error.AlreadyAcceptedProposal = A disciplina à qual está a fazer a proposta já faz parte das cadeiras que possuem este agrupamento, uma vez que já foi realizada e aceite esta proposta. error.CandidacyInformationBean.conclusionGrade.invalid.format = Formato inválido.
Introduza até 2 dígitos (0-20)