Bug 42225: (QA follow-up) Use configured unitprice field in outer SELECT

The outer SELECT hardcoded unitprice_tax_included while the inner
subquery selects the field returned by FieldsForCalculatingFundValues.
With CalculateFundValuesIncludingTax disabled the derived table only
exposes unitprice_tax_excluded, so spent.pl dies with:
Unknown column 'unitprice_tax_included' in 'field list'

To test:
1. Set CalculateFundValuesIncludingTax to 'Exclude'
2. View spent.pl for a fund with received orders
3. Observe error 500
4. Apply patch, restart_all
5. Reload, page renders correctly
6. Set CalculateFundValuesIncludingTax back to 'Include'
7. Reload, page still renders correctly

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Paul Derscheid 2026-07-10 12:09:36 +02:00 committed by Pedro Amorim
parent 683142868f
commit 852b0f1dcd
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
1 changed files with 1 additions and 1 deletions

View File

@ -68,7 +68,7 @@ SELECT
invoiceid, invoiceid,
invoicenumber, invoicenumber,
quantityreceived, quantityreceived,
unitprice_tax_included, $unitprice_field,
datereceived, datereceived,
aqbooksellers.name as vendorname aqbooksellers.name as vendorname
FROM FROM