From: Paul Hänsch <paul@plutz.net>
Date: Fri, 5 Feb 2021 01:50:05 +0000 (+0100)
Subject: omit empty teltype when exporting csv
X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=fb30c96d53c0da5ef0c40bf44341d1f9a6ebec0e;p=confetti

omit empty teltype when exporting csv
---

diff --git a/cards/export_csv.sh b/cards/export_csv.sh
index a1004f7..6f17d1f 100755
--- a/cards/export_csv.sh
+++ b/cards/export_csv.sh
@@ -26,7 +26,12 @@ list_item() {
   seq 1 $cnt |while read n; do case $item in
     TEL)
       tel="$(pdi_value "$card" "$item" "$n" |unescape)"
-      [ "$tel" ] && printf '%s: %s\n' "$(l10n "TYPE=$(pdi_attrib "$card" "$item" "$n" TYPE)")" "$tel"
+      ttype="$(pdi_attrib "$card" "$item" "$n" TYPE)"
+      if [ "$tel" -a "$ttype" ]; then 
+        printf '%s: %s\n' "$(l10n "TYPE=$ttype")" "$tel"
+      elif [ "$tel" -a "$ttype" ]; then
+        printf '%s\n' "$tel"
+      fi
       ;;
     GENDER)
       gen="$(pdi_value "$card" "$item" "$n" |unescape)"