Bug 32256 - Self checkout batch mode
Summary: Self checkout batch mode
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Self checkout (show other bugs)
Version: Main
Hardware: All All
: P5 - low new feature
Assignee: Aleisha Amohia
QA Contact: Martin Renvoize (ashimema)
URL:
Keywords:
Depends on: 36349
Blocks: 36718 37525 38174
  Show dependency treegraph
 
Reported: 2022-11-17 18:30 UTC by davedaghita
Modified: 2024-10-15 13:24 UTC (History)
13 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: ---
Documentation contact: Caroline Cyr La Rose
Documentation submission: https://gitlab.com/koha-community/koha-manual/-/merge_requests/969
Text to go in the release notes:
This new feature allows more than one item to be scanned and processed at once in Koha's self-checkout module. This feature uses the existing BatchCheckouts and BatchCheckoutsValidCategories system preferences to determine if batch checkouts should be allowed. NOTE: The items in the batch are handled one-by-one, so if any item in the batch requires confirmation (for example, to be renewed or returned) or is impossible to check out, the process will stop at that item. Any items earlier in the list will be processed, but any items coming after in the list will be ignored.
Version(s) released in:
24.05.00
Circulation function:


Attachments
Bug 32256: WIP (7.10 KB, patch)
2023-08-28 04:58 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 32256: Enable batch checkout using self-checkout (11.04 KB, patch)
2023-08-29 03:09 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 32256: Enable batch checkout using self-checkout (11.07 KB, patch)
2023-11-07 02:40 UTC, David Nind
Details | Diff | Splinter Review
Bug 32256: Add message to SCO that batch checkouts works for checkouts only (1.56 KB, patch)
2023-11-07 03:19 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 32256: Enable batch checkout using self-checkout (11.25 KB, patch)
2024-03-26 01:45 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 32256: Add message to SCO that batch checkouts works for checkouts only (1.56 KB, patch)
2024-03-26 01:45 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 32256: Enable batch checkout using self-checkout (11.25 KB, patch)
2024-04-10 01:00 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 32256: Add message to SCO that batch checkouts works for checkouts only (1.56 KB, patch)
2024-04-10 01:00 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 32256: (follow-up) Use correct patron category (1.73 KB, patch)
2024-04-10 01:00 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 32256: (follow-up) Use correct patron category (1.73 KB, patch)
2024-04-10 20:49 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 32256: Enable batch checkout using self-checkout (11.30 KB, patch)
2024-04-10 21:10 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 32256: Add message to SCO that batch checkouts works for checkouts only (1.62 KB, patch)
2024-04-10 21:10 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 32256: (follow-up) Use correct patron category (1.78 KB, patch)
2024-04-10 21:10 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 32256: Display barcodes not checked out in batch (3.25 KB, patch)
2024-04-15 00:57 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 32256: Handle batch error messages better (20.43 KB, patch)
2024-04-29 04:41 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 32256: Enable batch checkout using self-checkout (11.30 KB, patch)
2024-04-29 16:53 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 32256: Add message to SCO that batch checkouts works for checkouts only (1.62 KB, patch)
2024-04-29 16:53 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 32256: (follow-up) Use correct patron category (1.78 KB, patch)
2024-04-29 16:53 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 32256: Display barcodes not checked out in batch (3.31 KB, patch)
2024-04-29 16:53 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 32256: Handle batch error messages better (20.48 KB, patch)
2024-04-29 16:53 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 32256: Enable batch checkout using self-checkout (11.37 KB, patch)
2024-05-01 14:21 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 32256: Add message to SCO that batch checkouts works for checkouts only (1.68 KB, patch)
2024-05-01 14:21 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 32256: (follow-up) Use correct patron category (1.85 KB, patch)
2024-05-01 14:21 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 32256: Display barcodes not checked out in batch (3.38 KB, patch)
2024-05-01 14:21 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 32256: Handle batch error messages better (20.55 KB, patch)
2024-05-01 14:21 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 32256: (QA follow-up) Tidy sco-main.pl (23.53 KB, patch)
2024-05-01 14:21 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 32256: Use a new SCOBatchCheckoutsValidCategories syspref (4.38 KB, patch)
2024-05-06 03:43 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 32256: Enable batch checkout using self-checkout (11.43 KB, patch)
2024-05-06 13:46 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 32256: Add message to SCO that batch checkouts works for checkouts only (1.74 KB, patch)
2024-05-06 13:46 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 32256: (follow-up) Use correct patron category (1.91 KB, patch)
2024-05-06 13:46 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 32256: Display barcodes not checked out in batch (3.43 KB, patch)
2024-05-06 13:46 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 32256: Handle batch error messages better (20.61 KB, patch)
2024-05-06 13:46 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 32256: (QA follow-up) Tidy sco-main.pl (23.59 KB, patch)
2024-05-06 13:46 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 32256: Use a new SCOBatchCheckoutsValidCategories syspref (4.43 KB, patch)
2024-05-06 13:46 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 32256: Enable batch checkout using self-checkout (11.49 KB, patch)
2024-05-07 17:52 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 32256: Add message to SCO that batch checkouts works for checkouts only (1.81 KB, patch)
2024-05-07 17:52 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 32256: (follow-up) Use correct patron category (1.97 KB, patch)
2024-05-07 17:52 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 32256: Display barcodes not checked out in batch (3.50 KB, patch)
2024-05-07 17:52 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 32256: Handle batch error messages better (20.67 KB, patch)
2024-05-07 17:53 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 32256: (QA follow-up) Tidy sco-main.pl (23.66 KB, patch)
2024-05-07 17:53 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 32256: Use a new SCOBatchCheckoutsValidCategories syspref (4.50 KB, patch)
2024-05-07 17:53 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description davedaghita 2022-11-17 18:30:01 UTC
Please enable batch checkouts on self-checkout machines using koha self-checkout module (/cgi-bin/koha/sco/sco-main.pl?).
 
We have patrons place one book at time on the RFID pad to self-checkout.  
 
We would ideally like patrons to stack five or more materials at a time so they checkout more efficiently all at once as it does on the koha staff side.
Comment 1 Catrina Berka 2023-06-06 13:45:06 UTC
Several partners have indicated an interest in this functionality, especially those using RFID pads for self-check stations, as Dave noted.
Comment 2 Martin Renvoize (ashimema) 2023-06-07 10:54:43 UTC
Could you clarify what form the output of the RFID reader comes as.. a newline delimited list of barcodes, or a comma delimited list perhaps?
Comment 3 davedaghita 2023-06-08 18:14:17 UTC
new line delimited list of barcodes
Comment 4 Aleisha Amohia 2023-08-28 04:58:53 UTC
Created attachment 154866 [details] [review]
Bug 32256: WIP

Not ready for testing
Comment 5 Aleisha Amohia 2023-08-29 03:09:44 UTC
Created attachment 154893 [details] [review]
Bug 32256: Enable batch checkout using self-checkout

This patch allows more than one item to be scanned and processed at once in Koha's self-checkout module. The items in the batch will still be handled one-by-one, so if any item in the batch requires confirmation (i.e. to be renewed or returned) or is impossible to check out, the process will stop at that item. Any items earlier in the list will be processed, but any items coming after in the list will be ignored. This feature uses the existing BatchCheckouts and BatchCheckoutsValidCategories system preferences to determine if batch checkouts should be allowed.

