diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index 0cdf73b2..f974ff9b 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -32,6 +32,8 @@ todo: seeded user names look stupid with the numbers in them, change that so uni todo: Case 3595 Mass delete extension Do this early as it will be copied over and over again +todo: View on map bombs if nothing is filled in for the address / geocode + should just do nothing ............................................................ diff --git a/ayanova/src/api/gzutil.js b/ayanova/src/api/gzutil.js index 8172622f..d40f61ec 100644 --- a/ayanova/src/api/gzutil.js +++ b/ayanova/src/api/gzutil.js @@ -584,6 +584,21 @@ export default { return false; }, /////////////////////////////////////////////// + // + // + // + stringIsNullOrEmpty: function(str) { + if (str === null || str === undefined) { + return true; + } + if (this.isString(str)) { + if (str.trim() == "") { + return true; + } + } + return false; + }, + /////////////////////////////////////////////// // is Boolean replacement for lodash // https://stackoverflow.com/a/43718478/8939 // @@ -654,13 +669,17 @@ export default { postCode: m.vm.obj.postCode } */ - let hasGeo = obj.latitude || obj.longitude; + console.log(obj); + + + let hasGeo = obj.latitude && obj.longitude; + let hasAddress = - obj.address || - obj.city || - objectHash.region || - obj.country || - obj.postCode; + !this.stringIsNullOrEmpty(obj.address) && + !this.stringIsNullOrEmpty(obj.city) && + !this.stringIsNullOrEmpty(obj.region) && + !this.stringIsNullOrEmpty(obj.country) && + !this.stringIsNullOrEmpty(obj.postCode); if (!hasGeo && !hasAddress) { throw new Error(