Bug 11759 - Batch checkout
Summary: Batch checkout
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: master
Hardware: All All
: P5 - low new feature
Assignee: Jonathan Druart
QA Contact: Marcel de Rooy
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 14015 15038 15718 15037 15091 15116
  Show dependency treegraph
 
Reported: 2014-02-14 10:52 UTC by Jonathan Druart
Modified: 2016-06-21 22:09 UTC (History)
19 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Medium patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:
Currently Koha does not allow to checkout several items at once to a user. This can cause a waste of time when a user want to checkout more than 10 items. This development has been asked to have statistics on in-house use. Every night, a librarian will e


Attachments
Bug 11759: Batch checkout - prepare the ground (7.44 KB, patch)
2014-02-14 12:30 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11759: Batch checkout - Add the new template (18.23 KB, patch)
2014-02-14 12:32 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11759: Add links to the new page (2.75 KB, patch)
2014-02-14 12:32 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11759: Add some css to highlight warnings and errors (786 bytes, patch)
2014-02-14 12:33 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11759: Batch checkout - DB changes (3.15 KB, patch)
2014-02-14 12:33 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11759: (follow-up) Prevent access to the batch checkout if not allowed (4.94 KB, patch)
2014-02-25 16:56 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11759: (follow-up) Prevent access to the batch checkout if not allowed (4.94 KB, patch)
2014-03-19 08:37 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11759: (follow-up) Prevent access to the batch checkout if not allowed (4.88 KB, patch)
2014-03-19 15:18 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11759: Batch checkout - prepare the ground (7.44 KB, patch)
2014-04-04 08:04 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11759: Batch checkout - Add the new template (18.22 KB, patch)
2014-04-04 08:04 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11759: Add links to the new page (2.75 KB, patch)
2014-04-04 08:04 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11759: Add some css to highlight warnings and errors (786 bytes, patch)
2014-04-04 08:05 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11759: Batch checkout - DB changes (3.11 KB, patch)
2014-04-04 08:05 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11759: (follow-up) Prevent access to the batch checkout if not allowed (4.88 KB, patch)
2014-04-04 08:05 UTC, Jonathan Druart
Details | Diff | Splinter Review
Message says "The hold will be canceled." (48.93 KB, image/png)
2014-04-04 08:59 UTC, Magnus Enger
Details
Bug 11759: FIX cancel the hold after the checkout (1.72 KB, patch)
2014-04-04 10:01 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11759: FIX Javascript error (1.31 KB, patch)
2014-04-04 10:01 UTC, Jonathan Druart
Details | Diff | Splinter Review
Checking out a book with a hold for another patron (17.29 KB, image/png)
2014-04-05 17:36 UTC, Magnus Enger
Details
Bug 11759: FIX the alert message if an item is on hold. (1.40 KB, patch)
2014-04-07 07:49 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11759: FIX issue list is empty (1.17 KB, patch)
2014-04-25 12:20 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11759: Batch checkout - prepare the ground (7.79 KB, patch)
2015-04-09 08:32 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11759: Batch checkout - Add the new template (18.27 KB, patch)
2015-04-09 08:32 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11759: Add links to the new page (2.74 KB, patch)
2015-04-09 08:32 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11759: Add some css to highlight warnings and errors (780 bytes, patch)
2015-04-09 08:32 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11759: Batch checkout - DB changes (3.24 KB, patch)
2015-04-09 08:32 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11759: (follow-up) Some fixes (7.13 KB, patch)
2015-04-09 08:32 UTC, Jonathan Druart
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 11759: Batch checkout - prepare the ground (7.86 KB, patch)
2015-04-09 09:28 UTC, Josef Moravec
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 11759: Batch checkout - Add the new template (18.34 KB, patch)
2015-04-09 09:29 UTC, Josef Moravec
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 11759: Add links to the new page (2.81 KB, patch)
2015-04-09 09:29 UTC, Josef Moravec
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 11759: Add some css to highlight warnings and errors (855 bytes, patch)
2015-04-09 09:29 UTC, Josef Moravec
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 11759: Batch checkout - DB changes (3.31 KB, patch)
2015-04-09 09:29 UTC, Josef Moravec
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 11759: (follow-up) Some fixes (7.21 KB, patch)
2015-04-09 09:29 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 11759 [QA Followup] - Fix koha-qa errors (2.76 KB, patch)
2015-04-10 13:55 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 11759 [QA Followup] - Fix koha-qa errors (2.84 KB, patch)
2015-04-10 14:15 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11759: Batch checkout - prepare the ground (7.86 KB, patch)
2015-08-20 08:09 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11759: Batch checkout - Add the new template (18.33 KB, patch)
2015-08-20 08:09 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11759: Add links to the new page (1.51 KB, patch)
2015-08-20 08:09 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11759: Add some css to highlight warnings and errors (861 bytes, patch)
2015-08-20 08:09 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11759: Batch checkout - DB changes (3.36 KB, patch)
2015-08-20 08:09 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11759: (follow-up) Some fixes (6.70 KB, patch)
2015-08-20 08:09 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11759 [QA Followup] - Fix koha-qa errors (2.78 KB, patch)
2015-08-20 08:09 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11759: Batch checkout - prepare the ground (7.96 KB, patch)
2015-08-20 13:50 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 11759: Batch checkout - Add the new template (18.43 KB, patch)
2015-08-20 13:51 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 11759: Add links to the new page (1.61 KB, patch)
2015-08-20 13:51 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 11759: Add some css to highlight warnings and errors (965 bytes, patch)
2015-08-20 13:51 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 11759: Batch checkout - DB changes (3.46 KB, patch)
2015-08-20 13:51 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 11759: (follow-up) Some fixes (6.80 KB, patch)
2015-08-20 13:51 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 11759 [QA Followup] - Fix koha-qa errors (2.88 KB, patch)
2015-08-20 13:51 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 11759: (QA followup) minor text changes (2.06 KB, patch)
2015-10-20 13:48 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 11759: (QA followup) Sysprefs should be kosher (6.32 KB, patch)
2015-10-20 13:49 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2014-02-14 10:52:22 UTC
Currently Koha does not allow to checkout several items at once to a user. This can cause a waste of time when a user want to checkout more than 10 items.

