From e444cdb93cf357f0686734504e4ae0a4b3a2b85e Mon Sep 17 00:00:00 2001 From: Jonathan Rosenbaum Date: Wed, 14 Jan 2015 06:10:04 +0000 Subject: [PATCH] Preparing GnuCash CSV interface, and fixed no shop bug with new logic. --- css/transactions.css | 2 +- sql/populate.sql | 6 ++---- transaction_log.php | 31 ++++++++++++++++++++----------- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/css/transactions.css b/css/transactions.css index 5e23e20..03497b3 100644 --- a/css/transactions.css +++ b/css/transactions.css @@ -1,7 +1,7 @@ /* sensible UI defaults for transaction views */ /* right-align labels */ -td > label:not(.payment_type):not(#open_shop) { +td > label:not(.payment_type):not(.open_shop) { float: right; padding-right: 5px; } diff --git a/sql/populate.sql b/sql/populate.sql index be76121..93cbba3 100644 --- a/sql/populate.sql +++ b/sql/populate.sql @@ -128,12 +128,10 @@ INSERT INTO contacts ( -- Deposit (transaction_type_id) is a special transaction type that behaves differently in the log -- for a good reason. -- --- DONATIONS (or option to allow an anonymous transactions) --- Anonymous (transaction_type_id) provides a checkbox if show_soldto_location is set to allow donations and other types --- of desired transactions to be anonymous. +-- DONATIONS are best complimented with anonymous, see below. -- -- "show_payment" shows cash, credit, and check payment types if selected. --- "anonymous" allows anonymous transactions with a check box. +-- Assuming show_soldto_location is set, "anonymous" allows anonymous transactions with a check box. ALTER TABLE transaction_types ADD show_payment tinyint(1) NOT NULL DEFAULT '1'; ALTER TABLE transaction_types ADD anonymous tinyint(1) NOT NULL DEFAULT '0'; diff --git a/transaction_log.php b/transaction_log.php index 1bad526..3e38586 100644 --- a/transaction_log.php +++ b/transaction_log.php @@ -637,7 +637,7 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ChangeDate")) { Show transactions on or before: - @@ -656,22 +656,31 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ChangeDate")) { - - + + curdate() AND shop_type = 'Mechanic Operation Shop',0,1) as CanEdit - FROM shops WHERE shop_id = $shop_id;"; - $query = mysql_query($sql, $YBDB) or die(mysql_error()); - $result = mysql_fetch_assoc($query); - - if(current_shop_by_ip()>=1) echo ''; - else echo ''; - echo "
" . $result['shop_location'] . " - " . $result['shop_type'] . " - " . $result['date']; + if ($shop_id) { + $sql = "SELECT *, IF(date <> curdate() AND shop_type = 'Mechanic Operation Shop',0,1) as CanEdit + FROM shops WHERE shop_id = $shop_id;"; + $query = mysql_query($sql, $YBDB) or die(mysql_error()); + $result = mysql_fetch_assoc($query); + } + + if(current_shop_by_ip()>=1) echo ''; + else echo ''; + if (current_shop_by_ip()>=1) echo "
" . "(" . $result['shop_id'] . ") " . + $result['shop_location'] . " - " . $result['shop_type'] . " - " . $result['date']; ?> + + +
+ + +