From 824bab9c4c5b5ae745a78b43a338d4b068e99cfa Mon Sep 17 00:00:00 2001 From: paul Date: Fri, 26 Feb 2016 11:35:17 +0000 Subject: [PATCH 01/16] data retriever for therapy section, some prescription improvements svn path=/trunk/; revision=86 --- globals.sh | 2 +- pages/therapy.sh | 33 +++++++++++++++++++++++++++++++++ templates/prescriptions.css.sh | 2 ++ templates/text_frame.sh | 1 + 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100755 pages/therapy.sh diff --git a/globals.sh b/globals.sh index 3f539cc..38ae5af 100755 --- a/globals.sh +++ b/globals.sh @@ -30,7 +30,7 @@ VCF_FIELDS=(PHOTO LOGO FN NICKNAME SOUND GENDER KIND TITLE ROLE ORG MEMBER CATEG case "${PROFILE}" in medical) - data_dirs vcard cache temp mappings prescriptions + data_dirs vcard cache temp mappings prescriptions therapies [ -z "$NAVIGATION" ] && NAVIGATION=(cards) ;; circus) diff --git a/pages/therapy.sh b/pages/therapy.sh new file mode 100755 index 0000000..571333e --- /dev/null +++ b/pages/therapy.sh @@ -0,0 +1,33 @@ +#!/bin/zsh + +# Copyright 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 . + +declare -A tpy + +BR=' +' + +id="$_GET[id]" + +tpyfile="$_DATA/therapies/$id" + +mpx=() +cat "$tpyfile" |while read -r line; do + val="${line#*:}" + tpy[${line%%:*}]="${val//\\n/$BR}" +done diff --git a/templates/prescriptions.css.sh b/templates/prescriptions.css.sh index f25cc38..91afffa 100755 --- a/templates/prescriptions.css.sh +++ b/templates/prescriptions.css.sh @@ -71,6 +71,8 @@ cat < Date: Fri, 26 Feb 2016 14:31:05 +0000 Subject: [PATCH 02/16] additional prescription fields, improved display of clients and prescriptions svn path=/trunk/; revision=87 --- templates/attendees.css.sh | 4 +++- templates/edit_prescription.sh | 16 +++++++++------- templates/prescriptions.css.sh | 25 +++++++++++++++++++------ templates/text_prescriptions.sh | 10 ++++++---- templates/view_client.sh | 19 +++++++++---------- templates/view_prescription.sh | 15 ++++++++++----- 6 files changed, 56 insertions(+), 33 deletions(-) diff --git a/templates/attendees.css.sh b/templates/attendees.css.sh index 758b1d1..036ad04 100755 --- a/templates/attendees.css.sh +++ b/templates/attendees.css.sh @@ -142,11 +142,13 @@ cat <$(l10n addcontrib) - + + + + + +

$(l10n prescription_by_catalogue)

@@ -56,11 +61,11 @@ cat <
- - -
+
+ +
@@ -96,9 +101,6 @@ cat <
- - -
diff --git a/templates/prescriptions.css.sh b/templates/prescriptions.css.sh index 91afffa..3374f98 100755 --- a/templates/prescriptions.css.sh +++ b/templates/prescriptions.css.sh @@ -142,10 +142,24 @@ cat < ${values[BDAY]}} - ${values[X-ZACK-JOINDATE]:+ $values[X-ZACK-JOINDATE]} - ${values[X-ZACK-LEAVEDATE]:+ $values[X-ZACK-LEAVEDATE]} ${values[SOUND]:+} ${values[PHOTO]:+} ${values[LOGO]:+} -

$(l10n ADR)

