From ec810a4a55eb9b3036f04716f805584e081fe07f Mon Sep 17 00:00:00 2001 From: sahil28297 <37302950+sahil28297@users.noreply.github.com> Date: Mon, 15 Jul 2019 16:54:41 +0530 Subject: [PATCH] fix(product_page): compare type as well and provide base class for parseInt (#18332) --- erpnext/templates/includes/product_page.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/erpnext/templates/includes/product_page.js b/erpnext/templates/includes/product_page.js index af98fc7987a..65949bb18cc 100644 --- a/erpnext/templates/includes/product_page.js +++ b/erpnext/templates/includes/product_page.js @@ -29,10 +29,10 @@ frappe.ready(function() { .html(r.message.product_info.price.formatted_price_sales_uom + "
\ (" + r.message.product_info.price.formatted_price + " / " + r.message.product_info.uom + ")
"); - if(r.message.product_info.in_stock==0) { + if(r.message.product_info.in_stock===0) { $(".item-stock").html("
{{ _("Not in stock") }}
"); } - else if(r.message.product_info.in_stock==1) { + else if(r.message.product_info.in_stock===1) { var qty_display = "{{ _("In stock") }}"; if (r.message.product_info.show_stock_qty) { qty_display += " ("+r.message.product_info.stock_qty+")"; @@ -75,13 +75,13 @@ frappe.ready(function() { newVal = 0; if (btn.attr('data-dir') == 'up') { - newVal = parseInt(oldValue) + 1; + newVal = Number.parseInt(oldValue) + 1; } else if (btn.attr('data-dir') == 'dwn') { - if (parseInt(oldValue) > 1) { - newVal = parseInt(oldValue) - 1; + if (Number.parseInt(oldValue) > 1) { + newVal = Number.parseInt(oldValue) - 1; } else { - newVal = parseInt(oldValue); + newVal = Number.parseInt(oldValue); } } input.val(newVal);