From b848edcee37d6bd3e94e97446ded703c03d07c13 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Tue, 19 Mar 2019 15:03:02 -0400 Subject: [PATCH] New db fields Adding table for terms Adding option for invoices --- classes/data/dataSettings.php | 42 +++++++++++ index.php | 2 +- ...0.0.33.sql => create_database_V0.0.34.sql} | 56 +++++++++++++- setup/databaseScripts/dbVersions.php | 1 + .../update_database_V0.0.34.sql | 75 +++++++++++++++++++ views/admin/settings/billing.html | 62 +++++++++++++++ 6 files changed, 236 insertions(+), 2 deletions(-) rename setup/databaseScripts/{create_database_V0.0.33.sql => create_database_V0.0.34.sql} (91%) create mode 100644 setup/databaseScripts/update_database_V0.0.34.sql diff --git a/classes/data/dataSettings.php b/classes/data/dataSettings.php index 050faad..53ff9d3 100644 --- a/classes/data/dataSettings.php +++ b/classes/data/dataSettings.php @@ -129,6 +129,13 @@ class GlmDataBillingSettings extends GlmDataAbstract 'use' => 'a', ), + // Logo for Invioce PDF + 'company_logo_width' => array( + 'field' => 'company_logo_width', + 'type' => 'integer', + 'use' => 'a', + ), + // Name 'company_name' => array( 'field' => 'company_name', @@ -321,6 +328,41 @@ class GlmDataBillingSettings extends GlmDataAbstract 'use' => 'a', ), + // Show account number in invoice + 'invoice_show_account_number' => array( + 'field' => 'invoice_show_account_number', + 'type' => 'checkbox', + 'use' => 'a', + ), + + // Show invoice number in invoice + 'invoice_show_invoice_number' => array( + 'field' => 'invoice_show_invoice_number', + 'type' => 'checkbox', + 'use' => 'a', + ), + + // Account Number Enabled + 'account_number_enabled' => array( + 'field' => 'account_number_enabled', + 'type' => 'checkbox', + 'use' => 'a', + ), + + // Account Number Required + 'account_number_required' => array( + 'field' => 'account_number_required', + 'type' => 'checkbox', + 'use' => 'a', + ), + + // Account Number Unique + 'account_number_unique' => array( + 'field' => 'account_number_unique', + 'type' => 'checkbox', + 'use' => 'a', + ), + ); } diff --git a/index.php b/index.php index f33b2cf..ecd8ef8 100644 --- a/index.php +++ b/index.php @@ -38,7 +38,7 @@ * version from this plugin. */ define('GLM_MEMBERS_BILLING_PLUGIN_VERSION', '1.0.25'); -define('GLM_MEMBERS_BILLING_PLUGIN_DB_VERSION', '0.0.33'); +define('GLM_MEMBERS_BILLING_PLUGIN_DB_VERSION', '0.0.34'); // 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.33.sql b/setup/databaseScripts/create_database_V0.0.34.sql similarity index 91% rename from setup/databaseScripts/create_database_V0.0.33.sql rename to setup/databaseScripts/create_database_V0.0.34.sql index d045a3f..b4027f9 100644 --- a/setup/databaseScripts/create_database_V0.0.33.sql +++ b/setup/databaseScripts/create_database_V0.0.34.sql @@ -235,8 +235,9 @@ CREATE TABLE {prefix}invoice_payments ( -- Settings CREATE TABLE {prefix}settings ( id INT NOT NULL AUTO_INCREMENT, + -- Invoice Options company_logo TINYTEXT NULL, -- Image logo - company_logo_height INT NULL, -- Logo Height (only used if creating pdf) + company_logo_width INT NULL, -- Logo Width (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 @@ -248,8 +249,11 @@ CREATE TABLE {prefix}settings ( company_email TINYTEXT NULL, -- Company Email company_url TINYTEXT NULL, -- Company URL payment_terms TEXT NULL, -- Payment Terms + invoice_show_account_number BOOLEAN DEFAULT '0', -- Show Billing Account number on invoices + invoice_show_invoice_number BOOLEAN DEFAULT '1', -- Show Invoice Number on invoices 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 + -- Renewal Options 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 member_types_enabled BOOLEAN DEFAULT '1', -- member types determine invoice types @@ -264,6 +268,10 @@ CREATE TABLE {prefix}settings ( invoice_pdf_enabled BOOLEAN DEFAULT '0', -- Create PDF invoices billing_contact_name_enabled BOOLEAN DEFAULT '0', -- Use billing_contact_name instead of fname lname member_types_requiring_billing TEXT NULL, -- List of member type id's that require billing + -- Account Number + account_number_enabled BOOLEAN DEFAULT '0', -- Enable Disable account_number + account_number_required BOOLEAN DEFAULT '0', -- Require account_number + account_number_unique BOOLEAN DEFAULT '0', -- account_number must be unique PRIMARY KEY (id) ); @@ -317,3 +325,49 @@ CREATE TABLE {prefix}employees ( employee INT NOT NULL, -- Employee Account Id PRIMARY KEY (id) ); + +---- + +-- Terms +CREATE TABLE {prefix}settings_terms ( + id INT NOT NULL AUTO_INCREMENT, + invoice_name TINYTEXT NOT NULL, + invoice_name_plur TINYTEXT NOT NULL, + invoice_name_cap TINYTEXT NOT NULL, + invoice_name_plur_cap TINYTEXT NOT NULL, + invoice_type TINYTEXT NOT NULL, + invoice_type_plur TINYTEXT NOT NULL, + invoice_type_cap TINYTEXT NOT NULL, + invoice_type_plur_cap TINYTEXT NOT NULL, + account_number TINYTEXT NOT NULL, + PRIMARY KEY (id) +); + +---- + +INSERT INTO {prefix}settings_terms + ( + id, + invoice_name, + invoice_name_plur, + invoice_name_cap, + invoice_name_plur_cap, + invoice_type, + invoice_type_plur, + invoice_type_cap, + invoice_type_plur_cap, + account_number + ) + VALUES + ( + 1, + 'invoice', + 'invoices', + 'Invoice', + 'Invoices', + 'invoice type', + 'invoice types', + 'Invoice Type', + 'Invoice Types', + 'Account Number' + ); diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php index ea5f30a..df2274b 100644 --- a/setup/databaseScripts/dbVersions.php +++ b/setup/databaseScripts/dbVersions.php @@ -47,5 +47,6 @@ $glmMembersBillingDbVersions = array( '0.0.31' => array('version' => '0.0.31', 'tables' => 15, 'date' => '12/17/2018'), '0.0.32' => array('version' => '0.0.32', 'tables' => 15, 'date' => '12/26/2018'), '0.0.33' => array('version' => '0.0.33', 'tables' => 15, 'date' => '02/19/2019'), + '0.0.34' => array('version' => '0.0.34', 'tables' => 16, 'date' => '03/19/2019'), ); diff --git a/setup/databaseScripts/update_database_V0.0.34.sql b/setup/databaseScripts/update_database_V0.0.34.sql new file mode 100644 index 0000000..82d1703 --- /dev/null +++ b/setup/databaseScripts/update_database_V0.0.34.sql @@ -0,0 +1,75 @@ +-- Gaslight Media Billing Database +-- File Created: 3/19/2019 +-- Database Version: 0.0.34 +-- +-- To permit each query below to be executed separately, +-- all queries must be separated by a line with four dashes + +-- Update the settings table +ALTER TABLE {prefix}settings CHANGE company_logo_height company_logo_width INT NULL; -- change height to width + +---- + +ALTER TABLE {prefix}settings ADD invoice_show_account_number BOOLEAN DEFAULT '0'; -- Show Billing Account number on invoices + +---- + +ALTER TABLE {prefix}settings ADD invoice_show_invoice_number BOOLEAN DEFAULT '1'; -- Show Invoice Number on invoices + +---- + +ALTER TABLE {prefix}settings ADD account_number_enabled BOOLEAN DEFAULT '0'; -- Enable Disable account_number + +---- + +ALTER TABLE {prefix}settings ADD account_number_required BOOLEAN DEFAULT '0'; -- Require account_number + +---- + +ALTER TABLE {prefix}settings ADD account_number_unique BOOLEAN DEFAULT '0'; -- account_number must be unique + +---- + +-- Terms +CREATE TABLE {prefix}settings_terms ( + id INT NOT NULL AUTO_INCREMENT, + invoice_name TINYTEXT NOT NULL, + invoice_name_plur TINYTEXT NOT NULL, + invoice_name_cap TINYTEXT NOT NULL, + invoice_name_plur_cap TINYTEXT NOT NULL, + invoice_type TINYTEXT NOT NULL, + invoice_type_plur TINYTEXT NOT NULL, + invoice_type_cap TINYTEXT NOT NULL, + invoice_type_plur_cap TINYTEXT NOT NULL, + account_number TINYTEXT NOT NULL, + PRIMARY KEY (id) +); + +---- + +INSERT INTO {prefix}settings_terms + ( + id, + invoice_name, + invoice_name_plur, + invoice_name_cap, + invoice_name_plur_cap, + invoice_type, + invoice_type_plur, + invoice_type_cap, + invoice_type_plur_cap, + account_number + ) + VALUES + ( + 1, + 'invoice', + 'invoices', + 'Invoice', + 'Invoices', + 'invoice type', + 'invoice types', + 'Invoice Type', + 'Invoice Types', + 'Account Number' + ); diff --git a/views/admin/settings/billing.html b/views/admin/settings/billing.html index 27c6d3d..e0d08db 100644 --- a/views/admin/settings/billing.html +++ b/views/admin/settings/billing.html @@ -39,6 +39,26 @@ + + + Width of PDF Logo
+ Must be a number + + + + {if $billingSettings.fieldFail.company_logo_width}

{$billingSettings.fieldFail.company_logo_width}

{/if}
+ + + + Invoice Options + + Company Name @@ -134,6 +154,48 @@ + + + + + + Shown Account # + + + + + + + + Shown invoice # + + + + + + + + Enable Account Number + + + + + + + + Require Account Number + + + + + + + + Require Unique Account Numbers + + + + Billing Options -- 2.17.1