From 4a562671ec18aa66041335c11541f5d36b13c1ca Mon Sep 17 00:00:00 2001 From: Jonathan Rosenbaum Date: Sun, 8 Feb 2015 07:10:47 +0000 Subject: [PATCH] Handles check_number value correctly. --- js/transaction.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/js/transaction.js b/js/transaction.js index 55632bc..53baad7 100644 --- a/js/transaction.js +++ b/js/transaction.js @@ -618,11 +618,16 @@ $(function() { sold_to = $("[name='sold_to']").val(); } - var payment_type_group = $("input[name='payment_type']"), payment_type; + var payment_type_group = $("input[name='payment_type']"), payment_type, check_number; if (payment_type_group.length) { payment_type_group.each(function(){ if ($(this).prop("checked") === true) { - payment_type = $(this).val(); + payment_type = $(this).val(); + if (payment_type === "credit" || payment_type === "cash") { + check_number = ""; + } else { + check_number = $("#check_number").val(); + } } } ); } @@ -642,7 +647,7 @@ $(function() { quantity: $("#quantity").val(), shop_id: $("#shop_id").val(), payment_type: payment_type, - check_number: $("#check_number").val(), + check_number: check_number, anonymous: $("#anonymous").val() };