From 2a0d9f542f5f95da774b7d4da9ee5a89e8280689 Mon Sep 17 00:00:00 2001 From: Jonathan Rosenbaum Date: Sat, 10 Jan 2015 11:06:21 +0000 Subject: [PATCH] Resets payment_type && amount if storage date is nullified. --- js/transaction.js | 15 +++++++++++---- json/transaction.php | 9 +++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/js/transaction.js b/js/transaction.js index 2eb07e5..9de8f63 100644 --- a/js/transaction.js +++ b/js/transaction.js @@ -70,7 +70,7 @@ $(function() { } - // Make change editable - could turn off when no shop + // Make Change Fund editable $('.editable_change input').mask("#0.00",{reverse: true, placeholder: "000"}); $('.editable_change').editable("json/transaction.php", { @@ -151,7 +151,7 @@ $(function() { } // Deposit Calculator - + // editing a transaction if ( $("input[name='shop_id']").length ) { @@ -237,8 +237,15 @@ $(function() { $("#price").show(); $("#payment_type").show(); } else { - $("#price").hide(); - $("#payment_type").hide(); + $("#amount").val(""); + $("#price").hide(); + + $('input[type=radio]').prop('checked',false).trigger('updateState'); + $("#payment_type").hide(); + + // reset payment_type && amount + $.post("json/transaction.php",{storage_payment_reset: 1, transaction_id: $transaction_id}); + } }); diff --git a/json/transaction.php b/json/transaction.php index c286c07..39bd632 100644 --- a/json/transaction.php +++ b/json/transaction.php @@ -59,6 +59,15 @@ $change_fund = CHANGE_FUND; echo json_encode($send_back); } + + // reset payment_type && amount for storage transaction + if(isset($_POST['storage_payment_reset'])) { + + $query = 'UPDATE transaction_log SET payment_type=NULL, amount=NULL WHERE transaction_id="' . + $_POST['transaction_id'] . '";'; + $result = mysql_query($query, $YBDB) or die(mysql_error()); + } + // Deposit Calculator if (isset($_POST['deposit'])) {