To test:
1) Open the staff interface. Go to Koha Administration -> Global system preferences. Search for "BatchCheckouts". Confirm BatchCheckouts syspref is disabled, and no categories are selected for the BatchCheckoutsValidCategories syspref.
2) In another tab, open the OPAC self checkout (found out OPACBaseURL/cgi-bin/koha/sco/sco-main.pl) and log in
3) Confirm the self-checkout works as normal for checking out, returning or renewing one item at a time
4) Go back to the staff interface tab (you may need to log back in). Enable the BatchCheckouts syspref but leave the BatchCheckoutsValidCategories syspref empty.
5) Refresh the OPAC self checkout tab. The barcode input field will now be bigger to support a list of barcodes. Enter a list of barcodes separated by newlines and Submit.
6) Only the first barcode should be processed. This is because no categories are valid for BatchCheckouts.
7) Go back to the staff interface tab (you may need to log back in). Select at least your patron category for the BatchCheckoutsValidCategories syspref and Save.
8) Refresh the OPAC self checkout tab. Enter a list of barcodes separated by newlines and Submit. Confirm all valid items are checked out as expected.
9) Test with a few items that are notforloan or would not be valid checkouts. Confirm they are not checked out, but other valid items in the batch are checked out successfully.
10) Test with a batch where one of the items is already checked out to the patron. The batch should get blocked at this item as the self-checkout asks for confirmation.
11) Test with both renewing and returning of items that are already checked out to the patron. This will only work with one item at a time and later items in the list will be ignored.

Sponsored-by: Koha-US
Comment 6 David Nind 2023-09-23 00:21:12 UTC
Hi Aleisha.

Step 9 doesn't work for me - everything else seems to work as per the test plan.

9. Test with a few items that are notforloan or would not be valid checkouts. Confirm they are not checked out, but other valid items in the batch are checked out successfully.

Checking out multiple items, where one or more is not for loan.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I used three items:
39999000000498 (not for loan)
39999000011111
39999000011135

Results - using the order above:
1. First item - message in yellow saying item cannot be checked out, with option to return to account summary.
2. Other two items - not checked out.

Results - putting the not for loan item in the middle:
1. Message in yellow: Item cannot be checked out (for 39999000000498)
2. Message in blue: Item checked out (39999000011111).
3. No other messages, the third item (39999000011135) not checked out

Results - putting not for loan item at the end:
1. Message in yellow: Item cannot be checked out (for 39999000000498)
2. Messages in blue:
    Item checked out (39999000011111)
    Item checked out (39999000011135)
3. The first two items are checked out, the not for loan item isn't (as expected)

Results - adding a fourth item:
1. I used four items:
   - 39999000011111
   - 39999000011135
   - 39999000000498 (not for loan)
   - 39999000005134
2. Stops at the third item, that is: the first two items are checked out. The third isn't (as expected), the fourth item isn't checked out.

Conclusion:
- If checking out multiple items, it stops checking out at the item that can't be checked out - even if later items can be checked out.


Interface message
~~~~~~~~~~~~~~~~~

Since this change only allows multiple checkouts, but NOT renewals or returns, then I think the text needs to reflect that.

Current text:

Scan a new item or enter its barcode
(or enter a barcode list, one barcode per line):

Proposed text - something like:

Scan a new item or enter its barcode
(for **multiple check outs only**, enter a barcode list, one barcode per line):

David
Comment 7 Aleisha Amohia 2023-11-06 01:37:14 UTC
(In reply to David Nind from comment #6)

> Conclusion:
> - If checking out multiple items, it stops checking out at the item that
> can't be checked out - even if later items can be checked out.
> 
> 

You're completely right, and actually that's what we wrote in the patch so maybe the test plan is misleading...

"The items in the batch will still be handled one-by-one, so if any item in the batch requires confirmation (i.e. to be renewed or returned) or is impossible to check out, the process will stop at that item. Any items earlier in the list will be processed, but any items coming after in the list will be ignored."

Do we think this is acceptable?
Comment 8 davedaghita 2023-11-07 01:14:27 UTC
I have not tested as I'm having an issue with adding the bug patch to my test server at the moment (I'm a rookie still LOL.) I think the patch is acceptable from previous comments, the workflow is as described.  It will work for our needs; we do have alerts to let patrons know if a book causes an issue, so this helps with reducing unchecked items from walking out overall as well.  This currently would be the best option to provide multiple item checkouts at once inside koha self-checkout natively.
Comment 9 David Nind 2023-11-07 02:28:55 UTC
(In reply to Aleisha Amohia from comment #7)
> (In reply to David Nind from comment #6)
...
> 
> You're completely right, and actually that's what we wrote in the patch so
> maybe the test plan is misleading...
> 
> "The items in the batch will still be handled one-by-one, so if any item in
> the batch requires confirmation (i.e. to be renewed or returned) or is
> impossible to check out, the process will stop at that item. Any items
> earlier in the list will be processed, but any items coming after in the
> list will be ignored."
> 
> Do we think this is acceptable?

Thanks Aleisha - I didn't properly read the description in the test plan!

I guess the main thing is knowing that this will happen. Having more advanced error messaging could be handled in a separate bug, if required.

Adding this as a note in the documentation will help as well.

The patch still applies, so I will sign off as it currently is, as it is working as planned.

David
Comment 10 David Nind 2023-11-07 02:34:11 UTC
(In reply to Dave from comment #8)
> I have not tested as I'm having an issue with adding the bug patch to my
> test server at the moment (I'm a rookie still LOL.) 

One way to test is to use the sandboxes (this bug can be tested in the sandboxes) - basically a fresh Koha environment that you can apply the bug with in your browser: https://wiki.koha-community.org/wiki/Sandboxes

A more advanced way is to set up the testing environment on your desktop (which is what I normally use) https://gitlab.com/koha-community/koha-testing-docker (feel free to ask on IRC or the development list if you want to use it, but have issues setting it up.
Comment 11 David Nind 2023-11-07 02:40:29 UTC
Created attachment 158585 [details] [review]
Bug 32256: Enable batch checkout using self-checkout

This patch allows more than one item to be scanned and processed at once in Koha's self-checkout module. The items in the batch will still be handled one-by-one, so if any item in the batch requires confirmation (i.e. to be renewed or returned) or is impossible to check out, the process will stop at that item. Any items earlier in the list will be processed, but any items coming after in the list will be ignored. This feature uses the existing BatchCheckouts and BatchCheckoutsValidCategories system preferences to determine if batch checkouts should be allowed.

To test:
1) Open the staff interface. Go to Koha Administration -> Global system preferences. Search for "BatchCheckouts". Confirm BatchCheckouts syspref is disabled, and no categories are selected for the BatchCheckoutsValidCategories syspref.
2) In another tab, open the OPAC self checkout (found out OPACBaseURL/cgi-bin/koha/sco/sco-main.pl) and log in
3) Confirm the self-checkout works as normal for checking out, returning or renewing one item at a time
4) Go back to the staff interface tab (you may need to log back in). Enable the BatchCheckouts syspref but leave the BatchCheckoutsValidCategories syspref empty.
5) Refresh the OPAC self checkout tab. The barcode input field will now be bigger to support a list of barcodes. Enter a list of barcodes separated by newlines and Submit.
6) Only the first barcode should be processed. This is because no categories are valid for BatchCheckouts.
7) Go back to the staff interface tab (you may need to log back in). Select at least your patron category for the BatchCheckoutsValidCategories syspref and Save.
8) Refresh the OPAC self checkout tab. Enter a list of barcodes separated by newlines and Submit. Confirm all valid items are checked out as expected.
9) Test with a few items that are notforloan or would not be valid checkouts. Confirm they are not checked out, but other valid items in the batch are checked out successfully.
10) Test with a batch where one of the items is already checked out to the patron. The batch should get blocked at this item as the self-checkout asks for confirmation.
11) Test with both renewing and returning of items that are already checked out to the patron. This will only work with one item at a time and later items in the list will be ignored.

