From b74191f4d57552c8db7162e9840c642ae46730c7 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Thu, 6 Dec 2018 11:09:58 -0500 Subject: [PATCH] Adding Street address to required for the wmta michigan.org When michigan.org is checked for required fields need to ensure that the event address is completed. --- index.php | 6 +-- views/admin/events/edit.html | 61 ++++++++++++++++++++-------- views/admin/events/editLocation.html | 18 ++++---- views/admin/management/events.html | 2 +- 4 files changed, 58 insertions(+), 29 deletions(-) diff --git a/index.php b/index.php index 15c3288..30e5b98 100755 --- a/index.php +++ b/index.php @@ -3,7 +3,7 @@ * Plugin Name: GLM Associate - Events Add-On * Plugin URI: http://www.gaslightmedia.com/ * Description: Gaslight Media Members Database. - * Version: 1.7.10 + * Version: 1.7.11 * Author: Chuck Scott * Author URI: http://www.gaslightmedia.com/ * License: GPL2 @@ -19,7 +19,7 @@ * @package glmMembersDatabaseEventsAddOn * @author Chuck Scott * @license http://www.gaslightmedia.com Gaslightmedia - * @version 1.7.10 + * @version 1.7.11 */ // Check that we're being called by WordPress. @@ -43,7 +43,7 @@ if (!defined('ABSPATH')) { * so that we're sure the other add-ons see an up to date * version from this plugin. */ -define('GLM_MEMBERS_EVENTS_PLUGIN_VERSION', '1.7.10'); +define('GLM_MEMBERS_EVENTS_PLUGIN_VERSION', '1.7.11'); define('GLM_MEMBERS_EVENTS_PLUGIN_DB_VERSION', '0.1.10'); // This is the minimum version of the GLM Members DB plugin require for this plugin. diff --git a/views/admin/events/edit.html b/views/admin/events/edit.html index 3f2770b..5e45a3b 100755 --- a/views/admin/events/edit.html +++ b/views/admin/events/edit.html @@ -172,24 +172,47 @@ var formErrors = []; {foreach $event.fieldRequired as $fieldName => $fValue} {if $fieldName != 'status' && $fieldName != 'descr' && $fieldName != 'name_slug'} - if ( {if $fValue}true{else}false{/if} ) { - // console.log('{$fieldName}', $('input[name="{$fieldName}"]')); - // console.log('{$fieldName}.val()', $('input[name="{$fieldName}"]').val()); - if ( !$('input[name="{$fieldName}"]').val() ) { - formErrors.push('{$fieldName}'); - } - } + if ( {if $fValue}true{else}false{/if} ) { + // console.log('{$fieldName}', $('input[name="{$fieldName}"]')); + // console.log('{$fieldName}.val()', $('input[name="{$fieldName}"]').val()); + if ( !$('input[name="{$fieldName}"]').val() ) { + formErrors.push('{$fieldName}'); + } + } {else if $fieldName == 'descr'} - if ( {if $fValue}true{else}false{/if} ) { - descr = get_tinymce_content(); - // console.log( 'descr', descr ); - if ( !descr ) { - formErrors.push('{$fieldName}'); - } - } + if ( {if $fValue}true{else}false{/if} ) { + descr = get_tinymce_content(); + // console.log( 'descr', descr ); + if ( !descr ) { + formErrors.push('{$fieldName}'); + } + } {/if} {/foreach} + + // This is for the location if the $settings.michigan_org_requirements is set to true. + {if $settings.michigan_org_requirements && $lockedToMember} + var hasAddress = false; + // If this event is new and location is new. + if ( $('#address_nLoc1').length ) { + if ( $('#address_nLoc1').val() && $('#city_nLoc1').val() != '0' && $('#state_nLoc1').val() && $('#zip_nLoc1').val()) { + hasAddress = true; + } + } + if ( $('.eLocation').length ) { + $('.eLocation').each(function(){ + var locId = $(this).data('id'); + if ( $('#address_' + locId).val() && $('#city_' + locId).val() != '0' && $('#state_' + locId).val() && $('#zip_' + locId).val()) { + hasAddress = true; + } + }); + } + if ( !hasAddress ) { + formErrors.push( 'Location: Address, City, State, ZIP/Postal Code' ); + } + {/if} + var numErrors = formErrors.length; if ( numErrors > 0 ) { // console.log('formErrors: ', formErrors); @@ -198,8 +221,14 @@ msg += formErrors[i] + "\n"; } alert(msg); - // move to first tab - $('#glm-event-descr').trigger('click'); + // move to first tab unless location is required. + {if $settings.michigan_org_requirements && $lockedToMember} + if ( hasAddress ) { + $('#glm-event-descr').trigger('click'); + } + {else} + $('#glm-event-descr').trigger('click'); + {/if} return false; } else { return true; diff --git a/views/admin/events/editLocation.html b/views/admin/events/editLocation.html index 1df04bd..e08a8da 100755 --- a/views/admin/events/editLocation.html +++ b/views/admin/events/editLocation.html @@ -85,7 +85,7 @@ - + @@ -95,13 +95,13 @@ - + Address: - + City - + State: - + ZIP / Postal Code: @@ -246,13 +246,13 @@ - + Address: - + City - + State: - + ZIP / Postal Code: diff --git a/views/admin/management/events.html b/views/admin/management/events.html index cc4b5b2..0add43e 100644 --- a/views/admin/management/events.html +++ b/views/admin/management/events.html @@ -147,7 +147,7 @@ -- 2.17.1
Address:
City
Add a new City
@@ -117,7 +117,7 @@
State:
ZIP / Postal Code:
Address:
City
Add a new City
@@ -266,7 +266,7 @@
State:
ZIP / Postal Code:
Admin Options -

+