This commit is contained in:
2020-12-04 15:56:43 +00:00
parent c6df055ad6
commit 5f033393c8
2 changed files with 27 additions and 6 deletions

View File

@@ -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 todo: Case 3595 Mass delete extension
Do this early as it will be copied over and over again 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
............................................................ ............................................................

View File

@@ -584,6 +584,21 @@ export default {
return false; 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 // is Boolean replacement for lodash
// https://stackoverflow.com/a/43718478/8939 // https://stackoverflow.com/a/43718478/8939
// //
@@ -654,13 +669,17 @@ export default {
postCode: m.vm.obj.postCode postCode: m.vm.obj.postCode
} }
*/ */
let hasGeo = obj.latitude || obj.longitude; console.log(obj);
let hasGeo = obj.latitude && obj.longitude;
let hasAddress = let hasAddress =
obj.address || !this.stringIsNullOrEmpty(obj.address) &&
obj.city || !this.stringIsNullOrEmpty(obj.city) &&
objectHash.region || !this.stringIsNullOrEmpty(obj.region) &&
obj.country || !this.stringIsNullOrEmpty(obj.country) &&
obj.postCode; !this.stringIsNullOrEmpty(obj.postCode);
if (!hasGeo && !hasAddress) { if (!hasGeo && !hasAddress) {
throw new Error( throw new Error(