]> git.plutz.net Git - confetti/blobdiff - actions/update_card.sh
styling for iban assignment
[confetti] / actions / update_card.sh
diff --git a/actions/update_card.sh b/actions/update_card.sh
deleted file mode 100755 (executable)
index f18c9ee..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-#!/bin/zsh
-
-# Copyright 2014, 2016 Paul Hänsch
-#
-# This file is part of Confetti.
-# 
-# Confetti is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# Confetti is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Affero General Public License for more details.
-# 
-# You should have received a copy of the GNU Affero General Public License
-# along with Confetti.  If not, see <http://www.gnu.org/licenses/>. 
-
-cgi_post
-cgi_refdata
-
-filter="&filter=${_REF[filter]}"
-filtertype="&filtertype=${_REF[filtertype]}"
-order="&order=${_REF[order]}"
-
-card="${_POST[card]}"
-tempfile="$_DATA/temp/$card"
-cardfile="$_DATA/vcard/$card"
-attfile="$_DATA/mappings/attendance"
-
-_POST[0N]="${_POST[0N]//;/,}"
-_POST[1N]="${_POST[1N]//;/,}"
-_POST[2N]="${_POST[2N]//;/,}"
-_POST[3N]="${_POST[3N]//;/,}"
-_POST[4N]="${_POST[4N]//;/,}"
-
-[ "$_POST[hi_select]" = "list" ] && hi_company="${_POST[hi_company]}" || hi_company="${_POST[hi_other]}"
-[ -n "${_POST[hi_company]}${_POST[hi_number]}${_POST[hi_status]}" ] \
-&& _POST[X-HEALTH-INSURANCE]="${hi_company//;/,};${_POST[hi_number]//;/,};${_POST[hi_status]//;/,}"
-
-sed -r 's;$;\r;' >"$tempfile" <<EOF
-BEGIN:VCARD
-VERSION:4.0
-N:${_POST[0N]};${_POST[1N]};${_POST[2N]};${_POST[3N]};${_POST[4N]}
-UID:${_POST[UID]}
-$(
-for field in $VCF_FIELDS; do
-  for key in $field $field{0..100}; do
-    [ -z "${_POST[$key]+x}" ] && break
-    value="$(printf %s "$_POST[$key]" |sed -r ':a;N;$!ba;s:\n:\\n:g;s:\r:\\r:g')"
-    [ "${key%%[0-9]*}" = TEL ] && tag="TYPE=${_POST[phonetype${key#TEL}]}" || tag=''
-    [ -n "$value" ] && printf '%s:%s\n' "${field}${tag:+;$tag}" "$value"
-  done
-done
-[ "${_POST[action]}" = addfield ] && printf '%s:\n' "${_POST[newfield]}"
-)
-END:VCARD
-EOF
-
-case "${_POST[action]}" in
-  addfield)
-    redirect "?p=cards${filter}${filtertype}${order}&edit=$card"
-    ;;
-  update)
-    attendance=()
-    for att in attendance attendance{0..100}; do
-      [ -n "${_POST[$att]}" ] && attendance+=("${_POST[$att]}")
-    done
-    sed -rn 's:^(.+)'$card'$:\1:p' "$attfile" |while read course; do
-      touch "$_DATA/ical/$course"
-    done
-    sed -i -r '/^(.+)\t'$card'$/d' "$attfile"
-    for each in $attendance; do
-      echo "$each\t$card"
-    done >>"$attfile"
-    sed -rn 's:^(.+)'$card'$:\1:p' "$attfile" |while read course; do
-      touch "$_DATA/ical/$course"
-    done
-
-    mv "$tempfile" "$cardfile"
-    redirect "?p=cards${filter}${filtertype}${order}#$card"
-    ;;
-  cancel)
-    rm "$tempfile"
-    [ -f "$cardfile" ] \
-    && redirect "?p=cards${filter}${filtertype}${order}#$card" \
-    || redirect "?p=cards${filter}${filtertype}${order}"
-    ;;
-  delete)
-    rm "$tempfile" "$cardfile"
-    redirect "?p=cards${filter}${filtertype}${order}"
-    ;;
-esac