From 502febb0080caf71a6c5195da921511150a2ad84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 8 Mar 2020 19:04:34 +0100 Subject: [PATCH] Fixed price detail autofill for min discount quantity. --- templates/Parts/edit/_orderdetails.html.twig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/templates/Parts/edit/_orderdetails.html.twig b/templates/Parts/edit/_orderdetails.html.twig index 27bc3a45..ba521dd0 100644 --- a/templates/Parts/edit/_orderdetails.html.twig +++ b/templates/Parts/edit/_orderdetails.html.twig @@ -41,6 +41,10 @@ //Determine the new value for the min_discount_qty var new_min_amount = $("input[id$='min_discount_quantity_value']" , $holder).last().val(); + //Assign a valid value, if no price are existing yet + if (typeof new_min_amount == "undefined") { + new_min_amount = 0; + } new_min_amount = parseInt(new_min_amount) + 1; //Determine the next exponent, 10 -> 100 -> 1000 new_min_amount = Math.pow(10, Math.ceil(Math.log10(new_min_amount)));