This development has been asked to have statistics on in-house use. Every night, a librarian will enter a barcode list (from a file or a scanner : the librarian scans the barcode of the documents that users let on the tables). Barcodes will be added to a statistics patron in order to count the number of items consulted.

The development has been expanded to cover another need: some special libraries (BDP for "Bibliothèque départementale de prêt": "Loan Regional Library").
These libraries loan items to smaller libraries (municipal). The number of items could be very important and the current way offered by Koha is not adequate.
Comment 1 Jonathan Druart 2014-02-14 12:30:42 UTC
Created attachment 25255 [details] [review]
Bug 11759: Batch checkout - prepare the ground

This patch does not introduce any changes.
It prepares the circulation script to accept several barcodes in
parameter.
A loop is done on all barcodes (until now, only 1) to generate a
structure to sent to the template.
At the end, only the first generated data is sent.
Comment 2 Jonathan Druart 2014-02-14 12:32:51 UTC
Created attachment 25256 [details] [review]
Bug 11759: Batch checkout - Add the new template

This patch is the main patch.
It adds:
- the new template circ/circulation_batch_checkouts.tt
- the change into circ/circulation.pl

=== Why this feature is useful for some libraries? ===

Currently Koha does not allow to checkout several items at once to a
user. This can cause a waste of time when a user want to checkout more
than 10 items.

This development has been asked to have statistics on in-house use.
Every night, a librarian will enter a barcode list (from a file or a
scanner : the librarian scans the barcode of the documents that users
let on the tables). Barcodes will be added to a statistics patron in
order to count the number of items consulted.

