From 492ff26e22e25e49f981835e9f6a64e5e4f92128 Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Wed, 18 Oct 2017 14:28:17 -0400 Subject: [PATCH] updating database files to add the required field option for the fields adding required field checkbox option in the mgmt view file when adding custom fields. adjusted the index file, db versions, update and create db scripts --- classes/data/dataCustomFields.php | 8 +++++++- index.php | 2 +- ...te_database_V0.0.3.sql => create_database_V0.0.4.sql} | 3 ++- setup/databaseScripts/dbVersions.php | 1 + setup/databaseScripts/update_database_V0.0.4.sql | 9 +++++++++ views/admin/management/fields.html | 7 +++++++ 6 files changed, 27 insertions(+), 3 deletions(-) rename setup/databaseScripts/{create_database_V0.0.3.sql => create_database_V0.0.4.sql} (91%) create mode 100644 setup/databaseScripts/update_database_V0.0.4.sql diff --git a/classes/data/dataCustomFields.php b/classes/data/dataCustomFields.php index 25f29ef..b860f62 100644 --- a/classes/data/dataCustomFields.php +++ b/classes/data/dataCustomFields.php @@ -138,7 +138,13 @@ class GlmDataFieldsCustomFields extends GlmDataAbstract 'required' => true, 'use' => 'a' ), - + // required field + 'required' => array( + 'field' => 'required', + 'type' => 'checkbox', + 'default' => false, + 'use' => 'a' + ), // admin_search flag 'admin_search' => array ( 'field' => 'admin_search', diff --git a/index.php b/index.php index 308f9a6..5d83803 100644 --- a/index.php +++ b/index.php @@ -38,7 +38,7 @@ * version from this plugin. */ define('GLM_MEMBERS_FIELDS_PLUGIN_VERSION', '1.0.3'); -define('GLM_MEMBERS_FIELDS_PLUGIN_DB_VERSION', '0.0.3'); +define('GLM_MEMBERS_FIELDS_PLUGIN_DB_VERSION', '0.0.4'); // This is the minimum version of the GLM Members DB plugin require for this plugin. define('GLM_MEMBERS_FIELDS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '2.8.0'); diff --git a/setup/databaseScripts/create_database_V0.0.3.sql b/setup/databaseScripts/create_database_V0.0.4.sql similarity index 91% rename from setup/databaseScripts/create_database_V0.0.3.sql rename to setup/databaseScripts/create_database_V0.0.4.sql index 9b11472..cdb4b53 100644 --- a/setup/databaseScripts/create_database_V0.0.3.sql +++ b/setup/databaseScripts/create_database_V0.0.4.sql @@ -1,6 +1,6 @@ -- Gaslight Media Members Database - Fields Add-On -- File Created: 2017-03-27 --- Database Version: 0.0.2 +-- Database Version: 0.0.4 -- Database Creation Script -- -- This file is called to create a new set of tables for this @@ -19,6 +19,7 @@ CREATE TABLE {prefix}custom_fields ( field_type TINYTEXT NOT NULL DEFAULT '', -- Field Type field_order SMALLINT NOT NULL DEFAULT 0, -- Order for Field admin_search BOOLEAN NOT NULL DEFAULT '0', -- If the field is added to member list filters. + required BOOLEAN NOT NULL DEFAULT '0', -- If the field is arequired. PRIMARY KEY (id), INDEX(field_name(20)) ); diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php index 68df00c..dc0810e 100644 --- a/setup/databaseScripts/dbVersions.php +++ b/setup/databaseScripts/dbVersions.php @@ -17,5 +17,6 @@ $glmMembersFieldsDbVersions = array( '0.0.1' => array('version' => '0.0.1', 'tables' => 2, 'date' => '03/27/2017'), '0.0.2' => array('version' => '0.0.2', 'tables' => 2, 'date' => '04/14/2017'), '0.0.3' => array('version' => '0.0.3', 'tables' => 2, 'date' => '04/24/2017'), + '0.0.4' => array('version' => '0.0.4', 'tables' => 2, 'date' => '10/18/2017'), ); diff --git a/setup/databaseScripts/update_database_V0.0.4.sql b/setup/databaseScripts/update_database_V0.0.4.sql new file mode 100644 index 0000000..c88a0eb --- /dev/null +++ b/setup/databaseScripts/update_database_V0.0.4.sql @@ -0,0 +1,9 @@ +-- Gaslit Media Members Database +-- File Created: 2017-04-14 +-- Database Version: 0.0.4 +-- 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 + +ALTER TABLE {prefix}custom_fields ADD COLUMN required BOOLEAN DEFAULT '0'; diff --git a/views/admin/management/fields.html b/views/admin/management/fields.html index a386da1..81a0b92 100644 --- a/views/admin/management/fields.html +++ b/views/admin/management/fields.html @@ -31,6 +31,13 @@ (text or checkbox only) + + Required? + + + + +

* Required

Cancel -- 2.17.1