[Bug 40808] New: Holds charges should be accessible from Holds
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40808 Bug ID: 40808 Summary: Holds charges should be accessible from Holds Change sponsored?: --- Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Hold requests Assignee: koha-bugs@lists.koha-community.org Reporter: martin.renvoize@openfifth.co.uk QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, lisette@bywatersolutions.com, tomascohen@gmail.com It should be easy to get from a hold to it's associated charges.. i.e. Hold fee, Cancellation fee, any processing fees. This would be useful for API responses and display purposes. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40808 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |40769 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40769 [Bug 40769] Highlight hold fees when placing a hold from the staff client -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40808 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |martin.renvoize@openfifth.c |ity.org |o.uk -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40808 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |3492 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=3492 [Bug 3492] Move hold fee setting into circulation rules -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40808 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on|40769 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40769 [Bug 40769] Highlight hold fees when placing a hold from the staff client -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40808 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=40769 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40808 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=40808 --- Comment #1 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 186436 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186436&action=edit Bug 40808: Add accountline_links table for polymorphic hold-fee linking This patch introduces a new polymorphic linking system to replace the growing number of nullable foreign key fields in the accountlines table. Database changes: - New accountline_links table with optimized indexes - Supports linking account lines to holds, checkouts, article requests, etc. - Uses clean link_type naming (hold, checkout, article_request) - Migrates existing issue_id and old_issue_id links during upgrade - Includes database triggers for referential integrity Benefits: - Eliminates nullable FK field bloat in accountlines - Infinitely extensible for new entity types - Enables one-to-many relationships (one fee can link to multiple entities) - Better performance with covering indexes -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40808 --- Comment #2 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 186437 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186437&action=edit Bug 40808: Add DBIx::Class schema for accountline_links polymorphic relationships This patch adds the DBIx::Class schema definitions for the new accountline_links table and updates the existing accountlines schema. Changes: - New Koha::Schema::Result::AccountlineLink with polymorphic relationships - Updated Koha::Schema::Result::Accountline to include has_many relationship - Supports modern link types: hold, checkout, article_request - Includes validation methods for link integrity - Optimized for common query patterns with covering indexes The polymorphic design allows linking account lines to any entity type without adding nullable foreign key columns to the accountlines table. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40808 --- Comment #3 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 186438 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186438&action=edit Bug 40808: Add Koha::Object classes for accountline_links and update existing objects This patch implements the Koha::Object layer for the new polymorphic account line linking system. New classes: - Koha::Account::Link - Individual link object with validation - Koha::Account::Links - Collection class with filtering methods Enhanced existing classes: - Koha::Account::Line gains methods: add_link, links, holds, checkouts, article_requests - Koha::Hold gains method: account_lines Features: - Clean API using modern class names (holds, checkouts vs reserves, issues) - Built-in validation for link integrity - Optimized queries with proper joins and prefetch - Seamless integration with existing Koha::Object patterns Usage examples: my $fees = $hold->debits; my $holds = $account_line->holds; $account_line->add_link('hold', $hold_id); -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40808 --- Comment #4 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 186439 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186439&action=edit Bug 40808: Add schema relationships for polymorphic account line linking Adds the necessary DBIx::Class relationships to support polymorphic linking between account lines and various entities: 1. Koha::Schema::Result::Reserve - Adds accountline_links relationship to enable holds to find their linked account lines 2. Koha::Schema::Result::AccountlineLink - Enhanced polymorphic methods for accessing linked objects and validation These relationships enable proper traversal from holds to account lines and support the polymorphic linking system. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40808 --- Comment #5 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 186440 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186440&action=edit Bug 40808: Add comprehensive test coverage for account line linking Adds comprehensive test coverage for the polymorphic account line linking system with proper transaction isolation: 1. t/db_dependent/Koha/Account/Link.t - Tests individual Link objects - Object creation and validation - Link integrity validation - Exception handling for invalid link types and targets - Integration with account lines and holds - Unique constraint enforcement 2. t/db_dependent/Koha/Account/Links.t - Tests Links collection - Collection filtering by link_type and linked_id - Polymorphic access to linked objects (holds, checkouts) - Proper transaction isolation between subtests 3. Updates to t/db_dependent/Koha/Account/Line.t - New subtest for Account::Line linking methods - Tests add_link(), links(), holds(), checkouts() methods - Proper integration testing with transaction isolation All tests pass with comprehensive coverage of the linking functionality. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40808 --- Comment #6 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 186441 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186441&action=edit Bug 40808: Add REST API embedding support for hold account_lines Adds support for embedding account lines in holds via the REST API: 1. api/v1/swagger/definitions/hold.yaml - Adds account_lines property to hold definition for API output when embedded 2. api/v1/swagger/paths/holds.yaml - Adds account_lines to the x-koha-embed enum for the GET /holds endpoint 3. api/v1/swagger/paths/patrons_holds.yaml - Adds account_lines to the x-koha-embed enum for GET /patrons/{patron_id}/holds endpoint Usage: GET /api/v1/holds?x-koha-embed=account_lines GET /api/v1/patrons/123/holds?x-koha-embed=account_lines This allows API consumers to retrieve holds with their associated charges/fees in a single request, enabling efficient access to hold-related financial information. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40808 --- Comment #7 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 186442 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186442&action=edit Bug 40808: Add account_lines embedding support to POST /holds endpoint Adds x-koha-embed parameter to the POST /holds endpoint to allow embedding account_lines in the response when creating a hold. This enables API consumers to immediately see any charges/fees that are created as part of the hold placement process in a single API call. Usage: POST /api/v1/holds x-koha-embed: account_lines The response will include any account lines (fees) automatically created during hold placement, such as hold placement fees. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40808 --- Comment #8 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 186443 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186443&action=edit Bug 40808: Add REST API unit tests for holds debits embedding Adds comprehensive API unit tests for the debits embedding functionality in the holds REST API endpoints. The tests verify: 1. GET /holds without embedding - should not include debits field 2. GET /holds with debits embedding - should include linked charges 3. GET /holds with empty debits - should return empty array when no fees linked Note: Currently the API embedding tests fail with 500 errors due to issues in the REST API framework's automatic embedding mechanism, though the underlying Hold.debits() method and to_api() functionality works correctly when tested directly. Also improves the Hold.debits() method to properly filter for debit-only account lines (excluding credits). -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40808 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #186436|0 |1 is obsolete| | --- Comment #9 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 186458 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186458&action=edit Bug 40808: Add accountline_links table for polymorphic hold-fee linking This patch introduces a new polymorphic linking system to replace the growing number of nullable foreign key fields in the accountlines table. Database changes: - New accountline_links table with optimized indexes - Supports linking account lines to holds, checkouts, article requests, etc. - Uses clean link_type naming (hold, checkout, article_request) - Migrates existing issue_id and old_issue_id links during upgrade - Includes database triggers for referential integrity Benefits: - Eliminates nullable FK field bloat in accountlines - Infinitely extensible for new entity types - Enables one-to-many relationships (one fee can link to multiple entities) - Better performance with covering indexes -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40808 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #186437|0 |1 is obsolete| | --- Comment #10 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 186459 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186459&action=edit Bug 40808: Add DBIx::Class schema for accountline_links polymorphic relationships This patch adds the DBIx::Class schema definitions for the new accountline_links table and updates the existing accountlines schema. Changes: - New Koha::Schema::Result::AccountlineLink with polymorphic relationships - Updated Koha::Schema::Result::Accountline to include has_many relationship - Supports modern link types: hold, checkout, article_request - Includes validation methods for link integrity - Optimized for common query patterns with covering indexes The polymorphic design allows linking account lines to any entity type without adding nullable foreign key columns to the accountlines table. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40808 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #186438|0 |1 is obsolete| | --- Comment #11 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 186460 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186460&action=edit Bug 40808: Add Koha::Object classes for accountline_links and update existing objects This patch implements the Koha::Object layer for the new polymorphic account line linking system. New classes: - Koha::Account::Link - Individual link object with validation - Koha::Account::Links - Collection class with filtering methods Enhanced existing classes: - Koha::Account::Line gains methods: add_link, links, holds - Koha::Hold gains method: account_lines Features: - Clean API using modern class names (holds) - Built-in validation for link integrity - Optimized queries with proper joins and prefetch - Seamless integration with existing Koha::Object patterns Usage examples: my $fees = $hold->debits; my $holds = $account_line->holds; $account_line->add_link('hold', $hold_id); -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40808 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #186439|0 |1 is obsolete| | --- Comment #12 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 186461 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186461&action=edit Bug 40808: Add schema relationships for polymorphic account line linking Adds the necessary DBIx::Class relationships to support polymorphic linking between account lines and various entities: 1. Koha::Schema::Result::Reserve - Adds accountline_links relationship to enable holds to find their linked account lines 2. Koha::Schema::Result::AccountlineLink - Enhanced polymorphic methods for accessing linked objects and validation These relationships enable proper traversal from holds to account lines and support the polymorphic linking system. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40808 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #186440|0 |1 is obsolete| | --- Comment #13 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 186462 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186462&action=edit Bug 40808: Add comprehensive test coverage for account line linking Adds comprehensive test coverage for the polymorphic account line linking system with proper transaction isolation: 1. t/db_dependent/Koha/Account/Link.t - Tests individual Link objects - Object creation and validation - Link integrity validation - Exception handling for invalid link types and targets - Integration with account lines and holds - Unique constraint enforcement 2. t/db_dependent/Koha/Account/Links.t - Tests Links collection - Collection filtering by link_type and linked_id - Polymorphic access to linked objects (holds, checkouts) - Proper transaction isolation between subtests 3. Updates to t/db_dependent/Koha/Account/Line.t - New subtest for Account::Line linking methods - Tests add_link(), links(), holds(), checkouts() methods - Proper integration testing with transaction isolation All tests pass with comprehensive coverage of the linking functionality. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40808 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #186441|0 |1 is obsolete| | --- Comment #14 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 186463 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186463&action=edit Bug 40808: Add REST API embedding support for hold account_lines Adds support for embedding account lines in holds via the REST API: 1. api/v1/swagger/definitions/hold.yaml - Adds account_lines property to hold definition for API output when embedded 2. api/v1/swagger/paths/holds.yaml - Adds account_lines to the x-koha-embed enum for the GET /holds endpoint 3. api/v1/swagger/paths/patrons_holds.yaml - Adds account_lines to the x-koha-embed enum for GET /patrons/{patron_id}/holds endpoint Usage: GET /api/v1/holds?x-koha-embed=account_lines GET /api/v1/patrons/123/holds?x-koha-embed=account_lines This allows API consumers to retrieve holds with their associated charges/fees in a single request, enabling efficient access to hold-related financial information. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40808 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #186442|0 |1 is obsolete| | --- Comment #15 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 186464 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186464&action=edit Bug 40808: Add account_lines embedding support to POST /holds endpoint Adds x-koha-embed parameter to the POST /holds endpoint to allow embedding account_lines in the response when creating a hold. This enables API consumers to immediately see any charges/fees that are created as part of the hold placement process in a single API call. Usage: POST /api/v1/holds x-koha-embed: account_lines The response will include any account lines (fees) automatically created during hold placement, such as hold placement fees. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40808 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #186443|0 |1 is obsolete| | --- Comment #16 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 186465 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186465&action=edit Bug 40808: Add REST API unit tests for holds debits embedding Adds comprehensive API unit tests for the debits embedding functionality in the holds REST API endpoints. The tests verify: 1. GET /holds without embedding - should not include debits field 2. GET /holds with debits embedding - should include linked charges 3. GET /holds with empty debits - should return empty array when no fees linked Note: Currently the API embedding tests fail with 500 errors due to issues in the REST API framework's automatic embedding mechanism, though the underlying Hold.debits() method and to_api() functionality works correctly when tested directly. Also improves the Hold.debits() method to properly filter for debit-only account lines (excluding credits). -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40808 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Holds charges should be |Consider a link table for |accessible from Holds |accountlines to varying | |other Koha tables -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40808 Bug 40808 depends on bug 3492, which changed state. Bug 3492 Summary: Move hold fee setting into circulation rules https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=3492 What |Removed |Added ---------------------------------------------------------------------------- Status|Needs documenting |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org