Database updates
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 26 Jul 2018 18:41:24 +0000 (14:41 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 26 Jul 2018 18:41:24 +0000 (14:41 -0400)
Adding new billing fields
company
position
fax

classes/data/dataAccounts.php
index.php
setup/databaseScripts/create_database_V0.0.25.sql [deleted file]
setup/databaseScripts/create_database_V0.0.26.sql [new file with mode: 0644]
setup/databaseScripts/dbVersions.php
setup/databaseScripts/update_database_V0.0.26.sql [new file with mode: 0644]
views/admin/billing/editAccount.html

index ad82ebb..17215f3 100644 (file)
@@ -187,6 +187,22 @@ class GlmDataAccounts extends GlmDataAbstract
                 'required' => true,
             ),
 
+            // Billing Company
+            'billing_company' => array(
+                'field'    => 'billing_company',
+                'type'     => 'text',
+                'use'      => 'a',
+                'required' => false,
+            ),
+
+            // Billing Position
+            'billing_position' => array(
+                'field'    => 'billing_position',
+                'type'     => 'text',
+                'use'      => 'a',
+                'required' => false,
+            ),
+
             // Billing First Name
             'billing_fname' => array(
                 'field'    => 'billing_fname',
@@ -253,6 +269,14 @@ class GlmDataAccounts extends GlmDataAbstract
                 'required' => false,
             ),
 
+            // Billing Fax
+            'billing_fax' => array(
+                'field'    => 'billing_fax',
+                'type'     => 'text',
+                'use'      => 'a',
+                'required' => false,
+            ),
+
             // Customer Profile Id
             // 'customer_profile_id' => array(
             //     'field'    => 'customer_profile_id',
index b924cff..17f93dc 100644 (file)
--- a/index.php
+++ b/index.php
@@ -38,7 +38,7 @@
  *  version from this plugin.
  */
 define('GLM_MEMBERS_BILLING_PLUGIN_VERSION', '1.0.9');
-define('GLM_MEMBERS_BILLING_PLUGIN_DB_VERSION', '0.0.25');
+define('GLM_MEMBERS_BILLING_PLUGIN_DB_VERSION', '0.0.26');
 
 // 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/setup/databaseScripts/create_database_V0.0.25.sql b/setup/databaseScripts/create_database_V0.0.25.sql
