diff --git a/ehr/resources/queries/ehr_lookups/cage.js b/ehr/resources/queries/ehr_lookups/cage.js index c86eff59a..1462e5135 100644 --- a/ehr/resources/queries/ehr_lookups/cage.js +++ b/ehr/resources/queries/ehr_lookups/cage.js @@ -14,6 +14,9 @@ function onUpsert(helper, scriptErrors, row, oldRow) { row.location = row.room; if (row.cage) row.location += '-' + row.cage; + if (row.location.length > 24) { + console.log("Location is longer than allowed length: ", row.location); + } //remove whitespace, normalize punctuation and pad digits if (row.joinToCage){ diff --git a/ehr/resources/scripts/ehr/utils.js b/ehr/resources/scripts/ehr/utils.js index a8b84e4ce..2873f707e 100644 --- a/ehr/resources/scripts/ehr/utils.js +++ b/ehr/resources/scripts/ehr/utils.js @@ -180,18 +180,21 @@ EHR.Server.Utils = new function(){ console.error('Unable to parse date string: ' + val); } } - else if (!isNaN(val)){ - // NOTE: i'm not sure if we should really attempt this. this should really never happen, - // and it's probably an error if it does - normalizedVal = new Date(val); - } else { - if (val['getTime']){ - normalizedVal = new Date(val.getTime()); + console.log('EHR trigger script is being passed a date with value: ' + val); + if (!isNaN(val)) { + // NOTE: i'm not sure if we should really attempt this. this should really never happen, + // and it's probably an error if it does + normalizedVal = new Date(val); } else { - if (!supppressErrors) - console.error('Unknown datatype for date value. Type was: ' + (typeof val) + ' and value was: ' + val); + if (val['getTime']) { + normalizedVal = new Date(val.getTime()); + } + else { + if (!supppressErrors) + console.error('Unknown datatype for date value. Type was: ' + (typeof val) + ' and value was: ' + val); + } } }