[ ${#byear} = 2 ] && byear="20$byear"
[ ${#bmonth} = 1 ] && bmonth="0$bmonth"
+mn=""
+case $fn in
+ *\ *)
+ mn="${fn#* }"
+ fn="${fn%% *}"
+ ;;
+esac
+
mkdir -p "${_DATA}/lock/vcard/"
lockdir="${_DATA}/lock/vcard/${card}/"
lockfile=${lockdir}/${SESSION_ID}
cat >"$lockfile" <<-EOF
BEGIN:VCARD
VERSION:4.0
- N:$(vcf_escape "$ln");$(vcf_escape "$fn");;;
- FN:$(vcf_escape "$fn $ln")
- BDAY:$(vcf_escape "${byear}-${bmonth}-01")
+ N:$(vcf_escape "$ln" "$fn" "$mn" "" "")
+ FN:$(vcf_escape "${fn}${mn:+ }${mn} ${ln}")
+ BDAY:$(parse_date "${byear}-${bmonth}-01")
TEL:$(vcf_escape "$tel")
TEL;TYPE=CELL:$(vcf_escape "$tcell")
EMAIL:$(vcf_escape "$email")
- X-ZACK-JOINDATE:$(vcf_escape "$date")
+ X-ZACK-JOINDATE:$(parse_date "$date")
ADR:
NOTE:$(vcf_escape "$note")
UID:${uid}
# UI Labels Special
course_attendance) printf %s "Kurs­teil­nahme";;
+ vcf_seed_label) printf "Anmeld. Vorn. Nachn. Geb. Monat Geb. Jahr Tel. Mobil () EMail () Notiz";;
gender_none) printf %s "keine Angabe";;
gender_female) printf %s "Weiblich";;
s;December;De\­\;zem\­\;ber;g; s;Dec\.;Dez.;g;
'
}
+
+parse_date() {
+ [ $# -eq 0 ] && read -r date || date="$*"
+
+ case $date in
+ *[0-9].*[0-9].*[0-9])
+ d="${date%%.*}"
+ y="${date##*.}"
+ m="${date%.*}"
+ m="${m#*.}"
+ [ $y -lt 100 ] && y="$((y + 2000))"
+ date -d "$(printf '%04i-%02i-%02i' "$y" "$m" "$d")" +%F
+ ;;
+ *) date -d "$date" +%F
+ ;;
+ esac
+}