Bug 24101

Summary: Due date to on-site loans according to the calendar and possibility to renew on-site loans
Product: Koha Reporter: Inkeri Hakulinen <inkeri.hakulinen+bugz>
Component: CirculationAssignee: Lari Taskula <lari.taskula>
Status: ASSIGNED --- QA Contact: Testopia <testopia>
Severity: new feature    
Priority: P5 - low CC: gmcharlt, joonas.kylmala, kyle.m.hall, lari.taskula, magnus, michael.hafen, severine.queune
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: Sponsored Patch complexity: Medium patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 26814    
Bug Blocks:    
Attachments: Bug 24101: Enable renewals for on-site checkouts
Bug 24101: (OLD CIRC RULES GUI) Add circulation rule onsite_renewalsallowed
Bug 24101: Enable renewals for on-site checkouts
Bug 24101: Enable renewals for on-site checkouts
Bug 24101: Enable renewals for on-site checkouts
Bug 24101: Calculate on-site checkouts due date via circulation rules

Description Inkeri Hakulinen 2019-11-25 08:48:35 UTC
We have reading rooms, where patrons can have their on-site loans available for them for a long time - even a year or more! (That is, if no one else needs that item in the meanwhile, and makes a hold for it.) We wish to be able to distinguish the on-site loans from the checkouts they take home. The on-site option is good for this, because it shows clearly to the patrons and to the staff that the loans are on-site. However, we need two improvements to Koha for this.

First, we need the option to set the due date automatically according to the calendar and the circulation rules, taking into account the holidays and the loan period that is set to the patron and to the item.

In addition, we need the option for the patrons to be able to renew their on-site loans, too. Now the on-site loans are non-renewable, so if the patron needs them longer than what is set to due date originally, it would be good for them to be able to renew the loans themselves through our OPAC. Now the renewal is impossible altogether.
Comment 1 Lari Taskula 2020-03-30 17:38:23 UTC Comment hidden (obsolete)
Comment 2 Lari Taskula 2020-03-30 17:40:30 UTC Comment hidden (obsolete)
Comment 3 Lari Taskula 2020-04-01 07:36:43 UTC
Initially I was thinking of duplicating the rules of normal
circulation the way maxissueqty and maxonsiteissueqty is currently
done, but in the end this would lead to duplicating almost all of the
circulation rules. That would not be very convenient and it seems like
a short-sighted way of solving this problem because it leaves no room
for possible new types of checkouts in the future. Who wants to see the circulation rule table doubling in width? Not me.

Another, more elegant approach would be to define a new circulation
rule scope "circulationtype" that defines whether a rule applies to
normal or on-site checkout (or any other type of checkout someone may
come up with in the future). Now that we are able to explicitly define
a scope that a specific circulation rule follows, this would make
sense. No need for ugly duplication and we can get rid of
maxonsiteissueqty too.
Comment 4 Lari Taskula 2020-04-01 07:39:10 UTC
In addition to Inkeri's original comment - there needs to be a way to define separate rules regarding fines between normal and on-site checkouts.
Comment 5 Michael Hafen 2020-04-01 16:54:58 UTC
(In reply to Inkeri Hakulinen from comment #0)
> We have reading rooms, where patrons can have their on-site loans available
> for them for a long time - even a year or more! (That is, if no one else
> needs that item in the meanwhile, and makes a hold for it.) We wish to be
> able to distinguish the on-site loans from the checkouts they take home. The
> on-site option is good for this, because it shows clearly to the patrons and
> to the staff that the loans are on-site. However, we need two improvements
> to Koha for this.
> 

How are item types handled between on-site and take home?  Is the item type ignored in favor of a check-box on the check-out screen?

If item type is factored into this, would setting the rules by item type be a solution?  Though that would increase the row count in the issue rules table.  In that case having the "All" circulation type would make sense, but in practice I expect the take home and on-site circulation rules rarely are the same.
Comment 6 Lari Taskula 2020-04-20 10:05:36 UTC Comment hidden (obsolete)
Comment 7 Lari Taskula 2020-04-21 09:51:27 UTC
Created attachment 103337 [details] [review]
Bug 24101: Enable renewals for on-site checkouts

To test:
1. Enable system preference OnSiteCheckouts
2. Set renewalsallowed circulation rule for on-site checkouts via
   circulation rules interface to value 0
3. Perform an on-site checkout
4. Try to renew the loan
5. Observe a similar error dialog:
"Cannot renew on-site checkout:

test / ( test ) has been renewed the maximum number of times by ( admin )"

6. Set renewalsallowed circulation rule for on-site checkouts via
   circulation rules interface to value 0
7. Perform an on-site checkout
8. Try to renew the loan
9. Observe success

Run unit tests:
1. prove t/db_dependent/Circulation.t
Comment 8 Lari Taskula 2020-05-04 12:59:00 UTC
Created attachment 104277 [details] [review]
Bug 24101: Enable renewals for on-site checkouts

To test:
1. Enable system preference OnSiteCheckouts
2. Set renewalsallowed circulation rule for on-site checkouts via
   circulation rules interface to value 0
3. Perform an on-site checkout
4. Try to renew the loan
5. Observe a similar error dialog:
"Cannot renew on-site checkout:

test / ( test ) has been renewed the maximum number of times by ( admin )"

6. Set renewalsallowed circulation rule for on-site checkouts via
   circulation rules interface to value 0
7. Perform an on-site checkout
8. Try to renew the loan
9. Observe success

Run unit tests:
1. prove t/db_dependent/Circulation.t
Comment 9 Lari Taskula 2020-07-31 01:34:27 UTC
Created attachment 107617 [details] [review]
Bug 24101: Calculate on-site checkouts due date via circulation rules

To test:
1. Set circulation rules to both normal and on-site checkouts, define loan
   period explicitly and make it different for both types of checkouts
2. Checkout two items, one as normal checkout and one as an on-site checkout
3. Observe they follow your circulation rules
Comment 10 Magnus Enger 2022-05-04 13:08:14 UTC
Should this be "Needs signoff"?
Comment 11 Katrin Fischer 2022-07-16 18:51:35 UTC
At the moment these patches don't apply:

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 24101: Enable renewals for on-site checkouts
error: sha1 information is lacking or useless (C4/Circulation.pm).
error: could not build fake ancestor
Patch failed at 0001 Bug 24101: Enable renewals for on-site checkouts
hint: Use 'git am --show-current-patch=diff' to see the failed patch
When you have resolved this problem run "git bz apply --continue".
If you would prefer to skip this patch, instead run "git bz apply --skip".
To restore the original branch and stop patching run "git bz apply --abort".
Patch left in /tmp/Bug-24101-Enable-renewals-for-on-site-checkouts-OjwApl.patch

Lari, do you plan to continue here or should we switch to NEW?