https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27834

--- Comment #6 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 186653
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186653&action=edit
Bug 27834: Fix CircControl behavior in TooMany function

This patch fixes the TooMany function in C4::Circulation to separate
circulation rule selection from checkout counting behavior, addressing
the mismatch between CircControl's documented purpose and actual behavior.

Previously, CircControl incorrectly controlled both:
1. Which circulation rules to apply (intended behavior)
2. How checkout limits are calculated (unintended side effect)

This caused inconsistent behavior where checkout limits would change
based on the user's location or item's library, even when the same
circulation rules applied.

This patch:
- Maintains CircControl's intended purpose (rule selection only)
- Uses the new CheckoutLimitScope preference to control checkout counting
- Preserves backward compatibility with existing behavior

Test plan:
1. Apply patches and restart services
2. Run: perl installer/data/mysql/updatedatabase.pl
3. Verify the new CheckoutLimitScope preference exists in system preferences

4. Set up test environment:
   - Create two branches (Branch1, Branch2)
   - Create a patron category and item type
   - Create a patron in Branch1
   - Create items from both branches
   - Set circulation rules:
     * Branch1: maxissueqty = 1 for the itemtype/category
     * Branch2: maxissueqty = 1 for the itemtype/category

5. Test PickupLibrary with branch_specific scope (default):
   a. Set CircControl = PickupLibrary
   b. Set CheckoutLimitScope = branch_specific
   c. Login as staff from Branch1, issue item from Branch1 to patron
   d. Try to checkout another item from Branch1 → should be blocked (limit
reached)
   e. Login as staff from Branch2, try to checkout item from Branch2 to same
patron
   f. Expected: Checkout allowed (no checkouts from Branch2 pickup location)

6. Test PickupLibrary with all scope:
   a. Keep CircControl = PickupLibrary
   b. Set CheckoutLimitScope = all
   c. From Branch2, try to checkout item to same patron
   d. Expected: Checkout blocked (patron already has 1 checkout total)

7. Test ItemHomeLibrary with branch_specific scope:
   a. Set CircControl = ItemHomeLibrary
   b. Set CheckoutLimitScope = branch_specific
   c. Reset patron (return all items)
   d. Checkout item from Branch1 to patron
   e. Try to checkout another item from Branch1 → should be blocked
   f. Try to checkout item from Branch2 → should be allowed
   g. Expected: Only items from same home library count toward limit

8. Test ItemHomeLibrary with all scope:
   a. Keep CircControl = ItemHomeLibrary
   b. Set CheckoutLimitScope = all
   c. Try to checkout item from Branch2 to same patron
   d. Expected: Checkout blocked (patron already has 1 checkout total)

9. Test PatronLibrary behavior unchanged:
   a. Set CircControl = PatronLibrary
   b. CheckoutLimitScope should be ignored
   c. Expected: Always counts all patron checkouts regardless of preference

10. Run tests:
    prove t/db_dependent/Circulation/TooMany.t

11. Test with patron-level limits:
    - Set up patron_maxissueqty limits at branch level
    - Verify same behavior patterns apply for patron-level limits
    - Test both CheckoutLimitScope settings

12. Verify existing functionality:
    - Test on-site checkouts still work correctly
    - Test item type hierarchies still work
    - Test unlimited ("") limits still work
    - Run broader circulation tests: prove t/db_dependent/Circulation/

Sponsored-by: University of the Arts London

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to