[Bug 41520] New: Using additional fields on ERM agreements results in an error when loading the agreements table
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41520 Bug ID: 41520 Summary: Using additional fields on ERM agreements results in an error when loading the agreements table Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: ERM Assignee: jonathan.druart@gmail.com Reporter: bibliothek@th-wildau.de QA Contact: testopia@bugs.koha-community.org CC: jonathan.druart@gmail.com, jonathan.field@openfifth.co.uk, martin.renvoize@openfifth.co.uk, matt.blenkinsop@openfifth.co.uk, pedro.amorim@openfifth.co.uk To recreate: a) enable ERM module in system preferences b) create an addition field (/cgi-bin/koha/admin/additional-fields.pl) for Agreements (erm_agreements) c) go to /cgi-bin/koha/erm/agreements and create an agreement, fill the additional field. Save and reload /cgi-bin/koha/erm/agreements d) see browser error 'Something went wrong when loading the table. 500: Internal Server Error. Properties not allowed: record_table.' and error log in ktd: '==> /var/log/koha/kohadev/plack-api-error.log <== [2026/01/05 12:39:19] [WARN] OpenAPI >>> GET api/v1/erm/agreements [{"message":"Properties not allowed: record_table.","path":"\/body\/0\/extended_attributes\/0"}] ' -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41520 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lucas@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41520 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |35451 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35451 [Bug 35451] Add tablename field to additional_field_values -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41520 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|jonathan.druart@gmail.com |martin.renvoize@openfifth.c | |o.uk -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41520 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41520 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |major -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41520 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |tomascohen@gmail.com |y.org | Sponsorship status|--- |Unsponsored Status|ASSIGNED |Needs Signoff Patch complexity|--- |Trivial patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41520 --- Comment #1 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 190892 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=190892&action=edit Bug 41520: Add tests for extended_attributes in ERM agreements API This patch adds api unit tests for the extended_attributes functionality in the ERM agreements API to ensure that: 1. Extended attributes are correctly returned when embedded 2. The internal record_table field is not exposed via the API 3. Both single GET and list endpoints work correctly with extended_attributes Test plan: 1. prove t/db_dependent/api/v1/erm_agreements.t 2. Verify all tests pass -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41520 --- Comment #2 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 190893 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=190893&action=edit Bug 41520: Filter out record_table from AdditionalFieldValue API responses Bug 35451 added a record_table field to the additional_field_values database table for performance optimization (better joins). However, this field was not added to the OpenAPI schema, and with additionalProperties: false, the API validator rejects responses containing it. Rather than adding this internal implementation detail to the public API schema, this patch adds a custom to_api method to Koha::AdditionalFieldValue that filters out the record_table field. This approach: 1. Keeps the database optimization from Bug 35451 2. Prevents internal implementation details from cluttering the API 3. Maintains context that API consumers already have from parent objects 4. Fixes OpenAPI validation errors for ERM agreements, licenses, and packages using extended_attributes Test plan: 1. Create an ERM agreement with additional fields/extended attributes 2. Access the agreement via the API with extended_attributes embedded 3. Verify the response includes extended_attributes but not record_table 4. Confirm no OpenAPI validation warnings in plack-api-error.log 5. prove t/db_dependent/api/v1/erm_agreements.t 6. Verify all tests pass -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41520 Jan Kissig <bibliothek@th-wildau.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #190892|0 |1 is obsolete| | Attachment #190893|0 |1 is obsolete| | --- Comment #3 from Jan Kissig <bibliothek@th-wildau.de> --- Created attachment 190906 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=190906&action=edit Bug 41520: Add tests for extended_attributes in ERM agreements API This patch adds api unit tests for the extended_attributes functionality in the ERM agreements API to ensure that: 1. Extended attributes are correctly returned when embedded 2. The internal record_table field is not exposed via the API 3. Both single GET and list endpoints work correctly with extended_attributes Test plan: 1. prove t/db_dependent/api/v1/erm_agreements.t 2. Verify all tests pass Signed-off-by: Jan Kissig <bibliothek@th-wildau.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41520 --- Comment #4 from Jan Kissig <bibliothek@th-wildau.de> --- Created attachment 190907 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=190907&action=edit Bug 41520: Filter out record_table from AdditionalFieldValue API responses Bug 35451 added a record_table field to the additional_field_values database table for performance optimization (better joins). However, this field was not added to the OpenAPI schema, and with additionalProperties: false, the API validator rejects responses containing it. Rather than adding this internal implementation detail to the public API schema, this patch adds a custom to_api method to Koha::AdditionalFieldValue that filters out the record_table field. This approach: 1. Keeps the database optimization from Bug 35451 2. Prevents internal implementation details from cluttering the API 3. Maintains context that API consumers already have from parent objects 4. Fixes OpenAPI validation errors for ERM agreements, licenses, and packages using extended_attributes Test plan: 1. Create an ERM agreement with additional fields/extended attributes 2. Access the agreement via the API with extended_attributes embedded 3. Verify the response includes extended_attributes but not record_table 4. Confirm no OpenAPI validation warnings in plack-api-error.log 5. prove t/db_dependent/api/v1/erm_agreements.t 6. Verify all tests pass Signed-off-by: Jan Kissig <bibliothek@th-wildau.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41520 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com --- Comment #5 from David Nind <david@davidnind.com> --- Hi Jan. You've signed off the bug, but the status is still showing as "Needs Signoff". David -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41520 --- Comment #6 from David Nind <david@davidnind.com> --- PS: I would add my sign off, so you could do the QA, but I don't know how to do steps 2 and 3 of the test plan. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41520 Jan Kissig <bibliothek@th-wildau.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off --- Comment #7 from Jan Kissig <bibliothek@th-wildau.de> --- (In reply to David Nind from comment #6)
PS: I would add my sign off, so you could do the QA, but I don't know how to do steps 2 and 3 of the test plan.
Hi David, thanks for the status reminder, I set it to signed off now but please add yours too: 2. Access the agreement via the API with extended_attributes embedded 3. Verify the response includes extended_attributes but not record_table For 2 and 3 you could either use an API testing tool and set - the URL to: /api/v1/erm/agreements - the header to: x-koha-embed: extended_attributes or just open the browser development tools -> network tab and reload that page: /cgi-bin/koha/erm/agreements. Then take a look to for the API request to /api/v1/erm/agreements (it includes some more query params here but we can ignore them) and by double clicking that request you can check for the request headers (they include x-koha-embed with the value extended_attributes) and the response payload will include an extended_attributes object. This is how its done in firefox but I guess the other browsers work alike Hope this was understandable :) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41520 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #190906|0 |1 is obsolete| | --- Comment #8 from David Nind <david@davidnind.com> --- Created attachment 190915 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=190915&action=edit Bug 41520: Add tests for extended_attributes in ERM agreements API This patch adds api unit tests for the extended_attributes functionality in the ERM agreements API to ensure that: 1. Extended attributes are correctly returned when embedded 2. The internal record_table field is not exposed via the API 3. Both single GET and list endpoints work correctly with extended_attributes Test plan: 1. prove t/db_dependent/api/v1/erm_agreements.t 2. Verify all tests pass Signed-off-by: Jan Kissig <bibliothek@th-wildau.de> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41520 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #190907|0 |1 is obsolete| | --- Comment #9 from David Nind <david@davidnind.com> --- Created attachment 190916 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=190916&action=edit Bug 41520: Filter out record_table from AdditionalFieldValue API responses Bug 35451 added a record_table field to the additional_field_values database table for performance optimization (better joins). However, this field was not added to the OpenAPI schema, and with additionalProperties: false, the API validator rejects responses containing it. Rather than adding this internal implementation detail to the public API schema, this patch adds a custom to_api method to Koha::AdditionalFieldValue that filters out the record_table field. This approach: 1. Keeps the database optimization from Bug 35451 2. Prevents internal implementation details from cluttering the API 3. Maintains context that API consumers already have from parent objects 4. Fixes OpenAPI validation errors for ERM agreements, licenses, and packages using extended_attributes Test plan: 1. Create an ERM agreement with additional fields/extended attributes 2. Access the agreement via the API with extended_attributes embedded 3. Verify the response includes extended_attributes but not record_table 4. Confirm no OpenAPI validation warnings in plack-api-error.log 5. prove t/db_dependent/api/v1/erm_agreements.t 6. Verify all tests pass Signed-off-by: Jan Kissig <bibliothek@th-wildau.de> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41520 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the| |This fixes the ERM release notes| |agreements table, when | |additional fields are added | |for agreements. | | | |When loading the ERM | |agreements table, a 500 | |error was generated: | | | | Something went wrong | |when loading the table. | | 500: Internal Server | |Error | | Properties not allowed: | |record_table. | | Properties not allowed: | |record_table. | | Properties not allowed: | |record_table. --- Comment #10 from David Nind <david@davidnind.com> --- Thanks Jan, with your tips I managed to muddle my way through using Bruno (an open-source API client). Managed to reproduce the error after enabling ERM, adding two additional fields for EZR > Agreements, and creating an agreement using those fields: Something went wrong when loading the table. 500: Internal Server Error Properties not allowed: record_table. Properties not allowed: record_table. Properties not allowed: record_table. After the patches, the tests pass and the agreements table loads in the staff interface. Using an API client (such as Bruno) the request is completed successfully: - GET http://127.0.0.1:8081/api/v1/erm/agreements - Body: No body - Headers: . Key: x-koha-embed . Value: extended_attributes - Auth: Basic Auth with koha + koha -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41520 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|major |critical -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41520 --- Comment #11 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- As always, many thanks for testing David :) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41520 --- Comment #12 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- In fact, thank you both.. I somehow completely missed Jan has tested and signed off too! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41520 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41520 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #190915|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41520 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #190916|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41520 --- Comment #13 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 190927 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=190927&action=edit Bug 41520: Add tests for extended_attributes in ERM agreements API This patch adds api unit tests for the extended_attributes functionality in the ERM agreements API to ensure that: 1. Extended attributes are correctly returned when embedded 2. The internal record_table field is not exposed via the API 3. Both single GET and list endpoints work correctly with extended_attributes Test plan: 1. prove t/db_dependent/api/v1/erm_agreements.t 2. Verify all tests pass Signed-off-by: Jan Kissig <bibliothek@th-wildau.de> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41520 --- Comment #14 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 190928 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=190928&action=edit Bug 41520: Filter out record_table from AdditionalFieldValue API responses Bug 35451 added a record_table field to the additional_field_values database table for performance optimization (better joins). However, this field was not added to the OpenAPI schema, and with additionalProperties: false, the API validator rejects responses containing it. Rather than adding this internal implementation detail to the public API schema, this patch adds a custom to_api method to Koha::AdditionalFieldValue that filters out the record_table field. This approach: 1. Keeps the database optimization from Bug 35451 2. Prevents internal implementation details from cluttering the API 3. Maintains context that API consumers already have from parent objects 4. Fixes OpenAPI validation errors for ERM agreements, licenses, and packages using extended_attributes Test plan: 1. Create an ERM agreement with additional fields/extended attributes 2. Access the agreement via the API with extended_attributes embedded 3. Verify the response includes extended_attributes but not record_table 4. Confirm no OpenAPI validation warnings in plack-api-error.log 5. prove t/db_dependent/api/v1/erm_agreements.t 6. Verify all tests pass Signed-off-by: Jan Kissig <bibliothek@th-wildau.de> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41520 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |26.05.00 released in| | Status|Passed QA |Pushed to main -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41520 --- Comment #15 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Nice work everyone! Pushed to main for 26.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41520 Chloé Zermatten <chloe.zermatten@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|26.05.00 |26.05.00,25.11.02 released in| | Status|Pushed to main |Pushed to stable -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41520 --- Comment #16 from Chloé Zermatten <chloe.zermatten@openfifth.co.uk> --- All pushed to 25.11.x Thanks all! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41520 Bug 41520 depends on bug 35451, which changed state. Bug 35451 Summary: Add tablename field to additional_field_values https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35451 What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to main |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41520 Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |wainuiwitikapark@catalyst.n | |et.nz Status|Pushed to stable |Needs documenting --- Comment #17 from Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> --- Not backporting to 25.05 - dependency not in 25.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41520 Aude Charillon <aude.charillon@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs documenting |RESOLVED Resolution|--- |FIXED CC| |aude.charillon@openfifth.co | |.uk --- Comment #18 from Aude Charillon <aude.charillon@openfifth.co.uk> --- No need for any updates to the Manual. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org