[Bug 44029] New: A refused over-limit checkout always says the limit came from the All / All / All rule
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44029 Bug ID: 44029 Summary: A refused over-limit checkout always says the limit came from the All / All / All rule Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Circulation Assignee: koha-bugs@lists.koha-community.org Reporter: babarjunaid1122@gmail.com QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, kyle@bywatersolutions.com Target Milestone: --- With AllowTooManyOverride off, checking out more items than a circulation rule allows is refused with "Too many checked out. N checked out, only N are allowed." followed by "Maximum checkouts calculated from the circulation rule for" and the rule's criteria. That box always reads "All item types / All patron categories / All libraries", even when a specific rule (one item type, one category, one library) set the limit, pointing staff at the wrong rule. Cause: in C4::Circulation::CanBookBeIssued, the branch for AllowTooManyOverride off sets $issuingimpossible{TOO_MANY}, current_loan_count and max_loans_allowed, but stores the rule in $needsconfirmation{circulation_rule_TOO_MANY}. circ/circulation.pl does not pass needsconfirmation to the template when the checkout is impossible, so the template's circulation_rule_TOO_MANY is empty and the criteria include shows "All" for everything. A side effect: the REST API's checkout availability returns this stray key in "confirms" even though the checkout is blocked. To reproduce: 1. AllowTooManyOverride: Don't allow. 2. Add a circulation rule for one library, one patron category and one item type with Current checkouts allowed = 1. 3. Check out one item of that type to a patron of that category at that library, then a second one. 4. The refusal's rule box says All item types / All patron categories / All libraries. Reproduced on Koha 26.05.02; the same code is on main. -- 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=44029 --- Comment #1 from babar junaid <babarjunaid1122@gmail.com> --- Created attachment 210876 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210876&action=edit Bug 44029: Return the TOO_MANY circulation rule with the blocker Bug 44029: Return the TOO_MANY circulation rule with the blocker When AllowTooManyOverride is off, CanBookBeIssued put TOO_MANY in issuingimpossible but the rule that set the limit in needsconfirmation. A refused checkout never passes needsconfirmation to the template, so "Maximum checkouts calculated from the circulation rule for" always said All item types / All patron categories / All libraries. Test plan: 1. Set AllowTooManyOverride to "Don't allow". 2. Add a circulation rule for one library, one patron category and one item type with "Current checkouts allowed" = 1. 3. At that library, check out one item of that type to a patron of that category, then try a second one. 4. The refusal's rule box says All item types / All patron categories / All libraries. 5. Apply the patch, restart Plack, repeat 3. 6. The box names the item type, category and library of your rule. 7. Set AllowTooManyOverride to "Allow" and repeat: the override prompt still shows the same rule. 8. prove t/db_dependent/Circulation/TooMany.t Sponsored-by: Koha Solutions -- 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=44029 babar junaid <babarjunaid1122@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Assignee|koha-bugs@lists.koha-commun |babarjunaid1122@gmail.com |ity.org | -- 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=44029 Michael Mundet <michael.mundet@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #210876|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=44029 --- Comment #2 from Michael Mundet <michael.mundet@gmail.com> --- Created attachment 211945 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211945&action=edit Bug 44029: Return the TOO_MANY circulation rule with the blocker When AllowTooManyOverride is off, CanBookBeIssued put TOO_MANY in issuingimpossible but the rule that set the limit in needsconfirmation. A refused checkout never passes needsconfirmation to the template, so "Maximum checkouts calculated from the circulation rule for" always said All item types / All patron categories / All libraries. Test plan: 1. Set AllowTooManyOverride to "Don't allow". 2. Add a circulation rule for one library, one patron category and one item type with "Current checkouts allowed" = 1. 3. At that library, check out one item of that type to a patron of that category, then try a second one. 4. The refusal's rule box says All item types / All patron categories / All libraries. 5. Apply the patch, restart Plack, repeat 3. 6. The box names the item type, category and library of your rule. 7. Set AllowTooManyOverride to "Allow" and repeat: the override prompt still shows the same rule. 8. prove t/db_dependent/Circulation/TooMany.t Sponsored-by: Koha Solutions Signed-off-by: Michael Mundet <michael.mundet@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44029 Michael Mundet <michael.mundet@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off --- Comment #3 from Michael Mundet <michael.mundet@gmail.com> --- Signed off using a sandbox -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44029 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |Laura.escamilla@bywatersolu |y.org |tions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44029 Laura Escamilla <Laura.escamilla@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA --- Comment #4 from Laura Escamilla <Laura.escamilla@bywatersolutions.com> --- The patch passes the static QA checks, but t/db_dependent/Circulation/TooMany.t fails when running qa. The failure occurs in the new subtest "CanBookBeIssued returns the TOO_MANY circulation rule with the blocker". At line 1253, the test expects TOO_MANY_CHECKOUTS, but receives undef: Failed test 'Checkout is refused' at t/db_dependent/Circulation/TooMany.t line 1253. got: undef expected: 'TOO_MANY_CHECKOUTS' The test then exits at line 1256 with: Can't call method "branchcode" on an undefined value I ran updatedatabase and restart_all, then reran qa, but the same failures occurred. Could you please take a look? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44029 --- Comment #5 from babar junaid <babarjunaid1122@gmail.com> --- Created attachment 212470 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212470&action=edit Bug 44029: (follow-up) Do not depend on the previous subtest's settings Bug 44029: (follow-up) Do not depend on the previous subtest's settings The new subtest ran after "HomeOrHoldingBranch is used", which leaves CircControl = ItemHomeLibrary, HomeOrHoldingBranch = holdingbranch and the userenv at another library. The first checkout then moved the item's holding library away, it no longer counted against the rule's library, and CanBookBeIssued returned no TOO_MANY. The subtest now sets CircControl and the userenv itself. Test plan: 1. prove t/db_dependent/Circulation/TooMany.t All tests pass. 2. Revert only the C4/Circulation.pm change: the subtest fails. Sponsored-by: Koha Solutions -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44029 --- Comment #6 from babar junaid <babarjunaid1122@gmail.com> --- Thanks for catching this, Laura. The fix itself was fine; the new subtest was not. It ran after "HomeOrHoldingBranch is used", which leaves CircControl = ItemHomeLibrary, HomeOrHoldingBranch = holdingbranch and the userenv at another library. The first checkout in my subtest then moved the item's holding library to that other library, so it no longer counted against the rule's library, and CanBookBeIssued returned no TOO_MANY. I wrote the test against 26.05, where that subtest is not in TooMany.t, so I missed it. The follow-up makes the subtest set CircControl and the userenv itself. Checked on main (c8e8025): - prove t/db_dependent/Circulation/TooMany.t: all 13 pass - with only the C4/Circulation.pm change reverted, the new subtest fails - koha-qa -c 2: PASS The follow-up changes only the test, so I've set it 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=44029 babar junaid <babarjunaid1122@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org