diff --git a/css/admin.css b/css/admin.css index 65966417a..fb3d5d569 100644 --- a/css/admin.css +++ b/css/admin.css @@ -547,6 +547,16 @@ body #post-body-content p.wp-clearfix:nth-child(1){ min-height: 30px; } +.oo-poststuff .custom-input-field input[name=oopluginlistviews-countryactive]:checked::before, +.oo-poststuff .custom-input-field input[name=oopluginlistviews-radiusactive]:checked::before { + filter: brightness(0) saturate(100%) invert(35%) sepia(4%) saturate(967%) hue-rotate(170deg) brightness(91%) contrast(94%); +} + +.oo-poststuff .custom-input-field input[name=oopluginlistviews-countryactive], +.oo-poststuff .custom-input-field input[name=oopluginlistviews-radiusactive] { + pointer-events: none; +} + #listSettings .custom-input-field, #viewpicturetypes .custom-input-field { display: block; diff --git a/plugin/Controller/GeoPositionFieldHandler.php b/plugin/Controller/GeoPositionFieldHandler.php index 391e58c29..f4c12ccf2 100644 --- a/plugin/Controller/GeoPositionFieldHandler.php +++ b/plugin/Controller/GeoPositionFieldHandler.php @@ -135,6 +135,7 @@ private function getDefaultConfiguration(): array $defaultActive = [ GeoPosition::ESTATE_LIST_SEARCH_ZIP, GeoPosition::ESTATE_LIST_SEARCH_RADIUS, + GeoPosition::ESTATE_LIST_SEARCH_COUNTRY ]; $intersection = array_intersect_key($this->_booleanFields, array_flip($defaultActive)); return array_combine($intersection, array_fill(0, count($intersection), '1')); diff --git a/plugin/Gui/AdminPageEstateListSettings.php b/plugin/Gui/AdminPageEstateListSettings.php index e286e5a55..53b2b2f5b 100644 --- a/plugin/Gui/AdminPageEstateListSettings.php +++ b/plugin/Gui/AdminPageEstateListSettings.php @@ -188,7 +188,7 @@ protected function buildForms() $pFormModelGeoFields->addInputModel($pInputModel); } - $geoNotice = __('At least the following fields must be active: country, radius and city or postcode.', 'onoffice-for-wp-websites'); + $geoNotice = __('At least city or postcode are required.', 'onoffice-for-wp-websites'); $pInputModelGeoLabel = new InputModelLabel(null, $geoNotice); $pInputModelGeoLabel->setValueEnclosure(InputModelLabel::VALUE_ENCLOSURE_ITALIC); $pFormModelGeoFields->addInputModel($pInputModelGeoLabel); diff --git a/plugin/Installer/DatabaseChanges.php b/plugin/Installer/DatabaseChanges.php index f1e1f9872..3bcfbbd4a 100644 --- a/plugin/Installer/DatabaseChanges.php +++ b/plugin/Installer/DatabaseChanges.php @@ -45,7 +45,7 @@ class DatabaseChanges implements DatabaseChangesInterface { /** @var int */ - const MAX_VERSION = 41; + const MAX_VERSION = 42; /** @var WPOptionWrapperBase */ private $_pWpOption; @@ -298,6 +298,11 @@ public function install() $dbversion = 41; } + if ($dbversion == 41) { + $this->updateValueGeoFieldsForEsateList(); + $dbversion = 42; + } + $this->_pWpOption->updateOption( 'oo_plugin_db_version', $dbversion, true ); } @@ -1115,4 +1120,16 @@ private function updateShowPriceOnRequestOptionForDetailView() $this->_pWpOption->updateOption('onoffice-default-view', $pDataDetailViewOptions); } } + + /** + * @return void + */ + public function updateValueGeoFieldsForEsateList() + { + $prefix = $this->getPrefix(); + $sql = "UPDATE {$prefix}oo_plugin_listviews + SET country_active = 1, radius_active = 1"; + + $this->_pWPDB->query($sql); + } } diff --git a/tests/TestClassDatabaseChanges.php b/tests/TestClassDatabaseChanges.php index 3f69dacc4..428b47b08 100644 --- a/tests/TestClassDatabaseChanges.php +++ b/tests/TestClassDatabaseChanges.php @@ -118,7 +118,7 @@ public function testInstall(): array $this->assertGreaterThanOrEqual(self::NUM_NEW_TABLES, count($this->_createQueries)); $dbversion = $this->_pDbChanges->getDbVersion(); - $this->assertEquals(41, $dbversion); + $this->assertEquals(42, $dbversion); return $this->_createQueries; } @@ -271,7 +271,7 @@ public function testDeleteMessageFieldApplicantSearchForm() */ public function testMaxVersion() { - $this->assertEquals(41, DatabaseChanges::MAX_VERSION); + $this->assertEquals(42, DatabaseChanges::MAX_VERSION); } diff --git a/tests/TestClassGeoPositionFieldHandler.php b/tests/TestClassGeoPositionFieldHandler.php index 4d9c500bb..c80c510a6 100644 --- a/tests/TestClassGeoPositionFieldHandler.php +++ b/tests/TestClassGeoPositionFieldHandler.php @@ -161,6 +161,7 @@ public function testDefaultValues(GeoPositionFieldHandler $pGeoPositionFieldHand $this->assertEquals([ 'radius_active' => 'radius', 'zip_active' => 'zip', + 'country_active' => 'country' ], $pGeoPositionFieldHandler->getActiveFields()); }