deleted file mode 100644 (file)
index b9d7d70..0000000
+++ /dev/null
@@ -1,289 +0,0 @@
--- Gaslight Media Billing Module
--- File Created: 11/08/2017
--- Database Version: 0.0.25
--- Database Creation Script
---
--- To permit each query below to be executed separately,
--- all queries must be separated by a line with four dashes
---
--- **** BE SURE TO ALSO UPDATE drop_database_Vxxx.sql FILE WHEN CHANGING TABLES ****
---
-
--- Billing Accounts
-CREATE TABLE {prefix}accounts (
-    id INT NOT NULL AUTO_INCREMENT,
-    archived BOOLEAN DEFAULT '0',                          -- Marks account as archived
-    ref_dest INT NOT NULL,                                 -- reference to member id
-    ref_name TINYTEXT NOT NULL,                            -- Name of reference member
-    invoice_type INT NOT NULL DEFAULT '0',                 -- Ref to Invoice Type id
-    billing_fname TINYTEXT NULL,                           -- Billing First Name
-    billing_lname TINYTEXT NULL,                           -- Billing Last Name
-    billing_addr1 TINYTEXT NULL,                           -- Billing Address 1
-    billing_addr2 TINYTEXT NULL,                           -- Billing Address 2
-    billing_city TINYTEXT NULL,                            -- Billing City
-    billing_state TINYTEXT NULL,                           -- Billing State
-    billing_zip TINYTEXT NULL,                             -- Billing Zip
-    billing_phone TINYTEXT NULL,                           -- Billing Phone
-    anniversary_date DATE NOT NULL,                        -- anniversary date - used for main invoice generation
-    renewal_date DATE NULL,                                -- renewal date of account
-    payment_data TEXT NULL,                                -- stored payment data
-    customer_profile_id TINYTEXT NULL,                     -- Customer Profile Id (Authorize.net)
-    payment_profile_id TINYTEXT NULL,                      -- Payment Profile Id (Authorize.net)
-    payment_profile_card TINYTEXT NULL,                    -- Payment Profile Card (Authorize.net)
-    email TINYTEXT NULL,                                   -- billing email
-    boss BOOLEAN DEFAULT '0',                              -- Boss flag
-    PRIMARY KEY (id),
-    INDEX(ref_dest),
-    INDEX(ref_name(20)),
-    INDEX(email(20)),
-    INDEX(invoice_type),
-    INDEX(renewal_date)
-);
-
-----
-
--- transactions
-CREATE TABLE {prefix}transactions (
-    id INT NOT NULL AUTO_INCREMENT,
-    type INT NOT NULL,                                     -- type of transaction (payment,invoice,etc)
-    type_id INT NOT NULL,                                  -- reference to type id
-    account INT NOT NULL,                                  -- reference to account id
-    transaction_time DATETIME NOT NULL,                    -- datetime for the transaction
-    current_invoice_total DECIMAL(8, 2) NOT NULL,          -- invoice total
-    current_payment_total DECIMAL(8, 2) NOT NULL,          -- payment total
-    PRIMARY KEY (id),
-    INDEX(account),
-    INDEX(type_id),
-    INDEX(transaction_time)
-);
-
-----
-
--- Invoices
-CREATE TABLE {prefix}invoices (
-    id INT NOT NULL AUTO_INCREMENT,
-    transaction_time DATETIME NOT NULL,                    -- datetime for the invoice
-    account INT NOT NULL,                                  -- ref to account id
-    amount_total DECIMAL(8, 2) NOT NULL,                   -- total amount for invoice
-    balance DECIMAL(8, 2) NOT NULL,                        -- balance for this invoice
-    due_date DATE NOT NULL,                                -- Due date for this invoice
-    paid BOOLEAN DEFAULT '0',                              -- true/false if invoice is paid
-    notes TINYTEXT,                                        -- notes for this invoice
-    renewal BOOLEAN DEFAULT '0',                           -- true/false if a renewal
-    recurring BOOLEAN DEFAULT '0',                         -- true/false if recurring
-    recurrence INT NULL DEFAULT 0,                         -- recurrence type
-    PRIMARY KEY (id),
-    INDEX(account),
-    INDEX(transaction_time),
-    INDEX(due_date)
-);
-
-----
-
--- Line Item Types
-CREATE TABLE {prefix}invoice_types (
-    id INT NOT NULL AUTO_INCREMENT,
-    name TINYTEXT NOT NULL,                                -- name
-    parent INT NOT NULL DEFAULT 0,                         -- 0 if top level otherwise ref to another line_item_type as it's parent
-    member_type INT NOT NULL DEFAULT 0,                    -- Member Type assigned Default 0
-    amount DECIMAL(8,2) NOT NULL DEFAULT '0.00',           -- amount
-    recurring BOOLEAN DEFAULT '0',                         -- true/false if recurring
-    recurrence INT NULL DEFAULT 0,                         -- recurrence type
-    PRIMARY KEY (id)
-);
-
-----
-
--- Line Items
-CREATE TABLE {prefix}line_items (
-    id INT NOT NULL AUTO_INCREMENT,
-    invoice INT NOT NULL,                                  -- reference to invoice
-    line_item_type INT NOT NULL,                           -- reference to line item type
-    account INT NULL DEFAULT 0,                            -- ref to account id (renewal or employee)
-    name TEXT NOT NULL,                                    -- line item name
-    amount DECIMAL(8,2) DEFAULT '0.00',                    -- line item amount per item
-    quantity INT DEFAULT 1,                                -- quantity
-    total DECIMAL(8,2) DEFAULT '0.00',                     -- line item total
-    recurring BOOLEAN DEFAULT '0',                         -- true/false if recurring
-    recurrence INT NULL DEFAULT 0,                         -- recurrence type
-    created DATE NULL,                                     -- Date this line item was first created
-    first_due_date DATE NULL,                              -- The first due date for this item
-    next_due_date DATE NULL,                               -- Next Due Date for this item
-    PRIMARY KEY (id),
-    INDEX(account),
-    INDEX(created),
-    INDEX(first_due_date),
-    INDEX(next_due_date)
-);
-
-----
-
--- payments
-CREATE TABLE {prefix}payments (
-    id INT NOT NULL AUTO_INCREMENT,
-    transaction_time DATETIME NOT NULL,                    -- datetime of payment
-    account INT NOT NULL,                                  -- ref to account table
-    amount DECIMAL(8, 2) NOT NULL,                         -- payment amount
-    payment_method TINYTEXT NOT NULL,                      -- payment method
-    payment_data TINYTEXT NULL,                            -- additional payment info
-    PRIMARY KEY (id)
-);
-
-----
-
--- pdfs
-CREATE TABLE {prefix}pdfs (
-    id INT NOT NULL AUTO_INCREMENT,
-    ref_type INT NOT NULL,                                 -- reference type
-    ref_dest INT NOT NULL,                                 -- reference types id
-    pdf MEDIUMTEXT NOT NULL,                               -- saved pdf
-    PRIMARY KEY (id)
-);
-
-----
-
--- Notification Types
-CREATE TABLE {prefix}notification_types (
-    id INT NOT NULL AUTO_INCREMENT,
-    name TINYTEXT NOT NULL,                                -- name
-    to_email TINYTEXT NULL,                                -- To email
-    from_header TINYTEXT NOT NULL,                         -- from headers
-    replyto TINYTEXT NULL,                                 -- reply-to headers
-    subject TINYTEXT NOT NULL,                             -- Subject
-    message TEXT NOT NULL,                                 -- Message
-    send_by_date BOOLEAN NULL DEFAULT '0',                 -- true/false send by date based on due date
-    send_by_action BOOLEAN NULL DEFAULT '0',               -- send notice based on an action
-    send_action INT NULL DEFAULT 0,                        -- (create invoice or receive payment)
-    send_date_number INT NULL DEFAULT 0,                   -- number to apply to send by date
-    send_date_period INT NULL DEFAULT 0,                   -- (days,weeks,months,years)
-    send_date_when INT NULL DEFAULT 0,                     -- (before or after)
-    PRIMARY KEY (id)
-);
-
-----
-
--- Notifications
-CREATE TABLE {prefix}notifications (
-    id INT NOT NULL AUTO_INCREMENT,
-    notification_type INT NOT NULL,                        -- ref to notification type
-    account INT NOT NULL,                                  -- ref to account
-    from_replyto TINYTEXT NOT NULL,                        -- from reply-to header
-    subject TEXT NOT NULL,                                 -- subject
-    message TEXT NOT NULL,                                 -- message
-    date_sent DATETIME NOT NULL,                           -- Date the notice was sent
-    email_sent TINYTEXT NOT NULL,                          -- email used
-    PRIMARY KEY (id)
-);
-
-----
-
--- Notification Queue
-CREATE TABLE {prefix}notification_queue (
-    id INT NOT NULL AUTO_INCREMENT,
-    notification_type INT NOT NULL,                        -- ref to notification type
-    account INT NOT NULL,                                  -- ref to account
-    queued_time DATETIME NOT NULL,                         -- Creation time
-    processed_time DATETIME NULL,                          -- The time this queue was processed. (sent out)
-    PRIMARY KEY (id),
-    INDEX (notification_type),
-    INDEX (account),
-    INDEX (queued_time),
-    INDEX (processed_time)
-);
-
-----
-
--- Gateway Settings
-CREATE TABLE {prefix}gateway_settings (
-    id INT NOT NULL AUTO_INCREMENT,
-    name TEXT NOT NULL,
-    login_id TINYTEXT NOT NULL,
-    transaction_key TINYTEXT NOT NULL,
-    PRIMARY KEY (id)
-);
-
-----
-
--- Invoice Payments
-CREATE TABLE {prefix}invoice_payments (
-    id INT NOT NULL AUTO_INCREMENT,
-    invoice INT NOT NULL,                                  -- reference to invoice id
-    payment INT NOT NULL,                                  -- reference to payment id
-    amount DECIMAL(8, 2) NOT NULL,                         -- payment amount
-    PRIMARY KEY (id),
-    INDEX(invoice)
-);
-
-----
-
--- Settings
-CREATE TABLE {prefix}settings (
-    id INT NOT NULL AUTO_INCREMENT,
-    company_logo TINYTEXT NULL,                            -- Image logo
-    company_logo_height INT NULL,                          -- Logo Height (only used if creating pdf)
-    company_name TINYTEXT NULL,                            -- Company Name
-    company_name2 TINYTEXT NULL,                           -- Company Name 2
-    company_addr1 TINYTEXT NULL,                           -- Company Address 1
-    company_addr2 TINYTEXT NULL,                           -- Company Address 2
-    company_city TINYTEXT NULL,                            -- Company City
-    company_state TINYTEXT NULL,                           -- Company State
-    company_zip TINYTEXT NULL,                             -- Company Zip
-    company_phone TINYTEXT NULL,                           -- Company Phone
-    company_email TINYTEXT NULL,                           -- Company Email
-    company_url TINYTEXT NULL,                             -- Company URL
-    payment_terms TEXT NULL,                               -- Payment Terms
-    days_before_renewal INT NULL,                          -- Number of days before renewal date to allow renewals
-    days_after_expired INT NULL,                           -- Number of days after renewal date expired
-    allow_membership_choice BOOLEAN DEFAULT '0',           -- If memberships can choose their membership levels when they renew
-    allow_employees BOOLEAN DEFAULT '0',                   -- If memberships have employees
-    PRIMARY KEY (id)
-);
-
-----
-
--- Set default billing Settings entry
-INSERT INTO {prefix}settings
-    ( id, days_before_renewal ,days_after_expired )
-    VALUES
-    ( 1, 90, 30 );
-
-----
-
--- Management
-CREATE TABLE {prefix}management (
-    id INT NOT NULL AUTO_INCREMENT,
-    payment_methods SMALLINT NULL,                              -- Payment methods available for all registrations - Bitmap - see payment_method in plugin.ini
-    proc_methods SMALLINT NULL,                                 -- Credit Cart payment processing methods available - Bitmap - see proc_method in plugin.ini
-    cc_accepts SMALLINT NULL,                                   -- Credit Cards Accepted - Bitmap - See credit_card in plugin.ini
-    -- Authorize.net Credentials
-    authorize_net_login TINYTEXT NULL,
-    authorize_net_key TINYTEXT NULL,
-    authorize_net_test TINYINT NULL,                            -- Authorize.net test mode - List - see proc_test_mode in plugin.ini
-    authorize_net_conf BOOLEAN NULL,                            -- Flag to send payment confirmation Email from Authorize.net
-    authorize_net_merchant_email TINYTEXT NULL,                 -- E-Mail Authorize.net will send copy of confirmation E-Mail
-    -- Merchant Solutions Credentials
-    merchant_solutions_acctid TINYTEXT NULL,                    -- Merchant Solutions credentials
-    merchant_solutions_merchantpin TINYTEXT NULL,
-    merchant_solutions_test TINYINT NULL,                       -- Merchant Solutions test mode - List - see proc_test_mode in plugin.ini
-    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
-    PRIMARY KEY (id)
-);
-
-----
-
--- Set default billing Management entry
-INSERT INTO {prefix}management
-    ( id )
-    VALUES
-    ( 1 );
-
-----
-
--- Employees table
-CREATE TABLE {prefix}employees (
-    id INT NOT NULL AUTO_INCREMENT,
-    account INT NOT NULL,                                     -- Account Id
-    employee INT NOT NULL,                                     -- Employee Account Id
-    PRIMARY KEY (id)
-);
diff --git a/setup/databaseScripts/create_database_V0.0.26.sql b/setup/databaseScripts/create_database_V0.0.26.sql
new file mode 100644 (file)
index 0000000..ba6f9be
--- /dev/null
@@ -0,0 +1,293 @@
+-- Gaslight Media Billing Module
+-- File Created: 11/08/2017
+-- Database Version: 0.0.26
+-- Database Creation Script
+--
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashes
+--
+-- **** BE SURE TO ALSO UPDATE drop_database_Vxxx.sql FILE WHEN CHANGING TABLES ****
+--
+
+-- Billing Accounts
+CREATE TABLE {prefix}accounts (
+    id INT NOT NULL AUTO_INCREMENT,
+    archived BOOLEAN DEFAULT '0',                          -- Marks account as archived
+    ref_dest INT NOT NULL,                                 -- reference to member id
+    ref_name TINYTEXT NOT NULL,                            -- Name of reference member
+    invoice_type INT NOT NULL DEFAULT '0',                 -- Ref to Invoice Type id
+    billing_fname TINYTEXT NULL,                           -- Billing First Name
+    billing_lname TINYTEXT NULL,                           -- Billing Last Name
+    billing_company TINYTEXT NULL,                         -- Billing Company Name
+    billing_position TINYTEXT NULL,                        -- Billing Title/Position
+    billing_addr1 TINYTEXT NULL,                           -- Billing Address 1
+    billing_addr2 TINYTEXT NULL,                           -- Billing Address 2
+    billing_city TINYTEXT NULL,                            -- Billing City
+    billing_state TINYTEXT NULL,                           -- Billing State
+    billing_zip TINYTEXT NULL,                             -- Billing Zip
+    billing_country TINYTEXT NULL,                         -- Billing Country
+    billing_phone TINYTEXT NULL,                           -- Billing Phone
+    billing_fax TINYTEXT NULL,                             -- Billing Fax
+    anniversary_date DATE NOT NULL,                        -- anniversary date - used for main invoice generation
+    renewal_date DATE NULL,                                -- renewal date of account
+    payment_data TEXT NULL,                                -- stored payment data
+    customer_profile_id TINYTEXT NULL,                     -- Customer Profile Id (Authorize.net)
+    payment_profile_id TINYTEXT NULL,                      -- Payment Profile Id (Authorize.net)
+    payment_profile_card TINYTEXT NULL,                    -- Payment Profile Card (Authorize.net)
+    email TINYTEXT NULL,                                   -- billing email
+    boss BOOLEAN DEFAULT '0',                              -- Boss flag
+    PRIMARY KEY (id),
+    INDEX(ref_dest),
+    INDEX(ref_name(20)),
+    INDEX(email(20)),
+    INDEX(invoice_type),
+    INDEX(renewal_date)
+);
+
+----
+
+-- transactions
+CREATE TABLE {prefix}transactions (
+    id INT NOT NULL AUTO_INCREMENT,
+    type INT NOT NULL,                                     -- type of transaction (payment,invoice,etc)
+    type_id INT NOT NULL,                                  -- reference to type id
+    account INT NOT NULL,                                  -- reference to account id
+    transaction_time DATETIME NOT NULL,                    -- datetime for the transaction
+    current_invoice_total DECIMAL(8, 2) NOT NULL,          -- invoice total
+    current_payment_total DECIMAL(8, 2) NOT NULL,          -- payment total
+    PRIMARY KEY (id),
+    INDEX(account),
+    INDEX(type_id),
+    INDEX(transaction_time)
+);
+
+----
+
+-- Invoices
+CREATE TABLE {prefix}invoices (
+    id INT NOT NULL AUTO_INCREMENT,
+    transaction_time DATETIME NOT NULL,                    -- datetime for the invoice
+    account INT NOT NULL,                                  -- ref to account id
+    amount_total DECIMAL(8, 2) NOT NULL,                   -- total amount for invoice
+    balance DECIMAL(8, 2) NOT NULL,                        -- balance for this invoice
+    due_date DATE NOT NULL,                                -- Due date for this invoice
+    paid BOOLEAN DEFAULT '0',                              -- true/false if invoice is paid
+    notes TINYTEXT,                                        -- notes for this invoice
+    renewal BOOLEAN DEFAULT '0',                           -- true/false if a renewal
+    recurring BOOLEAN DEFAULT '0',                         -- true/false if recurring
+    recurrence INT NULL DEFAULT 0,                         -- recurrence type
+    PRIMARY KEY (id),
+    INDEX(account),
+    INDEX(transaction_time),
+    INDEX(due_date)
+);
+
+----
+
+-- Line Item Types
+CREATE TABLE {prefix}invoice_types (
+    id INT NOT NULL AUTO_INCREMENT,
+    name TINYTEXT NOT NULL,                                -- name
+    parent INT NOT NULL DEFAULT 0,                         -- 0 if top level otherwise ref to another line_item_type as it's parent
+    member_type INT NOT NULL DEFAULT 0,                    -- Member Type assigned Default 0
+    amount DECIMAL(8,2) NOT NULL DEFAULT '0.00',           -- amount
+    recurring BOOLEAN DEFAULT '0',                         -- true/false if recurring
+    recurrence INT NULL DEFAULT 0,                         -- recurrence type
+    PRIMARY KEY (id)
+);
+
+----
+
+-- Line Items
+CREATE TABLE {prefix}line_items (
+    id INT NOT NULL AUTO_INCREMENT,
+    invoice INT NOT NULL,                                  -- reference to invoice
+    line_item_type INT NOT NULL,                           -- reference to line item type
+    account INT NULL DEFAULT 0,                            -- ref to account id (renewal or employee)
+    name TEXT NOT NULL,                                    -- line item name
+    amount DECIMAL(8,2) DEFAULT '0.00',                    -- line item amount per item
+    quantity INT DEFAULT 1,                                -- quantity
+    total DECIMAL(8,2) DEFAULT '0.00',                     -- line item total
+    recurring BOOLEAN DEFAULT '0',                         -- true/false if recurring
+    recurrence INT NULL DEFAULT 0,                         -- recurrence type
+    created DATE NULL,                                     -- Date this line item was first created
+    first_due_date DATE NULL,                              -- The first due date for this item
+    next_due_date DATE NULL,                               -- Next Due Date for this item
+    PRIMARY KEY (id),
+    INDEX(account),
+    INDEX(created),
+    INDEX(first_due_date),
+    INDEX(next_due_date)
+);
+
+----
+
+-- payments
+CREATE TABLE {prefix}payments (
+    id INT NOT NULL AUTO_INCREMENT,
+    transaction_time DATETIME NOT NULL,                    -- datetime of payment
+    account INT NOT NULL,                                  -- ref to account table
+    amount DECIMAL(8, 2) NOT NULL,                         -- payment amount
+    payment_method TINYTEXT NOT NULL,                      -- payment method
+    payment_data TINYTEXT NULL,                            -- additional payment info
+    PRIMARY KEY (id)
+);
+
+----
+
+-- pdfs
+CREATE TABLE {prefix}pdfs (
+    id INT NOT NULL AUTO_INCREMENT,
+    ref_type INT NOT NULL,                                 -- reference type
+    ref_dest INT NOT NULL,                                 -- reference types id
+    pdf MEDIUMTEXT NOT NULL,                               -- saved pdf
+    PRIMARY KEY (id)
+);
+
+----
+
+-- Notification Types
+CREATE TABLE {prefix}notification_types (
+    id INT NOT NULL AUTO_INCREMENT,
+    name TINYTEXT NOT NULL,                                -- name
+    to_email TINYTEXT NULL,                                -- To email
+    from_header TINYTEXT NOT NULL,                         -- from headers
+    replyto TINYTEXT NULL,                                 -- reply-to headers
+    subject TINYTEXT NOT NULL,                             -- Subject
+    message TEXT NOT NULL,                                 -- Message
+    send_by_date BOOLEAN NULL DEFAULT '0',                 -- true/false send by date based on due date
+    send_by_action BOOLEAN NULL DEFAULT '0',               -- send notice based on an action
+    send_action INT NULL DEFAULT 0,                        -- (create invoice or receive payment)
+    send_date_number INT NULL DEFAULT 0,                   -- number to apply to send by date
+    send_date_period INT NULL DEFAULT 0,                   -- (days,weeks,months,years)
+    send_date_when INT NULL DEFAULT 0,                     -- (before or after)
+    PRIMARY KEY (id)
+);
+
+----
+
+-- Notifications
+CREATE TABLE {prefix}notifications (
+    id INT NOT NULL AUTO_INCREMENT,
+    notification_type INT NOT NULL,                        -- ref to notification type
+    account INT NOT NULL,                                  -- ref to account
+    from_replyto TINYTEXT NOT NULL,                        -- from reply-to header
+    subject TEXT NOT NULL,                                 -- subject
+    message TEXT NOT NULL,                                 -- message
+    date_sent DATETIME NOT NULL,                           -- Date the notice was sent
+    email_sent TINYTEXT NOT NULL,                          -- email used
+    PRIMARY KEY (id)
+);
+
+----
+
+-- Notification Queue
+CREATE TABLE {prefix}notification_queue (
+    id INT NOT NULL AUTO_INCREMENT,
+    notification_type INT NOT NULL,                        -- ref to notification type
+    account INT NOT NULL,                                  -- ref to account
+    queued_time DATETIME NOT NULL,                         -- Creation time
+    processed_time DATETIME NULL,                          -- The time this queue was processed. (sent out)
+    PRIMARY KEY (id),
+    INDEX (notification_type),
+    INDEX (account),
+    INDEX (queued_time),
+    INDEX (processed_time)
+);
+
+----
+
+-- Gateway Settings
+CREATE TABLE {prefix}gateway_settings (
+    id INT NOT NULL AUTO_INCREMENT,
+    name TEXT NOT NULL,
+    login_id TINYTEXT NOT NULL,
+    transaction_key TINYTEXT NOT NULL,
+    PRIMARY KEY (id)
+);
+
+----
+
+-- Invoice Payments
+CREATE TABLE {prefix}invoice_payments (
+    id INT NOT NULL AUTO_INCREMENT,
+    invoice INT NOT NULL,                                  -- reference to invoice id
+    payment INT NOT NULL,                                  -- reference to payment id
+    amount DECIMAL(8, 2) NOT NULL,                         -- payment amount
+    PRIMARY KEY (id),
+    INDEX(invoice)
+);
+
+----
+
+-- Settings
+CREATE TABLE {prefix}settings (
+    id INT NOT NULL AUTO_INCREMENT,
+    company_logo TINYTEXT NULL,                            -- Image logo
+    company_logo_height INT NULL,                          -- Logo Height (only used if creating pdf)
+    company_name TINYTEXT NULL,                            -- Company Name
+    company_name2 TINYTEXT NULL,                           -- Company Name 2
+    company_addr1 TINYTEXT NULL,                           -- Company Address 1
+    company_addr2 TINYTEXT NULL,                           -- Company Address 2
+    company_city TINYTEXT NULL,                            -- Company City
+    company_state TINYTEXT NULL,                           -- Company State
+    company_zip TINYTEXT NULL,                             -- Company Zip
+    company_phone TINYTEXT NULL,                           -- Company Phone
+    company_email TINYTEXT NULL,                           -- Company Email
+    company_url TINYTEXT NULL,                             -- Company URL
+    payment_terms TEXT NULL,                               -- Payment Terms
+    days_before_renewal INT NULL,                          -- Number of days before renewal date to allow renewals
+    days_after_expired INT NULL,                           -- Number of days after renewal date expired
+    allow_membership_choice BOOLEAN DEFAULT '0',           -- If memberships can choose their membership levels when they renew
+    allow_employees BOOLEAN DEFAULT '0',                   -- If memberships have employees
+    PRIMARY KEY (id)
+);
+
+----
+
+-- Set default billing Settings entry
+INSERT INTO {prefix}settings
+    ( id, days_before_renewal ,days_after_expired )
+    VALUES
+    ( 1, 90, 30 );
+
+----
+
+-- Management
+CREATE TABLE {prefix}management (
+    id INT NOT NULL AUTO_INCREMENT,
+    payment_methods SMALLINT NULL,                              -- Payment methods available for all registrations - Bitmap - see payment_method in plugin.ini
+    proc_methods SMALLINT NULL,                                 -- Credit Cart payment processing methods available - Bitmap - see proc_method in plugin.ini
+    cc_accepts SMALLINT NULL,                                   -- Credit Cards Accepted - Bitmap - See credit_card in plugin.ini
+    -- Authorize.net Credentials
+    authorize_net_login TINYTEXT NULL,
+    authorize_net_key TINYTEXT NULL,
+    authorize_net_test TINYINT NULL,                            -- Authorize.net test mode - List - see proc_test_mode in plugin.ini
+    authorize_net_conf BOOLEAN NULL,                            -- Flag to send payment confirmation Email from Authorize.net
+    authorize_net_merchant_email TINYTEXT NULL,                 -- E-Mail Authorize.net will send copy of confirmation E-Mail
+    -- Merchant Solutions Credentials
+    merchant_solutions_acctid TINYTEXT NULL,                    -- Merchant Solutions credentials
+    merchant_solutions_merchantpin TINYTEXT NULL,
+    merchant_solutions_test TINYINT NULL,                       -- Merchant Solutions test mode - List - see proc_test_mode in plugin.ini
+    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
+    PRIMARY KEY (id)
+);
+
+----
+
+-- Set default billing Management entry
+INSERT INTO {prefix}management
+    ( id )
+    VALUES
+    ( 1 );
+
+----
+
+-- Employees table
+CREATE TABLE {prefix}employees (
+    id INT NOT NULL AUTO_INCREMENT,
+    account INT NOT NULL,                                     -- Account Id
+    employee INT NOT NULL,                                     -- Employee Account Id
+    PRIMARY KEY (id)
+);
index 6177b2c..0c31fb0 100644 (file)
@@ -39,5 +39,6 @@ $glmMembersBillingDbVersions = array(
     '0.0.23' => array('version' => '0.0.23', 'tables' => 15),
     '0.0.24' => array('version' => '0.0.24', 'tables' => 15),
     '0.0.25' => array('version' => '0.0.25', 'tables' => 15),
+    '0.0.26' => array('version' => '0.0.26', 'tables' => 15),
 );
 
