From db2619ca1afed0aaf68972f8c815ff2798bf2a62 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Tue, 9 Jul 2019 11:57:50 -0400 Subject: [PATCH] New setting for city range search City search for wmta isn't working until all cities have lat lon. --- classes/data/settings/dataSettingsGeneral.php | 13 +++++++++++++ index.php | 2 +- models/front/members/list.php | 16 +++++++++++----- ...e_V1.1.53.sql => create_database_V1.1.54.sql} | 1 + setup/databaseScripts/dbVersions.php | 1 + ...ase_V1.1.52.sql => drop_database_V1.1.54.sql} | 0 .../databaseScripts/update_database_V1.1.54.sql | 10 ++++++++++ views/admin/management/index.html | 6 ++++++ 8 files changed, 43 insertions(+), 6 deletions(-) rename setup/databaseScripts/{create_database_V1.1.53.sql => create_database_V1.1.54.sql} (99%) rename setup/databaseScripts/{drop_database_V1.1.52.sql => drop_database_V1.1.54.sql} (100%) create mode 100755 setup/databaseScripts/update_database_V1.1.54.sql diff --git a/classes/data/settings/dataSettingsGeneral.php b/classes/data/settings/dataSettingsGeneral.php index 750436b1..5d4c6288 100755 --- a/classes/data/settings/dataSettingsGeneral.php +++ b/classes/data/settings/dataSettingsGeneral.php @@ -168,6 +168,12 @@ class GlmDataSettingsGeneral extends GlmDataAbstract 'message' => '', 'option' => '' ), + 'city_range_search' => array( + 'name' => 'city_range_search', + 'prompt' => 'City Range Search', + 'message' => '', + 'option' => '' + ), 'enable_multiple_profiles' => array( 'name' => 'enable_multiple_profiles', 'prompt' => 'Enable Multiple Active Member Profile', @@ -486,6 +492,13 @@ class GlmDataSettingsGeneral extends GlmDataAbstract 'use' => 'a' ), + // Enable City Range Search + 'city_range_search' => array( + 'field' => 'city_range_search', + 'type' => 'checkbox', + 'use' => 'a' + ), + // Enable Multiple Active Profiles 'enable_multiple_profiles' => array( 'field' => 'enable_multiple_profiles', diff --git a/index.php b/index.php index 18735f73..8bdb52d2 100755 --- a/index.php +++ b/index.php @@ -51,7 +51,7 @@ define('GLM_MEMBERS_PLUGIN_VERSION', '2.12.4'); /** * Dbversion */ -define('GLM_MEMBERS_PLUGIN_DB_VERSION', '1.1.53'); +define('GLM_MEMBERS_PLUGIN_DB_VERSION', '1.1.54'); // Check if plugin version is not current in WordPress option and if needed updated it if (GLM_MEMBERS_PLUGIN_VERSION != get_option('glmMembersDatabasePluginVersion')) { diff --git a/models/front/members/list.php b/models/front/members/list.php index 3fc84a11..27cadbf5 100755 --- a/models/front/members/list.php +++ b/models/front/members/list.php @@ -584,8 +584,10 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo if ( (isset($_REQUEST['cityUserSearch']) && in_array($id, $_REQUEST['cityUserSearch'])) || (isset($_REQUEST['citySearch']) && $id == $_REQUEST['citySearch']) ) { $cityData[$id]['default'] = true; $citySearchSelected = $id; - // $where .= $whereSep." T.city = $id"; - // $whereSep = ' AND '; + if ( !$this->config['settings']['city_range_search'] ) { + $where .= $whereSep." T.city = $id"; + $whereSep = ' AND '; + } $categoryCityList .= $categoryCitySep."$id"; $categoryCitySep = ', '; } @@ -1024,7 +1026,7 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo if (!$blankStart) { // If there's a full text search, handle separately - if ( $fullTextSearch || $citySearchSelected ) { + if ( $fullTextSearch || ( $citySearchSelected && $this->config['settings']['city_range_search'] ) ) { // Get stats for the current selection // $membersFound = $this->getStats(str_replace('T.', '', $where)); @@ -1052,9 +1054,10 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo // } elseif ( $citySearchSelected ) { // Setup city search for distance - if ( $citySearchSelected ) { + if ( $citySearchSelected && $this->config['settings']['city_range_search'] ) { $cityCoordinates = $this->getCityCoordinates( $citySearchSelected ); - if ( $cityCoordinates ) { + // echo '
$cityCoordinates: ' . print_r( $cityCoordinates, true ) . '
'; + if ( $cityCoordinates && $cityCoordinates['lat'] && $cityCoordinates['lon'] ) { $cityName = $cityCoordinates['name']; // Distance query $distanceQuery = $this->getDistanceQuery( $cityCoordinates['lat'], $cityCoordinates['lon'] ); @@ -1076,6 +1079,9 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo } else { $appendSelect = ""; $order = " member_name ASC "; + // $whereSep = ' AND '; + // $where .= $whereSep." T.city = $citySearchSelected"; + // $whereSep = ' AND '; } } diff --git a/setup/databaseScripts/create_database_V1.1.53.sql b/setup/databaseScripts/create_database_V1.1.54.sql similarity index 99% rename from setup/databaseScripts/create_database_V1.1.53.sql rename to setup/databaseScripts/create_database_V1.1.54.sql index bc333a77..a6e20099 100755 --- a/setup/databaseScripts/create_database_V1.1.53.sql +++ b/setup/databaseScripts/create_database_V1.1.54.sql @@ -389,6 +389,7 @@ CREATE TABLE {prefix}settings_general ( phone_format TINYTEXT DEFAULT NULL, default_state TINYTEXT DEFAULT NULL, enable_counties BOOLEAN DEFAULT '0', + city_range_search BOOLEAN DEFAULT '0', enable_multiple_profiles BOOLEAN DEFAULT '0', enable_single_profile BOOLEAN DEFAULT '0', -- Hide the add profile and clone profile links/buttons enable_member_reports BOOLEAN DEFAULT '1', diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php index 47acf972..4460d974 100755 --- a/setup/databaseScripts/dbVersions.php +++ b/setup/databaseScripts/dbVersions.php @@ -85,4 +85,5 @@ $glmMembersDbVersions = array( '1.1.51' => array('version' => '1.1.51', 'tables' => 23, 'date' => '02/26/19'), '1.1.52' => array('version' => '1.1.52', 'tables' => 23, 'date' => '02/27/19'), '1.1.53' => array('version' => '1.1.53', 'tables' => 26, 'date' => '06/25/19'), + '1.1.54' => array('version' => '1.1.54', 'tables' => 26, 'date' => '07/09/19'), ); diff --git a/setup/databaseScripts/drop_database_V1.1.52.sql b/setup/databaseScripts/drop_database_V1.1.54.sql similarity index 100% rename from setup/databaseScripts/drop_database_V1.1.52.sql rename to setup/databaseScripts/drop_database_V1.1.54.sql diff --git a/setup/databaseScripts/update_database_V1.1.54.sql b/setup/databaseScripts/update_database_V1.1.54.sql new file mode 100755 index 00000000..2269914b --- /dev/null +++ b/setup/databaseScripts/update_database_V1.1.54.sql @@ -0,0 +1,10 @@ +-- Gaslight Media Members Database +-- File Created: 2019-07-09 +-- Database Version: 1.1.54 +-- 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 + +-- Add fax to member info record +ALTER TABLE {prefix}settings_general ADD COLUMN city_range_search BOOLEAN DEFAULT false; diff --git a/views/admin/management/index.html b/views/admin/management/index.html index 71bef575..6c805e72 100755 --- a/views/admin/management/index.html +++ b/views/admin/management/index.html @@ -123,6 +123,12 @@ + + City Range Search: + + + + Enable Multiple Active Member Profiles: -- 2.17.1