container: lib_taxes: fix for generating all years (year=all)

- The expected `hledger` output format appears to have changed, likely
  from a recent `hledger` release (confirmed to be unrelated to `xan`).

- This bug does *not* affect individual year tax report generation, when
  given a specific (or default) year.
This commit is contained in:
2026-01-27 15:24:24 -08:00
parent 5f57ea12b2
commit 5e8fff8103

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
@@ -1003,7 +1003,7 @@ function lib_taxes::__taxes_write()
if [ -z "$global_arg_year" ]; then
lib_utils::print_info "Capturing the year of the oldest tagged record ...\n"
local -r _oldest_year="$("${_base_hledger[@]}" | head -n2 | xan select \"date\" | tail -n1 | cut -d'-' -f1)"
local -r _oldest_year="$("${_base_hledger[@]}" | head -n2 | xan select \"date\" | gawk 'END {gsub(/"/, ""); printf $1}' FS=- OFS=-)"
[ -z "$_oldest_year" ] && lib_utils::die_fatal "No records available to write"
elif [[ "$global_arg_year" -gt "$_current_year" ]]; then