Sponsored-by: Koha-US
Signed-off-by: David Nind <david@davidnind.com>
Comment 12 Aleisha Amohia 2023-11-07 03:19:16 UTC
Created attachment 158586 [details] [review]
Bug 32256: Add message to SCO that batch checkouts works for checkouts only

Not yet handling renewals, returns, or items that are impossible to check out.
Comment 13 Aleisha Amohia 2023-11-07 03:20:00 UTC
(In reply to David Nind from comment #9)
> (In reply to Aleisha Amohia from comment #7)
> > (In reply to David Nind from comment #6)
> ...
> > 
> > You're completely right, and actually that's what we wrote in the patch so
> > maybe the test plan is misleading...
> > 
> > "The items in the batch will still be handled one-by-one, so if any item in
> > the batch requires confirmation (i.e. to be renewed or returned) or is
> > impossible to check out, the process will stop at that item. Any items
> > earlier in the list will be processed, but any items coming after in the
> > list will be ignored."
> > 
> > Do we think this is acceptable?
> 
> Thanks Aleisha - I didn't properly read the description in the test plan!
> 
> I guess the main thing is knowing that this will happen. Having more
> advanced error messaging could be handled in a separate bug, if required.
> 
> Adding this as a note in the documentation will help as well.
> 
> The patch still applies, so I will sign off as it currently is, as it is
> working as planned.
> 
> David

Thanks David. I added the follow-up you suggested to say it only works for multiple checkouts, and agree with your other comments.
Comment 14 davedaghita 2023-11-07 22:07:01 UTC
(In reply to David Nind from comment #10)
> (In reply to Dave from comment #8)
> > I have not tested as I'm having an issue with adding the bug patch to my
> > test server at the moment (I'm a rookie still LOL.) 
> 
> One way to test is to use the sandboxes (this bug can be tested in the
> sandboxes) - basically a fresh Koha environment that you can apply the bug
> with in your browser: https://wiki.koha-community.org/wiki/Sandboxes
> 
> A more advanced way is to set up the testing environment on your desktop
> (which is what I normally use)
> https://gitlab.com/koha-community/koha-testing-docker (feel free to ask on
> IRC or the development list if you want to use it, but have issues setting
> it up.



David- Thank you for the sandbox information I heard of these, but I've only seen the demo section of ByWater.  I'll use those from now on too.  
I do have docker setup on my macbook, but didn't know if I needed it to be on my work network to test our SCO kiosks in the library.  I was trying to added to a debian OS instance of koha that is on our network.  Anyway long story as I slowly get into this developer chair LOL.

Thank you for testing and the updated write up to the bug/patch.  Great!
Comment 15 davedaghita 2023-11-07 22:09:45 UTC
(In reply to Aleisha Amohia from comment #13)
> (In reply to David Nind from comment #9)
> > (In reply to Aleisha Amohia from comment #7)
> > > (In reply to David Nind from comment #6)
> > ...
> > > 
> > > You're completely right, and actually that's what we wrote in the patch so
> > > maybe the test plan is misleading...
> > > 
> > > "The items in the batch will still be handled one-by-one, so if any item in
> > > the batch requires confirmation (i.e. to be renewed or returned) or is
> > > impossible to check out, the process will stop at that item. Any items
> > > earlier in the list will be processed, but any items coming after in the
> > > list will be ignored."
> > > 
> > > Do we think this is acceptable?
> > 
> > Thanks Aleisha - I didn't properly read the description in the test plan!
> > 
> > I guess the main thing is knowing that this will happen. Having more
> > advanced error messaging could be handled in a separate bug, if required.
> > 
> > Adding this as a note in the documentation will help as well.
> > 
> > The patch still applies, so I will sign off as it currently is, as it is
> > working as planned.
> > 
> > David
> 
> Thanks David. I added the follow-up you suggested to say it only works for
> multiple checkouts, and agree with your other comments.



Alesisha-  Thank you for all your work on the bug/patch! Wonderful!
Comment 16 Lucas Gass (lukeg) 2024-03-25 21:09:27 UTC
Needs rebased on top of Bug 34478 now.
Comment 17 Aleisha Amohia 2024-03-26 01:45:53 UTC
Created attachment 163878 [details] [review]
Bug 32256: Enable batch checkout using self-checkout

This patch allows more than one item to be scanned and processed at once in Koha's self-checkout module. The items in the batch will still be handled one-by-one, so if any item in the batch requires confirmation (i.e. to be renewed or returned) or is impossible to check out, the process will stop at that item. Any items earlier in the list will be processed, but any items coming after in the list will be ignored. This feature uses the existing BatchCheckouts and BatchCheckoutsValidCategories system preferences to determine if batch checkouts should be allowed.

To test:
1) Open the staff interface. Go to Koha Administration -> Global system preferences. Search for "BatchCheckouts". Confirm BatchCheckouts syspref is disabled, and no categories are selected for the BatchCheckoutsValidCategories syspref.
2) In another tab, open the OPAC self checkout (found out OPACBaseURL/cgi-bin/koha/sco/sco-main.pl) and log in
3) Confirm the self-checkout works as normal for checking out, returning or renewing one item at a time
4) Go back to the staff interface tab (you may need to log back in). Enable the BatchCheckouts syspref but leave the BatchCheckoutsValidCategories syspref empty.
5) Refresh the OPAC self checkout tab. The barcode input field will now be bigger to support a list of barcodes. Enter a list of barcodes separated by newlines and Submit.
6) Only the first barcode should be processed. This is because no categories are valid for BatchCheckouts.
7) Go back to the staff interface tab (you may need to log back in). Select at least your patron category for the BatchCheckoutsValidCategories syspref and Save.
8) Refresh the OPAC self checkout tab. Enter a list of barcodes separated by newlines and Submit. Confirm all valid items are checked out as expected.
9) Test with a few items that are notforloan or would not be valid checkouts. Confirm they are not checked out, but other valid items in the batch are checked out successfully.
10) Test with a batch where one of the items is already checked out to the patron. The batch should get blocked at this item as the self-checkout asks for confirmation.
11) Test with both renewing and returning of items that are already checked out to the patron. This will only work with one item at a time and later items in the list will be ignored.

Sponsored-by: Koha-US
Signed-off-by: David Nind <david@davidnind.com>
Comment 18 Aleisha Amohia 2024-03-26 01:45:56 UTC
Created attachment 163879 [details] [review]
Bug 32256: Add message to SCO that batch checkouts works for checkouts only

Not yet handling renewals, returns, or items that are impossible to check out.
Comment 19 Andrew Fuerste-Henry 2024-04-03 19:53:53 UTC
When I had no categories selected in BatchCheckoutsValidCategories, only one checkout was allowed at a time, as you described (Step 6). Once I'd enabled one category in BatchCheckoutsValidCategories, however, I was able to perform batch checkouts via the SCO with any patron, regardless of their category.