$(for n in ADR ADR{0..10}; do echo "${values[$n]:+$values[$n]}" @@ -92,12 +88,15 @@ cat < $(find "$_DATA/prescriptions/" -name "${id%.vcf}.*.mpx" \ | while read pfile; do - printf '%s\t%s\t%s\n' "$(grep '^date' "$pfile")" "$(sed -nr 's;^icd10:(.*)$;\1;p' "$pfile")" - done \ - | sort -r | cut -f2 \ - | while read icd; do - printf '
  • %s
  • ' "${id}" "${icd:-$(l10n no_icd)}" - done) + printf '%s\t%s\t%s\n' + printf '
  • %s: %s - %s%s
  • ' \ + "${id}" \ + "$(sed -nr 's;^date:(.+)$;\1;p' "$pfile")" \ + "$(sed -nr 's;^indicator:(.+)$;\1;p' "$pfile")" \ + "$(sed -nr 's;^quantity:(.+) ?$;\1x ;p' "$pfile")$(sed -nr 's;^remidy:(.+)$;\1;p' "$pfile")" \ + "$(sed -nr 's;^quantity1:(.+) ?$;,\1x ;p' "$pfile")$(sed -nr 's;^remidy1:(.+)$;\1;p' "$pfile")" + done |sort -r + )
    END_HTML diff --git a/templates/view_prescription.sh b/templates/view_prescription.sh index c11bd9d..57ff0b6 100755 --- a/templates/view_prescription.sh +++ b/templates/view_prescription.sh @@ -38,9 +38,16 @@ cat < ${mpx[addcontrib]} - + +${mpx[contribconfirm]} +
    + +

    $(l10n prescription_by_catalogue)

    @@ -49,9 +56,9 @@ cat <
    - -
    +
    +
    @@ -85,8 +92,6 @@ cat <${mpx[icd10]}
    - -
    $(l10n edit) $(l10n therapy) -- 2.39.2 From aedb6776919b351df7df7c310c238c41317ddc44 Mon Sep 17 00:00:00 2001 From: paul Date: Sat, 27 Feb 2016 16:20:54 +0000 Subject: [PATCH 03/16] enable support for phone number types svn path=/trunk/; revision=88 --- actions/update_card.sh | 5 ++-- pages/cards.sh | 9 ++++--- templates/attendees.css.sh | 52 ++++++++++++++++++++++---------------- templates/edit_client.sh | 28 ++++++++++++++++---- templates/text_cards.sh | 10 ++++++++ templates/text_courses.sh | 6 +---- templates/view_client.sh | 32 +++++++++++------------ 7 files changed, 89 insertions(+), 53 deletions(-) diff --git a/actions/update_card.sh b/actions/update_card.sh index a810476..f18c9ee 100755 --- a/actions/update_card.sh +++ b/actions/update_card.sh @@ -47,9 +47,10 @@ UID:${_POST[UID]} $( for field in $VCF_FIELDS; do for key in $field $field{0..100}; do - [ -z "$_POST[$key]" ] && break + [ -z "${_POST[$key]+x}" ] && break value="$(printf %s "$_POST[$key]" |sed -r ':a;N;$!ba;s:\n:\\n:g;s:\r:\\r:g')" - printf '%s:%s\n' "${field}" "$value" + [ "${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]}" diff --git a/pages/cards.sh b/pages/cards.sh index d1170b0..50fee63 100755 --- a/pages/cards.sh +++ b/pages/cards.sh @@ -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")" @@ -115,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" \ @@ -154,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 @@ -192,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 diff --git a/templates/attendees.css.sh b/templates/attendees.css.sh index 036ad04..b7c800e 100755 --- a/templates/attendees.css.sh +++ b/templates/attendees.css.sh @@ -134,6 +134,35 @@ cat <. +setchecked() { + printf 'checked="checked"' +} +setselected() { + printf 'selected="selected"' +} check_gen() { - [ "$values[GENDER]" = "$1" ] && echo 'selected="selected"' + [ "$values[GENDER]" = "$1" ] && setselected } check_a() { - egrep -q "^${1}.${id}$" "$_DATA/mappings/attendance" && echo 'checked="checked"' + egrep -q "^${1}.${id}$" "$_DATA/mappings/attendance" && setchecked +} +teltype() { + cat <<-EOF + + EOF } n_last="$(printf %s "$values[N]" |sed -rn 's:^([^;]*;){0} *([^;]*).*$:\2:p')" @@ -85,13 +103,13 @@ cat <

    $(l10n TEL)

    - + $(teltype "${tags[TEL_TYPE]}") $(for n in TEL{0..10}; do - echo "${values[$n]:+}" + printf "${values[$n]:+$(teltype "${tags[$n_TYPE]}")}" done) ${values[EMAIL]:+

    $(l10n EMAIL)

    } $(for n in EMAIL EMAIL{0..10}; do - echo "${values[$n]:+}" + printf "${values[$n]:+}" done) ${values[IMPP]:+

    $(l10n IMPP)

    } $(for n in IMPP IMPP{0..10}; do diff --git a/templates/text_cards.sh b/templates/text_cards.sh index 53d8489..be2efa7 100755 --- a/templates/text_cards.sh +++ b/templates/text_cards.sh @@ -37,6 +37,16 @@ item_name[ANNIVERSARY]="Jubiläum" item_name[BDAY]="Geburtstag" item_name[EMAIL]="E-Mail" item_name[TEL]="Telefon" +item_name[phone_typeselect]="Typ" +item_name[phone_home]="Privat" +item_name[phone_cell]="Mobil" +item_name[phone_work]="Büro" +item_name[phone_fax]="Fax" +item_name[tHOME]="Privat:" +item_name[tWORK]="Büro:" +item_name[tCELL]="Mobil:" +item_name[tFAX]="Fax:" +item_name[tVOICE]="" item_name[IMPP]="Chat" item_name[ADR]="Anschrift" item_name[URL]="Webseite" diff --git a/templates/text_courses.sh b/templates/text_courses.sh index fd92ddd..b86240a 100755 --- a/templates/text_courses.sh +++ b/templates/text_courses.sh @@ -1,4 +1,4 @@ -# Copyright 2014 Paul Hänsch +# Copyright 2014, 2016 Paul Hänsch # # This file is part of Confetti. # @@ -58,7 +58,3 @@ item_name[t_eternal]="ewig" item_name[t_times]="mal" item_name[t_until]="Bis" item_name[t_oclock]="Uhr" - -l10n() { - [ -n "$item_name[$1]" ] && echo -n "$item_name[$1]" || echo -n "$1" -} diff --git a/templates/view_client.sh b/templates/view_client.sh index 4b06268..bbcc091 100755 --- a/templates/view_client.sh +++ b/templates/view_client.sh @@ -29,57 +29,57 @@ hi_status="$(printf %s "${values[X-HEALTH-INSURANCE]}" |cut -d\; -f3)" cat <

    $fullname

    - ${values[GENDER]:+$(l10n $values[GENDER])} + ${values[GENDER]:+$(l10n $values[GENDER])} $(for n in NICKNAME NICKNAME{0..10}; do - echo "${values[$n]:+aka. $values[$n]}" + echo "${values[$n]:+aka. $values[$n]}" done) - ${values[BDAY]:+ ${values[BDAY]}} - ${values[SOUND]:+} - ${values[PHOTO]:+} - ${values[LOGO]:+} + ${values[BDAY]:+ ${values[BDAY]}} + ${values[SOUND]:+} + ${values[PHOTO]:+} + ${values[LOGO]:+}

    $(l10n ADR)

    $(for n in ADR ADR{0..10}; do - echo "${values[$n]:+$values[$n]}" + echo "${values[$n]:+$values[$n]}" done) ${values[URL]:+

    $(l10n URL)

    } $(for n in URL URL{0..10}; do - echo "${values[$n]:+$values[$n]}" + echo "${values[$n]:+$values[$n]}" done)

    $(l10n TEL)

    $(for n in TEL TEL{0..10}; do - echo "${values[$n]:+$tags[${n}_TYPE] $values[$n]}" + echo "${values[$n]:+$(l10n t${tags[${n}_TYPE]}) $values[$n]}" done) ${values[EMAIL]:+

    $(l10n EMAIL)

    } $(for n in EMAIL EMAIL{0..10}; do - echo "${values[$n]:+}" + echo "${values[$n]:+$values[$n]}" done) ${values[IMPP]:+

    $(l10n IMPP)

    } $(for n in IMPP IMPP{0..10}; do - echo "${values[$n]:+$tags[${n}_TYPE] $values[$n]}" + echo "${values[$n]:+$tags[${n}_TYPE] $values[$n]}" done)

    $(l10n X-HEALTH-INSURANCE)

    - ${hi_company:+${hi_company}} - ${hi_number:+ ${hi_number}} - ${hi_status:+ ${hi_status}} + ${hi_company:+${hi_company}} + ${hi_number:+ ${hi_number}} + ${hi_status:+ ${hi_status}}
    ${values[NOTE]:+

    $(l10n NOTE)

    } $(for n in NOTE NOTE{0..10}; do - echo "${values[$n]:+$values[$n]}" + echo "${values[$n]:+$values[$n]}" done) ${values[X-CLIENT-REFERRAL]:+

    $(l10n X-CLIENT-REFERRAL)

    } $(for n in X-CLIENT-REFERRAL X-CLIENT-REFERRAL{0..10}; do - echo "${values[$n]:+$values[$n]}" + echo "${values[$n]:+$values[$n]}" done)
    ${tpy[${sid}_date]}${tpy[${sid}_therapist]} + +
    + + $(n=1; while [ -n "${tpy[${sid}_note${n}]+x}" ]; do + t_session_note $session_n $n + n=$(($n+1)) + done + printf '' "$sid" "$n" + ) + + + +
    +EOF +} + +therapy_sessions(){ + n=1; while [ -n "${tpy[session${n}]}" ]; do + t_session $n + n=$(($n+1)) + done + + sid=session$n + +cat < + … + + +
    +EOF +} + +unset c0 c1 c2 c3 c4 c5 c6 c7 +case "$tpy[color]" in + c001) c1=checked;; + c010) c2=checked;; + c011) c3=checked;; + c100) c4=checked;; + c101) c5=checked;; + c110) c6=checked;; + c111) c7=checked;; + *) c0=checked;; +esac + cat <

    Behandlungen

    -

    Flrbrlprrf Zoidberg

    - < zur Patientenliste - Gemeinsame Betriebskrankenkasse der Gesellschaften der Textilgruppe Hof +

    $client_name

    + < $(l10n prescriptionlist)
    -

    Verordnung

    - +

    $(l10n therapy_prescription)

    + ${mpx[insurance]} +
      -
    • 6x MT
    • -
    • 6x Fango
    • + ${mpx[remidy]:+
    • ${mpx[quantity]} ${mpx[remidy]}
    • } + ${mpx[remidy1]:+
    • ${mpx[quantity1]} ${mpx[remidy1]}
    • }
    - ??? - + + ${mpx[addcontrib]:+ + + }
    +
    + + - - -
    - - -
    - - - - - - - - - -
    - -
    - - - - - - - - - -
    - -
    - - - - - - - - - -
    - -
    - - - - -
    - - -
    - - - - - - - - - -
    - -
    + $(therapy_sessions)
    - - - - - - - - + + + + + + + +
    - + +
    EOF -- 2.39.2 From 015242823eb4a79cf615bef6951b0af6bd0a5b01 Mon Sep 17 00:00:00 2001 From: paul Date: Thu, 7 Apr 2016 04:07:58 +0000 Subject: [PATCH 05/16] additional prescription functions svn path=/trunk/; revision=90 --- actions/update_prescription.sh | 2 +- actions/update_therapy.sh | 27 +++++++++++++- templates/edit_prescription.sh | 66 ++++++++++++++++++++++++++++++++- templates/frame.html.sh | 1 + templates/prescriptions.css.sh | 34 +++++++++++++++-- templates/text_prescriptions.sh | 9 +++++ templates/therapy.css.sh | 2 +- templates/therapy.html.sh | 1 - templates/view_client.sh | 3 +- templates/view_prescription.sh | 11 +++++- 10 files changed, 144 insertions(+), 12 deletions(-) diff --git a/actions/update_prescription.sh b/actions/update_prescription.sh index 68cb7fd..a0d9371 100755 --- a/actions/update_prescription.sh +++ b/actions/update_prescription.sh @@ -50,4 +50,4 @@ case "${_POST[action]}" in ;; esac -redirect "?p=prescriptions&client=${client}" +redirect "?p=prescriptions&client=${client}#${prescription}" diff --git a/actions/update_therapy.sh b/actions/update_therapy.sh index 43a2e1f..cc95e39 100755 --- a/actions/update_therapy.sh +++ b/actions/update_therapy.sh @@ -42,13 +42,38 @@ if [ -n "$_POST[delete_session]" ]; then elif [ -n "$_POST[new_session]" ]; then sid="$_POST[new_session]" - printf '%s:exists\n' "$sid" >>"$tempfile" identify "$_EXEC/templates/therapy_background.png" \ | sed -r 's;^.* ([0-9]+x[0-9]+) .*$;\1;' \ | read dim convert -size "$dim" xc:transparent "${tpyfile%.tpy}_${sid}.png" + + printf '%s:exists\n' "$sid" >>"$tempfile" + printf '%s_open:checked\n' "$sid" >>"$tempfile" + +elif [ -n "$_POST[dotmark.x]" -a -n "$_POST[dotmark.y]" ]; then + sed -rn 's;^(session[0-9]+)_open:checked$;\1;p' "$tempfile" \ + | sort -n \ + | tail -n1 \ + | read sid + + x="$_POST[dotmark.x]" + y="$_POST[dotmark.y]" + + case "$_POST[color]" in + c000) c="#000000";; + c001) c="#000088";; + c010) c="#008800";; + c011) c="#008888";; + c100) c="#880000";; + c101) c="#880088";; + c110) c="#888800";; + c111) c="#888888";; + esac + + convert "${tpyfile%.tpy}_${sid}.png" -fill "$c" -stroke "$c" -draw "circle $x,$y $(($x+5)),$y" "${tpyfile%.tpy}_${sid}.png" + fi mv "$tempfile" "$tpyfile" diff --git a/templates/edit_prescription.sh b/templates/edit_prescription.sh index b916258..4701ebb 100755 --- a/templates/edit_prescription.sh +++ b/templates/edit_prescription.sh @@ -21,6 +21,63 @@ cat < + + + + + + + + + + + + + + + + + + + + + + + + + +
    $(l10n doctor)$(l10n dentist)$(l10n noprescription)$(l10n altpractition)
    + + + + + + + + + + + +
    + + + + + + + + + +
    + + + + + + + +
    +
    @@ -37,7 +94,7 @@ cat <
    -

    $(l10n therapy_prescription)

    +

    $(l10n therapy_prescription)

    @@ -94,11 +151,18 @@ cat <
    +


    +

    +
    +

    + + +

    diff --git a/templates/frame.html.sh b/templates/frame.html.sh index 2cc13d1..5fd6e7c 100755 --- a/templates/frame.html.sh +++ b/templates/frame.html.sh @@ -26,6 +26,7 @@ cat < $(l10n p_${PAGE}) +