Bug 33887 - Automatic checkin should be able to optionally fill the next hold with the returned item
Summary: Automatic checkin should be able to optionally fill the next hold with the re...
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Sam Lau
QA Contact: Katrin Fischer
URL:
Keywords:
Depends on: 23207
Blocks:
  Show dependency treegraph
 
Reported: 2023-06-02 13:42 UTC by Kyle M Hall (khall)
Modified: 2024-07-22 19:32 UTC (History)
9 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact: Caroline Cyr La Rose
Documentation submission: https://gitlab.com/koha-community/koha-manual/-/merge_requests/921
Text to go in the release notes:
This enhancement adds an option for automatic checkins, so that for any holds, it automatically fills the next hold and sends a notification to the patron that a hold is waiting. This option is set using the new system preference `AutomaticCheckinAutoFill`.
Version(s) released in:
23.11.00
Circulation function:


Attachments
Bug 33887: Add the ability to optionally fill the next hold when an item is automatically checked in. (6.20 KB, patch)
2023-06-12 18:04 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 33887: Add the ability to optionally fill the next hold when an item is automatically checked in. (6.20 KB, patch)
2023-06-12 18:05 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 33887: Add the ability to optionally fill the next hold when an item is automatically checked in. (7.30 KB, patch)
2023-06-15 15:03 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 33887: Unit tests (2.98 KB, patch)
2023-06-15 15:37 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 33887: Unit tests (3.90 KB, patch)
2023-06-15 18:34 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 33887: Add the ability to optionally fill the next hold when an item is automatically checked in. (7.05 KB, patch)
2023-06-15 18:34 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 33887: Add the ability to optionally fill the next hold when an item is automatically checked in. (7.06 KB, patch)
2023-06-20 18:25 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 33887: Unit tests (3.95 KB, patch)
2023-08-27 18:27 UTC, David Nind
Details | Diff | Splinter Review
Bug 33887: Add the ability to optionally fill the next hold when an item is automatically checked in. (7.11 KB, patch)
2023-08-27 18:27 UTC, David Nind
Details | Diff | Splinter Review
Bug 33887: (follow-up) Update the system preference description (1.55 KB, patch)
2023-08-27 18:28 UTC, David Nind
Details | Diff | Splinter Review
Bug 33887: Unit tests (4.00 KB, patch)
2023-10-21 09:07 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 33887: Add the ability to optionally fill the next hold when an item is automatically checked in. (7.16 KB, patch)
2023-10-21 09:07 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 33887: (follow-up) Update the system preference description (1.61 KB, patch)
2023-10-21 09:07 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 33887: (QA follow-up) Perltidy and fix some formatting issues (8.74 KB, patch)
2023-10-21 09:07 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Kyle M Hall (khall) 2023-06-02 13:42:44 UTC
When an item is automatically checked in, Koha should be able to trap that item for the next patron and send a notification to that patron that a hold is waiting for them.
Comment 1 Sam Lau 2023-06-12 18:04:26 UTC
Created attachment 152279 [details] [review]
Bug 33887: Add the ability to optionally fill the next hold when an item is automatically checked in.

When an item is automatically checked in, Koha should be able to trap that item for the next patron and send a notification to that patron that a hold is waiting for them.
Comment 2 Sam Lau 2023-06-12 18:05:23 UTC
Created attachment 152280 [details] [review]
Bug 33887: Add the ability to optionally fill the next hold when an item is automatically checked in.

When an item is automatically checked in, Koha should be able to trap that item for the next patron and send a notification to that patron that a hold is waiting for them.
Comment 3 Sam Lau 2023-06-12 18:08:38 UTC
work in progress
Comment 4 Sam Lau 2023-06-15 15:03:37 UTC
Created attachment 152385 [details] [review]
Bug 33887: Add the ability to optionally fill the next hold when an item is automatically checked in.

When an item is automatically checked in, Koha should be able to trap that item for the next patron and send a notification to that patron that a hold is waiting for them.

