From 2fd3ccd0b4ffbc16c15779b82d63537ff9493c02 Mon Sep 17 00:00:00 2001 From: Daniel Tran <d.tran@adito.de> Date: Thu, 29 Apr 2021 07:28:37 +0000 Subject: [PATCH] =?UTF-8?q?[Projekt:=20xRM-ContactManagement][TicketNr.:?= =?UTF-8?q?=201077287][updateAllAdressLocations=20sollte=20bei=20invaliden?= =?UTF-8?q?=20Datens=C3=A4tzen=20weiterlaufen]=20-=20Added=20logic,=20to?= =?UTF-8?q?=20prevent=20process=20from=20stopping=20when=20=20=20=20=20dat?= =?UTF-8?q?a=20is=20invalid=20and=20implemented=20logic=20to=20collect=20u?= =?UTF-8?q?ids=20of=20=20=20=20=20invalid=20data=20sets=20and=20print=20it?= =?UTF-8?q?=20after=20process=20is=20finished.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../process.js | 28 ++++++++++++++++--- .../process.js | 28 ++++++++++++++++--- 2 files changed, 48 insertions(+), 8 deletions(-) diff --git a/process/setMissingAddressLocations_serverProcess/process.js b/process/setMissingAddressLocations_serverProcess/process.js index 38efd07055..7cef5bfae4 100644 --- a/process/setMissingAddressLocations_serverProcess/process.js +++ b/process/setMissingAddressLocations_serverProcess/process.js @@ -1,9 +1,12 @@ +import("system.logging"); +import("Util_lib"); import("system.db"); import("Sql_lib"); import("Address_lib"); import("Location_lib"); var locationSearch = new LocationFinder(); +var malformedAddressData = []; if (locationSearch.isEnabled()) { @@ -18,14 +21,31 @@ if (locationSearch.isEnabled()) addresses.forEach(function ([addressId, address, buildingno, zip, city, country, state]) { var addressData = new AddressObject(address, buildingno, zip, city, country, state); - var location = locationSearch.getGeoLocation(addressData); - if (location) + + try { - locationUpdates.push(["ADDRESS", ["LAT", "LON"], null, [location.lat, location.lon], - newWhere("ADDRESS.ADDRESSID", addressId).buildCondition()]); + var location = locationSearch.getGeoLocation(addressData); + if (location) + { + locationUpdates.push(["ADDRESS", ["LAT", "LON"], null, [location.lat, location.lon], + newWhere("ADDRESS.ADDRESSID", addressId).buildCondition()]); + } + } + catch (pException) + { + malformedAddressData.push(addressId); } }); if (locationUpdates.length > 0) db.updates(locationUpdates); }); + if (Utils.isNotNullOrEmptyString(malformedAddressData)) + { + errMsg = "updateAllAddressLocations_serverProcess: Something went wrong, during updating address locations, with the following uids: "; + malformedAddressData.forEach(function(pMalformedData) + { + errMsg += pMalformedData + "\n"; + }); + logging.log(errMsg); + } } \ No newline at end of file diff --git a/process/updateAllAddressLocations_serverProcess/process.js b/process/updateAllAddressLocations_serverProcess/process.js index 5341f47ddf..6239ba470a 100644 --- a/process/updateAllAddressLocations_serverProcess/process.js +++ b/process/updateAllAddressLocations_serverProcess/process.js @@ -1,9 +1,12 @@ import("system.db"); +import("system.logging"); import("Sql_lib"); import("Address_lib"); import("Location_lib"); +import("Util_lib"); var locationSearch = new LocationFinder(); +var malformedAddressData = []; if (locationSearch.isEnabled()) { @@ -16,14 +19,31 @@ if (locationSearch.isEnabled()) addresses.forEach(function ([addressId, address, buildingno, zip, city, country, state]) { var addressData = new AddressObject(address, buildingno, zip, city, country, state); - var location = locationSearch.getGeoLocation(addressData); - if (location) + try { - locationUpdates.push(["ADDRESS", ["LAT", "LON"], null, [location.lat, location.lon], - newWhere("ADDRESS.ADDRESSID", addressId).buildCondition()]); + var location = locationSearch.getGeoLocation(addressData); + + if (location) + { + locationUpdates.push(["ADDRESS", ["LAT", "LON"], null, [location.lat, location.lon], + newWhere("ADDRESS.ADDRESSID", addressId).buildCondition()]); + } + } + catch (pException) + { + malformedAddressData.push(addressId); } }); if (locationUpdates.length > 0) db.updates(locationUpdates); }); + if (Utils.isNotNullOrEmptyString(malformedAddressData)) + { + errMsg = "updateAllAddressLocations_serverProcess: Something went wrong, during updating address locations, with the following uids: "; + malformedAddressData.forEach(function(pMalformedData) + { + errMsg += pMalformedData + "\n"; + }); + logging.log(errMsg); + } } \ No newline at end of file -- GitLab