Adding Salutation to the company info section. feature/revamp
authorSteve Sutton <steve@gaslightmedia.com>
Mon, 14 Oct 2019 17:31:50 +0000 (13:31 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Mon, 14 Oct 2019 17:31:50 +0000 (13:31 -0400)
Adding new field.

classes/data/dataContacts.php
index.php
setup/databaseScripts/create_database_V0.0.8.sql [deleted file]
setup/databaseScripts/create_database_V0.0.9.sql [new file with mode: 0644]
setup/databaseScripts/dbVersions.php
setup/databaseScripts/update_database_V0.0.9.sql [new file with mode: 0644]
views/admin/ajax/contactsListExport.html
views/admin/ajax/contactsListExportCsv.html
views/admin/contacts/edit.html
views/admin/contacts/index.html

index 4276d14..34c7179 100644 (file)
@@ -451,6 +451,13 @@ class GlmDataContacts extends GlmDataAbstract
                 'use' => 'lged'
             ),
 
+            // Org Salutation
+            'business_salutation' => array (
+                'field' => 'business_salutation',
+                'type'  => 'text',
+                'use'   => 'a'
+            ),
+
             // Org First Name
             'business_fname' => array (
                 'field' => 'business_fname',
index bd68e22..a7edf9d 100644 (file)
--- a/index.php
+++ b/index.php
@@ -40,7 +40,10 @@ if (!defined('ABSPATH')) {
  *  version nunmber of that release for the DB version.
  */
 define('GLM_MEMBERS_CONTACTS_PLUGIN_VERSION', '1.1.11');
-define('GLM_MEMBERS_CONTACTS_PLUGIN_DB_VERSION', '0.0.8');
+/**
+ * Database Version
+ */
+define('GLM_MEMBERS_CONTACTS_PLUGIN_DB_VERSION', '0.0.9');
 
 // This is the minimum version of the GLM Members DB plugin require for this plugin.
 define('GLM_MEMBERS_CONTACTS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '1.0.58');
diff --git a/setup/databaseScripts/create_database_V0.0.8.sql b/setup/databaseScripts/create_database_V0.0.8.sql
deleted file mode 100644 (file)
index af7da90..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
--- Gaslight Media Members Database
--- File Created: 12/09/14 15:27:15
--- Database Version: 0.0.8
--- Database Creation Script - Contacts Add-On
---
--- 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 ****
---
-
--- Contacts - used by various entities
-CREATE TABLE {prefix}contacts (
-    id INT NOT NULL AUTO_INCREMENT,
-    active BOOLEAN NULL,                      -- Contact is active flag
-    access INT NULL,                          -- Access type - See access table in plugin.ini
-    primary_contact BOOLEAN NULL,             -- Contact is the "Primary Contact" for mailings to entity (ref_type/ref_dest)
-    fname TINYTEXT NULL,                      -- First name of contact
-    lname TINYTEXT NULL,                      -- Last name of contact
-    contact_type INT NULL,                    -- Contact type - see contact_type table (individual, role, ...)
-    contact_role INT NULL,                    -- Contact WordPress user Role
-    org TINYTEXT NULL,                        -- Organization name
-    title TINYTEXT NULL,                      -- Title/Position
-    descr TEXT NULL,                          -- Description of position/responsibilities - Displayed
-    image TINYTEXT NULL,                      -- Image
-    addr1 TINYTEXT NULL,                      -- Address line 1 - Address is for contact, not necessarily for organization
-    addr2 TINYTEXT NULL,                      -- Address line 2
-    county TINYTEXT NULL,                     -- County
-    city INT NULL,                            -- Pointer to city in cities table
-    state TINYTEXT NULL,                      -- Two character state code - matches states.ini entries
-    country TINYTEXT NULL,                    -- Two character country code - matches countries.ini entries
-    zip TINYTEXT NULL,                        -- ZIP/Postal Code
-    lat FLOAT NULL,                           -- Latitude of contact location
-    lon FLOAT NULL,                           -- Longitude of contact location
-    url TINYTEXT NULL,                        -- URL to information regarding this contact
-    home_phone TINYTEXT NULL,                 -- Home phone number - or after-hours phone number
-    mobile_phone TINYTEXT NULL,               -- Mobile phone number
-    alt_phone TINYTEXT NULL,                  -- An alternate phone number
-    email TINYTEXT NULL,                      -- E-Mail address
-    alt_email TINYTEXT NULL,                  -- Alternate E-Mail address - Also used to log-in
-    username TINYTEXT NULL,                   -- Optional username to use for login
-    password TINYTEXT NULL,                   -- Encrypted password
-    notes TEXT NULL,                          -- Notes - Not displayed on front-end
-    create_time TIMESTAMP NULL,               -- Create date/time
-    modify_time TIMESTAMP NULL,               -- Last modified date/time
-    ref_type INT NULL,                        -- Type of entity this contact is associated with
-    ref_dest INT NULL,                        -- Pointer to the specific entity of ref_type this contact is associated with
-    business_fname TINYTEXT NULL,             -- Org First Name
-    business_lname TINYTEXT NULL,             -- Org Last Name
-    business_addr1 TINYTEXT NULL,             -- Org Address 1
-    business_addr2 TINYTEXT NULL,             -- Org Address 2
-    business_city INT NULL,                   -- Org City
-    business_state TINYTEXT NULL,             -- Org State
-    business_zip TINYTEXT NULL,               -- Org Zip
-    business_country TINYTEXT NULL,           -- Org Country
-    business_email TINYTEXT NULL,             -- Org Email
-    business_phone TINYTEXT NULL,             -- Org Phone in Directory
-    office_phone TINYTEXT NULL,               -- Org Office phone number
-    business_mobile TINYTEXT NULL,            -- Org Mobile
-    fax TINYTEXT NULL,                        -- Org FAX number (do people still use these?)
-    contact_publish BOOLEAN NULL,             -- Flag to publish Contact Info to Directory
-    contact_use_billing BOOLEAN NULL,         -- Flag to use Contact Info as Billing
-    business_publish BOOLEAN NULL,            -- Flag to publish Business to Directory
-    business_use_billing BOOLEAN NULL,        -- Flag to use Business as Billing
-    mailing_address_type TINYTEXT NULL,       -- Mailing Address Type
-    mailto_label TINYTEXT NULL,               -- Mail To Label
-    PRIMARY KEY (id),
-    INDEX(fname(20)),
-    INDEX(lname(20)),
-    INDEX(city),
-    INDEX(zip(10)),
-    INDEX(lat),
-    INDEX(lon),
-    INDEX(email(20))
-    );
-
-----
-
--- Settings
-CREATE TABLE {prefix}settings (
-    id INT NOT NULL AUTO_INCREMENT,
-    enable_custom_contact BOOLEAN DEFAULT false,    -- Enable / Disable Custom Contact
-    enable_contact_info BOOLEAN DEFAULT true,       -- Enable / Disable Contact Info
-    enable_profile_image BOOLEAN DEFAULT true,      -- Enable / Disable Profile Image
-    enable_billing_info BOOLEAN DEFAULT false,      -- Enable / Disable Billing Info
-    enable_organization BOOLEAN DEFAULT false,      -- Enable / Disable Organization
-    PRIMARY KEY (id)
-);
-
-----
-
--- Insert into settings
-INSERT INTO {prefix}settings ( id,enable_custom_contact, enable_contact_info, enable_profile_image, enable_billing_info, enable_organization ) VALUES ( 1, false, true, true, false, false );
diff --git a/setup/databaseScripts/create_database_V0.0.9.sql b/setup/databaseScripts/create_database_V0.0.9.sql
new file mode 100644 (file)
index 0000000..f1bac4d
--- /dev/null
@@ -0,0 +1,94 @@
+-- Gaslight Media Members Database
+-- File Created: 12/09/14 15:27:15
+-- Database Version: 0.0.9
+-- Database Creation Script - Contacts Add-On
+--
+-- 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 ****
+--
+
+-- Contacts - used by various entities
+CREATE TABLE {prefix}contacts (
+    id INT NOT NULL AUTO_INCREMENT,
+    active BOOLEAN NULL,                      -- Contact is active flag
+    access INT NULL,                          -- Access type - See access table in plugin.ini
+    primary_contact BOOLEAN NULL,             -- Contact is the "Primary Contact" for mailings to entity (ref_type/ref_dest)
+    fname TINYTEXT NULL,                      -- First name of contact
+    lname TINYTEXT NULL,                      -- Last name of contact
+    contact_type INT NULL,                    -- Contact type - see contact_type table (individual, role, ...)
+    contact_role INT NULL,                    -- Contact WordPress user Role
+    org TINYTEXT NULL,                        -- Organization name
+    title TINYTEXT NULL,                      -- Title/Position
+    descr TEXT NULL,                          -- Description of position/responsibilities - Displayed
+    image TINYTEXT NULL,                      -- Image
+    addr1 TINYTEXT NULL,                      -- Address line 1 - Address is for contact, not necessarily for organization
+    addr2 TINYTEXT NULL,                      -- Address line 2
+    county TINYTEXT NULL,                     -- County
+    city INT NULL,                            -- Pointer to city in cities table
+    state TINYTEXT NULL,                      -- Two character state code - matches states.ini entries
+    country TINYTEXT NULL,                    -- Two character country code - matches countries.ini entries
+    zip TINYTEXT NULL,                        -- ZIP/Postal Code
+    lat FLOAT NULL,                           -- Latitude of contact location
+    lon FLOAT NULL,                           -- Longitude of contact location
+    url TINYTEXT NULL,                        -- URL to information regarding this contact
+    home_phone TINYTEXT NULL,                 -- Home phone number - or after-hours phone number
+    mobile_phone TINYTEXT NULL,               -- Mobile phone number
+    alt_phone TINYTEXT NULL,                  -- An alternate phone number
+    email TINYTEXT NULL,                      -- E-Mail address
+    alt_email TINYTEXT NULL,                  -- Alternate E-Mail address - Also used to log-in
+    username TINYTEXT NULL,                   -- Optional username to use for login
+    password TINYTEXT NULL,                   -- Encrypted password
+    notes TEXT NULL,                          -- Notes - Not displayed on front-end
+    create_time TIMESTAMP NULL,               -- Create date/time
+    modify_time TIMESTAMP NULL,               -- Last modified date/time
+    ref_type INT NULL,                        -- Type of entity this contact is associated with
+    ref_dest INT NULL,                        -- Pointer to the specific entity of ref_type this contact is associated with
+    business_salutation TINYTEXT NULL,        -- Org Salutation
+    business_fname TINYTEXT NULL,             -- Org First Name
+    business_lname TINYTEXT NULL,             -- Org Last Name
+    business_addr1 TINYTEXT NULL,             -- Org Address 1
+    business_addr2 TINYTEXT NULL,             -- Org Address 2
+    business_city INT NULL,                   -- Org City
+    business_state TINYTEXT NULL,             -- Org State
+    business_zip TINYTEXT NULL,               -- Org Zip
+    business_country TINYTEXT NULL,           -- Org Country
+    business_email TINYTEXT NULL,             -- Org Email
+    business_phone TINYTEXT NULL,             -- Org Phone in Directory
+    office_phone TINYTEXT NULL,               -- Org Office phone number
+    business_mobile TINYTEXT NULL,            -- Org Mobile
+    fax TINYTEXT NULL,                        -- Org FAX number (do people still use these?)
+    contact_publish BOOLEAN NULL,             -- Flag to publish Contact Info to Directory
+    contact_use_billing BOOLEAN NULL,         -- Flag to use Contact Info as Billing
+    business_publish BOOLEAN NULL,            -- Flag to publish Business to Directory
+    business_use_billing BOOLEAN NULL,        -- Flag to use Business as Billing
+    mailing_address_type TINYTEXT NULL,       -- Mailing Address Type
+    mailto_label TINYTEXT NULL,               -- Mail To Label
+    PRIMARY KEY (id),
+    INDEX(fname(20)),
+    INDEX(lname(20)),
+    INDEX(city),
+    INDEX(zip(10)),
+    INDEX(lat),
+    INDEX(lon),
+    INDEX(email(20))
+    );
+
+----
+
+-- Settings
+CREATE TABLE {prefix}settings (
+    id INT NOT NULL AUTO_INCREMENT,
+    enable_custom_contact BOOLEAN DEFAULT false,    -- Enable / Disable Custom Contact
+    enable_contact_info BOOLEAN DEFAULT true,       -- Enable / Disable Contact Info
+    enable_profile_image BOOLEAN DEFAULT true,      -- Enable / Disable Profile Image
+    enable_billing_info BOOLEAN DEFAULT false,      -- Enable / Disable Billing Info
+    enable_organization BOOLEAN DEFAULT false,      -- Enable / Disable Organization
+    PRIMARY KEY (id)
+);
+
+----
+
+-- Insert into settings
+INSERT INTO {prefix}settings ( id,enable_custom_contact, enable_contact_info, enable_profile_image, enable_billing_info, enable_organization ) VALUES ( 1, false, true, true, false, false );
index 1d78618..a422343 100644 (file)
@@ -35,6 +35,7 @@ $glmMembersContactsDbVersions = array(
     '0.0.6' => array('version' => '0.0.6', 'tables' => 1, 'date' => '07/26/2018'),
     '0.0.7' => array('version' => '0.0.7', 'tables' => 1, 'date' => '08/09/2018'),
     '0.0.8' => array('version' => '0.0.8', 'tables' => 2, 'date' => '04/24/2019'),
+    '0.0.9' => array('version' => '0.0.9', 'tables' => 2, 'date' => '10/10/2019'),
 );
 
 
diff --git a/setup/databaseScripts/update_database_V0.0.9.sql b/setup/databaseScripts/update_database_V0.0.9.sql
new file mode 100644 (file)
index 0000000..a51d679
--- /dev/null
@@ -0,0 +1,10 @@
+-- Gaslight Media Members Database  - Contacts Add-On
+-- File Created: 10/10/19
+-- Database Version: 0.0.9
+-- Database Update From Previous Version Script
+--
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashes
+
+-- Add Salutation
+ALTER TABLE {prefix}contacts ADD COLUMN business_salutation TINYTEXT NULL;
index 4009f6f..eafdedd 100644 (file)
@@ -31,6 +31,7 @@
                     {if $select.exportMemberType}<th align="left">Member Type</th>{/if}
 
                     {if $select.exportOrg}<th align="left">Org</th>{/if}
+                    {if $select.exportBusSalutation}<th align="left">Business Salutation</th>{/if}
                     {if $select.exportBusFname}<th align="left">Business First Name</th>{/if}
                     {if $select.exportBusLname}<th align="left">Business Last Name</th>{/if}
                     {if $select.exportTitle}<th align="left">Title</th>{/if}
@@ -74,6 +75,7 @@
                     {if $select.exportMemberType}<td>{$m.member_type}</td>{/if}
 
                     {if $select.exportOrg}<td>{$m.org}</td>{/if}
+                    {if $select.exportBusSalutation}<td>{$m.business_salutation}</td>{/if}
                     {if $select.exportBusFname}<td>{$m.business_fname}</td>{/if}
                     {if $select.exportBusLname}<td>{$m.business_lname}</td>{/if}
                     {if $select.exportTitle}<td>{$m.title}</td>{/if}
index a54c63c..ea0f219 100644 (file)
@@ -18,6 +18,7 @@
 {if $select.exportAltEmail}"Alt E-Mail",{/if}
 {if $select.exportMemberType}"Member Type",{/if}
 {if $select.exportOrg}"Organization",{/if}
+{if $select.exportBusSalutation}"Business Salutation",{/if}
 {if $select.exportBusFname}"Business First Name",{/if}
 {if $select.exportBusLname}"Business Last Name",{/if}
 {if $select.exportTitle}"Title",{/if}
@@ -55,6 +56,7 @@
 {if $select.exportAltEmail}"{$m.alt_email}",{/if}
 {if $select.exportMemberType}"{$m.member_type}",{/if}
 {if $select.exportOrg}"{$m.org}",{/if}
+{if $select.exportBusSalutation}"{$m.business_salutation}",{/if}
 {if $select.exportBusFname}"{$m.business_fname}",{/if}
 {if $select.exportBusLname}"{$m.business_lname}",{/if}
 {if $select.exportTitle}"{$m.title}",{/if}
index 426319b..0b67efb 100644 (file)
 
                         {/if}
 
-                            <tr{if !$settings.enable_profile_image} class="glm-hidden"{/if}>
+                            <tr{if !$settings.enable_profile_image} class="glm-hidden{/if}>
                                 <th {if $contactInfo.fieldRequired.image}class="glm-required"{/if}>Profile Image</th>
                                 <td {if $contactInfo.fieldFail.image}class="glm-form-bad-input"{/if}>
                         {if $contactInfo.fieldData.image}
                                 </td>
                             </tr>
 
+                            <tr>
+                                <th {if $contactInfo.fieldRequired.business_salutation}class="glm-required"{/if}>Salutation</th>
+                                <td {if $contactInfo.fieldFail.business_salutation}class="glm-form-bad-input"{/if}>
+                                    <input type="text" name="business_salutation" value="{$contactInfo.fieldData.business_salutation}" class="glm-form-text-input-short">
+                                    {if $contactInfo.fieldFail.business_salutation}<p>{$contactInfo.fieldFail.business_salutation}</p>{/if}
+                                </td>
+                            </tr>
                             <tr>
                                 <th {if $contactInfo.fieldRequired.business_fname}class="glm-required"{/if}>First Name</th>
                                 <td {if $contactInfo.fieldFail.business_fname}class="glm-form-bad-input"{/if}>
index 902e660..2642c83 100644 (file)
                                     <label class="export-label"> <input type="checkbox" name="exportAltEmail" checked> Alt Email<br> </label>
                                     <label class="export-label"> <input type="checkbox" name="exportMemberType" checked> Member Type<br> </label>
                                     <label class="export-label"> <input type="checkbox" name="exportOrg" checked> Organization<br> </label>
+                                    <label class="export-label"> <input type="checkbox" name="exportBusSalutation" checked> Business Salutation<br> </label>
                                     <label class="export-label"> <input type="checkbox" name="exportBusFname" checked> Business First Name<br> </label>
                                     <label class="export-label"> <input type="checkbox" name="exportBusLname" checked> Business Last Name<br> </label>
                                 </td>