]> git.plutz.net Git - invoices/blobdiff - invoices.sh
allow use in fake proxy, replace tid function with new equivalent from library
[invoices] / invoices.sh
index aa66717c115f641bad3fe58c9365e29a606e8b5f..b97c6e79db6c5c9ba8a1a0dd10dd3ec054fae3ff 100755 (executable)
@@ -95,7 +95,7 @@ edit_invoice(){
   && hourly="${hourly#hourly=}" \
   || hourly="${chourly}"
 
-  tid="$(tid "invoices/$id")"
+  tid="$(transid "invoices/$id")"
 
   read -r taxtype nett tax gross x<<-EOF
        $(invoice_total "$id")
@@ -215,7 +215,7 @@ invoice_total(){
 
 update_invoice(){
   local id="$(POST id |checkid)" extra=0 tid
-  tid="$(tid invoices/$id)"
+  tid="$(transid invoices/$id)"
 
   if [ "$(POST update)" = "$tid" ] || [ "$(POST genpdf)" = "$tid" ]; then
     mkdir -p invoices
@@ -238,6 +238,11 @@ update_invoice(){
         | grep -xvF 'time=     work=   hours=0'
       done
     } >"invoices/$id"
+
+    [ -d .git ] && {
+      git add "invoices/$id"
+      git commit -m 'Update invoice info for "'"$(POST number)"'"' -- "invoices/$id"
+    } >/dev/null
   fi
   if [ "$(POST genpdf)" ]; then
     read -r sender client date x<"invoices/$id"
@@ -246,7 +251,7 @@ update_invoice(){
     filename="Rechnung $(UNSTRING "${saddress#address=}" |sed 1q) an $(UNSTRING "${caddress#address=}" |sed 1q) $(date -d@"${date#date=}" +%F).pdf"
 
     . $_EXEC/odtgen.sh
-    pdfgen "$id"
+    genpdf "$id"
     REDIRECT "/export/${id}.pdf/$(URL "${filename}" |sed s/%0D//g)"
     exit 0
   fi