X-Git-Url: http://git.plutz.net/?p=invoices;a=blobdiff_plain;f=clients.sh;h=474f6258538189525f60dea9dff0d2eb40f96301;hp=fc047a2447aad54669b64e3f927631785b7aa628;hb=bc8eee210325c38d66bef5640deb933c0f680d4d;hpb=de8eaf901067d4e0c72e5b0ca05f6dc12553fd79 diff --git a/clients.sh b/clients.sh index fc047a2..474f625 100755 --- a/clients.sh +++ b/clients.sh @@ -14,11 +14,12 @@ edit_client(){ %s [label for=hourly Hourly Rate:] [input #hourly type=number name=hourly value="%s"] - [submit "update" "update" Update] + [submit "update" "%s" Update] ]' \ "$(HTML $id)" \ "$(UNSTRING "${address#address=}" |HTML)" \ - "$(UNSTRING "${hourly#hourly=}" |grep -xE '[0-9]+')" + "$(UNSTRING "${hourly#hourly=}" |grep -xE '[0-9]+')" \ + "$(tid "clients/$id")" } list_clients(){ @@ -38,13 +39,15 @@ list_clients(){ } update_client(){ - id="$(POST id |checkid)" - if [ "$(POST update)" = update -a "$id" ]; then + local id="$(POST id |checkid)" + if [ "$(POST update)" = "$(tid "clients/$id")" ]; then mkdir -p clients printf 'address=%s hourly=%s' \ "$(POST address |STRING)" "$(POST hourly |STRING)" \ >"clients/$id" + REDIRECT "/clients/" else - echo Invalid Data "$(POST id)" "$(POST update)" >&2 + error Invalid Data "$id" "$(POST update)" + REDIRECT "/clients/$1" fi }