diff --git a/setup/databaseScripts/update_database_V0.0.26.sql b/setup/databaseScripts/update_database_V0.0.26.sql
new file mode 100644 (file)
index 0000000..2f7f4c1
--- /dev/null
@@ -0,0 +1,20 @@
+-- Gaslight Media Billing Database
+-- File Created: 2018-07-26
+-- Database Version: 0.0.26
+--
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashes
+
+ALTER TABLE {prefix}accounts ADD billing_company TINYTEXT NULL;   -- Billing Title/Position
+
+----
+
+ALTER TABLE {prefix}accounts ADD billing_position TINYTEXT NULL;   -- Billing Title/Position
+
+----
+
+ALTER TABLE {prefix}accounts ADD billing_country TINYTEXT NULL;    -- Billing Country
+
+----
+
+ALTER TABLE {prefix}accounts ADD billing_fax TINYTEXT NULL;        -- Billing Fax
index 7d20414..614d11d 100644 (file)
         <div class="glm-billing-field">
             <div class="glm-billing-label{if $account.fieldRequired.email} glm-required{/if}">Billing Email</div>
             <div class="glm-billing-input{if $account.fieldFail.email} glm-form-bad-input{/if}" data-tabid="glm-email">
-                <input type="text" name="email" value="{$account.fieldData.email}" class="glm-form-text-input-medium">
+                <input type="text" name="email" value="{$account.fieldData.email}" class="glm-form-text-input-medium"{if $account.fieldRequired.email} required{/if}>
             {if $account.fieldFail.email}<p>{$account.fieldFail.email}</p>{/if}<br>
             </div>
         </div>
 
