From 17d6cab5aa971460d03a279b366f96af6545b69e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=ABl=20Mugnier?= Date: Mon, 9 Nov 2020 13:43:13 +0100 Subject: [PATCH] =?UTF-8?q?Update=20-=20Ajout=20de=20v=C3=A9rification=20s?= =?UTF-8?q?uppl=C3=A9mentaire=20pour=20modifier=20la=20TVA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Commands/ProductCommandsHandler.cs | 1 - Sheaft.Domain/Product.cs | 2 +- Sheaft.Web.Manage/Views/Products/Add.cshtml | 8 ++++---- Sheaft.Web.Manage/Views/Products/Edit.cshtml | 8 ++++---- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Sheaft.Application.Handlers/Commands/ProductCommandsHandler.cs b/Sheaft.Application.Handlers/Commands/ProductCommandsHandler.cs index c0dc0328f..9d147786b 100644 --- a/Sheaft.Application.Handlers/Commands/ProductCommandsHandler.cs +++ b/Sheaft.Application.Handlers/Commands/ProductCommandsHandler.cs @@ -106,7 +106,6 @@ public async Task> Handle(UpdateProductCommand request, Cancellatio entity.SetVat(request.Vat); entity.SetName(request.Name); entity.SetDescription(request.Description); - entity.SetVat(request.Vat); entity.SetWholeSalePricePerUnit(request.WholeSalePricePerUnit); entity.SetReference(request.Reference); entity.SetWeight(request.Weight); diff --git a/Sheaft.Domain/Product.cs b/Sheaft.Domain/Product.cs index 92b56eede..31dcc7c7e 100644 --- a/Sheaft.Domain/Product.cs +++ b/Sheaft.Domain/Product.cs @@ -139,7 +139,7 @@ public void SetVat(decimal? newVat) { if (Producer.NotSubjectToVat) newVat = 0; - else if(!newVat.HasValue) + else if(!newVat.HasValue || newVat == 0) throw new ValidationException(MessageKind.Product_Vat_Required); if (newVat < 0) diff --git a/Sheaft.Web.Manage/Views/Products/Add.cshtml b/Sheaft.Web.Manage/Views/Products/Add.cshtml index 5600dde00..accb41b42 100644 --- a/Sheaft.Web.Manage/Views/Products/Add.cshtml +++ b/Sheaft.Web.Manage/Views/Products/Add.cshtml @@ -2,10 +2,10 @@ @{ ViewData["Title"] = "New Product"; var vats = new List { - new SelectListItem("0%", "0"), - new SelectListItem("5.5%", "5.5"), - new SelectListItem("10%", "10"), - new SelectListItem("20%", "20"), + new SelectListItem("0%", "0.00"), + new SelectListItem("5.5%", "5.50"), + new SelectListItem("10%", "10.00"), + new SelectListItem("20%", "20.00"), }; var units = new List { diff --git a/Sheaft.Web.Manage/Views/Products/Edit.cshtml b/Sheaft.Web.Manage/Views/Products/Edit.cshtml index 0167852a0..261000350 100644 --- a/Sheaft.Web.Manage/Views/Products/Edit.cshtml +++ b/Sheaft.Web.Manage/Views/Products/Edit.cshtml @@ -2,10 +2,10 @@ @{ ViewData["Title"] = "Product details"; var vats = new List { - new SelectListItem("0%", "0"), - new SelectListItem("5.5%", "5.5"), - new SelectListItem("10%", "10"), - new SelectListItem("20%", "20"), + new SelectListItem("0%", "0.00"), + new SelectListItem("5.5%", "5.50"), + new SelectListItem("10%", "10.00"), + new SelectListItem("20%", "20.00"), }; var units = new List {