diff --git a/src/main/java/net/gepafin/tendermanagement/constants/GepafinConstant.java b/src/main/java/net/gepafin/tendermanagement/constants/GepafinConstant.java index 834462a1..325bf286 100644 --- a/src/main/java/net/gepafin/tendermanagement/constants/GepafinConstant.java +++ b/src/main/java/net/gepafin/tendermanagement/constants/GepafinConstant.java @@ -389,5 +389,6 @@ public class GepafinConstant { public static final String NON_EMPTY_TABLES="nonEmptyTables"; public static final String VALIDATION_IN_TABLE = "validation.table.message"; public static final String CALL_EXPIRED="call.expired"; + public static final String AMOUNT_REQUEST_SHOULD_GREATED_THEN_ZERO = "amount.request.should.greated.then.zero"; } diff --git a/src/main/java/net/gepafin/tendermanagement/dao/ApplicationDao.java b/src/main/java/net/gepafin/tendermanagement/dao/ApplicationDao.java index d9938639..84131b9b 100644 --- a/src/main/java/net/gepafin/tendermanagement/dao/ApplicationDao.java +++ b/src/main/java/net/gepafin/tendermanagement/dao/ApplicationDao.java @@ -1260,6 +1260,9 @@ public class ApplicationDao { if (Boolean.FALSE.equals(ApplicationStatusTypeEnum.DRAFT.getValue().equals(applicationEntity.getStatus()))) { throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.APPLICATION_NOT_IN_DRAFT_STATUS)); } + if (applicationEntity.getAmountRequested() == null || applicationEntity.getAmountRequested().compareTo(BigDecimal.ZERO) <= 0 ) { + throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.AMOUNT_REQUEST_SHOULD_GREATED_THEN_ZERO)); + } List flowEdgesList = flowEdgesRepository.findByCallId(applicationEntity.getCall().getId()); Long totalSteps = flowFormDao.calculateTotalSteps(flowEdgesList); Integer completedSteps = flowFormDao.getCompletedSteps(applicationEntity); diff --git a/src/main/resources/message_en.properties b/src/main/resources/message_en.properties index 70c783b9..5fcbc7f7 100644 --- a/src/main/resources/message_en.properties +++ b/src/main/resources/message_en.properties @@ -352,3 +352,4 @@ user.action.fetched.successfully = User action details fetched successfully. action.context.labels.fetched.successfully = Action Context Labels Fetched Successfully. amount.accepted.required=Amount accepted is required while approving the application. call.expired=Call has been expired. +amount.request.should.greated.then.zero=Requested amount should not be empty and should be greater than zero. diff --git a/src/main/resources/message_it.properties b/src/main/resources/message_it.properties index 54b7dae9..fd355f2f 100644 --- a/src/main/resources/message_it.properties +++ b/src/main/resources/message_it.properties @@ -341,5 +341,6 @@ user.with.company.not.found = Utente con azienda non trovato per utente o aziend user.action.fetched.successfully = Dettagli sull'azione dell'utente recuperati correttamente. action.context.labels.fetched.successfully = Etichette del contesto dell'azione recuperate correttamente. amount.accepted.required=L'importo accettato � obbligatorio durante l'approvazione della domanda. -validation.table.message=I dati per il campo {0} non sono presenti. +call.expired=La chiamata � scaduta. +amount.request.should.greated.then.zero=L'importo richiesto non deve essere vuoto e deve essere maggiore di zero. call.expired=La chiamata � scaduta.