+        <div class="glm-billing-field">
+            <div class="glm-billing-label{if $account.fieldRequired.billing_company} glm-required{/if}">Billing Company</div>
+            <div class="glm-billing-input{if $account.fieldFail.billing_company} glm-form-bad-input{/if}" data-tabid="glm-billing-company">
+                <input type="text" name="billing_company" value="{$account.fieldData.billing_company}" class="glm-form-text-input-medium"{if $account.fieldRequired.billing_company} required{/if}>
+            {if $account.fieldFail.billing_company}<p>{$account.fieldFail.billing_company}</p>{/if}<br>
+            </div>
+        </div>
+
+        <div class="glm-billing-field">
+            <div class="glm-billing-label{if $account.fieldRequired.billing_position} glm-required{/if}">Billing Position</div>
+            <div class="glm-billing-input{if $account.fieldFail.billing_position} glm-form-bad-input{/if}" data-tabid="glm-billing-position">
+                <input type="text" name="billing_position" value="{$account.fieldData.billing_position}" class="glm-form-text-input-medium"{if $account.fieldRequired.billing_position} required{/if}>
+            {if $account.fieldFail.billing_position}<p>{$account.fieldFail.billing_position}</p>{/if}<br>
+            </div>
+        </div>
+
+
         <div class="glm-billing-field glm-billing-left-half">
             <div class="glm-billing-label{if $account.fieldRequired.billing_fname} glm-required{/if}">Billing First Name</div>
             <div class="glm-billing-input{if $account.fieldFail.billing_fname} glm-form-bad-input{/if}" data-tabid="glm-billing-fname">