The development has been expanded to cover another need: some special
libraries (BDP for "Bibliotheque departementale de pret": "Loan Regional
Library").
These libraries loan items to smaller libraries (municipal). The number
of items could be very important and the current way offered by Koha is
not adequate.

=== Test plan ===
0/ Apply all patches and execute the DB change entry.
1/ Verify you are abble to do some checkouts (with confirmations,
errors).

= Statistics way =
2/ Create a statistical patron (e.g. category code STATS).
3/ Update the batch_checkouts pref with the category code (STATS).
4/ Go on the member page and verify the new "Batch check out" tab
appears (and only for this user).
5/ Check some items out on the new page using the textarea or a file.
6/ Verify the table contains the item's information and the
"Information" column contains "Local use recorded".

= Real checkouts =
7/ Create a non statistical patron and update the pref.
8/ Check some items out on the new page using the textarea or a file.
9/ Verify the information in the table is consistent.
10/ Verify item without confirmation needed or impossible alert is
checked out.
11/ If the logged in user has the "force_checkout" permission, all
checkouts with a "confirmation needed" message can be done.
If the logged in user does not have it, there is no way to force the
checkout.
Comment 3 Jonathan Druart 2014-02-14 12:32:58 UTC
Created attachment 25257 [details] [review]
Bug 11759: Add links to the new page
Comment 4 Jonathan Druart 2014-02-14 12:33:03 UTC
Created attachment 25258 [details] [review]
Bug 11759: Add some css to highlight warnings and errors
Comment 5 Jonathan Druart 2014-02-14 12:33:11 UTC
Created attachment 25260 [details] [review]
Bug 11759: Batch checkout - DB changes

Add the new pref batch_checkouts in DB.
Comment 6 Jonathan Druart 2014-02-14 12:37:00 UTC
Note this development has not been tested and is not waiting to be signed off.
Comment 7 Jonathan Druart 2014-02-25 16:56:20 UTC
Created attachment 25620 [details] [review]
Bug 11759: (follow-up) Prevent access to the batch checkout if not allowed

If a user pass '&batch=1' to the url, he was allowed to access to the
batch checkout page even if the patron is not in an authorised category.

This patch also fixes the link to "Batch check out" from the "Details"
tab (cf changes in circ-menu.inc).
Comment 8 Jonathan Druart 2014-03-19 08:37:28 UTC
Created attachment 26442 [details] [review]
Bug 11759: (follow-up) Prevent access to the batch checkout if not allowed

If a user pass '&batch=1' to the url, he was allowed to access to the
batch checkout page even if the patron is not in an authorised category.

This patch also fixes the link to "Batch check out" from the "Details"
tab (cf changes in circ-menu.inc).
Comment 9 Jonathan Druart 2014-03-19 08:39:16 UTC
The last patch fixes an issue: all patron cards were expired.
Comment 10 Jonathan Druart 2014-03-19 15:18:25 UTC
Created attachment 26455 [details] [review]
Bug 11759: (follow-up) Prevent access to the batch checkout if not allowed

If a user pass '&batch=1' to the url, he was allowed to access to the
batch checkout page even if the patron is not in an authorised category.

This patch also fixes the link to "Batch check out" from the "Details"
tab (cf changes in circ-menu.inc).
Comment 11 David Cook 2014-03-26 06:16:55 UTC
I'm not certain about the utility of this patch...

What happens if an item has a hold, can't be checked out to that patron, etc.?
Comment 12 Jonathan Druart 2014-03-26 08:19:13 UTC
(In reply to David Cook from comment #11)
> I'm not certain about the utility of this patch...

I tried to explain the goal of the patch in the description of this report.

> What happens if an item has a hold, can't be checked out to that patron,
> etc.?

This patch catches errors/warnings using the same tests as the "normal" checkout.
Comment 13 Magnus Enger 2014-04-04 07:48:46 UTC
$ git bz apply 11759
Bug 11759 - Batch checkout

25255 - Bug 11759: Batch checkout - prepare the ground
25256 - Bug 11759: Batch checkout - Add the new template
25257 - Bug 11759: Add links to the new page
25258 - Bug 11759: Add some css to highlight warnings and errors
25260 - Bug 11759: Batch checkout - DB changes
26455 - Bug 11759: (follow-up) Prevent access to the batch checkout if not allowed

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 11759: Batch checkout - prepare the ground
Applying: Bug 11759: Batch checkout - Add the new template
fatal: sha1 information is lacking or useless (circ/circulation.pl).
Repository lacks necessary blobs to fall back on 3-way merge.
Cannot fall back to three-way merge.
Patch failed at 0001 Bug 11759: Batch checkout - Add the new template
The copy of the patch that failed is found in:
   /home/magnus/scripts/kohaclone/.git/rebase-apply/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-11759-Batch-checkout---Add-the-new-template-tEAbBf.patch
Comment 14 Jonathan Druart 2014-04-04 08:04:47 UTC
Created attachment 26806 [details] [review]
Bug 11759: Batch checkout - prepare the ground

This patch does not introduce any changes.
It prepares the circulation script to accept several barcodes in
parameter.
A loop is done on all barcodes (until now, only 1) to generate a
structure to sent to the template.
At the end, only the first generated data is sent.
Comment 15 Jonathan Druart 2014-04-04 08:04:52 UTC
Created attachment 26807 [details] [review]
Bug 11759: Batch checkout - Add the new template

This patch is the main patch.
It adds:
- the new template circ/circulation_batch_checkouts.tt
- the change into circ/circulation.pl

=== Why this feature is useful for some libraries? ===

Currently Koha does not allow to checkout several items at once to a
user. This can cause a waste of time when a user want to checkout more
than 10 items.

This development has been asked to have statistics on in-house use.
Every night, a librarian will enter a barcode list (from a file or a
scanner : the librarian scans the barcode of the documents that users
let on the tables). Barcodes will be added to a statistics patron in
order to count the number of items consulted.

The development has been expanded to cover another need: some special
libraries (BDP for "Bibliotheque departementale de pret": "Loan Regional
Library").
These libraries loan items to smaller libraries (municipal). The number
of items could be very important and the current way offered by Koha is
not adequate.

=== Test plan ===
0/ Apply all patches and execute the DB change entry.
1/ Verify you are abble to do some checkouts (with confirmations,
errors).

= Statistics way =
2/ Create a statistical patron (e.g. category code STATS).
3/ Update the batch_checkouts pref with the category code (STATS).
4/ Go on the member page and verify the new "Batch check out" tab
appears (and only for this user).
5/ Check some items out on the new page using the textarea or a file.
6/ Verify the table contains the item's information and the
"Information" column contains "Local use recorded".

= Real checkouts =
7/ Create a non statistical patron and update the pref.
8/ Check some items out on the new page using the textarea or a file.
9/ Verify the information in the table is consistent.
10/ Verify item without confirmation needed or impossible alert is
checked out.
11/ If the logged in user has the "force_checkout" permission, all
checkouts with a "confirmation needed" message can be done.
If the logged in user does not have it, there is no way to force the
checkout.
Comment 16 Jonathan Druart 2014-04-04 08:04:57 UTC
Created attachment 26808 [details] [review]
Bug 11759: Add links to the new page
Comment 17 Jonathan Druart 2014-04-04 08:05:02 UTC
Created attachment 26809 [details] [review]
Bug 11759: Add some css to highlight warnings and errors
Comment 18 Jonathan Druart 2014-04-04 08:05:07 UTC
Created attachment 26810 [details] [review]
Bug 11759: Batch checkout - DB changes

Add the new pref batch_checkouts in DB.
Comment 19 Jonathan Druart 2014-04-04 08:05:12 UTC
Created attachment 26811 [details] [review]
Bug 11759: (follow-up) Prevent access to the batch checkout if not allowed

If a user pass '&batch=1' to the url, he was allowed to access to the
batch checkout page even if the patron is not in an authorised category.

This patch also fixes the link to "Batch check out" from the "Details"
tab (cf changes in circ-menu.inc).
Comment 20 Magnus Enger 2014-04-04 08:59:15 UTC
Created attachment 26813 [details]
Message says "The hold will be canceled."

Just a question:

If I include an item with a (item level) hold in the batch, I get the attached message, which says:

"This Item has been on hold for another patron. The hold will be canceled." 

But when I click on the "Checkout or renew" button, the hold is not actually cancelled, just overridden so the item can be issued to the current patron. Is the hold really ment to be cancelled? I think it would work if the message was something like:

"This item is on hold for another patron. The hold will be overridden, but not cancelled."
Comment 21 Magnus Enger 2014-04-04 09:00:46 UTC
And let me just add that everything else seems to be working fine so far, and I think this will be a very good enhancement, speeding up the checkout process a lot!
Comment 22 Jonathan Druart 2014-04-04 10:01:48 UTC
Created attachment 26814 [details] [review]
Bug 11759: FIX cancel the hold after the checkout

If an item is on hold, it will be cancelled after the checkout.
Comment 23 Jonathan Druart 2014-04-04 10:01:54 UTC
Created attachment 26815 [details] [review]
Bug 11759: FIX Javascript error

The following JS error occurred:
  ReferenceError: MSG_ADD_MESSAGE is not defined

The circulation.js file is useless and should not be included.
Comment 24 Jonathan Druart 2014-04-04 10:02:42 UTC
(In reply to Magnus Enger from comment #20)

Thanks for testing Magnus!

> If I include an item with a (item level) hold in the batch, I get the
> attached message, which says:
> 
> "This Item has been on hold for another patron. The hold will be canceled." 

Yes, it is the expected behavior. I provided a followup.
Comment 25 Katrin Fischer 2014-04-05 07:43:23 UTC
Hm I think I agree with Magnus here. I am not sure cancelling the hold makes sense - why not just check it out to the other patron, but leave the hold intact so the other patron can get the book later?
Comment 26 Magnus Enger 2014-04-05 17:36:07 UTC
Created attachment 26833 [details]
Checking out a book with a hold for another patron

Item X is on the shelf, but also on hold for Patron A. Patron B finds it on the shelf and takes it to the checkout desk. The librarian is given the option to check the book out to Patron B or not, and optionally to delete the hold for Patron A.
Comment 27 Magnus Enger 2014-04-05 17:51:08 UTC
With the new patch series, holds for other patrons are cancelled/deleted when a book is checked out with batch checkout. This is the opposite behaviour of the "normal" checkout (see attachment 26833 [details] and comment 26). 

I think the default has to be to keep the holds, but possibly with an *option* to delete them, like in the "normal" checkout. Marking as "failed QA". 

Jonathan: Can you try and explain why you think the holds should be deleted? I hope we can resolve this quickly, I'd love to see this in 3.16!
Comment 28 Jonathan Druart 2014-04-07 07:47:40 UTC
(In reply to Magnus Enger from comment #27)
> Jonathan: Can you try and explain why you think the holds should be deleted?
> I hope we can resolve this quickly, I'd love to see this in 3.16!

No, you are right, we should apply the default behavior.
Comment 29 Jonathan Druart 2014-04-07 07:49:44 UTC
Created attachment 26854 [details] [review]
Bug 11759: FIX the alert message if an item is on hold.

If an item is on hold, the hold is not cancelled.
This patch corrects the message displayed in this case.
Comment 30 Jonathan Druart 2014-04-25 12:20:42 UTC
Created attachment 27613 [details] [review]
Bug 11759: FIX issue list is empty

The issue list is empty after checking an item out to a patron without
existing checkout.

To reproduce:
- Search for a patron without checkout.
- Check an item out using the "normal" checkout.
- Verify the checkout list contain the checkout.
Comment 31 Jonathan Druart 2014-07-03 15:00:46 UTC
I mark this patch set as does not apply since bug 11703 is going to be pushed.

Jesse, Kyle told me you are working on ajaxify checkouts. Please let me know what you are doing. I would prefer to base a rebase of this feature on top of your work :)
Comment 32 Viktor Sarge 2014-08-06 07:10:48 UTC
+1 for batch checkout. Is there any need to coordinate the efforts with bug 11858 (RFID) where the RFC states batch checkouts as a specific use case?
Comment 33 David Cook 2014-08-22 03:49:44 UTC
A few thoughts:

1) Do we need to have a separate batch checkout page? Or can we add batch checkout functionality to the existing checkout page? (Perhaps having "Single" and "Batch" tabs in the UI)

2) As Viktor pointed out, how could this work with a RFID scanner providing multiple barcodes at once? 

In my case, I have a RFID scanner that is returning comma-separated barcodes (e.g. 12345,67890,111213). I suppose this case is similar to the textarea case, except for a difference with separator, and the RFID scanner sends a carriage return at the end of the concatenated barcode string to trigger a submit...

Tricky...
Comment 34 Viktor Sarge 2014-08-22 07:53:18 UTC
> 1) Do we need to have a separate batch checkout page? Or can we add batch
> checkout functionality to the existing checkout page? (Perhaps having
> "Single" and "Batch" tabs in the UI)

Both works for me but If possible I personally prefer not ever having to say "Oh, but you see that's a batch checkout and has it's own module". If the existing interface could handle it I'd prefer to just expand it's functionality. 

> 2) As Viktor pointed out, how could this work with a RFID scanner providing
> multiple barcodes at once? 
> 
> In my case, I have a RFID scanner that is returning comma-separated barcodes
> (e.g. 12345,67890,111213). I suppose this case is similar to the textarea
> case, except for a difference with separator, and the RFID scanner sends a
> carriage return at the end of the concatenated barcode string to trigger a
> submit...
> 
> Tricky...