To test:
1. Apply patches
2. restart_all and updatedatabase
3. Go to administration -> item types and edit an item type
4. Make sure the checkbox that is labeled ‘Automatic checkin:’ is checked. At the bottom of the page click save changes.
5. In Administration -> system preferences, search for ‘AutomaticCheckinAutoFill’ and set it to ‘Do’.
6. Check out an item to a patron and make it overdue (.ie set due date to yesterday). Also make sure that the item type you are checking out matches the item type edited in step 4.
7. Place a hold on the item. Make the pickup location the same as the library it is checked out from.
8. Run cronjob at misc/cronjobs/automatic_checkin.pl
9. On the item details page, notice that the item was checked in and now the hold is waiting for pickup.
10. Visit the patron’s page who placed the hold.
11. Click on the notices tab and see that there is a ‘Hold available for pickup’ notice.
12. Repeat steps 6-8, but this time make the hold pickup location different than the library the item is currently checked out to.
13. Notice that this time, the item was checked in, the hold is waiting, and the item is in transit to the other library.
14. If you visit the patron’s page, this time there should be no new notice because the item is still in transit.
15. Sign-Off :)
Comment 5 Nick Clemens (kidclamp) 2023-06-15 15:37:35 UTC
Created attachment 152388 [details] [review]
Bug 33887: Unit tests

prove -v t/db_dependent/Koha/Checkouts.t
Comment 6 Sam Lau 2023-06-15 18:34:21 UTC
Created attachment 152391 [details] [review]
Bug 33887: Unit tests

prove -v t/db_dependent/Koha/Checkouts.t
Comment 7 Sam Lau 2023-06-15 18:34:23 UTC
Created attachment 152392 [details] [review]
Bug 33887: Add the ability to optionally fill the next hold when an item is automatically checked in.

When an item is automatically checked in, Koha should be able to trap that item for the next patron and send a notification to that patron that a hold is waiting for them.

To test:
1. Apply patches
2. restart_all and updatedatabase
3. Go to administration -> item types and edit an item type
4. Make sure the checkbox that is labeled ‘Automatic checkin:’ is checked. At the bottom of the page click save changes.
5. In Administration -> system preferences, search for ‘AutomaticCheckinAutoFill’ and set it to ‘Do’.
6. Check out an item to a patron and make it overdue (.ie set due date to yesterday). Also make sure that the item type you are checking out matches the item type edited in step 4.
7. Place a hold on the item. Make the pickup location the same as the library it is checked out from.
8. Run cronjob at misc/cronjobs/automatic_checkin.pl
9. On the item details page, notice that the item was checked in and now the hold is waiting for pickup.
10. Visit the patron’s page who placed the hold.
11. Click on the notices tab and see that there is a ‘Hold available for pickup’ notice.
12. Repeat steps 6-8, but this time make the hold pickup location different than the library the item is currently checked out to.
13. Notice that this time, the item was checked in, the hold is waiting, and the item is in transit to the other library.
14. If you visit the patron’s page, this time there should be no new notice because the item is still in transit.
15. Sign-Off :)
Comment 8 David Nind 2023-06-16 00:44:00 UTC
Hi Sam.

I've Failed QA as there is an error with the database update. This is the message I get:

kohadev-koha@kohadevbox:koha(bz33887)$ updatedatabase
DEV atomic update /kohadevbox/koha/installer/data/mysql/atomicupdate/bug_33887.pl  [21:35:55]: Bug 33887 - Automatically fill the next hold with a automatic check in.
ERROR - {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1 at /kohadevbox/koha/C4/Installer.pm line 741

This is because there is a missing closing bracket in the do statement: ...., 'YesNo'}); - this should be ...., 'YesNo') });

I manually fixed this and followed through the test plan - everything works as per the test plan. So happy to sign it off once that is fixed.

Some other feedback:

- For the AutomaticCheckinAutoFill system preference:
  . Make the dropdown options Don't allow/Allow: "we" spent a bit of time on a previous release making these more consistent across all system preferences.
  . I think for the note, that it should start with "This system preference", instead of "These system preferences".

