]> git.plutz.net Git - invoices/blobdiff - clients.sh
sort invoice list, newest to oldest
[invoices] / clients.sh
index 474f6258538189525f60dea9dff0d2eb40f96301..052a0c84c897f82a38bbe4b82ad7b86f285442be 100755 (executable)
@@ -19,7 +19,7 @@ edit_client(){
     "$(HTML $id)" \
     "$(UNSTRING "${address#address=}" |HTML)" \
     "$(UNSTRING "${hourly#hourly=}" |grep -xE '[0-9]+')" \
-    "$(tid "clients/$id")"
+    "$(transid "clients/$id")"
 }
 
 list_clients(){
@@ -40,11 +40,17 @@ list_clients(){
 
 update_client(){
   local id="$(POST id |checkid)"
-  if [ "$(POST update)" = "$(tid "clients/$id")" ]; then
+  if [ "$(POST update)" = "$(transid "clients/$id")" ]; then
     mkdir -p clients
     printf 'address=%s hourly=%s' \
       "$(POST address |STRING)" "$(POST hourly |STRING)" \
       >"clients/$id"
+
+    [ -d .git ] && {
+      git add "clients/$id"
+      git commit -m 'Update client info for "'"$(POST address |sed 1q)"'"' -- "clients/$id"
+    } >/dev/null
+
     REDIRECT "/clients/"
   else
     error Invalid Data "$id" "$(POST update)"