From 13d8e5a137e20533655cb5081a0c4b4c8fc3bac4 Mon Sep 17 00:00:00 2001 From: Chuck Scott Date: Fri, 8 Apr 2016 14:46:29 -0400 Subject: [PATCH] Changed from using all_dates to recurring flag in recurrences. --- classes/data/dataRecurrences.php | 13 ++++--------- classes/data/dataTimes.php | 4 ++-- index.php | 2 +- ...base_V0.0.11.sql => create_database_V0.0.12.sql} | 2 +- setup/databaseScripts/dbVersions.php | 3 ++- setup/databaseScripts/update_database_V0.0.12.sql | 10 ++++++++++ views/admin/events/edit.html | 6 +++--- views/admin/events/editSchedule.html | 10 +++++----- 8 files changed, 28 insertions(+), 22 deletions(-) rename setup/databaseScripts/{create_database_V0.0.11.sql => create_database_V0.0.12.sql} (98%) create mode 100644 setup/databaseScripts/update_database_V0.0.12.sql diff --git a/classes/data/dataRecurrences.php b/classes/data/dataRecurrences.php index 7af7a69..37a0138 100644 --- a/classes/data/dataRecurrences.php +++ b/classes/data/dataRecurrences.php @@ -194,9 +194,9 @@ class GlmDataEventsRecurrences extends GlmDataAbstract 'use' => 'a' ), - // All Dates Flag - 'all_dates' => array ( - 'field' => 'all_dates', + // Recurring flag (means to use recurrence schedule rather than all dates between start date and end date) + 'recurring' => array ( + 'field' => 'recurring', 'type' => 'checkbox', 'default' => false, 'use' => 'a' @@ -410,7 +410,7 @@ class GlmDataEventsRecurrences extends GlmDataAbstract $endTime = $to->getTimestamp(); // If this is not a recurring schedule but is All Dates from start date to end date - if (!$recurData['all_dates']['value']) { + if (!$recurData['recurring']['value']) { // for each date from From through To for ($date = clone $from ; $date < $to ; $date->modify('+1 day')) { @@ -469,11 +469,6 @@ class GlmDataEventsRecurrences extends GlmDataAbstract } - // Check if the recurrences caught the "First Occurance" - if (!isset($dates[$start->getTimestamp()])) { - $dates[$start->getTimestamp()] = $start; - } - // Create From and to timestamp for comparison - To date is already + 1 day $fromTime = $from->getTimestamp(); $toTime = $to->getTimestamp(); diff --git a/classes/data/dataTimes.php b/classes/data/dataTimes.php index 56546f3..82c3680 100644 --- a/classes/data/dataTimes.php +++ b/classes/data/dataTimes.php @@ -167,7 +167,7 @@ class GlmDataEventsTimes extends GlmDataAbstract 'required' => true, 'use' => 'glei' ), - +/* removing because "all_dates" flag no longer exists // Ongoing 'ongoing' => array( 'field' => 'recur_id', @@ -178,7 +178,7 @@ class GlmDataEventsTimes extends GlmDataAbstract 'p_static' => true, 'use' => 'gle' ), - +*/ // Active Flag 'active' => array ( 'field' => 'active', diff --git a/index.php b/index.php index 950b250..7bca092 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.11'); +define('GLM_MEMBERS_EVENTS_PLUGIN_DB_VERSION', '0.0.12'); // 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.11.sql b/setup/databaseScripts/create_database_V0.0.12.sql similarity index 98% rename from setup/databaseScripts/create_database_V0.0.11.sql rename to setup/databaseScripts/create_database_V0.0.12.sql index 462e1c9..5673ee4 100644 --- a/setup/databaseScripts/create_database_V0.0.11.sql +++ b/setup/databaseScripts/create_database_V0.0.12.sql @@ -47,7 +47,7 @@ CREATE TABLE {prefix}recurrences ( start_date DATE NULL, -- Starting Date (if all_day is selected) Used instead of start_time from_date DATE NULL, -- From Date for recurrences to_date DATE NULL, -- To Date for recurrences - all_dates BOOLEAN NULL, -- Flag indicating that event recurs on all dates from from_date through to_date + recurring BOOLEAN NULL, -- Flag indicating that event recurs on a schedule rather than all dates month_of_year SMALLINT UNSIGNED NULL, -- Month of year (bitmap) week_of_month TINYINT UNSIGNED NULL, -- Week of the month (bitmap) day_of_week TINYINT UNSIGNED NULL, -- Day of the week (bitmap) diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php index 369e087..9793aa7 100644 --- a/setup/databaseScripts/dbVersions.php +++ b/setup/databaseScripts/dbVersions.php @@ -24,6 +24,7 @@ $glmMembersEventsDbVersions = array( '0.0.8' => array('version' => '0.0.8', 'tables' => 7), '0.0.9' => array('version' => '0.0.9', 'tables' => 7), '0.0.10' => array('version' => '0.0.10', 'tables' => 7), - '0.0.11' => array('version' => '0.0.11', 'tables' => 7) + '0.0.11' => array('version' => '0.0.11', 'tables' => 7), + '0.0.12' => array('version' => '0.0.12', 'tables' => 7) ); diff --git a/setup/databaseScripts/update_database_V0.0.12.sql b/setup/databaseScripts/update_database_V0.0.12.sql new file mode 100644 index 0000000..40fed5f --- /dev/null +++ b/setup/databaseScripts/update_database_V0.0.12.sql @@ -0,0 +1,10 @@ +-- Gaslight Media Members Database - Events Add-On +-- Database Version: 0.0.12 +-- 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 + + +-- Change all_dates to recurring (also changes polarity of value) +ALTER TABLE {prefix}recurrences CHANGE all_dates recurring BOOLEAN; diff --git a/views/admin/events/edit.html b/views/admin/events/edit.html index af6af07..f1989be 100644 --- a/views/admin/events/edit.html +++ b/views/admin/events/edit.html @@ -470,10 +470,10 @@ // All Dates Event selection $('.all-dates-checkbox').click( function() { recurID = $(this).attr('data-id'); - if ($("#allDatesEvent_" + recurID)[0].checked) { - $("#allDatesExclude_" + recurID).removeClass('glm-hidden'); + if ($("#recurringEvent_" + recurID)[0].checked) { + $("#recurringExclude_" + recurID).removeClass('glm-hidden'); } else { - $("#allDatesExclude_" + recurID).addClass('glm-hidden'); + $("#recurringExclude_" + recurID).addClass('glm-hidden'); } }); diff --git a/views/admin/events/editSchedule.html b/views/admin/events/editSchedule.html index 7950c66..a63ac4e 100644 --- a/views/admin/events/editSchedule.html +++ b/views/admin/events/editSchedule.html @@ -60,7 +60,7 @@ Recurring Event: - + Setup a detailed schedule. @@ -72,10 +72,10 @@ - Delete this Event Schedule + Delete this Event Schedule - + Months @@ -232,7 +232,7 @@ Recurring Event: - + Setup a detailed schedule; @@ -247,7 +247,7 @@ Delete this Event Schedule - + Months -- 2.17.1