-                <input type="text" name="billing_fname" value="{$account.fieldData.billing_fname}" class="glm-form-text-input-medium">
+                <input type="text" name="billing_fname" value="{$account.fieldData.billing_fname}" class="glm-form-text-input-medium"{if $account.fieldRequired.billing_fname} required{/if}>
             {if $account.fieldFail.billing_fname}<p>{$account.fieldFail.billing_fname}</p>{/if}<br>
             </div>
         </div>
         <div class="glm-billing-field glm-billing-right-half">
             <div class="glm-billing-label{if $account.fieldRequired.billing_lname} glm-required{/if}">Billing Last Name</div>
             <div class="glm-billing-input{if $account.fieldFail.billing_lname} glm-form-bad-input{/if}" data-tabid="glm-billing-lname">
-                <input type="text" name="billing_lname" value="{$account.fieldData.billing_lname}" class="glm-form-text-input-medium">
+                <input type="text" name="billing_lname" value="{$account.fieldData.billing_lname}" class="glm-form-text-input-medium"{if $account.fieldRequired.billing_lname} required{/if}>
             {if $account.fieldFail.billing_lname}<p>{$account.fieldFail.billing_lname}</p>{/if}<br>
             </div>
         </div>
         <div class="glm-billing-field glm-billing-left-half">
             <div class="glm-billing-label{if $account.fieldRequired.billing_addr1} glm-required{/if}">Billing Address 1</div>
             <div class="glm-billing-input{if $account.fieldFail.billing_addr1} glm-form-bad-input{/if}" data-tabid="glm-billing-addr1">
