From d6ffa420d4a8bca31a3b72045a79d9b814eb9c8d Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Mon, 17 Dec 2018 13:32:00 -0500 Subject: [PATCH] DB update and redo uptravel payment form. New uptra payment form (simplified). New field for payment notes. New field for uptra_payment_form boolean. --- classes/data/dataManagement.php | 7 ++ classes/data/dataPayments.php | 7 ++ config/plugin.ini | 7 ++ index.php | 2 +- models/admin/billing/invoices.php | 1 + models/admin/member/billing.php | 31 ++++++ ...0.0.30.sql => create_database_V0.0.31.sql} | 2 + setup/databaseScripts/dbVersions.php | 1 + .../update_database_V0.0.31.sql | 13 +++ todo.txt | 24 +++-- views/admin/billing/invoices.html | 12 ++- views/admin/billing/makePayment.html | 12 +-- .../admin/billing/makePaymentAdjustment.html | 94 +++++++++++++++++++ .../admin/billing/memberBillingSubHeader.html | 18 +--- views/admin/billing/statements.html | 8 +- views/admin/management/billing.html | 9 ++ 16 files changed, 215 insertions(+), 33 deletions(-) rename setup/databaseScripts/{create_database_V0.0.30.sql => create_database_V0.0.31.sql} (98%) create mode 100644 setup/databaseScripts/update_database_V0.0.31.sql create mode 100644 views/admin/billing/makePaymentAdjustment.html diff --git a/classes/data/dataManagement.php b/classes/data/dataManagement.php index 5bb8f29..d50d3b0 100644 --- a/classes/data/dataManagement.php +++ b/classes/data/dataManagement.php @@ -225,6 +225,13 @@ class GlmDataBillingManagement extends GlmDataAbstract 'use' => 'a', ), + // Use uptra invoice template + 'uptravel_payment_form' => array( + 'field' => 'uptravel_payment_form', + 'type' => 'checkbox', + 'use' => 'a', + ), + ); } diff --git a/classes/data/dataPayments.php b/classes/data/dataPayments.php index cb0d548..c563b25 100644 --- a/classes/data/dataPayments.php +++ b/classes/data/dataPayments.php @@ -169,6 +169,13 @@ class GlmDataPayments extends GlmDataAbstract 'use' => 'a', ), + // Payment Notes / Comments + 'notes' => array( + 'field' => 'notes', + 'type' => 'text', + 'use' => 'a', + ), + ); diff --git a/config/plugin.ini b/config/plugin.ini index ca91c40..b11daca 100644 --- a/config/plugin.ini +++ b/config/plugin.ini @@ -24,6 +24,13 @@ payment_method[20] = "Credit Card" payment_method[30] = "Cash" payment_method[40] = "Other" +; Alternate Payment Methods +alt_payment_method[10] = "Check" +alt_payment_method[20] = "Credit Card" +alt_payment_method[30] = "Cash" +alt_payment_method[40] = "Other" +alt_payment_method[50] = "Adjustment" + ; Recurrences recurrence[10] = "Monthly" recurrence[20] = "Yearly" diff --git a/index.php b/index.php index 92114a1..27fb5cf 100644 --- a/index.php +++ b/index.php @@ -38,7 +38,7 @@ * version from this plugin. */ define('GLM_MEMBERS_BILLING_PLUGIN_VERSION', '1.0.16'); -define('GLM_MEMBERS_BILLING_PLUGIN_DB_VERSION', '0.0.30'); +define('GLM_MEMBERS_BILLING_PLUGIN_DB_VERSION', '0.0.31'); // This is the minimum version of the GLM Members DB plugin require for this plugin. define('GLM_MEMBERS_BILLING_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '2.8.0'); diff --git a/models/admin/billing/invoices.php b/models/admin/billing/invoices.php index 32d8dcd..05bfa59 100644 --- a/models/admin/billing/invoices.php +++ b/models/admin/billing/invoices.php @@ -673,6 +673,7 @@ class GlmMembersAdmin_billing_invoices extends GlmDataInvoices 'filterOverdue' => $filterOverdue, 'counties' => $counties, 'paymentTypes' => $paymentTypes, + 'billing_settings' => $this->config['billing_settings'], ); // Return status, any suggested view, and any data to controller diff --git a/models/admin/member/billing.php b/models/admin/member/billing.php index b87e6f7..c0d70c6 100644 --- a/models/admin/member/billing.php +++ b/models/admin/member/billing.php @@ -709,6 +709,36 @@ class GlmMembersAdmin_member_billing // extends GlmDataBilling $view = 'makePayment'; break; + + case 'makepaymentadjustment': + $view = 'makePaymentAdjustment'; + + // Get unpaid invoices + $invoices = $BillingSupport->getUnPaidInvoicesByAccount( $accountID ); + + // Need to see if there's an account for this member. + $account = $Accounts->editEntry( $accountID ); + + break; + + case 'createMemberPayment': + $view = 'paymentProcess'; + $account_id = filter_var( $_REQUEST['account_id'], FILTER_VALIDATE_INT ); + $amount = filter_var( $_REQUEST['amount'], FILTER_VALIDATE_FLOAT ); + $payment_method = filter_var( $_REQUEST['payment_method'], FILTER_VALIDATE_INT ); + $payment_data = filter_var( $_REQUEST['payment_data'], FILTER_SANITIZE_STRING ); + $invoices = filter_var( $_REQUEST['invoices'], FILTER_VALIDATE_INT, array( 'flags' => FILTER_REQUIRE_ARRAY ) ); + echo '
$_REQUEST: ' . print_r( $_REQUEST, true ) . '
'; + + if ( $account_id && $amount && $payment_method && $payment_data && !empty( $invoices ) ) { + // Create new payment. + $payment_id = $BillingSupport->createPayment( $account_id, $amount, $this->config['alt_payment_method'][$payment_method], $payment_data ); + + // Record the payment. + $BillingSupport->recordPayment( $payment_id, $account_id, $amount, $invoices ); + } + break; + case 'list': $view = 'statements'; // echo '
$test: ' . print_r( $test, true ) . '
'; @@ -761,6 +791,7 @@ class GlmMembersAdmin_member_billing // extends GlmDataBilling 'account_status' => $account_status, 'accounts' => $accounts, 'invoiceTypes' => $invoiceTypes, + 'paymentMethods' => $this->config['alt_payment_method'] ); // Return status, any suggested view, and any data to controller. diff --git a/setup/databaseScripts/create_database_V0.0.30.sql b/setup/databaseScripts/create_database_V0.0.31.sql similarity index 98% rename from setup/databaseScripts/create_database_V0.0.30.sql rename to setup/databaseScripts/create_database_V0.0.31.sql index f18b8b9..7bbcb25 100644 --- a/setup/databaseScripts/create_database_V0.0.30.sql +++ b/setup/databaseScripts/create_database_V0.0.31.sql @@ -140,6 +140,7 @@ CREATE TABLE {prefix}payments ( amount DECIMAL(8, 2) NOT NULL, -- payment amount payment_method TINYTEXT NOT NULL, -- payment method payment_data TINYTEXT NULL, -- additional payment info + notes TEXT NULL, -- Notes/Comments on the payment PRIMARY KEY (id) ); @@ -293,6 +294,7 @@ CREATE TABLE {prefix}management ( merchant_solutions_conf BOOLEAN NULL, -- Flag to send payment confirmation Email merchant_solutions_merchant_email TINYTEXT NULL, -- Merchant Solutions will send copy of confirmation E-Mail uptravel_invoice_template BOOLEAN DEFAULT '0', -- Use uptravel template for invoices. + uptravel_payment_form BOOLEAN DEFAULT '0', -- Use uptravel payment form style. PRIMARY KEY (id) ); diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php index 5276c44..7bb16c2 100644 --- a/setup/databaseScripts/dbVersions.php +++ b/setup/databaseScripts/dbVersions.php @@ -44,5 +44,6 @@ $glmMembersBillingDbVersions = array( '0.0.28' => array('version' => '0.0.28', 'tables' => 15, 'date' => '11/27/2018'), '0.0.29' => array('version' => '0.0.29', 'tables' => 15, 'date' => '11/29/2018'), '0.0.30' => array('version' => '0.0.30', 'tables' => 15, 'date' => '12/04/2018'), + '0.0.31' => array('version' => '0.0.31', 'tables' => 15, 'date' => '12/17/2018'), ); diff --git a/setup/databaseScripts/update_database_V0.0.31.sql b/setup/databaseScripts/update_database_V0.0.31.sql new file mode 100644 index 0000000..de8232c --- /dev/null +++ b/setup/databaseScripts/update_database_V0.0.31.sql @@ -0,0 +1,13 @@ +-- Gaslight Media Billing Database +-- File Created: 12/17/2018 +-- Database Version: 0.0.31 +-- +-- To permit each query below to be executed separately, +-- all queries must be separated by a line with four dashes + +-- Update the accounts table +ALTER TABLE {prefix}payments ADD notes TEXT NULL; + +---- + +ALTER TABLE {prefix}management ADD uptravel_payment_form BOOLEAN DEFAULT '0'; diff --git a/todo.txt b/todo.txt index 386e8e2..1fee6d8 100644 --- a/todo.txt +++ b/todo.txt @@ -4,8 +4,8 @@ Additional features that need to be added to our billing plugin. Invoice type payment type with Dynamic amount. See how this was used. -QIF (quickbooks) export? -qcode entry for payment type (numeric) +[x] QIF (quickbooks) export? +[x] qcode entry for payment type (numeric) Invoicing: [x] Create Invoices (batch) @@ -14,17 +14,21 @@ Invoicing: [x] -- Filter by county and category or member type [x]-Create labels [ ] -Send Email (invoices) -[ ] Pro - Rate an invoice +[ ] Ability to add adjustment [ ] Ability to edit an invoice -[ ] Ability to delete an invoice +[x] Ability to delete an invoice +[ ] Ability to delete a payment +[x] Redo payment form for Uptravel.com +[x] Find all places where there's a link to make payment to check for option. + Reports: --Open Accounts --Closed Accounts --Account by Age --Report Generator --No Accounts --All Accounts +[x] Open Accounts +[x] Closed Accounts +[x] Account by Age +[x] Report Generator +[x] No Accounts +[x] All Accounts [x] Make Payment:(might already be done) Donna used the payment form from the member edit section. diff --git a/views/admin/billing/invoices.html b/views/admin/billing/invoices.html index aaea34a..ade476a 100644 --- a/views/admin/billing/invoices.html +++ b/views/admin/billing/invoices.html @@ -89,8 +89,16 @@ View | Print | - {if $t.paid.value} {else} - Pay Invoice{/if} | +