diff --git a/src/main/java/io/hardingadonis/saledock/controller/management/order/AddProductIntoOrder.java b/src/main/java/io/hardingadonis/saledock/controller/management/order/AddProductIntoOrder.java index 1559fdd..5f44317 100644 --- a/src/main/java/io/hardingadonis/saledock/controller/management/order/AddProductIntoOrder.java +++ b/src/main/java/io/hardingadonis/saledock/controller/management/order/AddProductIntoOrder.java @@ -65,6 +65,12 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) Integer productId = Integer.parseInt(productIdParam); Integer productQuantity = Integer.parseInt(productQuantityParam); + + if(productQuantity <= 0){ + request.setAttribute("message", "productQuantityNotPositive"); + this.doGet(request, response); + return; + } Optional product = Singleton.productDAO.getByID(productId); diff --git a/src/main/webapp/view/jsp/management/order/add-product-into-order.jsp b/src/main/webapp/view/jsp/management/order/add-product-into-order.jsp index 234990f..152ed27 100644 --- a/src/main/webapp/view/jsp/management/order/add-product-into-order.jsp +++ b/src/main/webapp/view/jsp/management/order/add-product-into-order.jsp @@ -56,6 +56,11 @@ Nhập sai định dạng số lượng sản phẩm. Vui lòng kiểm tra lại. + + +