- Item type description:
  . I think the label should be "Automatic check-in", as it is a noun (I think). See the terminology guidelines https://wiki.koha-community.org/wiki/Terminology#C
  . Also, if this requires the AutomaticCheckinAutoFill to work, then I think we should include that in the guidance, including linking to the system preference. For example:
    If checked, items are automatically checked in once they've reached their due date. This requires setting the AutomaticCheckinAutoFill system preference and scheduling the running of the misc/cronjobs/automatic_checkin.pl cronjob.

Also, thank you for the awesome work on all the sign-offs that you have been doing!

David
Comment 9 Sam Lau 2023-06-20 18:25:28 UTC
Created attachment 152494 [details] [review]
Bug 33887: Add the ability to optionally fill the next hold when an item is automatically checked in.

When an item is automatically checked in, Koha should be able to trap that item for the next patron and send a notification to that patron that a hold is waiting for them.

To test:
1. Apply patches
2. restart_all and updatedatabase
3. Go to administration -> item types and edit an item type
4. Make sure the checkbox that is labeled ‘Automatic checkin:’ is checked. At the bottom of the page click save changes.
5. In Administration -> system preferences, search for ‘AutomaticCheckinAutoFill’ and set it to ‘Do’.
6. Check out an item to a patron and make it overdue (.ie set due date to yesterday). Also make sure that the item type you are checking out matches the item type edited in step 4.
7. Place a hold on the item. Make the pickup location the same as the library it is checked out from.
8. Run cronjob at misc/cronjobs/automatic_checkin.pl
9. On the item details page, notice that the item was checked in and now the hold is waiting for pickup.
10. Visit the patron’s page who placed the hold.
11. Click on the notices tab and see that there is a ‘Hold available for pickup’ notice.
12. Repeat steps 6-8, but this time make the hold pickup location different than the library the item is currently checked out to.
13. Notice that this time, the item was checked in, the hold is waiting, and the item is in transit to the other library.
14. If you visit the patron’s page, this time there should be no new notice because the item is still in transit.
15. Sign-Off :)
Comment 10 Sam Lau 2023-06-20 18:43:42 UTC
(In reply to David Nind from comment #8)

Hi David, thanks for taking the time to test my patch! I fixed the closing bracket issue and also changed the system preference to 'Don't Allow/Allow' as requested. 

> - Item type description:
>   . I think the label should be "Automatic check-in", as it is a noun (I
> think). See the terminology guidelines
> https://wiki.koha-community.org/wiki/Terminology#C
>   . Also, if this requires the AutomaticCheckinAutoFill to work, then I
> think we should include that in the guidance, including linking to the
> system preference. For example:
>     If checked, items are automatically checked in once they've reached
> their due date. This requires setting the AutomaticCheckinAutoFill system
> preference and scheduling the running of the
> misc/cronjobs/automatic_checkin.pl cronjob.

These comments seem to be regarding the initial automatic check-in feature and it would be best to file them as a separate bug. I will file this bug very soon. 

>   . Also, if this requires the AutomaticCheckinAutoFill to work, then I
> think we should include that in the guidance, including linking to the
> system preference. 
Just for some more clarification on this feature: AutomaticCheckinAutoFill isn't required in order for automatic check-in to occur, it just adds another part to it where if there is a hold on the item being automatically checked in, the hold is moved into the next state.

Once again, thanks for taking the time to test, and let me know if any more changes need to be made!
- Sam
Comment 11 Sam Lau 2023-06-20 19:41:52 UTC
I just filed bug 34071 which addresses the hyphen issue.
Comment 12 David Nind 2023-08-27 18:27:56 UTC
Created attachment 154862 [details] [review]
Bug 33887: Unit tests

prove -v t/db_dependent/Koha/Checkouts.t

Signed-off-by: David Nind <david@davidnind.com>
Comment 13 David Nind 2023-08-27 18:27:59 UTC
Created attachment 154863 [details] [review]
Bug 33887: Add the ability to optionally fill the next hold when an item is automatically checked in.

When an item is automatically checked in, Koha should be able to trap that item for the next patron and send a notification to that patron that a hold is waiting for them.

To test:
1. Apply patches
2. restart_all and updatedatabase
3. Go to administration -> item types and edit an item type
4. Make sure the checkbox that is labeled ‘Automatic checkin:’ is checked. At the bottom of the page click save changes.
5. In Administration -> system preferences, search for ‘AutomaticCheckinAutoFill’ and set it to ‘Do’.
6. Check out an item to a patron and make it overdue (.ie set due date to yesterday). Also make sure that the item type you are checking out matches the item type edited in step 4.
7. Place a hold on the item. Make the pickup location the same as the library it is checked out from.
8. Run cronjob at misc/cronjobs/automatic_checkin.pl
9. On the item details page, notice that the item was checked in and now the hold is waiting for pickup.
10. Visit the patron’s page who placed the hold.
11. Click on the notices tab and see that there is a ‘Hold available for pickup’ notice.
12. Repeat steps 6-8, but this time make the hold pickup location different than the library the item is currently checked out to.
13. Notice that this time, the item was checked in, the hold is waiting, and the item is in transit to the other library.
14. If you visit the patron’s page, this time there should be no new notice because the item is still in transit.
15. Sign-Off :)

