From 90c6b7253ce8948747459bdb1e315cb48006278b Mon Sep 17 00:00:00 2001 From: Volker Schmidt Date: Tue, 18 Dec 2018 13:48:09 +0100 Subject: [PATCH] Use address line when no other address details are available. --- .gitignore | 1 + src/lib/index.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 6dd32ca..e7607e4 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ tests/e2e/screenshots selenium-debug.log !.gitkeep +/build/config/*-custom.json5 diff --git a/src/lib/index.js b/src/lib/index.js index 9fa5c8f..88a9a48 100644 --- a/src/lib/index.js +++ b/src/lib/index.js @@ -294,10 +294,11 @@ export function getPatientEmail(patient = {}) { export function getPatientHomeAddress(patient = {}) { let a = (patient.address || []); a = a.find(c => c.use == "home") || a[0] || {}; - return [a.line, a.postalCode, a.city, a.country] + var l = [a.line, a.postalCode, a.city, a.country] .map(x => String(x || "").trim()) .filter(Boolean) .join(" "); + return l ? l : a.text || ""; } /**