diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bd1de8..4af1f67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog All notable changes for the CiviGeometry extension will be noted here. +## [1.13.0] - 2023-12-12 +### Changed + - geoplaceAddress task refactored to use APIv4 calls instead of APIv3 + ## [1.12.0] - 2023-08-01 ### Added - Geometry.getcachedoverlaps APIv4 method diff --git a/CRM/CiviGeometry/Tasks.php b/CRM/CiviGeometry/Tasks.php index a4d664b..a5b79b8 100644 --- a/CRM/CiviGeometry/Tasks.php +++ b/CRM/CiviGeometry/Tasks.php @@ -29,10 +29,11 @@ public static function geoplaceAddress(CRM_Queue_TaskContext $ctx, $address_id) ])['values']; if (!empty($geometry_ids)) { foreach ($geometry_ids as $geometry_id) { - civicrm_api3('Address', 'creategeometries', [ - 'address_id' => $address['id'], - 'geometry_id' => $geometry_id, - ]); + \Civi\Api4\Geometry::createEntity(FALSE) + ->setEntity_id($address['id']) + ->setEntity_table('civicrm_address') + ->setGeometry_id($geometry_id) + ->execute(); } } $addressObject = new CRM_Core_BAO_Address(); @@ -49,10 +50,11 @@ public static function geoplaceAddress(CRM_Queue_TaskContext $ctx, $address_id) */ public static function buildGeometryRelationships(CRM_Queue_TaskContext $ctx, $geometry_id) { foreach (CRM_CiviGeometry_BAO_Geometry::getAddresses($geometry_id) as $match) { - civicrm_api3('Address', 'creategeometries', [ - 'geometry_id' => $match['geometry_id'], - 'address_id' => $match['address_id'], - ]); + \Civi\Api4\Geometry::createEntity(FALSE) + ->setEntity_id($match['address_id']) + ->setEntity_table('civicrm_address') + ->setGeometry_id($match['geometry_id']) + ->execute(); } return TRUE; } diff --git a/composer.json b/composer.json index 9876901..ccad448 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ } ], "require": { - "composer/installers": "^1.6" + "composer/installers": "^1.6 || ^2.2" }, "config": { "allow-plugins": { diff --git a/info.xml b/info.xml index 37f7d4c..50ab732 100644 --- a/info.xml +++ b/info.xml @@ -14,8 +14,8 @@ https://github.com/australiangreens/au.org.greens.civigeometry http://www.gnu.org/licenses/agpl-3.0.html - 2023-08-01 - 1.12.0 + 2023-12-12 + 1.13.0 stable 5.45