fix dmp new version already draft error

This commit is contained in:
amentis 2024-06-03 13:59:07 +03:00
parent 39abb725bc
commit 878869ce61
6 changed files with 22 additions and 3 deletions

View File

@ -244,4 +244,15 @@ public class ErrorThesaurusProperties {
public void setTenantCodeExists(ErrorDescription tenantCodeExists) { public void setTenantCodeExists(ErrorDescription tenantCodeExists) {
this.tenantCodeExists = tenantCodeExists; this.tenantCodeExists = tenantCodeExists;
} }
private ErrorDescription dmpNewVersionAlreadyCreatedDraft;
public ErrorDescription getDmpNewVersionAlreadyCreatedDraft() {
return dmpNewVersionAlreadyCreatedDraft;
}
public void setDmpNewVersionAlreadyCreatedDraft(ErrorDescription dmpNewVersionAlreadyCreatedDraft) {
this.dmpNewVersionAlreadyCreatedDraft = dmpNewVersionAlreadyCreatedDraft;
}
} }

View File

@ -408,7 +408,7 @@ public class DmpServiceImpl implements DmpService {
.groupIds(oldDmpEntity.getGroupId()) .groupIds(oldDmpEntity.getGroupId())
.isActive(IsActive.Active) .isActive(IsActive.Active)
.count(); .count();
if (notFinalizedCount > 0) throw new MyValidationException(this.errors.getModelValidation().getCode(), "Already created draft for this template"); if (notFinalizedCount > 0) throw new MyValidationException(this.errors.getDmpNewVersionAlreadyCreatedDraft().getCode(), this.errors.getDmpNewVersionAlreadyCreatedDraft().getMessage());
DmpEntity newDmp = new DmpEntity(); DmpEntity newDmp = new DmpEntity();
newDmp.setId(UUID.randomUUID()); newDmp.setId(UUID.randomUUID());

View File

@ -80,3 +80,6 @@ error-thesaurus:
tenant-code-exists: tenant-code-exists:
code: 130 code: 130
message: Tenant code exists message: Tenant code exists
dmp-new-version-already-created-draft:
code: 131
message: Already created draft for this dmp

View File

@ -25,4 +25,5 @@ export enum ResponseErrorCode {
TenantConfigurationTypeCanNotChange = 128, TenantConfigurationTypeCanNotChange = 128,
MultipleTenantConfigurationTypeNotAllowed = 129, MultipleTenantConfigurationTypeNotAllowed = 129,
TenantCodeExists = 130, TenantCodeExists = 130,
DmpNewVersionAlreadyCreatedDraft = 131
} }

View File

@ -54,7 +54,8 @@
"TENANT-TAMPERING": "This operation affects data from a Tenant different than your selected. Please reselect your Tenant.", "TENANT-TAMPERING": "This operation affects data from a Tenant different than your selected. Please reselect your Tenant.",
"TENANT-CONFIGURATION-TYPE-CAN-NOT-CHANGE": "The configuration type for this Tenant cannot be changed.", "TENANT-CONFIGURATION-TYPE-CAN-NOT-CHANGE": "The configuration type for this Tenant cannot be changed.",
"MULTIPLE-TENANT-CONFIGURATION-TYPE-NOT-ALLOWED": "Tenant Configuration already exists for this Tenant.", "MULTIPLE-TENANT-CONFIGURATION-TYPE-NOT-ALLOWED": "Tenant Configuration already exists for this Tenant.",
"TENANT-CODE-EXISTS": "The Tenant code you provided already exists. Please choose a different code." "TENANT-CODE-EXISTS": "The Tenant code you provided already exists. Please choose a different code.",
"DMP-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this plan."
}, },
"FORM-VALIDATION-DISPLAY-DIALOG": { "FORM-VALIDATION-DISPLAY-DIALOG": {
"WARNING": "Warning!", "WARNING": "Warning!",

View File

@ -88,6 +88,9 @@ export class HttpErrorHandlingService {
else if(errorResponse.error.code === ResponseErrorCode.TenantCodeExists){ else if(errorResponse.error.code === ResponseErrorCode.TenantCodeExists){
this.uiNotificationService.snackBarNotification(this.language.instant("GENERAL.BACKEND-ERRORS.TENANT-CODE-EXISTS"), SnackBarNotificationLevel.Error); this.uiNotificationService.snackBarNotification(this.language.instant("GENERAL.BACKEND-ERRORS.TENANT-CODE-EXISTS"), SnackBarNotificationLevel.Error);
} }
else if(errorResponse.error.code === ResponseErrorCode.DmpNewVersionAlreadyCreatedDraft){
this.uiNotificationService.snackBarNotification(this.language.instant("GENERAL.BACKEND-ERRORS.DMP-NEW-VERSION-ALREADY-CREATED-DRAFT"), SnackBarNotificationLevel.Error);
}
else if (error.statusCode === 302 || error.statusCode === 400 || error.statusCode === 404) { else if (error.statusCode === 302 || error.statusCode === 400 || error.statusCode === 404) {
errorMessage ??= this.language.instant('GENERAL.SNACK-BAR.NOT-FOUND'); errorMessage ??= this.language.instant('GENERAL.SNACK-BAR.NOT-FOUND');
this.uiNotificationService.snackBarNotification(errorMessage, SnackBarNotificationLevel.Warning); this.uiNotificationService.snackBarNotification(errorMessage, SnackBarNotificationLevel.Warning);