Bug 27435 - Patron suspensions calculated differently when items are returned through patron Details tab
Summary: Patron suspensions calculated differently when items are returned through pat...
Status: RESOLVED DUPLICATE of bug 26208
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on: 11703
Blocks:
  Show dependency treegraph
 
Reported: 2021-01-14 15:35 UTC by Holly
Modified: 2021-01-18 14:58 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Holly 2021-01-14 15:35:56 UTC
Suspension dates for patrons are different depending on where overdue items are checked in, i.e Details tab on the patron account vs. under Circulation, Checkin.

Example:

Circulation rules for items a + b
Suspension in days (day) = 2
Max suspension duration (day) = 10
Suspension charging interval = 1
Fine grace period = 1

Circulation rules for item c
Suspension in days (day) = 1
Max suspension duration (day) = 10
Suspension charging interval = 1
Fine grace period = 1


System preference CumulativeRestrictionPeriods set to "Cumulate".


3 items are overdue, all with the due date 06/01/21. They are all checked in, via Circulation, Checkin on 08/01/21.


The ‘debarred until’ date increases as each individual item is checked in.  The final restriction date of 15/01/21.


Same three items, under the same conditions are checked in via the Circulation table on the Details tab of the patron account and restriction date is set to 14/01/21.

This could relate to bug 3514
Comment 1 Jonathan Druart 2021-01-15 10:54:58 UTC
I don't recreate on master.
Comment 2 Jonathan Druart 2021-01-15 10:55:49 UTC
If you are able to recreate the problem on a sandbox let me know the different steps to reproduce the issue and I will have a look.
Comment 3 Holly 2021-01-15 16:40:00 UTC
I recreated this on master. 

I checked out three items to a patron in the "Patron" category. 

Two of these items were item type "Books".

One of these items was item type "Visual Materials".

The circulation rules for "Patron" and "Books" were:

Fine grace period: 1

Suspensions in days: 2

Max. suspension duration: 10 

Suspension charging interval: 1


The circulation rules for "Patron" and "Visual Materials" were:

Fine grace period: 1

Suspensions in days: 1

Max. suspension duration: 10 

Suspension charging interval: 1

The system preference CumulativeRestrictionPeriods was set to "Cumulate".



When I checked the three items out on 15/01/21, I backdated the due date on the three items to 13/01/21.

When I checked the items in together, all at once on the Patron Details page, the patron was suspended until 01/19/2021.

I then checked the items out again and backdated them to be due on 13/01/21 again.

When I checked the items back in, one at a time, under Circulation, Checkin the patron was suspended until 01/20/2021.
Comment 4 Jonathan Druart 2021-01-18 12:59:02 UTC
Right, I think I recreate it now.

If I am understanding correctly what's going on we have a race condition.

For instance if the 3rd checkin happens when the 1st (or 2nd) is not completed yet then it will create an other restriction, instead of cumulating over the 2 other restrictions as it should.
Comment 5 Jonathan Druart 2021-01-18 13:52:16 UTC
The following change may fix the problem.

diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js
index b5347c0bae..284b86c0ca 100644
--- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js
+++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js
@@ -128,7 +128,9 @@ $(document).ready(function() {

                 $(id).replaceWith( content );
             }, "json")
+            $.ajaxSetup({async: true});
         });
Comment 6 Jonathan Druart 2021-01-18 14:37:45 UTC
Should be fixed by bug 26208, can you test it please?

*** This bug has been marked as a duplicate of bug 26208 ***
Comment 7 Holly 2021-01-18 14:58:19 UTC
Testing confirms that the fix in bug 26208 resolves this issue. 

Thanks so much Jonathan.