From 9ad2f0badfb23527627c31cb3aeca9201ab152c5 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Mon, 4 Apr 2016 16:30:10 -0400 Subject: [PATCH] Working on settings for event pdf adding new fields and db updates --- classes/data/dataManagement.php | 27 +++++++++++++---- index.php | 2 +- ..._V0.0.8.sql => create_database_V0.0.9.sql} | 4 ++- setup/databaseScripts/dbVersions.php | 3 +- setup/databaseScripts/readme.txt | 29 +++++++++++++++++++ .../update_database_V0.0.9.sql | 13 +++++++++ views/admin/management/events.html | 14 +++++++++ 7 files changed, 83 insertions(+), 9 deletions(-) rename setup/databaseScripts/{create_database_V0.0.8.sql => create_database_V0.0.9.sql} (97%) create mode 100644 setup/databaseScripts/update_database_V0.0.9.sql diff --git a/classes/data/dataManagement.php b/classes/data/dataManagement.php index ffea990..834d1e6 100644 --- a/classes/data/dataManagement.php +++ b/classes/data/dataManagement.php @@ -116,18 +116,33 @@ class GlmDataEventsManagement extends GlmDataAbstract $this->fields = array ( 'id' => array ( - 'field' => 'id', - 'type' => 'integer', + 'field' => 'id', + 'type' => 'integer', 'view_only' => true, - 'use' => 'a' + 'use' => 'a' ), // Canonical Page Slug 'canonical_event_page' => array ( - 'field' => 'canonical_event_page', - 'type' => 'text', + 'field' => 'canonical_event_page', + 'type' => 'text', 'required' => true, - 'use' => 'a' + 'use' => 'a' + ), + + // Logo for Event PDF + 'pdf_logo' => array( + 'field' => 'pdf_logo', + 'type' => 'image', + 'use' => 'a' + ), + + // Footer text for PDF + 'footer_text' => array( + 'field' => 'footer_text', + 'type' => 'text', + 'required' => false, + 'use' => 'a' ) ); diff --git a/index.php b/index.php index e9eb14e..187bdf9 100644 --- a/index.php +++ b/index.php @@ -39,7 +39,7 @@ * version from this plugin. */ define('GLM_MEMBERS_EVENTS_PLUGIN_VERSION', '0.0.1'); -define('GLM_MEMBERS_EVENTS_PLUGIN_DB_VERSION', '0.0.8'); +define('GLM_MEMBERS_EVENTS_PLUGIN_DB_VERSION', '0.0.9'); // This is the minimum version of the GLM Members DB plugin require for this plugin. define('GLM_MEMBERS_EVENTS_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.9.sql similarity index 97% rename from setup/databaseScripts/create_database_V0.0.8.sql rename to setup/databaseScripts/create_database_V0.0.9.sql index b22ddf4..be5432d 100644 --- a/setup/databaseScripts/create_database_V0.0.8.sql +++ b/setup/databaseScripts/create_database_V0.0.9.sql @@ -154,7 +154,9 @@ CREATE TABLE {prefix}events ( -- Event Management Settings CREATE TABLE {prefix}management ( id INT NOT NULL AUTO_INCREMENT, - canonical_event_page TINYTEXT NULL, -- Canonical page slug for event detail + canonical_event_page TINYTEXT NULL, -- Canonical page slug for event detail + pdf_logo TINYTEXT NULL, -- Image for the Top of the PDF + footer_texit TINYTEXT NULL, -- Image for the Top of the PDF PRIMARY KEY (id) ); diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php index b324373..7bb4a18 100644 --- a/setup/databaseScripts/dbVersions.php +++ b/setup/databaseScripts/dbVersions.php @@ -21,6 +21,7 @@ $glmMembersEventsDbVersions = array( '0.0.5' => array('version' => '0.0.5', 'tables' => 7), '0.0.6' => array('version' => '0.0.6', 'tables' => 7), '0.0.7' => array('version' => '0.0.7', 'tables' => 7), - '0.0.8' => array('version' => '0.0.8', 'tables' => 7) + '0.0.8' => array('version' => '0.0.8', 'tables' => 7), + '0.0.9' => array('version' => '0.0.9', 'tables' => 7) ); diff --git a/setup/databaseScripts/readme.txt b/setup/databaseScripts/readme.txt index 8d2866e..38ec539 100644 --- a/setup/databaseScripts/readme.txt +++ b/setup/databaseScripts/readme.txt @@ -8,3 +8,32 @@ for this add-on, there should be no files in this directory. The directory may also be deleted. See the "examples" directory for a sample of what can go in this directory. +Procedure to update database +----------------------------- + +0) Make a backup copy of the site's database. + +1) Rename "create_database_Vx.x.x.sql" to new version number. + example: create_database_V0.0.9.sql -> create_database_V0.0.10.sql + +2) Edit renamed create database file and make desired changes + +3) Add a new "update_database_Vx.x.x.sql" named with the correct version #. + +4) Edit new update database files with SQL script to make the necessary changes + from the previous version to the new version. (i.e. to add new fields, + rename fields, insert records, ...) + +5) Optionally add an "update_database_Vx.x.x.php" file if PHP scripting is + needed to update database content. (i.e. to make changes to database content) + +6) Edit the "dbVersions.php" file and add a new line for the new version. + +7) When this is all done, edit the index.php file for the plugin/add-on and + change "GLM_MEMBERS_{addon}_PLUGIN_DB_VERSION" defined parameter where + {addon} is the add-on name. + +8) Go to an admin menu item for the main member db plugin or any add-on. If all + goes well, the main plugin should have detected the change and updated the + database. If not, restore the database and try again. +9) Check the database to make sure the changes to fields and data are correct. diff --git a/setup/databaseScripts/update_database_V0.0.9.sql b/setup/databaseScripts/update_database_V0.0.9.sql new file mode 100644 index 0000000..2fef98d --- /dev/null +++ b/setup/databaseScripts/update_database_V0.0.9.sql @@ -0,0 +1,13 @@ +-- Gaslight Media Members Database - Events Add-On +-- File Created: 12/09/14 15:27:15 +-- Database Version: 0.0.6 +-- 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 dashses + + +-- Add use end time +ALTER TABLE {prefix}events ADD COLUMN pdf_logo TINYTEXT; +ALTER TABLE {prefix}events ADD COLUMN footer_text TINYTEXT; + diff --git a/views/admin/management/events.html b/views/admin/management/events.html index 0b32cb7..75003ee 100644 --- a/views/admin/management/events.html +++ b/views/admin/management/events.html @@ -30,6 +30,20 @@ {if $eventsSettings.fieldFail.canonical_event_page}

{$eventsSettings.fieldFail.canonical_event_page}

{/if} + + Logo for Event PDF: + + + {if $eventsSettings.fieldFail.pdf_logo}

{$eventsSettings.fieldFail.pdf_logo}

{/if} + + + + Footer text for PDF (no html or the PDF will break) + + + {if $eventsSettings.fieldFail.footer_text}

{$eventsSettings.fieldFail.footer_text}

{/if} + + -- 2.17.1