]> git.plutz.net Git - confetti/blobdiff - pages/cards.sh
simplify distinction between attendees and clients
[confetti] / pages / cards.sh
index c045b5bfd09cc3a0fbd7c1bbc58d8efbb5e6c2d5..50fee63b76c70040b1a776172e19d3385337b5f4 100755 (executable)
@@ -19,6 +19,9 @@
 
 [ -z "${_GET[order]}" ] && _GET[order]="firstname"
 
+BR='
+'
+
 listcourses() {
   ls -1 ${_DATA}/ical/*ics |while read file; do
     icstime="$(sed -rn 's:^DTSTART\:(TZID=.*\:)?([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2})([0-9]{2})([0-9]{2})Z?\r$:\2-\3-\4 \5\:\6\:\7:p' "$file")"
@@ -26,6 +29,10 @@ listcourses() {
   done |sort |sed -r 's:^.*\t(.*/)([^/]+)$:\2:'
 }
 
+list_hi_companies(){
+  sed -rn 's;^X-HEALTH-INSURANCE:([^\;]+)\;.*$;\1;p' ${_DATA}/vcard/*vcf
+}
+
 listcards() {
   case "${_GET[filtertype]}" in
     any)
@@ -111,7 +118,7 @@ vcf_parse() {
     case "$line" in
       key=*) printf %s\\n "$line"
        ;;
-      value=*) printf %s\\n "$line"
+      value=*) printf %s\\n "${line}"
        ;;
       tag=*) ot=''
             printf %s "$line" \
@@ -150,7 +157,7 @@ view_card() {  #Parameter: Cardfile
           if [ -z "$key" ]; then
             eval "$line"
           else
-            values[$key]="$value"
+            values[$key]="${value//\\r\\n/$BR}"
             for t in ${(k)tag}; do
               tags[${key}_$t]="$tag[$t]"
             done
@@ -188,7 +195,7 @@ edit_card() {  #Parameter: Cardfile
         if [ -z "$key" ]; then
           eval "$line"
         else
-          [ -n "$value" ] && values[$key]="$value" || values[$key]='\r'
+          [ -n "$value" ] && values[$key]="${value//\\r\\n/$BR}" || values[$key]='\r'
           for t in ${(k)tag}; do
             tags[${key}_$t]="$tag[$t]"
           done