Otherwise everything worked as described. Thanks!
Comment 20 Andrew Fuerste-Henry 2024-04-04 14:40:40 UTC
(In reply to Andrew Fuerste-Henry from comment #19)
> When I had no categories selected in BatchCheckoutsValidCategories, only one
> checkout was allowed at a time, as you described (Step 6). Once I'd enabled
> one category in BatchCheckoutsValidCategories, however, I was able to
> perform batch checkouts via the SCO with any patron, regardless of their
> category.
> 
> Otherwise everything worked as described. Thanks!

I did a little more testing this morning and confirmed that BatchCheckoutsValidCategories is being enforced based on the category of the account used to activate the SCO, rather than the account of the patron. In KTD by default that's the self-check user, who is in category Staff. I did the following test:
1 - Enable BatchCheckouts, select nothing in BatchCheckoutsValidCategories 
2 - confirm AutoSelfCheckAllowed is allowed and contains the username and password for the self_check user. Confirm self_check user is in category Staff
3 - log into SCO with a user in category Patron, confirm you can only check out 1 item at a time
4 - select Staff in BatchCheckoutsValidCategories 
5 - log into SCO with your Patron user again, confirm you can check out multiple items at a time
6 - edit the self_check user, change category to Patron
7 - log into SCO with your Patron user again, now you are back to only checking out 1 item at a time
Comment 21 Aleisha Amohia 2024-04-10 01:00:40 UTC
Created attachment 164571 [details] [review]
Bug 32256: Enable batch checkout using self-checkout

This patch allows more than one item to be scanned and processed at once in Koha's self-checkout module. The items in the batch will still be handled one-by-one, so if any item in the batch requires confirmation (i.e. to be renewed or returned) or is impossible to check out, the process will stop at that item. Any items earlier in the list will be processed, but any items coming after in the list will be ignored. This feature uses the existing BatchCheckouts and BatchCheckoutsValidCategories system preferences to determine if batch checkouts should be allowed.

To test:
1) Open the staff interface. Go to Koha Administration -> Global system preferences. Search for "BatchCheckouts". Confirm BatchCheckouts syspref is disabled, and no categories are selected for the BatchCheckoutsValidCategories syspref.
2) In another tab, open the OPAC self checkout (found out OPACBaseURL/cgi-bin/koha/sco/sco-main.pl) and log in
3) Confirm the self-checkout works as normal for checking out, returning or renewing one item at a time
4) Go back to the staff interface tab (you may need to log back in). Enable the BatchCheckouts syspref but leave the BatchCheckoutsValidCategories syspref empty.
5) Refresh the OPAC self checkout tab. The barcode input field will now be bigger to support a list of barcodes. Enter a list of barcodes separated by newlines and Submit.
6) Only the first barcode should be processed. This is because no categories are valid for BatchCheckouts.
7) Go back to the staff interface tab (you may need to log back in). Select at least your patron category for the BatchCheckoutsValidCategories syspref and Save.
8) Refresh the OPAC self checkout tab. Enter a list of barcodes separated by newlines and Submit. Confirm all valid items are checked out as expected.
9) Test with a few items that are notforloan or would not be valid checkouts. Confirm they are not checked out, but other valid items in the batch are checked out successfully.
10) Test with a batch where one of the items is already checked out to the patron. The batch should get blocked at this item as the self-checkout asks for confirmation.
11) Test with both renewing and returning of items that are already checked out to the patron. This will only work with one item at a time and later items in the list will be ignored.

Sponsored-by: Koha-US
Signed-off-by: David Nind <david@davidnind.com>
Comment 22 Aleisha Amohia 2024-04-10 01:00:43 UTC
Created attachment 164572 [details] [review]
Bug 32256: Add message to SCO that batch checkouts works for checkouts only

Not yet handling renewals, returns, or items that are impossible to check out.
Comment 23 Aleisha Amohia 2024-04-10 01:00:46 UTC
Created attachment 164573 [details] [review]
Bug 32256: (follow-up) Use correct patron category

This patch ensures we check the categorycode of the patron trying to issue the items is valid (based on BatchCheckoutsValidCategories), rather than the categorycode of the AutoSelfCheckAllowed patron.

To test:

1 - Enable BatchCheckouts, select nothing in BatchCheckoutsValidCategories
2 - confirm AutoSelfCheckAllowed is allowed and contains the username and password for the self_check user. Confirm self_check user is in category Staff
3 - log into SCO with a user in category Patron, confirm you can only check out 1 item at a time
4 - select Patron in BatchCheckoutsValidCategories
5 - log into SCO with your Patron user again, confirm you can check out multiple items at a time

Sponsored-by: Koha-US
Comment 24 Andrew Fuerste-Henry 2024-04-10 14:08:02 UTC
The category code limits are now working as intended, everything in the test plan worked.

I typo-ed my way into finding another issue. Self-check login dies with the following error if self-check login is unsuccessful while BatchCheckouts is set to Allow:

"Can't call method 'categorycode' on an undefined value at /kohadevbox/koha/opac/sco/sco-main.pl"

I was testing this bug with SelfCheckoutByLogin set to cardnumber, so entering a nonexistent cardnumber caused the SCO to die. When I switched SelfCheckoutByLogin to username and password, it died on an incorrect username/password combo.
Comment 25 Aleisha Amohia 2024-04-10 20:49:11 UTC
Created attachment 164637 [details] [review]
Bug 32256: (follow-up) Use correct patron category

This patch ensures we check the categorycode of the patron trying to issue the items is valid (based on BatchCheckoutsValidCategories), rather than the categorycode of the AutoSelfCheckAllowed patron.

To test:

1 - Enable BatchCheckouts, select nothing in BatchCheckoutsValidCategories
2 - confirm AutoSelfCheckAllowed is allowed and contains the username and password for the self_check user. Confirm self_check user is in category Staff
3 - log into SCO with a user in category Patron, confirm you can only check out 1 item at a time
4 - select Patron in BatchCheckoutsValidCategories
5 - log into SCO with your Patron user again, confirm you can check out multiple items at a time

Sponsored-by: Koha-US
Comment 26 Andrew Fuerste-Henry 2024-04-10 21:10:02 UTC
Created attachment 164638 [details] [review]
Bug 32256: Enable batch checkout using self-checkout

This patch allows more than one item to be scanned and processed at once in Koha's self-checkout module. The items in the batch will still be handled one-by-one, so if any item in the batch requires confirmation (i.e. to be renewed or returned) or is impossible to check out, the process will stop at that item. Any items earlier in the list will be processed, but any items coming after in the list will be ignored. This feature uses the existing BatchCheckouts and BatchCheckoutsValidCategories system preferences to determine if batch checkouts should be allowed.

To test:
1) Open the staff interface. Go to Koha Administration -> Global system preferences. Search for "BatchCheckouts". Confirm BatchCheckouts syspref is disabled, and no categories are selected for the BatchCheckoutsValidCategories syspref.
2) In another tab, open the OPAC self checkout (found out OPACBaseURL/cgi-bin/koha/sco/sco-main.pl) and log in
3) Confirm the self-checkout works as normal for checking out, returning or renewing one item at a time
4) Go back to the staff interface tab (you may need to log back in). Enable the BatchCheckouts syspref but leave the BatchCheckoutsValidCategories syspref empty.
5) Refresh the OPAC self checkout tab. The barcode input field will now be bigger to support a list of barcodes. Enter a list of barcodes separated by newlines and Submit.
6) Only the first barcode should be processed. This is because no categories are valid for BatchCheckouts.
7) Go back to the staff interface tab (you may need to log back in). Select at least your patron category for the BatchCheckoutsValidCategories syspref and Save.
8) Refresh the OPAC self checkout tab. Enter a list of barcodes separated by newlines and Submit. Confirm all valid items are checked out as expected.
9) Test with a few items that are notforloan or would not be valid checkouts. Confirm they are not checked out, but other valid items in the batch are checked out successfully.
10) Test with a batch where one of the items is already checked out to the patron. The batch should get blocked at this item as the self-checkout asks for confirmation.
11) Test with both renewing and returning of items that are already checked out to the patron. This will only work with one item at a time and later items in the list will be ignored.

Sponsored-by: Koha-US
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Comment 27 Andrew Fuerste-Henry 2024-04-10 21:10:04 UTC
Created attachment 164639 [details] [review]
Bug 32256: Add message to SCO that batch checkouts works for checkouts only

