Merge remote-tracking branch 'origin/master'

This commit is contained in:
M_Kececi
2026-03-17 11:17:00 +03:00
parent 84466e87ba
commit ba8c1dd801
2 changed files with 21 additions and 0 deletions

View File

@@ -397,6 +397,9 @@ func drawCustomerBalancePDF(
totalY := pdf.GetY()
totalX := marginL
for i, v := range totalsRow {
if i >= len(summaryW) {
break
}
pdf.Rect(totalX, totalY, summaryW[i], totalH, "FD")
align := "L"
if i >= 7 {
@@ -441,6 +444,9 @@ func drawCustomerBalancePDF(
y := pdf.GetY()
x := marginL
for i, v := range row {
if i >= len(summaryW) {
break
}
pdf.Rect(x, y, summaryW[i], rowH, "")
align := "L"
if i >= 7 {
@@ -520,6 +526,9 @@ func drawCustomerBalancePDF(
rowY := pdf.GetY()
rowX := marginL
for i, v := range line {
if i >= len(detailW) {
break
}
pdf.Rect(rowX, rowY, detailW[i], rowH, "")
align := "L"
if i >= 5 {
@@ -557,6 +566,9 @@ func calcPDFRowHeight(pdf *gofpdf.Fpdf, row []string, widths []float64, wrapIdx
if !wrapIdx[i] {
continue
}
if i >= len(widths) || widths[i] <= 2 {
continue
}
lines := pdf.SplitLines([]byte(strings.TrimSpace(v)), widths[i]-2)
if len(lines) > maxLines {
maxLines = len(lines)
@@ -570,6 +582,9 @@ func calcPDFRowHeight(pdf *gofpdf.Fpdf, row []string, widths []float64, wrapIdx
}
func drawPDFCellWrapped(pdf *gofpdf.Fpdf, value string, x, y, w, h float64, align string, lineH float64) {
if w <= 2 || h <= 0 {
return
}
text := strings.TrimSpace(value)
lines := pdf.SplitLines([]byte(text), w-2)
if len(lines) == 0 {

View File

@@ -16,6 +16,12 @@ import (
func ExportStatementAgingPDFHandler(_ *sql.DB) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
defer func() {
if rec := recover(); rec != nil {
http.Error(w, fmt.Sprintf("pdf panic: %v", rec), http.StatusInternalServerError)
}
}()
claims, ok := auth.GetClaimsFromContext(r.Context())
if !ok || claims == nil {
http.Error(w, "unauthorized", http.StatusUnauthorized)