Correction: Aucune validation lors de la création d'un type de produit
Correction: Impossible de créer des PDFs de kit de retouche Correction: L'icône de l'imprimante n'est pas toujours actualisée lorsque l'extension bPac est installée
This commit is contained in:
parent
12433c353c
commit
67a8c361dd
|
@ -12,6 +12,7 @@ import dev.fyloz.trial.colorrecipesexplorer.dao.MaterialTypeDao;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@ -110,12 +111,22 @@ public class MaterialTypeService extends AbstractService<MaterialType, MaterialT
|
|||
*/
|
||||
public MaterialType getByName(String name) {
|
||||
Optional<MaterialType> found = dao.findByName(name);
|
||||
if(found.isEmpty())
|
||||
if (found.isEmpty())
|
||||
throw new EntityNotFoundException(type, ModelException.IdentifierType.NAME, name);
|
||||
|
||||
return found.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MaterialType save(@NotNull MaterialType materialType) {
|
||||
if (existsByName(materialType.getName()))
|
||||
throw new EntityAlreadyExistsException(type, ModelException.IdentifierType.NAME, materialType.getName());
|
||||
if (existsByPrefix(materialType.getPrefix()))
|
||||
throw new EntityAlreadyExistsException(type, ModelException.IdentifierType.OTHER, MaterialType.IDENTIFIER_PREFIX_NAME, materialType.getPrefix());
|
||||
|
||||
return super.save(materialType);
|
||||
}
|
||||
|
||||
public MaterialType update(MaterialTypeEditorDto materialTypeDto) {
|
||||
MaterialType materialType = materialTypeDto.getMaterialType();
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ public class PdfBuilder {
|
|||
this.lineSpacing = (int) (this.fontSize * 1.5f);
|
||||
|
||||
document.addPage(page);
|
||||
font = PDType0Font.load(document, resourceLoader.getResource(WebsitePaths.FONT_ARIAL_BOLD).getFile());
|
||||
font = PDType0Font.load(document, resourceLoader.getResource(WebsitePaths.FONT_ARIAL_BOLD).getInputStream());
|
||||
}
|
||||
|
||||
public PdfBuilder addLine(String text, boolean bold, int marginTop) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package dev.fyloz.trial.colorrecipesexplorer.web.controller.creators;
|
||||
|
||||
import dev.fyloz.trial.colorrecipesexplorer.core.exception.model.EntityAlreadyExistsException;
|
||||
import dev.fyloz.trial.colorrecipesexplorer.core.exception.model.ModelException;
|
||||
import dev.fyloz.trial.colorrecipesexplorer.core.io.response.ModelResponseBuilder;
|
||||
import dev.fyloz.trial.colorrecipesexplorer.core.io.response.ResponseCode;
|
||||
import dev.fyloz.trial.colorrecipesexplorer.core.io.response.ResponseDataType;
|
||||
|
@ -48,7 +49,11 @@ public class MaterialTypeCreatorController {
|
|||
null
|
||||
);
|
||||
} catch (EntityAlreadyExistsException ex) {
|
||||
modelResponseBuilder.addResponseCode(ResponseCode.MATERIAL_TYPE_ALREADY_EXIST, materialType.getName());
|
||||
if (ex.getIdentifierType() == ModelException.IdentifierType.NAME) {
|
||||
modelResponseBuilder.addResponseCode(ResponseCode.MATERIAL_TYPE_ALREADY_EXIST, materialType.getName());
|
||||
} else {
|
||||
modelResponseBuilder.addResponseCode(ResponseCode.MATERIAL_TYPE_ALREADY_EXIST_PREFIX, materialType.getPrefix());
|
||||
}
|
||||
}
|
||||
|
||||
return getPage(modelResponseBuilder.build(), materialType);
|
||||
|
|
|
@ -72,14 +72,19 @@ $(() => {
|
|||
// Imprimante
|
||||
let src = `${baseUrl}/icons/printerError.svg`;
|
||||
let title = printErrorTitle;
|
||||
if ($(".bpac-extension-installed").length) {
|
||||
src = `${baseUrl}/icons/printer.svg`;
|
||||
title = printOkTitle;
|
||||
}
|
||||
$("#printStatusIcon").attr({
|
||||
src: src,
|
||||
title: title
|
||||
});
|
||||
const intervalId = setInterval(() => {
|
||||
if ($(".bpac-extension-installed").length) {
|
||||
src = `${baseUrl}/icons/printer.svg`;
|
||||
title = printOkTitle;
|
||||
|
||||
clearInterval(intervalId);
|
||||
}
|
||||
|
||||
$("#printStatusIcon").attr({
|
||||
src: src,
|
||||
title: title
|
||||
});
|
||||
}, 500);
|
||||
});
|
||||
|
||||
function checkSimdutAvailability(materialId) {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
}
|
||||
</style>
|
||||
</head>
|
||||
<body th:with='error = ${recipeMap.empty ? "__#{recipe.error.anyFound}__" : error}'>
|
||||
<body>
|
||||
<!-- Fragment de l'entête -->
|
||||
<header th:include="fragments.html :: header(true)"></header>
|
||||
<!-- Corps de la page -->
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
# v1.3.1
|
||||
### Corrections
|
||||
* Correction d'un bug qui empêchait d'avoir plus que 2 mélanges avec le même nom.
|
||||
* Correction d'un bug qui empêchait de modifier des types de produit.
|
||||
* Correction d'un bug qui empêchait de créer des PDFs de kit de retouche.
|
||||
* Correction d'un bug qui empêchait les fichiers SIMDUT de fonctionner.
|
||||
** Correction d'un bug qui empêchait de détecter si un fichier SIMDUT existait.
|
||||
|
||||
# v1.3.0 (Optimisations back-end)
|
||||
### Note: Cette mise à jour n'est pas compatible avec les anciennes versions.
|
||||
|
|
Loading…
Reference in New Issue