Not yet handling renewals, returns, or items that are impossible to check out.

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Comment 28 Andrew Fuerste-Henry 2024-04-10 21:10:07 UTC
Created attachment 164640 [details] [review]
Bug 32256: (follow-up) Use correct patron category

This patch ensures we check the categorycode of the patron trying to issue the items is valid (based on BatchCheckoutsValidCategories), rather than the categorycode of the AutoSelfCheckAllowed patron.

To test:

1 - Enable BatchCheckouts, select nothing in BatchCheckoutsValidCategories
2 - confirm AutoSelfCheckAllowed is allowed and contains the username and password for the self_check user. Confirm self_check user is in category Staff
3 - log into SCO with a user in category Patron, confirm you can only check out 1 item at a time
4 - select Patron in BatchCheckoutsValidCategories
5 - log into SCO with your Patron user again, confirm you can check out multiple items at a time

Sponsored-by: Koha-US
Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Comment 29 Martin Renvoize (ashimema) 2024-04-11 15:08:46 UTC
I'd love to have seen this allow for different delimiter options rather than on/off and assume it's new line delimited.

I've seen scanners that allow for delimiter to be configured and final character to be configured.. so one could produce a comma delimited list followed by return.. that would allow for a more seamless workflow (and may also allow for replacing this on/off pref with a 'delimeter' preference instead.

Even if we don't do that, the preference isn't well names.. we could make it clear this only pertains to the SCO and nothing else.

Finally.. and the main reason I'm failing QA now.. if you list good and bad barcodes the failure is silent if it's not the first barcode happens to pass.. we should be listing all info/warning/blockers for each barcode that returns a problem.
Comment 30 Aleisha Amohia 2024-04-15 00:57:14 UTC
Created attachment 164869 [details] [review]
Bug 32256: Display barcodes not checked out in batch

This patch encourages the user to check out certain items individually if they fail to be checked out in a batch.

This way they will be presented with more useful error messages.

To test:

1 - Enable BatchCheckouts, select nothing in BatchCheckoutsValidCategories
2 - Find three barcodes
3 - log into SCO with a user in category Patron, paste the barcodes separated by newlines and submit. confirm one item is succcessfully checked out and the other two barcodes are listed in the pop-up, encouraged to try checking out individually.
4 - select Patron in BatchCheckoutsValidCategories
5 - log into SCO with your Patron user again, confirm you can check out multiple items at a time
Comment 31 Aleisha Amohia 2024-04-15 00:58:56 UTC
Thanks for your comments Martin

(In reply to Martin Renvoize from comment #29)
> I'd love to have seen this allow for different delimiter options rather than
> on/off and assume it's new line delimited.
> 
> I've seen scanners that allow for delimiter to be configured and final
> character to be configured.. so one could produce a comma delimited list
> followed by return.. that would allow for a more seamless workflow (and may
> also allow for replacing this on/off pref with a 'delimeter' preference
> instead.

I haven't addressed this in the latest follow-up, I think it's a great idea for a next enhancement, but is outside of the scope for this development.

> 
> Even if we don't do that, the preference isn't well names.. we could make it
> clear this only pertains to the SCO and nothing else.

BatchCheckouts is used already by the staff interface circulation system. It does not only pertain to the SCO.

> 
> Finally.. and the main reason I'm failing QA now.. if you list good and bad
> barcodes the failure is silent if it's not the first barcode happens to
> pass.. we should be listing all info/warning/blockers for each barcode that
> returns a problem.

I have addressed this in follow-up.
Comment 32 Andrew Fuerste-Henry 2024-04-15 19:43:18 UTC
(In reply to Aleisha Amohia from comment #31)

As Aleisha says, the sysprefs here existed before this feature and apply to both staff checkout and self-check.

I agree that customizable delimiters make sense as a feature to be added down the road, but would hate to see this enhancement stall out over it now.

> > 
> > Finally.. and the main reason I'm failing QA now.. if you list good and bad
> > barcodes the failure is silent if it's not the first barcode happens to
> > pass.. we should be listing all info/warning/blockers for each barcode that
> > returns a problem.
> 
> I have addressed this in follow-up.

I'm not sure this follow-up is addressing the issue raised. With this new patch this is what I see:
- enable BatchCheckouts, but no categories in BatchCheckoutsValidCategories 
- Have barcodes 1,2,3 that allow checkout, barcodes A,B,C that are not for loan
- log into SCO with a patron, enter a valid barcode followed by an invalid barcode (1, A). Item 1 checks out correctly, but Koha says "Please check out the following items individually: A" -- This is inaccurate as A doesn't exist, cannot be checked out at all
- log into SCO with another patron, enter an invalid barcode followed by a valid barcode (B, 2). Neither item checks out. Koha accurately reports that B is not a known item and says 2 must be checked out individually

- return your items, enable a patron category in BatchCheckoutsValidCategories

- log into SCO with a patron in the category you've allowed to use batch checkouts
- Enter a valid barcode followed by an invalid barcode (1, A). Item 1 checks out, Koha makes no mention of item A. This behavior appears unchanged. Your new patch appears to apply only to patrons who are not allowed batch checkout?
Comment 33 Aleisha Amohia 2024-04-29 04:41:56 UTC
Created attachment 165719 [details] [review]
Bug 32256: Handle batch error messages better

This enhancement modifies the self-checkout script to better handle 'impossible' and 'needs confirmation' checkout messages.

Test with a combination of barcodes that would invoke these messages, for example:
- impossible: barcode doesn't exist
- impossible: barcode is for a 'notforloan' item type
- impossible: debt
- needs confirmation: barcode already checked out, i.e. confirm renewal

Include barcodes that should have successful checkouts too.

Also, test with the following sysprefs:
- BatchCheckouts: enabled
- BatchCheckoutsValidCategories: none selected

Confirm SCO does not have a multi-line text area for more than one barcode, and doesn't accept more than one barcode.
Comment 34 Andrew Fuerste-Henry 2024-04-29 16:53:19 UTC
Created attachment 165751 [details] [review]
Bug 32256: Enable batch checkout using self-checkout

This patch allows more than one item to be scanned and processed at once in Koha's self-checkout module. The items in the batch will still be handled one-by-one, so if any item in the batch requires confirmation (i.e. to be renewed or returned) or is impossible to check out, the process will stop at that item. Any items earlier in the list will be processed, but any items coming after in the list will be ignored. This feature uses the existing BatchCheckouts and BatchCheckoutsValidCategories system preferences to determine if batch checkouts should be allowed.

To test:
1) Open the staff interface. Go to Koha Administration -> Global system preferences. Search for "BatchCheckouts". Confirm BatchCheckouts syspref is disabled, and no categories are selected for the BatchCheckoutsValidCategories syspref.
2) In another tab, open the OPAC self checkout (found out OPACBaseURL/cgi-bin/koha/sco/sco-main.pl) and log in
3) Confirm the self-checkout works as normal for checking out, returning or renewing one item at a time
4) Go back to the staff interface tab (you may need to log back in). Enable the BatchCheckouts syspref but leave the BatchCheckoutsValidCategories syspref empty.
5) Refresh the OPAC self checkout tab. The barcode input field will now be bigger to support a list of barcodes. Enter a list of barcodes separated by newlines and Submit.
6) Only the first barcode should be processed. This is because no categories are valid for BatchCheckouts.
7) Go back to the staff interface tab (you may need to log back in). Select at least your patron category for the BatchCheckoutsValidCategories syspref and Save.
8) Refresh the OPAC self checkout tab. Enter a list of barcodes separated by newlines and Submit. Confirm all valid items are checked out as expected.
9) Test with a few items that are notforloan or would not be valid checkouts. Confirm they are not checked out, but other valid items in the batch are checked out successfully.
10) Test with a batch where one of the items is already checked out to the patron. The batch should get blocked at this item as the self-checkout asks for confirmation.
11) Test with both renewing and returning of items that are already checked out to the patron. This will only work with one item at a time and later items in the list will be ignored.