-                <input type="text" name="billing_addr1" value="{$account.fieldData.billing_addr1}" class="glm-form-text-input-medium">
+                <input type="text" name="billing_addr1" value="{$account.fieldData.billing_addr1}" class="glm-form-text-input-medium"{if $account.fieldRequired.billing_addr1} required{/if}>
             {if $account.fieldFail.billing_addr1}<p>{$account.fieldFail.billing_addr1}</p>{/if}<br>
             </div>
         </div>
         <div class="glm-billing-field glm-billing-right-half">
             <div class="glm-billing-label{if $account.fieldRequired.billing_addr2} glm-required{/if}">Billing Address2</div>
             <div class="glm-billing-input{if $account.fieldFail.billing_addr2} glm-form-bad-input{/if}" data-tabid="glm-billing-addr2">
-                <input type="text" name="billing_addr2" value="{$account.fieldData.billing_addr2}" class="glm-form-text-input-medium">
+                <input type="text" name="billing_addr2" value="{$account.fieldData.billing_addr2}" class="glm-form-text-input-medium"{if $account.fieldRequired.billing_addr2} required{/if}>
             {if $account.fieldFail.billing_addr2}<p>{$account.fieldFail.billing_addr2}</p>{/if}<br>
             </div>
         </div>
         <div class="glm-billing-field glm-billing-left-half">
             <div class="glm-billing-label{if $account.fieldRequired.billing_city} glm-required{/if}">Billing City</div>
             <div class="glm-billing-input{if $account.fieldFail.billing_city} glm-form-bad-input{/if}" data-tabid="glm-billing-city">
