From: Steve Sutton Date: Mon, 12 Dec 2016 19:21:39 +0000 (-0500) Subject: Updating database X-Git-Tag: v1.0.0^2~3 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=ab4ba383caab70dcc95227a55bafc13efcf4de8c;p=WP-Plugins%2Fglm-member-db-coupons.git Updating database Adding field for management for setting the text for the coupon ribbon on the list and grid views. --- diff --git a/classes/data/dataManagement.php b/classes/data/dataManagement.php index bec335b..2d9e1a2 100644 --- a/classes/data/dataManagement.php +++ b/classes/data/dataManagement.php @@ -150,6 +150,13 @@ class GlmDataCouponsManagement extends GlmDataAbstract 'required' => true, 'use' => 'a' ), + // Ribbon Text + 'ribbon_text' => array( + 'field' => 'ribbon_text', + 'type' => 'text', + 'required' => true, + 'use' => 'a', + ), ); diff --git a/css/front.css b/css/front.css index b2a7bfc..852e9a1 100644 --- a/css/front.css +++ b/css/front.css @@ -86,7 +86,7 @@ margin-left: 0 !important;; } } -.ribbon { +.glm-coupon-ribbon { position:absolute; z-index: 2; padding:0; @@ -110,7 +110,7 @@ -moz-transform:rotateZ(45deg); -o-transform:rotateZ(45deg); } -.ribbon:hover { +.glm-coupon-ribbon:hover { cursor: pointer; color:rgba(0,0,0,0.9); } diff --git a/index.php b/index.php index 20ca9e0..b842140 100644 --- a/index.php +++ b/index.php @@ -38,7 +38,7 @@ * version from this plugin. */ define('GLM_MEMBERS_COUPONS_PLUGIN_VERSION', '0.0.1'); -define('GLM_MEMBERS_COUPONS_PLUGIN_DB_VERSION', '0.0.2'); +define('GLM_MEMBERS_COUPONS_PLUGIN_DB_VERSION', '0.0.3'); // This is the minimum version of the GLM Members DB plugin require for this plugin. define('GLM_MEMBERS_COUPONS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '2.8.0'); diff --git a/setup/databaseScripts/create_database_V0.0.2.sql b/setup/databaseScripts/create_database_V0.0.2.sql deleted file mode 100644 index 0c36e32..0000000 --- a/setup/databaseScripts/create_database_V0.0.2.sql +++ /dev/null @@ -1,79 +0,0 @@ --- Gaslight Media Members Database - Coupons Add-On --- File Created: 11/15/16 --- Database Version: 0.0.2 --- Database Creation Script --- --- This file is called to create a new set of tables for this --- add-on for the most recent database version for this add-on. --- --- There should only be one such file in this directory --- --- To permit each query below to be executed separately, --- all queries must be separated by a line with four dashes - - --- Coupons -CREATE TABLE {prefix}coupons ( - id INT NOT NULL AUTO_INCREMENT, - status INT NULL, -- Status of the Coupon (Active Pending) - created DATETIME NULL, -- Create date - updated DATETIME NULL, -- Update date - approved DATETIME NULL, -- Approved date - start_date DATE NULL, -- Starting date of the coupon - end_date DATE NULL, -- Ending date of the coupon - expire DATE NULL, -- Expire date of the coupon - name TINYTEXT NULL, -- Coupon name - name_slug TINYTEXT NULL, -- Coupon name slug - ref_type INT NULL, -- Ref type - ref_dest INT NULL, -- Id from ref type table - descr TEXT NULL, -- Description of the coupon - image TINYTEXT NULL, -- Coupon image - url TINYTEXT NULL, -- website of the coupon - PRIMARY KEY(id), - INDEX(ref_type), - INDEX(ref_dest), - INDEX(start_date), - INDEX(end_date) -); - ----- - --- Categories -CREATE TABLE {prefix}categories ( - id INT NOT NULL AUTO_INCREMENT, - name TINYTEXT NULL, -- Category Name - PRIMARY KEY (id), - INDEX(name(20)) -); - ----- - --- Coupon-Category - Categories for specific coupon records -CREATE TABLE {prefix}coupon_categories ( - id INT NOT NULL AUTO_INCREMENT, - coupon INT NULL, -- Pointer to the coupon - category INT NULL, -- Pointer to the category - PRIMARY KEY (id), - INDEX(coupon), - INDEX(category) -); - ----- - --- Settings -CREATE TABLE {prefix}management ( - id INT NOT NULL AUTO_INCREMENT, - notify_to TINYTEXT NULL, -- To for the notify email - notify_from TINYTEXT NULL, -- From header for notify email - notify_message TEXT NULL, -- Message to add to the notify email - default_date_range TINYTEXT NULL, -- Default span for start and end dates - PRIMARY KEY (id) -); - ----- - --- Data for Settings -INSERT INTO {prefix}management -(id,notify_to,notify_from,notify_message,default_date_range) -VALUES -(1, '', '', '','6 months'); diff --git a/setup/databaseScripts/create_database_V0.0.3.sql b/setup/databaseScripts/create_database_V0.0.3.sql new file mode 100644 index 0000000..89b9ee9 --- /dev/null +++ b/setup/databaseScripts/create_database_V0.0.3.sql @@ -0,0 +1,80 @@ +-- Gaslight Media Members Database - Coupons Add-On +-- File Created: 11/15/16 +-- Database Version: 0.0.3 +-- Database Creation Script +-- +-- This file is called to create a new set of tables for this +-- add-on for the most recent database version for this add-on. +-- +-- There should only be one such file in this directory +-- +-- To permit each query below to be executed separately, +-- all queries must be separated by a line with four dashes + + +-- Coupons +CREATE TABLE {prefix}coupons ( + id INT NOT NULL AUTO_INCREMENT, + status INT NULL, -- Status of the Coupon (Active Pending) + created DATETIME NULL, -- Create date + updated DATETIME NULL, -- Update date + approved DATETIME NULL, -- Approved date + start_date DATE NULL, -- Starting date of the coupon + end_date DATE NULL, -- Ending date of the coupon + expire DATE NULL, -- Expire date of the coupon + name TINYTEXT NULL, -- Coupon name + name_slug TINYTEXT NULL, -- Coupon name slug + ref_type INT NULL, -- Ref type + ref_dest INT NULL, -- Id from ref type table + descr TEXT NULL, -- Description of the coupon + image TINYTEXT NULL, -- Coupon image + url TINYTEXT NULL, -- website of the coupon + PRIMARY KEY(id), + INDEX(ref_type), + INDEX(ref_dest), + INDEX(start_date), + INDEX(end_date) +); + +---- + +-- Categories +CREATE TABLE {prefix}categories ( + id INT NOT NULL AUTO_INCREMENT, + name TINYTEXT NULL, -- Category Name + PRIMARY KEY (id), + INDEX(name(20)) +); + +---- + +-- Coupon-Category - Categories for specific coupon records +CREATE TABLE {prefix}coupon_categories ( + id INT NOT NULL AUTO_INCREMENT, + coupon INT NULL, -- Pointer to the coupon + category INT NULL, -- Pointer to the category + PRIMARY KEY (id), + INDEX(coupon), + INDEX(category) +); + +---- + +-- Settings +CREATE TABLE {prefix}management ( + id INT NOT NULL AUTO_INCREMENT, + notify_to TINYTEXT NULL, -- To for the notify email + notify_from TINYTEXT NULL, -- From header for notify email + notify_message TEXT NULL, -- Message to add to the notify email + default_date_range TINYTEXT NULL, -- Default span for start and end dates + ribbon_text TEXT NULL, -- Text for the Coupon ribbon on the list and grid views + PRIMARY KEY (id) +); + +---- + +-- Data for Settings +INSERT INTO {prefix}management +(id,notify_to,notify_from,notify_message,default_date_range,ribbon_text) +VALUES +(1, '', '', '','6 months','Savings Coupon'); diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php index 8f3f69c..7230d2f 100644 --- a/setup/databaseScripts/dbVersions.php +++ b/setup/databaseScripts/dbVersions.php @@ -16,5 +16,6 @@ $glmMembersCouponsDbVersions = array( '0.0.1' => array('version' => '0.0.1', 'tables' => 3), '0.0.2' => array('version' => '0.0.2', 'tables' => 4), + '0.0.3' => array('version' => '0.0.3', 'tables' => 4), ); diff --git a/setup/databaseScripts/update_database_V0.0.3.sql b/setup/databaseScripts/update_database_V0.0.3.sql new file mode 100644 index 0000000..01e7484 --- /dev/null +++ b/setup/databaseScripts/update_database_V0.0.3.sql @@ -0,0 +1,17 @@ +-- Gaslight Media Members Database - Coupons Add-On +-- File Created: 12/09/14 15:27:15 +-- Database Version: 0.0.2 +-- 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 + + +-- Coupon-Category - Categories for specific coupon records +ALTER TABLE {prefix}management ADD COLUMN ribbon_text TEXT; + + +---- + +-- Update the management record +UPDATE {prefix}management SET ribbon_text = 'Savings Coupon'; diff --git a/setup/frontHooks.php b/setup/frontHooks.php index 81d4aba..5e60170 100644 --- a/setup/frontHooks.php +++ b/setup/frontHooks.php @@ -68,7 +68,7 @@ add_filter('glm-member-db-front-members-list-memberTop', WHERE id = %d"; $memberSlug = $wpdb->get_var( $wpdb->prepare( $sql, $memberId ) ); $url = get_bloginfo('url') . '/member-detail/' . $memberSlug . '/?expanded=coupons'; - $content = 'Savings Coupon'; + $content = '' . $config['settings']['ribbon_text'] . ''; } } return $content; diff --git a/views/admin/management/coupons.html b/views/admin/management/coupons.html index 153d3ba..fbef15c 100644 --- a/views/admin/management/coupons.html +++ b/views/admin/management/coupons.html @@ -28,6 +28,13 @@ {if $couponsSettings.fieldFail.default_date_range}

{$couponsSettings.fieldFail.default_date_range}

{/if} + + Default date range for start and end dates: + + + {if $couponsSettings.fieldFail.ribbon_text}

{$couponsSettings.fieldFail.ribbon_text}

{/if} + +

E-Mail Notification Settings

@@ -82,10 +89,5 @@ // Flash certain elements for a short time after display $(".glm-flash-updated").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500); - if('{$couponsSettings.fieldData.calendar_view}'){ - $("#calendar-view").val('{$couponsSettings.fieldData.calendar_view}'); - } else { - $("#calendar-view").val("agenda"); - } });