Sponsored-by: Koha-US
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Comment 35 Andrew Fuerste-Henry 2024-04-29 16:53:21 UTC
Created attachment 165752 [details] [review]
Bug 32256: Add message to SCO that batch checkouts works for checkouts only

Not yet handling renewals, returns, or items that are impossible to check out.

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Comment 36 Andrew Fuerste-Henry 2024-04-29 16:53:24 UTC
Created attachment 165753 [details] [review]
Bug 32256: (follow-up) Use correct patron category

This patch ensures we check the categorycode of the patron trying to issue the items is valid (based on BatchCheckoutsValidCategories), rather than the categorycode of the AutoSelfCheckAllowed patron.

To test:

1 - Enable BatchCheckouts, select nothing in BatchCheckoutsValidCategories
2 - confirm AutoSelfCheckAllowed is allowed and contains the username and password for the self_check user. Confirm self_check user is in category Staff
3 - log into SCO with a user in category Patron, confirm you can only check out 1 item at a time
4 - select Patron in BatchCheckoutsValidCategories
5 - log into SCO with your Patron user again, confirm you can check out multiple items at a time

Sponsored-by: Koha-US
Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Comment 37 Andrew Fuerste-Henry 2024-04-29 16:53:27 UTC
Created attachment 165754 [details] [review]
Bug 32256: Display barcodes not checked out in batch

This patch encourages the user to check out certain items individually if they fail to be checked out in a batch.

This way they will be presented with more useful error messages.

To test:

1 - Enable BatchCheckouts, select nothing in BatchCheckoutsValidCategories
2 - Find three barcodes
3 - log into SCO with a user in category Patron, paste the barcodes separated by newlines and submit. confirm one item is succcessfully checked out and the other two barcodes are listed in the pop-up, encouraged to try checking out individually.
4 - select Patron in BatchCheckoutsValidCategories
5 - log into SCO with your Patron user again, confirm you can check out multiple items at a time

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Comment 38 Andrew Fuerste-Henry 2024-04-29 16:53:29 UTC
Created attachment 165755 [details] [review]
Bug 32256: Handle batch error messages better

This enhancement modifies the self-checkout script to better handle 'impossible' and 'needs confirmation' checkout messages.

Test with a combination of barcodes that would invoke these messages, for example:
- impossible: barcode doesn't exist
- impossible: barcode is for a 'notforloan' item type
- impossible: debt
- needs confirmation: barcode already checked out, i.e. confirm renewal

Include barcodes that should have successful checkouts too.

Also, test with the following sysprefs:
- BatchCheckouts: enabled
- BatchCheckoutsValidCategories: none selected

Confirm SCO does not have a multi-line text area for more than one barcode, and doesn't accept more than one barcode.

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Comment 39 Andrew Fuerste-Henry 2024-04-29 17:04:12 UTC
I made a follow-up about including item barcodes in the error messages. I tested this with a bunch of items all on the same bib and the lack of barcodes in errors got confusing. But that doesn't seem like a situation a lot of patrons will get into, so it didn't seem worth blocking this.
Comment 40 Andrew Fuerste-Henry 2024-04-29 17:15:59 UTC
I want to note explicitly that with these new patches the batch is not aborted on the first error. I entered the following barcodes in this order:
1 (good barcode)
2 (withdrawn)
3 (lost)
4 (not for loan)
5 (good barcode)

Items 1 & 5 both checked out and I got detailed errors about the other three (or at least as detailed as I would have gotten in a regular not-batch checkout)
Comment 41 Martin Renvoize (ashimema) 2024-05-01 14:21:38 UTC
Created attachment 165978 [details] [review]
Bug 32256: Enable batch checkout using self-checkout

This patch allows more than one item to be scanned and processed at once in Koha's self-checkout module. The items in the batch will still be handled one-by-one, so if any item in the batch requires confirmation (i.e. to be renewed or returned) or is impossible to check out, the process will stop at that item. Any items earlier in the list will be processed, but any items coming after in the list will be ignored. This feature uses the existing BatchCheckouts and BatchCheckoutsValidCategories system preferences to determine if batch checkouts should be allowed.

To test:
1) Open the staff interface. Go to Koha Administration -> Global system preferences. Search for "BatchCheckouts". Confirm BatchCheckouts syspref is disabled, and no categories are selected for the BatchCheckoutsValidCategories syspref.
2) In another tab, open the OPAC self checkout (found out OPACBaseURL/cgi-bin/koha/sco/sco-main.pl) and log in
3) Confirm the self-checkout works as normal for checking out, returning or renewing one item at a time
4) Go back to the staff interface tab (you may need to log back in). Enable the BatchCheckouts syspref but leave the BatchCheckoutsValidCategories syspref empty.
5) Refresh the OPAC self checkout tab. The barcode input field will now be bigger to support a list of barcodes. Enter a list of barcodes separated by newlines and Submit.
6) Only the first barcode should be processed. This is because no categories are valid for BatchCheckouts.
7) Go back to the staff interface tab (you may need to log back in). Select at least your patron category for the BatchCheckoutsValidCategories syspref and Save.
8) Refresh the OPAC self checkout tab. Enter a list of barcodes separated by newlines and Submit. Confirm all valid items are checked out as expected.
9) Test with a few items that are notforloan or would not be valid checkouts. Confirm they are not checked out, but other valid items in the batch are checked out successfully.
10) Test with a batch where one of the items is already checked out to the patron. The batch should get blocked at this item as the self-checkout asks for confirmation.
11) Test with both renewing and returning of items that are already checked out to the patron. This will only work with one item at a time and later items in the list will be ignored.

Sponsored-by: Koha-US
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 42 Martin Renvoize (ashimema) 2024-05-01 14:21:42 UTC
Created attachment 165979 [details] [review]
Bug 32256: Add message to SCO that batch checkouts works for checkouts only

Not yet handling renewals, returns, or items that are impossible to check out.

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 43 Martin Renvoize (ashimema) 2024-05-01 14:21:46 UTC
Created attachment 165980 [details] [review]
Bug 32256: (follow-up) Use correct patron category

This patch ensures we check the categorycode of the patron trying to issue the items is valid (based on BatchCheckoutsValidCategories), rather than the categorycode of the AutoSelfCheckAllowed patron.

To test:

1 - Enable BatchCheckouts, select nothing in BatchCheckoutsValidCategories
2 - confirm AutoSelfCheckAllowed is allowed and contains the username and password for the self_check user. Confirm self_check user is in category Staff
3 - log into SCO with a user in category Patron, confirm you can only check out 1 item at a time
4 - select Patron in BatchCheckoutsValidCategories
5 - log into SCO with your Patron user again, confirm you can check out multiple items at a time

Sponsored-by: Koha-US
Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 44 Martin Renvoize (ashimema) 2024-05-01 14:21:49 UTC
Created attachment 165981 [details] [review]
Bug 32256: Display barcodes not checked out in batch

This patch encourages the user to check out certain items individually if they fail to be checked out in a batch.

This way they will be presented with more useful error messages.

To test:

