container: hledger-flow: btcpayserver: add uniform quotes

- Allows undesirable characters in variable-text columns
- Related refactoring
This commit is contained in:
2026-02-13 10:32:12 -08:00
parent 3a7d97b3fb
commit 7f4e739f9d

View File

@@ -2,7 +2,7 @@
# docker-finance | modern accounting for the power-user
#
# Copyright (C) 2021-2025 Aaron Fiore (Founder, Evergreen Crypto LLC)
# Copyright (C) 2021-2026 Aaron Fiore (Founder, Evergreen Crypto LLC)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -74,7 +74,9 @@ function btcpayserver::print_warning()
# "Legacy Invoice" report
function btcpayserver::legacy()
{
gawk -v global_year="$global_year" -v global_subaccount="$global_subaccount" \
gawk --csv \
-v global_year="$global_year" \
-v global_subaccount="$global_subaccount" \
'{
if (NR<2 || $1 !~ global_year)
next
@@ -126,9 +128,10 @@ function btcpayserver::legacy()
printf $21 OFS # InvoiceSubtotal
printf $22 OFS # InvoiceItemCode
# TODO: if description contains comma(s)?
# InvoiceItemDesc
sub(/%/, "%%", $23)
printf $23 OFS # InvoiceItemDesc
gsub(/"/, "", $23)
printf "\"" $23 "\"" OFS
printf $24 OFS # InvoiceFullStatus
printf $25 OFS # InvoiceStatus
@@ -141,7 +144,7 @@ function btcpayserver::legacy()
printf global_subaccount # Subaccount
printf "\n"
}' FS=, OFS=, "$global_in_path"
}' OFS=, "$global_in_path"
}
# "Payments" report
@@ -173,7 +176,9 @@ function btcpayserver::sales()
# "Wallets" report
function btcpayserver::wallets()
{
gawk -v global_year="$global_year" -v global_subaccount="$global_subaccount" \
gawk --csv \
-v global_year="$global_year" \
-v global_subaccount="$global_subaccount" \
'{
if (NR<2 || $1 !~ global_year)
next
@@ -238,7 +243,7 @@ function btcpayserver::wallets()
printf global_subaccount # Subaccount
printf "\n"
}' FS=, OFS=, "$global_in_path"
}' OFS=, "$global_in_path"
}
function btcpayserver::parse()