Signed-off-by: David Nind <david@davidnind.com>
Comment 14 David Nind 2023-08-27 18:28:02 UTC
Created attachment 154864 [details] [review]
Bug 33887: (follow-up) Update the system preference description

Remove duplicate word, use singular for the note text.

Signed-off-by: David Nind <david@davidnind.com>
Comment 15 Katrin Fischer 2023-10-21 09:07:51 UTC
Created attachment 157594 [details] [review]
Bug 33887: Unit tests

prove -v t/db_dependent/Koha/Checkouts.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 16 Katrin Fischer 2023-10-21 09:07:54 UTC
Created attachment 157595 [details] [review]
Bug 33887: Add the ability to optionally fill the next hold when an item is automatically checked in.

When an item is automatically checked in, Koha should be able to trap that item for the next patron and send a notification to that patron that a hold is waiting for them.

To test:
1. Apply patches
2. restart_all and updatedatabase
3. Go to administration -> item types and edit an item type
4. Make sure the checkbox that is labeled ‘Automatic checkin:’ is checked. At the bottom of the page click save changes.
5. In Administration -> system preferences, search for ‘AutomaticCheckinAutoFill’ and set it to ‘Do’.
6. Check out an item to a patron and make it overdue (.ie set due date to yesterday). Also make sure that the item type you are checking out matches the item type edited in step 4.
7. Place a hold on the item. Make the pickup location the same as the library it is checked out from.
8. Run cronjob at misc/cronjobs/automatic_checkin.pl
9. On the item details page, notice that the item was checked in and now the hold is waiting for pickup.
10. Visit the patron’s page who placed the hold.
11. Click on the notices tab and see that there is a ‘Hold available for pickup’ notice.
12. Repeat steps 6-8, but this time make the hold pickup location different than the library the item is currently checked out to.
13. Notice that this time, the item was checked in, the hold is waiting, and the item is in transit to the other library.
14. If you visit the patron’s page, this time there should be no new notice because the item is still in transit.
15. Sign-Off :)

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 17 Katrin Fischer 2023-10-21 09:07:56 UTC
Created attachment 157596 [details] [review]
Bug 33887: (follow-up) Update the system preference description

Remove duplicate word, use singular for the note text.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 18 Katrin Fischer 2023-10-21 09:07:59 UTC
Created attachment 157597 [details] [review]
Bug 33887: (QA follow-up) Perltidy and fix some formatting issues

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 19 Tomás Cohen Arazi (tcohen) 2023-10-25 14:49:01 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 20 Fridolin Somers 2023-10-26 08:38:14 UTC
Enhancement not pushed to 23.05.x