I guess the first choice is handling it server side or client wise. With the Ajax circulation I guess you could actually have a javascript that slices the barcodes and sends them one by one(?). I guess you could even make it possible to do multiple batch scans and just append all new barcodes to the queue to be handled by the script. 

Not an authority on the internals of Koha though so it's really just my two cents.
Comment 35 Jonathan Druart 2015-04-09 08:32:06 UTC
Created attachment 37603 [details] [review]
Bug 11759: Batch checkout - prepare the ground

This patch does not introduce any changes.
It prepares the circulation script to accept several barcodes in
parameter.
A loop is done on all barcodes (until now, only 1) to generate a
structure to sent to the template.
At the end, only the first generated data is sent.
Comment 36 Jonathan Druart 2015-04-09 08:32:14 UTC
Created attachment 37604 [details] [review]
Bug 11759: Batch checkout - Add the new template

This patch is the main patch.
It adds:
- the new template circ/circulation_batch_checkouts.tt
- the change into circ/circulation.pl

=== Why this feature is useful for some libraries? ===

Currently Koha does not allow to checkout several items at once to a
user. This can cause a waste of time when a user want to checkout more
than 10 items.

This development has been asked to have statistics on in-house use.
Every night, a librarian will enter a barcode list (from a file or a
scanner : the librarian scans the barcode of the documents that users
let on the tables). Barcodes will be added to a statistics patron in
order to count the number of items consulted.