1 - Enable BatchCheckouts, select nothing in BatchCheckoutsValidCategories
2 - Find three barcodes
3 - log into SCO with a user in category Patron, paste the barcodes separated by newlines and submit. confirm one item is succcessfully checked out and the other two barcodes are listed in the pop-up, encouraged to try checking out individually.
4 - select Patron in BatchCheckoutsValidCategories
5 - log into SCO with your Patron user again, confirm you can check out multiple items at a time

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 45 Martin Renvoize (ashimema) 2024-05-01 14:21:52 UTC
Created attachment 165982 [details] [review]
Bug 32256: Handle batch error messages better

This enhancement modifies the self-checkout script to better handle 'impossible' and 'needs confirmation' checkout messages.

Test with a combination of barcodes that would invoke these messages, for example:
- impossible: barcode doesn't exist
- impossible: barcode is for a 'notforloan' item type
- impossible: debt
- needs confirmation: barcode already checked out, i.e. confirm renewal

Include barcodes that should have successful checkouts too.

Also, test with the following sysprefs:
- BatchCheckouts: enabled
- BatchCheckoutsValidCategories: none selected

Confirm SCO does not have a multi-line text area for more than one barcode, and doesn't accept more than one barcode.

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 46 Martin Renvoize (ashimema) 2024-05-01 14:21:56 UTC
Created attachment 165983 [details] [review]
Bug 32256: (QA follow-up) Tidy sco-main.pl

This tidies the whole file as the patchset touched so much that we
basically needed to tidy all to make the QA scripts clean.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 47 Martin Renvoize (ashimema) 2024-05-01 14:22:44 UTC
Nice teamwork there, and thanks for the thorough testing.

QA scripts are happy and I think all issues raised are now addressed.

Passing QA
Comment 48 Katrin Fischer 2024-05-03 16:55:56 UTC
I am sorry as this might be coming (too) late, but I think the way this patch re-uses the existing system preferences doesn't quite work for the use case.

We have 2 preferences that come into play here:
BatchCheckouts : General ON/OFF switch.
BatchCheckoutsValidCategories : Patron categories allowed to checkout in a batch.

I believe the second one is currently described misleadingly. It should probably read: Patron categories a staff user can batch checkout items to. 

Just to be sure I have confirmed the current behavior in our 22.11 demo installation and on main.

What it means is that with the current preferences the behavior in the staff interface and the OPAC cannot be configured separately. I can't turn it off in the OPAC if I want to feature to remain available to my staff users.
Just checking "staff" will not allow staff to still keep doing batch checkouts to all users and block patrons from doing so. 

We don't know how the self check stations are equipped/built and this could come as an unwanted feature for some libraries that want that patrons check out one after the other to avoid any confusion for errors/problems.

I think this should have its own system preference. I am not sure that a ON/OFF is really needed - we could just do something like SCOBatchCheckoutsValidCategories and place it right in the "Self check-out module" section with the other relevant preferences.
Comment 49 Andrew Fuerste-Henry 2024-05-03 16:58:27 UTC
(In reply to Katrin Fischer from comment #48)
> I think this should have its own system preference. I am not sure that a
> ON/OFF is really needed - we could just do something like
> SCOBatchCheckoutsValidCategories and place it right in the "Self check-out
> module" section with the other relevant preferences.

This solution makes sense to me. Should we rename the existing syspref "IntranetBatchCheckoutsValidCategories" while we're at it?
Comment 50 Katrin Fischer 2024-05-03 17:15:44 UTC
(In reply to Andrew Fuerste-Henry from comment #49)
> (In reply to Katrin Fischer from comment #48)
> > I think this should have its own system preference. I am not sure that a
> > ON/OFF is really needed - we could just do something like
> > SCOBatchCheckoutsValidCategories and place it right in the "Self check-out
> > module" section with the other relevant preferences.
> 
> This solution makes sense to me. Should we rename the existing syspref
> "IntranetBatchCheckoutsValidCategories" while we're at it?

Let's move this to a new bug report:
Bug 36776 - Clarify description of BatchCheckouts* system preferences
Comment 51 Aleisha Amohia 2024-05-06 03:43:44 UTC
Created attachment 166179 [details] [review]
Bug 32256: Use a new SCOBatchCheckoutsValidCategories syspref

So that this functionality can be controlled separately from staff-side batch checkouts
Comment 52 Andrew Fuerste-Henry 2024-05-06 13:46:35 UTC
Created attachment 166225 [details] [review]
Bug 32256: Enable batch checkout using self-checkout

This patch allows more than one item to be scanned and processed at once in Koha's self-checkout module. The items in the batch will still be handled one-by-one, so if any item in the batch requires confirmation (i.e. to be renewed or returned) or is impossible to check out, the process will stop at that item. Any items earlier in the list will be processed, but any items coming after in the list will be ignored. This feature uses the existing BatchCheckouts and BatchCheckoutsValidCategories system preferences to determine if batch checkouts should be allowed.

To test:
1) Open the staff interface. Go to Koha Administration -> Global system preferences. Search for "BatchCheckouts". Confirm BatchCheckouts syspref is disabled, and no categories are selected for the BatchCheckoutsValidCategories syspref.
2) In another tab, open the OPAC self checkout (found out OPACBaseURL/cgi-bin/koha/sco/sco-main.pl) and log in
3) Confirm the self-checkout works as normal for checking out, returning or renewing one item at a time
4) Go back to the staff interface tab (you may need to log back in). Enable the BatchCheckouts syspref but leave the BatchCheckoutsValidCategories syspref empty.
5) Refresh the OPAC self checkout tab. The barcode input field will now be bigger to support a list of barcodes. Enter a list of barcodes separated by newlines and Submit.
6) Only the first barcode should be processed. This is because no categories are valid for BatchCheckouts.
7) Go back to the staff interface tab (you may need to log back in). Select at least your patron category for the BatchCheckoutsValidCategories syspref and Save.
8) Refresh the OPAC self checkout tab. Enter a list of barcodes separated by newlines and Submit. Confirm all valid items are checked out as expected.
9) Test with a few items that are notforloan or would not be valid checkouts. Confirm they are not checked out, but other valid items in the batch are checked out successfully.
10) Test with a batch where one of the items is already checked out to the patron. The batch should get blocked at this item as the self-checkout asks for confirmation.
11) Test with both renewing and returning of items that are already checked out to the patron. This will only work with one item at a time and later items in the list will be ignored.

Sponsored-by: Koha-US
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Comment 53 Andrew Fuerste-Henry 2024-05-06 13:46:38 UTC
Created attachment 166226 [details] [review]
Bug 32256: Add message to SCO that batch checkouts works for checkouts only

Not yet handling renewals, returns, or items that are impossible to check out.

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Comment 54 Andrew Fuerste-Henry 2024-05-06 13:46:41 UTC
Created attachment 166227 [details] [review]
Bug 32256: (follow-up) Use correct patron category

This patch ensures we check the categorycode of the patron trying to issue the items is valid (based on BatchCheckoutsValidCategories), rather than the categorycode of the AutoSelfCheckAllowed patron.

To test:

1 - Enable BatchCheckouts, select nothing in BatchCheckoutsValidCategories
2 - confirm AutoSelfCheckAllowed is allowed and contains the username and password for the self_check user. Confirm self_check user is in category Staff
3 - log into SCO with a user in category Patron, confirm you can only check out 1 item at a time
4 - select Patron in BatchCheckoutsValidCategories
5 - log into SCO with your Patron user again, confirm you can check out multiple items at a time

Sponsored-by: Koha-US
Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Comment 55 Andrew Fuerste-Henry 2024-05-06 13:46:43 UTC
Created attachment 166228 [details] [review]
Bug 32256: Display barcodes not checked out in batch

This patch encourages the user to check out certain items individually if they fail to be checked out in a batch.

This way they will be presented with more useful error messages.

To test:

