[Bug 42425] New: Add checkin_id FK to accountlines to link fee adjustments to checkin events
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 Bug ID: 42425 Summary: Add checkin_id FK to accountlines to link fee adjustments to checkin events Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: tomascohen@gmail.com QA Contact: testopia@bugs.koha-community.org Depends on: 42418 Blocks: 24401 When AddReturn processes a checkin, it may create or modify several accountlines (lost item fee refunds/charges, processing fee refunds, etc.). Currently these fee adjustments have no persistent link back to the checkin event that triggered them. Bug 42418 introduced the checkins table as a first-class resource. Adding a checkin_id FK to accountlines would: - Allow Koha::Checkin->account_lines as a proper relationship - Enable embedding account_lines in the checkin REST API response (bug 24401) - Provide an audit trail linking financial transactions to the specific checkin that caused them - Eliminate the need to infer fee changes from timestamps or $messages parsing Implementation notes: - Add checkin_id INT(11) DEFAULT NULL to accountlines with FK to checkins.checkin_id ON DELETE SET NULL - Update AddReturn to pass the checkin_id when creating/modifying accountlines during return processing - The relevant C4::Circulation code paths are: _FixAccountForLostAndFound, _FixOverduesOnReturn, and the lost item fee charge logic Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24401 [Bug 24401] REST API: Check-in https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42418 [Bug 42418] Add Koha::Checkin(s) - checkin as a first-class resource -- 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=42425 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | Patch complexity|--- |Small patch Status|NEW |Needs Signoff -- 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=42425 --- Comment #1 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 198235 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=198235&action=edit Bug 42425: DB changes Adds a checkin_id column to accountlines so fee adjustments created during a checkin (lost item refunds, overdue fine updates, processing fee refunds) can be linked back to the specific checkin event. - checkin_id INT(11) DEFAULT NULL, FK ON DELETE SET NULL - Links existing accountlines to checkin records via old_issue_id -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 --- Comment #2 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 198236 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=198236&action=edit Bug 42425: DBIC schema changes [DO NOT PUSH] Adds checkin belongs_to relationship on Accountline and accountlines has_many relationship on Checkin. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 --- Comment #3 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 198237 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=198237&action=edit Bug 42425: Populate checkin_id on accountlines Creates the Koha::Checkin record early in AddReturn (before fee processing) so checkin_id is available, then updates it with outcomes after processing completes. Links accountlines created during the checkin by matching borrower, item, and timestamp. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 --- Comment #4 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 198238 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=198238&action=edit Bug 42425: Add accountlines, debits and credits accessors Adds filtered DBIC relationships (debits, credits) on Koha::Schema::Result::Checkin for API embedding support, and corresponding Koha::Checkin accessors (accountlines, debits, credits). -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 --- Comment #5 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Comment on attachment 198237 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=198237 Bug 42425: Populate checkin_id on accountlines Review of attachment 198237: --> (https://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=42425&attachment=198237) ----------------------------------------------------------------- ::: C4/Circulation.pm @@ +2857,5 @@
+ { + borrowernumber => $borrowernumber, + itemnumber => $item->itemnumber, + checkin_id => undef, + date => { '>=' => $checkin_record->timestamp },
Is this reliable? This assumes all the related accountlines will be created on the exact same tick as the checkin record. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #198235|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=42425 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #198236|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=42425 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #198237|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=42425 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #198238|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=42425 --- Comment #6 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 198562 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=198562&action=edit Bug 42425: DB changes Adds a checkin_id column to accountlines so fee adjustments created during a checkin can be linked back to the specific checkin event. - checkin_id INT(11) DEFAULT NULL, FK ON DELETE SET NULL ON UPDATE CASCADE - Backfills existing accountlines via old_issue_id join to checkins -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 --- Comment #7 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 198563 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=198563&action=edit Bug 42425: DBIC schema changes [DO NOT PUSH] Patch from commit 5034c2d -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 --- Comment #8 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 198564 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=198564&action=edit Bug 42425: Add debits and credits accessors Adds filtered DBIC relationships (debits, credits) on Koha::Schema::Result::Checkin for API embedding support, and corresponding Koha::Checkin accessors. Test plan: 1. Apply patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Koha/Checkin.t => SUCCESS: Tests pass! 3. Sign off :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 --- Comment #9 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 198565 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=198565&action=edit Bug 42425: Populate checkin_id on accountlines Replaces the fragile timestamp-based matching approach with explicit checkin_id threading through the call chain. Each accountline receives its checkin_id at creation time. The Koha::Item->store() chokepoint for lost-item accounting is preserved: store() still detects itemlost transitions and calls _set_found_trigger. It now passes checkin_id context through so the resulting accountlines are linked deterministically. Changes: - Koha::Account->add_credit/add_debit: accept and store checkin_id - Koha::Item->store/_set_found_trigger: thread checkin_id to LOST_FOUND and PROCESSING_FOUND credits - C4::Items::ModDateLastSeen: pass checkin_id to store() - C4::Circulation::_FixOverduesOnReturn: accept checkin_id, pass to FORGIVEN credit - C4::Circulation::_CalculateAndUpdateFine: pass checkin_id to UpdateFine - C4::Overdues::UpdateFine: pass checkin_id to add_debit - C4::Circulation::AddReturn: pass checkin_record->id to all callers; remove timestamp-based matching block Test plan: 1. Apply patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Circulation.t => SUCCESS: Tests pass! 3. Sign off :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #198562|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=42425 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #198563|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=42425 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #198564|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=42425 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #198565|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=42425 --- Comment #10 from David Nind <david@davidnind.com> --- Created attachment 198720 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=198720&action=edit Bug 42425: DB changes Adds a checkin_id column to accountlines so fee adjustments created during a checkin can be linked back to the specific checkin event. - checkin_id INT(11) DEFAULT NULL, FK ON DELETE SET NULL ON UPDATE CASCADE - Backfills existing accountlines via old_issue_id join to checkins 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=42425 --- Comment #11 from David Nind <david@davidnind.com> --- Created attachment 198721 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=198721&action=edit Bug 42425: DBIC schema changes [DO NOT PUSH] 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=42425 --- Comment #12 from David Nind <david@davidnind.com> --- Created attachment 198722 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=198722&action=edit Bug 42425: Add debits and credits accessors Adds filtered DBIC relationships (debits, credits) on Koha::Schema::Result::Checkin for API embedding support, and corresponding Koha::Checkin accessors. Test plan: 1. Apply patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Koha/Checkin.t => SUCCESS: Tests pass! 3. Sign off :-D 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=42425 --- Comment #13 from David Nind <david@davidnind.com> --- Created attachment 198723 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=198723&action=edit Bug 42425: Populate checkin_id on accountlines Replaces the fragile timestamp-based matching approach with explicit checkin_id threading through the call chain. Each accountline receives its checkin_id at creation time. The Koha::Item->store() chokepoint for lost-item accounting is preserved: store() still detects itemlost transitions and calls _set_found_trigger. It now passes checkin_id context through so the resulting accountlines are linked deterministically. Changes: - Koha::Account->add_credit/add_debit: accept and store checkin_id - Koha::Item->store/_set_found_trigger: thread checkin_id to LOST_FOUND and PROCESSING_FOUND credits - C4::Items::ModDateLastSeen: pass checkin_id to store() - C4::Circulation::_FixOverduesOnReturn: accept checkin_id, pass to FORGIVEN credit - C4::Circulation::_CalculateAndUpdateFine: pass checkin_id to UpdateFine - C4::Overdues::UpdateFine: pass checkin_id to add_debit - C4::Circulation::AddReturn: pass checkin_record->id to all callers; remove timestamp-based matching block Test plan: 1. Apply patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Circulation.t => SUCCESS: Tests pass! 3. Sign off :-D 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=42425 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #198720|0 |1 is obsolete| | Attachment #198721|0 |1 is obsolete| | Attachment #198722|0 |1 is obsolete| | Attachment #198723|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=42425 --- Comment #14 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 204163 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=204163&action=edit Bug 42425: DB changes Adds a checkin_id column to accountlines so fee adjustments created during a checkin can be linked back to the specific checkin event. - checkin_id INT(11) DEFAULT NULL, FK ON DELETE SET NULL ON UPDATE CASCADE - Backfills existing accountlines via old_issue_id join to checkins Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 --- Comment #15 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 204164 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=204164&action=edit Bug 42425: DBIC schema changes [DO NOT PUSH] Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 --- Comment #16 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 204165 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=204165&action=edit Bug 42425: Add debits and credits accessors Adds filtered DBIC relationships (debits, credits) on Koha::Schema::Result::Checkin for API embedding support, and corresponding Koha::Checkin accessors. Test plan: 1. Apply patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Koha/Checkin.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 --- Comment #17 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 204166 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=204166&action=edit Bug 42425: Populate checkin_id on accountlines Replaces the fragile timestamp-based matching approach with explicit checkin_id threading through the call chain. Each accountline receives its checkin_id at creation time. The Koha::Item->store() chokepoint for lost-item accounting is preserved: store() still detects itemlost transitions and calls _set_found_trigger. It now passes checkin_id context through so the resulting accountlines are linked deterministically. Changes: - Koha::Account->add_credit/add_debit: accept and store checkin_id - Koha::Item->store/_set_found_trigger: thread checkin_id to LOST_FOUND and PROCESSING_FOUND credits - C4::Items::ModDateLastSeen: pass checkin_id to store() - C4::Circulation::_FixOverduesOnReturn: accept checkin_id, pass to FORGIVEN credit - C4::Circulation::_CalculateAndUpdateFine: pass checkin_id to UpdateFine - C4::Overdues::UpdateFine: pass checkin_id to add_debit - C4::Circulation::AddReturn: pass checkin_record->id to all callers; remove timestamp-based matching block Test plan: 1. Apply patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Circulation.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA QA Contact|testopia@bugs.koha-communit |martin.renvoize@openfifth.c |y.org |o.uk -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #204163|0 |1 is obsolete| | Attachment #204164|0 |1 is obsolete| | Attachment #204165|0 |1 is obsolete| | Attachment #204166|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=42425 --- Comment #18 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 204916 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=204916&action=edit Bug 42425: DB changes Adds a checkin_id column to accountlines so fee adjustments created during a checkin can be linked back to the specific checkin event. - checkin_id INT(11) DEFAULT NULL, FK ON DELETE SET NULL ON UPDATE CASCADE - Backfills existing accountlines via old_issue_id join to checkins Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 --- Comment #19 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 204917 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=204917&action=edit Bug 42425: DBIC schema changes [DO NOT PUSH] Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 --- Comment #20 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 204918 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=204918&action=edit Bug 42425: Add debits and credits accessors Adds filtered DBIC relationships (debits, credits) on Koha::Schema::Result::Checkin for API embedding support, and corresponding Koha::Checkin accessors. Test plan: 1. Apply patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Koha/Checkin.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 --- Comment #21 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 204919 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=204919&action=edit Bug 42425: Populate checkin_id on accountlines Replaces the fragile timestamp-based matching approach with explicit checkin_id threading through the call chain. Each accountline receives its checkin_id at creation time. The Koha::Item->store() chokepoint for lost-item accounting is preserved: store() still detects itemlost transitions and calls _set_found_trigger. It now passes checkin_id context through so the resulting accountlines are linked deterministically. Changes: - Koha::Account->add_credit/add_debit: accept and store checkin_id - Koha::Item->store/_set_found_trigger: thread checkin_id to LOST_FOUND and PROCESSING_FOUND credits - C4::Items::ModDateLastSeen: pass checkin_id to store() - C4::Circulation::_FixOverduesOnReturn: accept checkin_id, pass to FORGIVEN credit - C4::Circulation::_CalculateAndUpdateFine: pass checkin_id to UpdateFine - C4::Overdues::UpdateFine: pass checkin_id to add_debit - C4::Circulation::AddReturn: pass checkin_record->id to all callers; remove timestamp-based matching block Test plan: 1. Apply patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Circulation.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #204916|0 |1 is obsolete| | Attachment #204917|0 |1 is obsolete| | Attachment #204918|0 |1 is obsolete| | Attachment #204919|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=42425 --- Comment #22 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 205071 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205071&action=edit Bug 42425: DB changes Adds a checkin_id column to accountlines so fee adjustments created during a checkin can be linked back to the specific checkin event. - checkin_id INT(11) DEFAULT NULL, FK ON DELETE SET NULL ON UPDATE CASCADE - Backfills existing accountlines via old_issue_id join to checkins Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 --- Comment #23 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 205072 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205072&action=edit Bug 42425: DBIC schema changes [DO NOT PUSH] Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 --- Comment #24 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 205073 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205073&action=edit Bug 42425: Add debits and credits accessors Adds filtered DBIC relationships (debits, credits) on Koha::Schema::Result::Checkin for API embedding support, and corresponding Koha::Checkin accessors. Test plan: 1. Apply patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Koha/Checkin.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 --- Comment #25 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 205074 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205074&action=edit Bug 42425: Populate checkin_id on accountlines Replaces the fragile timestamp-based matching approach with explicit checkin_id threading through the call chain. Each accountline receives its checkin_id at creation time. The Koha::Item->store() chokepoint for lost-item accounting is preserved: store() still detects itemlost transitions and calls _set_found_trigger. It now passes checkin_id context through so the resulting accountlines are linked deterministically. Changes: - Koha::Account->add_credit/add_debit: accept and store checkin_id - Koha::Item->store/_set_found_trigger: thread checkin_id to LOST_FOUND and PROCESSING_FOUND credits - C4::Items::ModDateLastSeen: pass checkin_id to store() - C4::Circulation::_FixOverduesOnReturn: accept checkin_id, pass to FORGIVEN credit - C4::Circulation::_CalculateAndUpdateFine: pass checkin_id to UpdateFine - C4::Overdues::UpdateFine: pass checkin_id to add_debit - C4::Circulation::AddReturn: pass checkin_record->id to all callers; remove timestamp-based matching block Test plan: 1. Apply patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Circulation.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #205071|0 |1 is obsolete| | Attachment #205072|0 |1 is obsolete| | Attachment #205073|0 |1 is obsolete| | Attachment #205074|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=42425 --- Comment #26 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 209006 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=209006&action=edit Bug 42425: DB changes Adds a checkin_id column to accountlines so fee adjustments created during a checkin can be linked back to the specific checkin event. - checkin_id INT(11) DEFAULT NULL, FK ON DELETE SET NULL ON UPDATE CASCADE - Backfills existing accountlines via old_issue_id join to checkins Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 --- Comment #27 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 209007 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=209007&action=edit Bug 42425: DBIC schema changes [DO NOT PUSH] Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 --- Comment #28 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 209008 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=209008&action=edit Bug 42425: Add debits and credits accessors Adds filtered DBIC relationships (debits, credits) on Koha::Schema::Result::Checkin for API embedding support, and corresponding Koha::Checkin accessors. Test plan: 1. Apply patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Koha/Checkin.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 --- Comment #29 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 209009 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=209009&action=edit Bug 42425: Populate checkin_id on accountlines Replaces the fragile timestamp-based matching approach with explicit checkin_id threading through the call chain. Each accountline receives its checkin_id at creation time. The Koha::Item->store() chokepoint for lost-item accounting is preserved: store() still detects itemlost transitions and calls _set_found_trigger. It now passes checkin_id context through so the resulting accountlines are linked deterministically. Changes: - Koha::Account->add_credit/add_debit: accept and store checkin_id - Koha::Item->store/_set_found_trigger: thread checkin_id to LOST_FOUND and PROCESSING_FOUND credits - C4::Items::ModDateLastSeen: pass checkin_id to store() - C4::Circulation::_FixOverduesOnReturn: accept checkin_id, pass to FORGIVEN credit - C4::Circulation::_CalculateAndUpdateFine: pass checkin_id to UpdateFine - C4::Overdues::UpdateFine: pass checkin_id to add_debit - C4::Circulation::AddReturn: pass checkin_record->id to all callers; remove timestamp-based matching block Test plan: 1. Apply patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Circulation.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 --- Comment #30 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 209388 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=209388&action=edit Bug 42425: (QA follow-up) Sort accountlines constraints like MariaDB dumps them The DB compare CI job (misc4dev run_tests.pl --compare-with) diffs a dump of an upgraded database against kohastructure.sql. MariaDB lists foreign keys sorted by name, so accountlines_ibfk_checkins is dumped between accountlines_ibfk_branches and accountlines_ibfk_credit_type, not last as kohastructure.sql had it. This is the same problem Pedro found for the checkins table on bug 42418 comment #119. This patch moves the constraint. There are no changes to the table definition, and the DBIC schema files generated from kohastructure.sql do not change. Test plan: 1. Apply patch 2. Run the DB compare job against main: $ ktd --shell k$ perl /kohadevbox/misc4dev/run_tests.pl --run-db-compare-only \ --compare-with=main => SUCCESS: No diff for the accountlines table 3. Sign off :-D Assisted-by: Opus 5.5 (Anthropic) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 --- Comment #31 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Rebased on top of main now that bug 42418 is pushed. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #209006|0 |1 is obsolete| | Attachment #209007|0 |1 is obsolete| | Attachment #209008|0 |1 is obsolete| | Attachment #209009|0 |1 is obsolete| | Attachment #209388|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=42425 --- Comment #32 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 209535 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=209535&action=edit Bug 42425: DB changes Adds a checkin_id column to accountlines so fee adjustments created during a checkin can be linked back to the specific checkin event. - checkin_id INT(11) DEFAULT NULL, FK ON DELETE SET NULL ON UPDATE CASCADE - Backfills existing accountlines via old_issue_id join to checkins Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 --- Comment #33 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 209536 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=209536&action=edit Bug 42425: DBIC schema changes [DO NOT PUSH] Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 --- Comment #34 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 209537 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=209537&action=edit Bug 42425: Add debits and credits accessors Adds filtered DBIC relationships (debits, credits) on Koha::Schema::Result::Checkin for API embedding support, and corresponding Koha::Checkin accessors. Test plan: 1. Apply patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Koha/Checkin.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 --- Comment #35 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 209538 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=209538&action=edit Bug 42425: Populate checkin_id on accountlines Replaces the fragile timestamp-based matching approach with explicit checkin_id threading through the call chain. Each accountline receives its checkin_id at creation time. The Koha::Item->store() chokepoint for lost-item accounting is preserved: store() still detects itemlost transitions and calls _set_found_trigger. It now passes checkin_id context through so the resulting accountlines are linked deterministically. Changes: - Koha::Account->add_credit/add_debit: accept and store checkin_id - Koha::Item->store/_set_found_trigger: thread checkin_id to LOST_FOUND and PROCESSING_FOUND credits - C4::Items::ModDateLastSeen: pass checkin_id to store() - C4::Circulation::_FixOverduesOnReturn: accept checkin_id, pass to FORGIVEN credit - C4::Circulation::_CalculateAndUpdateFine: pass checkin_id to UpdateFine - C4::Overdues::UpdateFine: pass checkin_id to add_debit - C4::Circulation::AddReturn: pass checkin_record->id to all callers; remove timestamp-based matching block Test plan: 1. Apply patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Circulation.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 --- Comment #36 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 209539 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=209539&action=edit Bug 42425: (QA follow-up) Sort accountlines constraints like MariaDB dumps them The DB compare CI job (misc4dev run_tests.pl --compare-with) diffs a dump of an upgraded database against kohastructure.sql. MariaDB lists foreign keys sorted by name, so accountlines_ibfk_checkins is dumped between accountlines_ibfk_branches and accountlines_ibfk_credit_type, not last as kohastructure.sql had it. This is the same problem Pedro found for the checkins table on bug 42418 comment #119. This patch moves the constraint. There are no changes to the table definition, and the DBIC schema files generated from kohastructure.sql do not change. Test plan: 1. Apply patch 2. Run the DB compare job against main: $ ktd --shell k$ perl /kohadevbox/misc4dev/run_tests.pl --run-db-compare-only \ --compare-with=main => SUCCESS: No diff for the accountlines table 3. Sign off :-D Assisted-by: Opus 5.5 (Anthropic) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pedro.amorim@openfifth.co.u | |k Status|Passed QA |Failed QA --- Comment #37 from Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> --- Hi Tomás, the new accountlines.checkin_id answers one question: "did this checkin cause this charge?". The upgrade backfill makes it answer yes for charges the checkin didn't cause. 1) Apply the patches, then: perl installer/data/mysql/updatedatabase.pl && restart_all 2) Edit item type 'BK', set 'Rental charge' to 1, click 'Save changes' (so the checkout creates a charge): http://localhost:8081/cgi-bin/koha/admin/itemtypes.pl?op=add_form&itemtype=BK 3) Check out item 3999900000001 to patron 'koha', then check it in 4) k$ echo "SELECT debit_type_code, checkin_id FROM accountlines WHERE debit_type_code = 'RENT' ORDER BY accountlines_id DESC LIMIT 1" | koha-mysql kohadev => checkin_id is NULL (correct, the rental fee was charged at checkout) 5) Run the atomicupdate again, as an upgrading site would: perl installer/data/mysql/updatedatabase.pl 6) Repeat 4) => checkin_id is now set The checkin now claims it caused a rental fee that was charged at checkout. On upgrade, historical charges tied to a returned checkout get linked this way (rental and renewal fees included), and those rows can't be told apart from correct ones later. This should be an easy fix now, but hard to fix retroactively later. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 --- Comment #38 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- QA review as part of the Bug 42383 dependency chain, applied on current main. Review was done with Claude assistance; items I reproduced are marked, the rest are from reading the code and tests. Applying the series on current main shows the last functional patch needs a rebase, and that its intent is broken on the forgive path. 1. (reproduced) "Populate checkin_id on accountlines" no longer applies: Bug 43504 (pushed 2026-11-06) moved the forgive logic out of C4::Circulation::_FixOverduesOnReturn into Koha::Account::forgive_debit. A mechanical resolution keeps the checkin_id argument at the call site, but forgive_debit builds its own credit via add_credit and never passes checkin_id on, so the FORGIVEN credit is created with checkin_id NULL. t/db_dependent/Circulation.t then fails: subtest "AddReturn populates checkin_id on accountlines", "Scenario 2: FORGIVEN credit has checkin_id" (got undef, expected the checkin id). Fix: pass checkin_id through forgive_debit (and document it in its POD), and add a direct test of forgive_debit in t/db_dependent/Koha/Account.t. On the author's earlier base this worked because add_credit was called inline there, so this is rebase fallout rather than a defect in the original patch. 2. The backfill problem Pedro reported in comment 37 stands. In addition, from reading the atomicupdate, it links every accountline that carries an old_issue_id, including payments and write-offs made long after the return, and it assumes one checkin per checkout although checkins.checkout_id is not unique. Please restrict it to the debit and credit types a checkin creates, and consider the duration of the single UPDATE (and the ALTER TABLE) on a large accountlines table. 3. Minor: the "( $x ? ( checkin_id => $x ) : () )" idiom is repeated and redundant, since add_credit and add_debit accept undef. The POD for add_credit and add_debit does not mention the new parameter. 4. Test gaps: PROCESSING_FOUND, direct add_credit/add_debit use of checkin_id, the atomicupdate backfill and its idempotency, and the FK ON DELETE SET NULL behaviour. The Koha/Checkin.t debits subtest sets checkin_id by hand, so it does not show that production code populates the column. Status stays Failed QA. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |44082 Attachment #209535|0 |1 is obsolete| | Attachment #209536|0 |1 is obsolete| | Attachment #209537|0 |1 is obsolete| | Attachment #209538|0 |1 is obsolete| | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44082 [Bug 44082] Backfill accountlines.checkin_id for the charges created by past check-ins -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 --- Comment #39 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 211497 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211497&action=edit Bug 42425: DB changes This patch adds a checkin_id column to accountlines, so the debits and credits created during a check-in can be linked to the check-in that created them: - checkin_id INT(11) DEFAULT NULL, FK to checkins, ON DELETE SET NULL ON UPDATE CASCADE Existing accountlines are not backfilled. Linking historical lines to a check-in can only be done heuristically, and a wrong link cannot be told apart from a correct one later. The column is populated going forward. Test plan: 1. Apply patch 2. Update the database: $ ktd --shell k$ updatedatabase => SUCCESS: "Added checkin_id column to accountlines" 3. Run the update again => SUCCESS: No errors, nothing is done 4. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 --- Comment #40 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 211498 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211498&action=edit Bug 42425: DBIC schema changes [DO NOT PUSH] Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 --- Comment #41 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 211499 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211499&action=edit Bug 42425: Add debits and credits accessors Adds filtered DBIC relationships (debits, credits) on Koha::Schema::Result::Checkin for API embedding support, and corresponding Koha::Checkin accessors. Test plan: 1. Apply patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Koha/Checkin.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 --- Comment #42 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 211500 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211500&action=edit Bug 42425: Populate checkin_id on accountlines Replaces the fragile timestamp-based matching approach with explicit checkin_id threading through the call chain. Each accountline receives its checkin_id at creation time. The Koha::Item->store() chokepoint for lost-item accounting is preserved: store() still detects itemlost transitions and calls _set_found_trigger. It now passes checkin_id context through so the resulting accountlines are linked deterministically. Changes: - Koha::Account->add_credit/add_debit: accept and store checkin_id - Koha::Item->store/_set_found_trigger: thread checkin_id to LOST_FOUND and PROCESSING_FOUND credits - C4::Items::ModDateLastSeen: pass checkin_id to store() - C4::Circulation::_FixOverduesOnReturn: accept checkin_id, pass to FORGIVEN credit - C4::Circulation::_CalculateAndUpdateFine: pass checkin_id to UpdateFine - C4::Overdues::UpdateFine: pass checkin_id to add_debit - C4::Circulation::AddReturn: pass checkin_record->id to all callers; remove timestamp-based matching block - Koha::Account->forgive_debit: pass checkin_id to the FORGIVEN credit Test plan: 1. Apply patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Circulation.t \ t/db_dependent/Koha/Account.t => SUCCESS: Tests pass! 3. Sign off :-D Assisted-by: Opus 5.5 (Anthropic) Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #209539|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=42425 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off --- Comment #43 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Thanks Pedro and Martin. Rebased on current main and addressed: 1. Rebase over bug 43504: checkin_id is now passed through Koha::Account::forgive_debit (documented in its POD), so the FORGIVEN credit gets it again. Tested in t/db_dependent/Koha/Account.t. 2. Backfill (comment 37 and point 2): dropped. A correct backfill can only match lines heuristically (type, item and a time window), and a wrong link cannot be told apart from a correct one later, while a missing link can always be added. checkin_id is populated going forward, and the backfill is filed as bug 44082, which describes how to do it without false links. This also removes the long UPDATE on large accountlines tables. 3. The ( $x ? ( checkin_id => $x ) : () ) idiom is gone, and add_credit and add_debit document checkin_id. 4. Tests added: PROCESSING_FOUND (Circulation.t), add_credit, add_debit and forgive_debit with checkin_id, and the FK setting it to NULL when the check-in is deleted (Koha/Account.t). The constraints sorting follow-up is folded into the DB changes patch. Sign-offs are kept on the patches that changed, as the changes are QA follow-ups. Back to Signed Off. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 --- Comment #44 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Thanks Pedro and Martin. Rebased on current main and addressed: 1. Rebase over bug 43504: checkin_id is now passed through Koha::Account::forgive_debit (documented in its POD), so the FORGIVEN credit gets it again. Tested in t/db_dependent/Koha/Account.t. 2. Backfill (comment 37 and point 2): dropped. A correct backfill can only match lines heuristically (type, item and a time window), and a wrong link cannot be told apart from a correct one later, while a missing link can always be added. checkin_id is populated going forward, and the backfill is filed as bug 44082, which describes how to do it without false links. This also removes the long UPDATE on large accountlines tables. 3. The ( $x ? ( checkin_id => $x ) : () ) idiom is gone, and add_credit and add_debit document checkin_id. 4. Tests added: PROCESSING_FOUND (Circulation.t), add_credit, add_debit and forgive_debit with checkin_id, and the FK setting it to NULL when the check-in is deleted (Koha/Account.t). The constraints sorting follow-up is folded into the DB changes patch. Sign-offs are kept on the patches that changed, as the changes are QA follow-ups. Back to Signed Off. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 Tomás Cohen Arazi (tcohen) <tomascohen@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=42425 Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |26.11.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=42425 --- Comment #45 from Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> --- Thanks everyone! Pushed to main for 26.11! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 --- Comment #46 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 211946 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211946&action=edit Bug 42425: (RM follow-up) Add checkin_id to the account line API definitions Bug 42425 added accountlines.checkin_id and the DBIC column, so Koha::Account::Line->to_api now returns checkin_id. The account_line, credit and debit swagger definitions have additionalProperties: false and did not list it, so response validation rejected every account response with "Properties not allowed: checkin_id" and the API answered 500 for GET /patrons/{patron_id}/account and POST /patrons/{patron_id}/account/credits. This made t/db_dependent/api/v1/patrons_accounts.t fail (get_balance() and add_credit() subtests, the warning and the plan). Add checkin_id as a read-only nullable integer to the three definitions. Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42425 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the| |Fines, fees and credits release notes| |created during a check-in | |are now linked to that | |check-in, so they can be | |traced back to it. The | |account line API now | |includes this link, as | |`checkin_id`. | | | |**Upgrade notes** | |- Existing account lines | |are not linked to | |check-ins. Only lines | |created after the upgrade | |are linked. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org