The development has been expanded to cover another need: some special
libraries (BDP for "Bibliotheque departementale de pret": "Loan Regional
Library").
These libraries loan items to smaller libraries (municipal). The number
of items could be very important and the current way offered by Koha is
not adequate.

=== Test plan ===
0/ Apply all patches and execute the DB change entry.
1/ Verify you are abble to do some checkouts (with confirmations,
errors).

= Statistics way =
2/ Create a statistical patron (e.g. category code STATS).
3/ Update the batch_checkouts pref with the category code (STATS).
4/ Go on the member page and verify the new "Batch check out" tab
appears (and only for this user).
5/ Check some items out on the new page using the textarea or a file.
6/ Verify the table contains the item's information and the
"Information" column contains "Local use recorded".

= Real checkouts =
7/ Create a non statistical patron and update the pref.
8/ Check some items out on the new page using the textarea or a file.
9/ Verify the information in the table is consistent.
10/ Verify item without confirmation needed or impossible alert is
checked out.
11/ If the logged in user has the "force_checkout" permission, all
checkouts with a "confirmation needed" message can be done.
If the logged in user does not have it, there is no way to force the
checkout.
Comment 37 Jonathan Druart 2015-04-09 08:32:19 UTC
Created attachment 37605 [details] [review]
Bug 11759: Add links to the new page
Comment 38 Jonathan Druart 2015-04-09 08:32:25 UTC
Created attachment 37606 [details] [review]
Bug 11759: Add some css to highlight warnings and errors
Comment 39 Jonathan Druart 2015-04-09 08:32:30 UTC
Created attachment 37607 [details] [review]
Bug 11759: Batch checkout - DB changes

Add the new pref batch_checkouts in DB.
Comment 40 Jonathan Druart 2015-04-09 08:32:36 UTC
Created attachment 37608 [details] [review]
Bug 11759: (follow-up) Some fixes

This is a squash of the following patches:

Bug 11759: (follow-up) Prevent access to the batch checkout if not allowed

If a user pass '&batch=1' to the url, he was allowed to access to the
batch checkout page even if the patron is not in an authorised
category.

This patch also fixes the link to "Batch check out" from the "Details"
tab (cf changes in circ-menu.inc).

Bug 11759: FIX Javascript error

The following JS error occurred:
  ReferenceError: MSG_ADD_MESSAGE is not defined

The circulation.js file is useless and should not be included.

Bug 11759: FIX the alert message if an item is on hold.

If an item is on hold, the hold is not cancelled.
This patch corrects the message displayed in this case.

Bug 11759: FIX issue list is empty

The issue list is empty after checking an item out to a patron without
existing checkout.

To reproduce:
- Search for a patron without checkout.
- Check an item out using the "normal" checkout.
- Verify the checkout list contain the checkout.
Comment 41 Jonathan Druart 2015-04-09 08:36:17 UTC
A quick note on this feature: I took a moment to rebase it, I tested it quickly and it seems to work as expected (i.e. as developed initially).
This is more or less abandoned on the BibLibre side, so I don't plan to spent time on enhancement request: it should be took as it, or find someone else to do the job.
Of course, I am still around for a quick fix if needed.
Comment 42 Josef Moravec 2015-04-09 09:28:57 UTC
Created attachment 37609 [details] [review]
[SIGNED-OFF] Bug 11759: Batch checkout - prepare the ground

This patch does not introduce any changes.
It prepares the circulation script to accept several barcodes in
parameter.
A loop is done on all barcodes (until now, only 1) to generate a
structure to sent to the template.
At the end, only the first generated data is sent.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 43 Josef Moravec 2015-04-09 09:29:14 UTC
Created attachment 37610 [details] [review]
[SIGNED-OFF] Bug 11759: Batch checkout - Add the new template

This patch is the main patch.
It adds:
- the new template circ/circulation_batch_checkouts.tt
- the change into circ/circulation.pl

=== Why this feature is useful for some libraries? ===

Currently Koha does not allow to checkout several items at once to a
user. This can cause a waste of time when a user want to checkout more
than 10 items.

This development has been asked to have statistics on in-house use.
Every night, a librarian will enter a barcode list (from a file or a
scanner : the librarian scans the barcode of the documents that users
let on the tables). Barcodes will be added to a statistics patron in
order to count the number of items consulted.

The development has been expanded to cover another need: some special
libraries (BDP for "Bibliotheque departementale de pret": "Loan Regional
Library").
These libraries loan items to smaller libraries (municipal). The number
of items could be very important and the current way offered by Koha is
not adequate.

=== Test plan ===
0/ Apply all patches and execute the DB change entry.
1/ Verify you are abble to do some checkouts (with confirmations,
errors).

= Statistics way =
2/ Create a statistical patron (e.g. category code STATS).
3/ Update the batch_checkouts pref with the category code (STATS).
4/ Go on the member page and verify the new "Batch check out" tab
appears (and only for this user).
5/ Check some items out on the new page using the textarea or a file.
6/ Verify the table contains the item's information and the
"Information" column contains "Local use recorded".

= Real checkouts =
7/ Create a non statistical patron and update the pref.
8/ Check some items out on the new page using the textarea or a file.
9/ Verify the information in the table is consistent.
10/ Verify item without confirmation needed or impossible alert is
checked out.
11/ If the logged in user has the "force_checkout" permission, all
checkouts with a "confirmation needed" message can be done.
If the logged in user does not have it, there is no way to force the
checkout.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 44 Josef Moravec 2015-04-09 09:29:24 UTC
Created attachment 37611 [details] [review]
[SIGNED-OFF] Bug 11759: Add links to the new page

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 45 Josef Moravec 2015-04-09 09:29:31 UTC
Created attachment 37612 [details] [review]
[SIGNED-OFF] Bug 11759: Add some css to highlight warnings and errors

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 46 Josef Moravec 2015-04-09 09:29:41 UTC
Created attachment 37613 [details] [review]
[SIGNED-OFF] Bug 11759: Batch checkout - DB changes

Add the new pref batch_checkouts in DB.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 47 Josef Moravec 2015-04-09 09:29:51 UTC
Created attachment 37614 [details] [review]
[SIGNED-OFF] Bug 11759: (follow-up) Some fixes

This is a squash of the following patches:

Bug 11759: (follow-up) Prevent access to the batch checkout if not allowed

If a user pass '&batch=1' to the url, he was allowed to access to the
batch checkout page even if the patron is not in an authorised
category.

This patch also fixes the link to "Batch check out" from the "Details"
tab (cf changes in circ-menu.inc).

Bug 11759: FIX Javascript error

The following JS error occurred:
  ReferenceError: MSG_ADD_MESSAGE is not defined

The circulation.js file is useless and should not be included.

Bug 11759: FIX the alert message if an item is on hold.

If an item is on hold, the hold is not cancelled.
This patch corrects the message displayed in this case.

Bug 11759: FIX issue list is empty

The issue list is empty after checking an item out to a patron without
existing checkout.

To reproduce:
- Search for a patron without checkout.
- Check an item out using the "normal" checkout.
- Verify the checkout list contain the checkout.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 48 Josef Moravec 2015-04-09 09:33:03 UTC
Thank you Jonathan,

I've just test it, and everything seems to work as expected, so I'm signing off.

For me it's fine now.
Comment 49 Kyle M Hall 2015-04-10 13:55:35 UTC
Created attachment 37650 [details] [review]
Bug 11759 [QA Followup] - Fix koha-qa errors
Comment 50 Kyle M Hall 2015-04-10 14:04:49 UTC
Jonathan, can you check my followup? I don't understand the double call to GetMemberIssuesAndFines
Comment 51 Jonathan Druart 2015-04-10 14:13:58 UTC
Comment on attachment 37650 [details] [review]
Bug 11759 [QA Followup] - Fix koha-qa errors

Review of attachment 37650 [details] [review]:
-----------------------------------------------------------------

All is good, thanks!

::: circ/circulation.pl
@@ -400,4 @@
>                  $template_params->{getTitleMessageIteminfo} = $iteminfo->{'title'};
>                  $template_params->{getBarcodeMessageIteminfo} = $iteminfo->{'barcode'};
>                  $template_params->{NEEDSCONFIRMATION} = 1;
> -                $template_params->{onsite_checkout} => $onsite_checkout,

oops, thanks!

@@ -413,5 @@
>  
>      my ( $od, $issue, $fines ) = GetMemberIssuesAndFines($borrowernumber);
>  
> -    # FIXME If the issue is confirmed, we launch another time GetMemberIssuesAndFines, now display the issue count after issue
> -    my ( $od, $issue, $fines ) = GetMemberIssuesAndFines( $borrowernumber );

It a bad conflict issue. The fixme has already been removed on master.
Comment 52 Jonathan Druart 2015-04-10 14:15:49 UTC
Created attachment 37653 [details] [review]
Bug 11759 [QA Followup] - Fix koha-qa errors

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 53 Jonathan Druart 2015-08-20 08:09:14 UTC
Created attachment 41692 [details] [review]
Bug 11759: Batch checkout - prepare the ground

This patch does not introduce any changes.
It prepares the circulation script to accept several barcodes in
parameter.
A loop is done on all barcodes (until now, only 1) to generate a
structure to sent to the template.
At the end, only the first generated data is sent.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 54 Jonathan Druart 2015-08-20 08:09:19 UTC
Created attachment 41693 [details] [review]
Bug 11759: Batch checkout - Add the new template

This patch is the main patch.
It adds:
- the new template circ/circulation_batch_checkouts.tt
- the change into circ/circulation.pl

=== Why this feature is useful for some libraries? ===

Currently Koha does not allow to checkout several items at once to a
user. This can cause a waste of time when a user want to checkout more
than 10 items.

This development has been asked to have statistics on in-house use.
Every night, a librarian will enter a barcode list (from a file or a
scanner : the librarian scans the barcode of the documents that users
let on the tables). Barcodes will be added to a statistics patron in
order to count the number of items consulted.

The development has been expanded to cover another need: some special
libraries (BDP for "Bibliotheque departementale de pret": "Loan Regional
Library").
These libraries loan items to smaller libraries (municipal). The number
of items could be very important and the current way offered by Koha is
not adequate.

=== Test plan ===
0/ Apply all patches and execute the DB change entry.
1/ Verify you are abble to do some checkouts (with confirmations,
errors).

= Statistics way =
2/ Create a statistical patron (e.g. category code STATS).
3/ Update the batch_checkouts pref with the category code (STATS).
4/ Go on the member page and verify the new "Batch check out" tab
appears (and only for this user).
5/ Check some items out on the new page using the textarea or a file.
6/ Verify the table contains the item's information and the
"Information" column contains "Local use recorded".

= Real checkouts =
7/ Create a non statistical patron and update the pref.
8/ Check some items out on the new page using the textarea or a file.
9/ Verify the information in the table is consistent.
10/ Verify item without confirmation needed or impossible alert is
checked out.
11/ If the logged in user has the "force_checkout" permission, all
checkouts with a "confirmation needed" message can be done.
If the logged in user does not have it, there is no way to force the
checkout.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 55 Jonathan Druart 2015-08-20 08:09:24 UTC
Created attachment 41694 [details] [review]
Bug 11759: Add links to the new page

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 56 Jonathan Druart 2015-08-20 08:09:30 UTC
Created attachment 41695 [details] [review]
Bug 11759: Add some css to highlight warnings and errors

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 57 Jonathan Druart 2015-08-20 08:09:36 UTC
Created attachment 41696 [details] [review]
Bug 11759: Batch checkout - DB changes

Add the new pref batch_checkouts in DB.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 58 Jonathan Druart 2015-08-20 08:09:41 UTC
Created attachment 41697 [details] [review]
Bug 11759: (follow-up) Some fixes

This is a squash of the following patches:

Bug 11759: (follow-up) Prevent access to the batch checkout if not allowed

If a user pass '&batch=1' to the url, he was allowed to access to the
batch checkout page even if the patron is not in an authorised
category.

This patch also fixes the link to "Batch check out" from the "Details"
tab (cf changes in circ-menu.inc).

Bug 11759: FIX Javascript error

The following JS error occurred:
  ReferenceError: MSG_ADD_MESSAGE is not defined

The circulation.js file is useless and should not be included.

Bug 11759: FIX the alert message if an item is on hold.

If an item is on hold, the hold is not cancelled.
This patch corrects the message displayed in this case.

Bug 11759: FIX issue list is empty

The issue list is empty after checking an item out to a patron without
existing checkout.

To reproduce:
- Search for a patron without checkout.
- Check an item out using the "normal" checkout.
- Verify the checkout list contain the checkout.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 59 Jonathan Druart 2015-08-20 08:09:47 UTC
Created attachment 41698 [details] [review]
Bug 11759 [QA Followup] - Fix koha-qa errors

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 60 Viktor Sarge 2015-08-20 12:43:04 UTC
Seems to work as advertised in the testplan and may prove quite useful for using RFID readers that send all barcodes in a batch.
Comment 61 Marcel de Rooy 2015-08-20 13:50:41 UTC
Created attachment 41735 [details] [review]
Bug 11759: Batch checkout - prepare the ground

This patch does not introduce any changes.
It prepares the circulation script to accept several barcodes in
parameter.
A loop is done on all barcodes (until now, only 1) to generate a
structure to sent to the template.
At the end, only the first generated data is sent.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 62 Marcel de Rooy 2015-08-20 13:51:15 UTC
Created attachment 41736 [details] [review]
Bug 11759: Batch checkout - Add the new template

This patch is the main patch.
It adds:
- the new template circ/circulation_batch_checkouts.tt
- the change into circ/circulation.pl

=== Why this feature is useful for some libraries? ===

Currently Koha does not allow to checkout several items at once to a
user. This can cause a waste of time when a user want to checkout more
than 10 items.

This development has been asked to have statistics on in-house use.
Every night, a librarian will enter a barcode list (from a file or a
scanner : the librarian scans the barcode of the documents that users
let on the tables). Barcodes will be added to a statistics patron in
order to count the number of items consulted.

The development has been expanded to cover another need: some special
libraries (BDP for "Bibliotheque departementale de pret": "Loan Regional
Library").
These libraries loan items to smaller libraries (municipal). The number
of items could be very important and the current way offered by Koha is
not adequate.

=== Test plan ===
0/ Apply all patches and execute the DB change entry.
1/ Verify you are abble to do some checkouts (with confirmations,
errors).

= Statistics way =
2/ Create a statistical patron (e.g. category code STATS).
3/ Update the batch_checkouts pref with the category code (STATS).
4/ Go on the member page and verify the new "Batch check out" tab
appears (and only for this user).
5/ Check some items out on the new page using the textarea or a file.
6/ Verify the table contains the item's information and the
"Information" column contains "Local use recorded".

= Real checkouts =
7/ Create a non statistical patron and update the pref.
8/ Check some items out on the new page using the textarea or a file.
9/ Verify the information in the table is consistent.
10/ Verify item without confirmation needed or impossible alert is
checked out.
11/ If the logged in user has the "force_checkout" permission, all
checkouts with a "confirmation needed" message can be done.
If the logged in user does not have it, there is no way to force the
checkout.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 63 Marcel de Rooy 2015-08-20 13:51:22 UTC
Created attachment 41737 [details] [review]
Bug 11759: Add links to the new page

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 64 Marcel de Rooy 2015-08-20 13:51:27 UTC
Created attachment 41738 [details] [review]
Bug 11759: Add some css to highlight warnings and errors

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 65 Marcel de Rooy 2015-08-20 13:51:32 UTC
Created attachment 41739 [details] [review]
Bug 11759: Batch checkout - DB changes

Add the new pref batch_checkouts in DB.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 66 Marcel de Rooy 2015-08-20 13:51:37 UTC
Created attachment 41740 [details] [review]
Bug 11759: (follow-up) Some fixes

This is a squash of the following patches:

Bug 11759: (follow-up) Prevent access to the batch checkout if not allowed

If a user pass '&batch=1' to the url, he was allowed to access to the
batch checkout page even if the patron is not in an authorised
category.

This patch also fixes the link to "Batch check out" from the "Details"
tab (cf changes in circ-menu.inc).

Bug 11759: FIX Javascript error

The following JS error occurred:
  ReferenceError: MSG_ADD_MESSAGE is not defined

The circulation.js file is useless and should not be included.

Bug 11759: FIX the alert message if an item is on hold.

If an item is on hold, the hold is not cancelled.
This patch corrects the message displayed in this case.

Bug 11759: FIX issue list is empty

The issue list is empty after checking an item out to a patron without
existing checkout.

To reproduce:
- Search for a patron without checkout.
- Check an item out using the "normal" checkout.
- Verify the checkout list contain the checkout.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 67 Marcel de Rooy 2015-08-20 13:51:43 UTC
Created attachment 41741 [details] [review]
Bug 11759 [QA Followup] - Fix koha-qa errors

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 68 Marcel de Rooy 2015-08-20 13:57:37 UTC
QA Comment:
I am passing qa on this patch set, but it is not completely without some doubts.
I saw some minor details needing attention (spelling, warning, count) but the functionality point below could be a discussion on itself..

Functionality: We also have something similar in Offline circulation. You can checkin, checkout etc. with koc files. 

Spelling:  Allow patron categories allowed
Idem: Breadcrumbs:  Checkouts a batch

Warning: Note that adding batch=1 to the URL does not imply that there is a borrowernumber
circulation.pl: Use of uninitialized value in regexp compilation at /home/koha/testclone/circ/circulation.pl line 120.

@$barcodes = $query->param('barcodes');
/cgi-bin/koha/circ/circulation.pl?borrowernumber=4&barcodes=1&barcodes=2
This results in "1 checkouts" tab with 2 entries (!!)

Passed QA
Comment 69 Tomás Cohen Arazi 2015-10-20 13:48:38 UTC
Created attachment 43626 [details] [review]
Bug 11759: (QA followup) minor text changes

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 70 Tomás Cohen Arazi 2015-10-20 13:49:03 UTC
Created attachment 43627 [details] [review]
Bug 11759: (QA followup) Sysprefs should be kosher

The introduced syspref was defined before we added new guidelines
for them. This patch puts them in sync with current standards. It also
splits them into:

 - A big on/off switch (BatchCheckouts)
 - Patron category filter (BatchCheckoutsValidCategories)

The latter is expected to go away if we move this into a boolean column
on the 'categories' table, which seems a better approach. I'm filling a
new bug for this last comment.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 71 Tomás Cohen Arazi 2015-10-20 13:56:22 UTC
Patches pushed to master.

Good job Jonathan!

PS. I'm filling a couple followup bugs that I will link. I hope someone can
take a look before the release.
Comment 72 Marcel de Rooy 2015-10-22 06:50:36 UTC
(In reply to Tomás Cohen Arazi from comment #70)
> The introduced syspref was defined before we added new guidelines
> for them. 

Where can we find those guidelines btw ?
Comment 73 David Cook 2015-12-07 22:09:26 UTC
Frédéric, I think the text you put into "Text to go in the release notes" has been truncated :(