1 - Enable BatchCheckouts, select nothing in BatchCheckoutsValidCategories
2 - Find three barcodes
3 - log into SCO with a user in category Patron, paste the barcodes separated by newlines and submit. confirm one item is succcessfully checked out and the other two barcodes are listed in the pop-up, encouraged to try checking out individually.
4 - select Patron in BatchCheckoutsValidCategories
5 - log into SCO with your Patron user again, confirm you can check out multiple items at a time

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Comment 56 Andrew Fuerste-Henry 2024-05-06 13:46:46 UTC
Created attachment 166229 [details] [review]
Bug 32256: Handle batch error messages better

This enhancement modifies the self-checkout script to better handle 'impossible' and 'needs confirmation' checkout messages.

Test with a combination of barcodes that would invoke these messages, for example:
- impossible: barcode doesn't exist
- impossible: barcode is for a 'notforloan' item type
- impossible: debt
- needs confirmation: barcode already checked out, i.e. confirm renewal

Include barcodes that should have successful checkouts too.

Also, test with the following sysprefs:
- BatchCheckouts: enabled
- BatchCheckoutsValidCategories: none selected

Confirm SCO does not have a multi-line text area for more than one barcode, and doesn't accept more than one barcode.

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Comment 57 Andrew Fuerste-Henry 2024-05-06 13:46:49 UTC
Created attachment 166230 [details] [review]
Bug 32256: (QA follow-up) Tidy sco-main.pl

This tidies the whole file as the patchset touched so much that we
basically needed to tidy all to make the QA scripts clean.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Comment 58 Andrew Fuerste-Henry 2024-05-06 13:46:51 UTC
Created attachment 166231 [details] [review]
Bug 32256: Use a new SCOBatchCheckoutsValidCategories syspref

So that this functionality can be controlled separately from staff-side batch checkouts

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Comment 59 Martin Renvoize (ashimema) 2024-05-07 17:52:46 UTC
Created attachment 166320 [details] [review]
Bug 32256: Enable batch checkout using self-checkout

This patch allows more than one item to be scanned and processed at once in Koha's self-checkout module. The items in the batch will still be handled one-by-one, so if any item in the batch requires confirmation (i.e. to be renewed or returned) or is impossible to check out, the process will stop at that item. Any items earlier in the list will be processed, but any items coming after in the list will be ignored. This feature uses the existing BatchCheckouts and BatchCheckoutsValidCategories system preferences to determine if batch checkouts should be allowed.

To test:
1) Open the staff interface. Go to Koha Administration -> Global system preferences. Search for "BatchCheckouts". Confirm BatchCheckouts syspref is disabled, and no categories are selected for the BatchCheckoutsValidCategories syspref.
2) In another tab, open the OPAC self checkout (found out OPACBaseURL/cgi-bin/koha/sco/sco-main.pl) and log in
3) Confirm the self-checkout works as normal for checking out, returning or renewing one item at a time
4) Go back to the staff interface tab (you may need to log back in). Enable the BatchCheckouts syspref but leave the BatchCheckoutsValidCategories syspref empty.
5) Refresh the OPAC self checkout tab. The barcode input field will now be bigger to support a list of barcodes. Enter a list of barcodes separated by newlines and Submit.
6) Only the first barcode should be processed. This is because no categories are valid for BatchCheckouts.
7) Go back to the staff interface tab (you may need to log back in). Select at least your patron category for the BatchCheckoutsValidCategories syspref and Save.
8) Refresh the OPAC self checkout tab. Enter a list of barcodes separated by newlines and Submit. Confirm all valid items are checked out as expected.
9) Test with a few items that are notforloan or would not be valid checkouts. Confirm they are not checked out, but other valid items in the batch are checked out successfully.
10) Test with a batch where one of the items is already checked out to the patron. The batch should get blocked at this item as the self-checkout asks for confirmation.
11) Test with both renewing and returning of items that are already checked out to the patron. This will only work with one item at a time and later items in the list will be ignored.

Sponsored-by: Koha-US
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 60 Martin Renvoize (ashimema) 2024-05-07 17:52:50 UTC
Created attachment 166321 [details] [review]
Bug 32256: Add message to SCO that batch checkouts works for checkouts only

Not yet handling renewals, returns, or items that are impossible to check out.

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 61 Martin Renvoize (ashimema) 2024-05-07 17:52:53 UTC
Created attachment 166322 [details] [review]
Bug 32256: (follow-up) Use correct patron category

This patch ensures we check the categorycode of the patron trying to issue the items is valid (based on BatchCheckoutsValidCategories), rather than the categorycode of the AutoSelfCheckAllowed patron.

To test:

1 - Enable BatchCheckouts, select nothing in BatchCheckoutsValidCategories
2 - confirm AutoSelfCheckAllowed is allowed and contains the username and password for the self_check user. Confirm self_check user is in category Staff
3 - log into SCO with a user in category Patron, confirm you can only check out 1 item at a time
4 - select Patron in BatchCheckoutsValidCategories
5 - log into SCO with your Patron user again, confirm you can check out multiple items at a time

Sponsored-by: Koha-US
Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 62 Martin Renvoize (ashimema) 2024-05-07 17:52:57 UTC
Created attachment 166323 [details] [review]
Bug 32256: Display barcodes not checked out in batch

This patch encourages the user to check out certain items individually if they fail to be checked out in a batch.

This way they will be presented with more useful error messages.

To test:

1 - Enable BatchCheckouts, select nothing in BatchCheckoutsValidCategories
2 - Find three barcodes
3 - log into SCO with a user in category Patron, paste the barcodes separated by newlines and submit. confirm one item is succcessfully checked out and the other two barcodes are listed in the pop-up, encouraged to try checking out individually.
4 - select Patron in BatchCheckoutsValidCategories
5 - log into SCO with your Patron user again, confirm you can check out multiple items at a time

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 63 Martin Renvoize (ashimema) 2024-05-07 17:53:01 UTC
Created attachment 166324 [details] [review]
Bug 32256: Handle batch error messages better

This enhancement modifies the self-checkout script to better handle 'impossible' and 'needs confirmation' checkout messages.

Test with a combination of barcodes that would invoke these messages, for example:
- impossible: barcode doesn't exist
- impossible: barcode is for a 'notforloan' item type
- impossible: debt
- needs confirmation: barcode already checked out, i.e. confirm renewal

Include barcodes that should have successful checkouts too.

Also, test with the following sysprefs:
- BatchCheckouts: enabled
- BatchCheckoutsValidCategories: none selected

Confirm SCO does not have a multi-line text area for more than one barcode, and doesn't accept more than one barcode.

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 64 Martin Renvoize (ashimema) 2024-05-07 17:53:05 UTC
Created attachment 166325 [details] [review]
Bug 32256: (QA follow-up) Tidy sco-main.pl

This tidies the whole file as the patchset touched so much that we
basically needed to tidy all to make the QA scripts clean.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 65 Martin Renvoize (ashimema) 2024-05-07 17:53:08 UTC
Created attachment 166326 [details] [review]
Bug 32256: Use a new SCOBatchCheckoutsValidCategories syspref

So that this functionality can be controlled separately from staff-side batch checkouts

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 66 Martin Renvoize (ashimema) 2024-05-07 17:53:53 UTC
I'm happy this all works as expected now and QA comments have all been dealt with.

QA scripts are happy too.

Passing QA, thanks for all the work everyone.
Comment 67 Katrin Fischer 2024-05-08 16:24:58 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 68 Aleisha Amohia 2024-05-14 03:42:51 UTC
Thanks everyone for your help!
Comment 69 Fridolin Somers 2024-05-24 15:02:06 UTC
Not backported to 23.11.x