-                <input type="text" name="billing_city" value="{$account.fieldData.billing_city}" class="glm-form-text-input-medium">
+                <input type="text" name="billing_city" value="{$account.fieldData.billing_city}" class="glm-form-text-input-medium"{if $account.fieldRequired.billing_city} required{/if}>
             {if $account.fieldFail.billing_city}<p>{$account.fieldFail.billing_city}</p>{/if}<br>
             </div>
         </div>
         <div class="glm-billing-field glm-billing-right-half">
             <div class="glm-billing-label{if $account.fieldRequired.billing_state} glm-required{/if}">Billing State</div>
             <div class="glm-billing-input{if $account.fieldFail.billing_state} glm-form-bad-input{/if}" data-tabid="glm-billing-state">
-                <select name="billing_state">
+                <select name="billing_state"{if $account.fieldRequired.billing_state} required{/if}>
                     <option value=""></option>
                     {foreach $account.fieldData.billing_state.list as $s}
                         <option value="{$s.value}"{if $account.fieldData.billing_state.value == $s.value} selected="selected"{/if}>
         <div class="glm-billing-field glm-billing-left-half">
             <div class="glm-billing-label{if $account.fieldRequired.billing_zip} glm-required{/if}">Billing Zip</div>
             <div class="glm-billing-input{if $account.fieldFail.billing_zip} glm-form-bad-input{/if}" data-tabid="glm-billing-zip">
