La mise à jour d'un type de produit ignorait s'il était un type système.

This commit is contained in:
FyloZ 2020-11-25 09:13:27 -05:00
parent dd480d72c0
commit dd36390a08
1 changed files with 3 additions and 2 deletions

View File

@ -56,7 +56,8 @@ class MaterialTypeServiceImpl(repository: MaterialTypeRepository, private val ma
MaterialType(
id = id,
name = if (name.isNotBlank()) name else persistedMaterialType.name,
prefix = if (prefix.isNotBlank()) prefix else persistedMaterialType.prefix
prefix = if (prefix.isNotBlank()) prefix else persistedMaterialType.prefix,
systemType = systemType
)
})
}
@ -75,7 +76,7 @@ class MaterialTypeServiceImpl(repository: MaterialTypeRepository, private val ma
fun saveOrUpdateSystemType(type: MaterialType) {
if (existsByName(type.name)) {
val persistedMaterialType = getByName(type.name)
update(materialType(type, newId = persistedMaterialType.id))
update(materialType(type, newId = persistedMaterialType.id, newSystemType = true))
} else {
save(type)
}