X-Git-Url: https://git.plutz.net/?p=confetti;a=blobdiff_plain;f=cards%2Fupdate_card.sh;h=c2b972069011faf5ff47d160259a4f70e5188255;hp=ee9ac3eb295cb7e524714dc1550dab82f16b524d;hb=b5c57e8d2a8b789b0021995b49dc4fd12f2b4281;hpb=a8d370f09eb54c50759fa6b92c2c50ffc4b4c604 diff --git a/cards/update_card.sh b/cards/update_card.sh index ee9ac3e..c2b9720 100755 --- a/cards/update_card.sh +++ b/cards/update_card.sh @@ -59,14 +59,18 @@ for field in $(POST_KEYS |grep -xE '[A-Z][A-Z0-9-]*'); do # (TEL) # printf '%s;TYPE=%s:%s\r\n' "${field}" "${_POST[phonetype${key#TEL}]}" "$(vcf_escape "$(POST "$field" "$cnt")")" # ;; - (*) - vcf="$(pdi_update_value "$vcf" "$field" "$cnt" "$(POST "$field" "$cnt")")" + TEL) + vcf="$(pdi_update_attrib "$vcf" TEL $cnt TYPE="$(POST teltype $cnt |grep -Exm1 'HOME|WORK|CELL|FAX')")" + vcf="$(pdi_update_value "$vcf" "$field" "$cnt" "$(vcf_escape "$(POST "$field" "$cnt")")")" + ;; + *) + vcf="$(pdi_update_value "$vcf" "$field" "$cnt" "$(vcf_escape "$(POST "$field" "$cnt")")")" ;; esac done; done [ "$(POST action)" = addfield ] && vcf="$(vcf_update_field "$vcf" "$(POST newfield)" $(($(pdi_count $(POST newfield)) + 1)) '')" -printf '%s' "$vcf" >"$tempfile" +printf '%s' "$vcf" |grep -vx '' >"$tempfile" case "$(POST action)" in addfield)