diff --git a/CHANGELOG.md b/CHANGELOG.md index 68dc101..48514b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +## 4.0.8 - 2024-06-27 [CRITICAL] +### Security +- Removed Polyfill.io (https://sansec.io/research/polyfill-supply-chain-attack) + +## 4.0.7 - 2024-06-06 +### Fixed +- Fix issue when using count query on location search results (Fixes #391) + +## 4.0.6 - 2024-05-08 +### Added +- French translations (via @pascalminator) + ## 4.0.5 - 2024-04-04 ### Fixed - Fix referred on Mapbox geo requests (Fixes #338, via @maxdmyers) diff --git a/src/fields/MapField.php b/src/fields/MapField.php index 009bcfb..0461728 100644 --- a/src/fields/MapField.php +++ b/src/fields/MapField.php @@ -474,7 +474,6 @@ private function _renderMap (Map $value, bool $isSettings = false): string $containerId = 'map-' . $this->id . '-container'; $vueContainerId = $view->namespaceInputId($containerId); - $view->registerJsFile('https://polyfill.io/v3/polyfill.min.js?flags=gated&features=default%2CIntersectionObserver%2CIntersectionObserverEntry'); $view->registerAssetBundle(MapAsset::class); $view->registerJs('new Vue({ el: \'#' . $vueContainerId . '\' });'); $view->registerTranslations('simplemap', [ diff --git a/src/services/MapService.php b/src/services/MapService.php index baf7a29..38466dd 100644 --- a/src/services/MapService.php +++ b/src/services/MapService.php @@ -373,19 +373,24 @@ private function _searchLocation (ElementQuery $query, mixed $value, string $tab ]; // Filter the query - $query - ->subQuery - ->addSelect($search . ' as [[mapsCalculatedDistance]]') + $subQuery = $query->subQuery; + $isCount = count($query->select) == 1 && array_values($query->select)[0] == 'COUNT(*)'; + + if (!$isCount) + $subQuery + ->addSelect($search . ' as [[mapsCalculatedDistance]]'); + + $subQuery ->andWhere($restrict) ->andWhere([ 'not', ['[[' . $table . '.lat]]' => null], ]); - if (Craft::$app->getDb()->driverName === 'pgsql') - $query->subQuery->andWhere($search . ' <= ' . $radius); + if (Craft::$app->getDb()->driverName === 'pgsql' || $isCount) + $subQuery->andWhere($search . ' <= ' . $radius); else - $query->subQuery->andHaving('[[mapsCalculatedDistance]] <= ' . $radius); + $subQuery->andHaving('[[mapsCalculatedDistance]] <= ' . $radius); return '[[mapsCalculatedDistance]]'; } diff --git a/src/translations/fr/simplemap.php b/src/translations/fr/simplemap.php new file mode 100644 index 0000000..bc19146 --- /dev/null +++ b/src/translations/fr/simplemap.php @@ -0,0 +1,38 @@ + 'Carte', + 'Geo-Coding' => 'Géocodage', + + 'Search for a location' => 'Rechercher un lieu', + 'Clear address' => 'Effacer l\'adresse', + 'No address selected' => 'Aucune adresse sélectionnée', + + 'Full Address' => 'Adresse complète', + 'Name / Number' => 'Nom / numéro', + 'Street Address' => 'Adresse de rue', + 'Town / City' => 'Ville', + 'Postcode' => 'Code postal', + 'County' => 'Comté', + 'State' => 'État / province', + 'Country' => 'Pays', + + 'Latitude' => 'Latitude', + 'Longitude' => 'Longitude', + + 'Zoom In' => 'Zoomer', + 'Zoom Out' => 'Dézoomer', + 'Center on Marker' => 'Centrer sur le marqueur', + 'Current Location' => 'Localisation actuelle', + +]; \ No newline at end of file