]> git.plutz.net Git - confetti/blobdiff - pages/cards.sh
unification of card editing functions
[confetti] / pages / cards.sh
index f6142dfd4f3acaa01de1e1577f845cda0cc2a6c0..2d1d4e29e112c825e6e5652e50e44bf5ca0a2d31 100755 (executable)
 BR='
 '
 
+force_items(){
+  for each in "$@"; do
+    [ -z "${values[$each]+x}" ] && values[${each}]=''
+  done
+}
+
 case $PROFILE in
 medical)
+  SUP_FIELDS=(N NICKNAME GENDER BDAY ADR TEL EMAIL X-HEALTH-INSURANCE X-HEALTH-INSURANCE-NOCONTRIB IMPP URL NOTE X-CLIENT-REFERRAL)
+  FORCE_ITEMS=(ADR TEL EMAIL NOTE X-CLIENT-REFERRAL)
   view_card="$_EXEC/templates/view_client.sh"
   edit_card="$_EXEC/templates/edit_client.sh"
   _GET[order]="${_GET[order]:-lastname}"
@@ -29,6 +37,8 @@ medical)
   profile_medical=x
 ;;
 circus)
+  SUP_FIELDS=(N NICKNAME GENDER BDAY X-ZACK-JOINDATE X-ZACK-LEAVEDATE EMAIL TEL IMPP ADR URL NOTE)
+  FORCE_ITEMS=(BDAY X-ZACK-JOINDATE TEL EMAIL ADR NOTE)
   view_card="$_EXEC/templates/view_attendee.sh"
   edit_card="$_EXEC/templates/edit_attendee.sh"
   _GET[order]="${_GET[order]:-firstname}"
@@ -258,5 +268,6 @@ edit_card() {  #Parameter: Cardfile
 
   declare -A values
   vcf_parse "$cardfile"
+  force_items $FORCE_ITEMS
   . $edit_card
 }