-                <input type="text" name="billing_zip" value="{$account.fieldData.billing_zip}" class="glm-form-text-input-medium">
+                <input type="text" name="billing_zip" value="{$account.fieldData.billing_zip}" class="glm-form-text-input-medium"{if $account.fieldRequired.billing_zip} required{/if}>
             {if $account.fieldFail.billing_zip}<p>{$account.fieldFail.billing_zip}</p>{/if}<br>
             </div>
         </div>
 
         <div class="glm-billing-field glm-billing-right-half">
+            <div class="glm-billing-label{if $account.fieldRequired.billing_country} glm-required{/if}">Billing Country</div>
+            <div class="glm-billing-input{if $account.fieldFail.billing_country} glm-form-bad-input{/if}" data-tabid="glm-billing-country">
+                <input type="text" name="billing_country" value="{$account.fieldData.billing_country}" class="glm-form-text-input-medium"{if $account.fieldRequired.billing_country} required{/if}>
+            {if $account.fieldFail.billing_country}<p>{$account.fieldFail.billing_country}</p>{/if}<br>
+            </div>
+        </div>
+
+        <div class="glm-billing-field glm-billing-left-half">
             <div class="glm-billing-label{if $account.fieldRequired.billing_phone} glm-required{/if}">Billing Phone</div>
             <div class="glm-billing-input{if $account.fieldFail.billing_phone} glm-form-bad-input{/if}" data-tabid="glm-billing-phone">
-                <input type="text" name="billing_phone" value="{$account.fieldData.billing_phone}" class="glm-form-text-input-medium">
+                <input type="text" name="billing_phone" value="{$account.fieldData.billing_phone}" class="glm-form-text-input-medium"{if $account.fieldRequired.billing_phone} required{/if}>
             {if $account.fieldFail.billing_phone}<p>{$account.fieldFail.billing_phone}</p>{/if}<br>
             </div>
         </div>
 
+        <div class="glm-billing-field glm-billing-right-half">
+            <div class="glm-billing-label{if $account.fieldRequired.billing_fax} glm-required{/if}">Billing Fax</div>
+            <div class="glm-billing-input{if $account.fieldFail.billing_fax} glm-form-bad-input{/if}" data-tabid="glm-billing-fax">
+                <input type="text" name="billing_fax" value="{$account.fieldData.billing_fax}" class="glm-form-text-input-medium"{if $account.fieldRequired.billing_fax} required{/if}>
+            {if $account.fieldFail.billing_fax}<p>{$account.fieldFail.billing_fax}</p>{/if}<br>
+            </div>
+        </div>
+
         </fieldset>
 
         <input class="button button-primary" type="submit" value="{if $haveAccount}Save{else}Create{/if} Account">