Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -284,7 +284,7 @@ func drawCustomerBalancePDF(
|
|||||||
if t == "" {
|
if t == "" {
|
||||||
t = "-"
|
t = "-"
|
||||||
}
|
}
|
||||||
return pdf.SplitLines([]byte(t), w)
|
return splitLinesSafe(pdf, t, w)
|
||||||
}
|
}
|
||||||
|
|
||||||
calcWrappedRowHeight := func(row []string, widths []float64, wrapIdx map[int]bool, lineH float64, minH float64) float64 {
|
calcWrappedRowHeight := func(row []string, widths []float64, wrapIdx map[int]bool, lineH float64, minH float64) float64 {
|
||||||
|
|||||||
@@ -7,8 +7,10 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
"math"
|
"math"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"runtime/debug"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -76,6 +78,13 @@ type agingMasterPDF struct {
|
|||||||
|
|
||||||
func ExportStatementAgingPDFHandler(_ *sql.DB) http.HandlerFunc {
|
func ExportStatementAgingPDFHandler(_ *sql.DB) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
defer func() {
|
||||||
|
if rec := recover(); rec != nil {
|
||||||
|
log.Printf("PANIC ExportStatementAgingPDFHandler: %v\n%s", rec, string(debug.Stack()))
|
||||||
|
http.Error(w, "internal server error", http.StatusInternalServerError)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
claims, ok := auth.GetClaimsFromContext(r.Context())
|
claims, ok := auth.GetClaimsFromContext(r.Context())
|
||||||
if !ok || claims == nil {
|
if !ok || claims == nil {
|
||||||
http.Error(w, "unauthorized", http.StatusUnauthorized)
|
http.Error(w, "unauthorized", http.StatusUnauthorized)
|
||||||
@@ -99,6 +108,11 @@ func ExportStatementAgingPDFHandler(_ *sql.DB) http.HandlerFunc {
|
|||||||
excludeZero12 := parseBoolQuery(r.URL.Query().Get("exclude_zero_12"))
|
excludeZero12 := parseBoolQuery(r.URL.Query().Get("exclude_zero_12"))
|
||||||
excludeZero13 := parseBoolQuery(r.URL.Query().Get("exclude_zero_13"))
|
excludeZero13 := parseBoolQuery(r.URL.Query().Get("exclude_zero_13"))
|
||||||
|
|
||||||
|
if err := queries.RebuildStatementAgingCache(r.Context()); err != nil {
|
||||||
|
http.Error(w, "cache rebuild error: "+err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
rows, err := queries.GetStatementAgingBalanceList(r.Context(), listParams)
|
rows, err := queries.GetStatementAgingBalanceList(r.Context(), listParams)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, "db error: "+err.Error(), http.StatusInternalServerError)
|
http.Error(w, "db error: "+err.Error(), http.StatusInternalServerError)
|
||||||
|
|||||||
Reference in New Issue
Block a user