Bug 8179 - Receiving multiple order lines at once
Summary: Receiving multiple order lines at once
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement with 50 votes (vote)
Assignee: Agustín Moyano
QA Contact:
URL:
Keywords:
Depends on: 20212 26635 18050 23376
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-01 13:55 UTC by Fred P
Modified: 2021-05-06 12:46 UTC (History)
23 users (show)

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


Attachments
Our local Acquisitions Workflow (109.26 KB, application/pdf)
2012-06-01 14:14 UTC, Fred P
Details
Bug 8179: Add tests (4.43 KB, patch)
2020-10-09 23:03 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Add syspref to database (2.61 KB, patch)
2020-10-09 23:03 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Add AcqReceiveMultipleOrderLines syspref to preference configuration (1.31 KB, patch)
2020-10-09 23:03 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Receive multiple orders (102.44 KB, patch)
2020-10-09 23:04 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Add tests (4.48 KB, patch)
2020-10-27 11:01 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Add syspref to database (2.65 KB, patch)
2020-10-27 11:01 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Add AcqReceiveMultipleOrderLines syspref to preference configuration (1.31 KB, patch)
2020-10-27 11:01 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Receive multiple orders (102.42 KB, patch)
2020-10-27 11:01 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Set render functions in every column (5.54 KB, patch)
2020-10-27 18:03 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Add tests (4.48 KB, patch)
2020-10-28 14:46 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Add syspref to database (2.65 KB, patch)
2020-10-28 14:46 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Add AcqReceiveMultipleOrderLines syspref to preference configuration (1.31 KB, patch)
2020-10-28 14:46 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Receive multiple orders (106.88 KB, patch)
2020-10-28 14:47 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Add tests (4.48 KB, patch)
2020-10-30 18:46 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Add syspref to database (2.65 KB, patch)
2020-10-30 18:46 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Add AcqReceiveMultipleOrderLines syspref to preference configuration (1.31 KB, patch)
2020-10-30 18:46 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Receive multiple orders (107.39 KB, patch)
2020-10-30 18:47 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Add tests (4.53 KB, patch)
2020-12-23 20:19 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Add syspref to database (2.65 KB, patch)
2020-12-23 20:19 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Add AcqReceiveMultipleOrderLines syspref to preference configuration (1.31 KB, patch)
2020-12-23 20:19 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Receive multiple orders (107.60 KB, patch)
2020-12-23 20:19 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Add tests (4.53 KB, patch)
2021-02-09 15:15 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Add syspref to database (2.65 KB, patch)
2021-02-09 15:15 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Add AcqReceiveMultipleOrderLines syspref to preference configuration (1.41 KB, patch)
2021-02-09 15:16 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Receive multiple orders (103.06 KB, patch)
2021-02-09 15:16 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Add tests (4.60 KB, patch)
2021-02-09 15:30 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Add syspref to database (2.72 KB, patch)
2021-02-09 15:30 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Add AcqReceiveMultipleOrderLines syspref to preference configuration (1.47 KB, patch)
2021-02-09 15:30 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Receive multiple orders (103.12 KB, patch)
2021-02-09 15:31 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Add tests (4.60 KB, patch)
2021-02-10 16:01 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Add syspref to database (2.72 KB, patch)
2021-02-10 16:01 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Add AcqReceiveMultipleOrderLines syspref to preference configuration (1.47 KB, patch)
2021-02-10 16:01 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Receive multiple orders (103.31 KB, patch)
2021-02-10 16:01 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Add tests (4.60 KB, patch)
2021-02-17 15:23 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Add syspref to database (2.72 KB, patch)
2021-02-17 15:23 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Add AcqReceiveMultipleOrderLines syspref to preference configuration (1.47 KB, patch)
2021-02-17 15:23 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Receive multiple orders (103.31 KB, patch)
2021-02-17 15:24 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Add tests (4.60 KB, patch)
2021-04-05 14:17 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Add syspref to database (2.72 KB, patch)
2021-04-05 14:17 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Add AcqReceiveMultipleOrderLines syspref to preference configuration (1.47 KB, patch)
2021-04-05 14:17 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Receive multiple orders (102.72 KB, patch)
2021-04-05 14:17 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Add tests (4.60 KB, patch)
2021-05-06 12:45 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Add syspref to database (2.68 KB, patch)
2021-05-06 12:45 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Add AcqReceiveMultipleOrderLines syspref to preference configuration (1.47 KB, patch)
2021-05-06 12:46 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 8179: Receive multiple orders (102.84 KB, patch)
2021-05-06 12:46 UTC, Agustín Moyano
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Fred P 2012-06-01 13:55:55 UTC
Our Acquisitions workflow is currently hindered by a repetitive process of
receiving individual items. The parcel.pl and orderreceive.pl scripts in Koha
3.5 do not provide us with a way to checkbox individual items for receipt, or
alternatively, "Receive All." We have to click receive on each item, then save
the individual item and return to the receive screen. On orders where we have a
hundred items, you can imagine this process of receiving is very tiresome, when
a "Receive All" function could be implemented.

  Because several Acquisitions team members may be receiving items in the same
basket, a checkbox on each line and a "Receive checked" would allow each worker
to receive their specific items - giving the option to check all and receive,
or just receive the items on your specific physical cart. This would be a benefit when large orders are being processed.

  By combining orderreceive.pl and finishreceive.pl we expect to be able to automate the process for batch receiving of items on an order.
Comment 1 Fred P 2012-06-01 14:14:49 UTC
Created attachment 9881 [details]
Our local Acquisitions Workflow

What are alternative workflows? I understand we can also create items through cataloging or when receiving them, using the AcqCreateItems system preference.
Comment 2 Monique 2019-12-05 18:10:45 UTC
This would be a great addition. Often I physically receive all the items in my basket and have to go through several steps in order to receive just one item. It takes up a lot of time.
Comment 3 Chris Curcio 2019-12-06 18:33:57 UTC
I would love to have this capability to batch receive big orders like YBP or Worldwide.
Comment 4 Karen Fellows 2019-12-06 19:13:38 UTC
This would be a great enhancement.  Being able to receive multiple items using  check-boxes would make it so much more efficient and would be a time saver. 

For example, if I receive a basket from Amazon, my invoice # is the same as my basket #, so I would love to see the items from the basket prepopulate in my invoice, have a "receive all" option or just have check boxes to select the ones I have and close the invoice.  If more items come in on a different day, I could reopen the invoice and check off those items (it would be date stamped with the day of receipt).
Comment 5 David Cook 2020-09-24 23:14:37 UTC
+1
Comment 6 Agustín Moyano 2020-10-09 23:03:41 UTC
Created attachment 111437 [details] [review]
Bug 8179: Add tests

This patch adds tests in:
* t/db_dependent/Koha/Acquisition/Fund.t
* t/db_dependent/Koha/Acquisitoin/Order.t
* t/db_dependent/Koha/Item.t
Comment 7 Agustín Moyano 2020-10-09 23:03:47 UTC
Created attachment 111438 [details] [review]
Bug 8179: Add syspref to database

This patch adds the AcqReceiveMultipleOrderLines syspref by atomicupdate
and in sysprefs.sql
Comment 8 Agustín Moyano 2020-10-09 23:03:54 UTC
Created attachment 111439 [details] [review]
Bug 8179: Add AcqReceiveMultipleOrderLines syspref to preference configuration

This patch adds AcqReceiveMultipleOrderLines to koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref
Comment 9 Agustín Moyano 2020-10-09 23:04:09 UTC
Created attachment 111440 [details] [review]
Bug 8179: Receive multiple orders

This patch implements the code to allow a patron to receive multiple
orders at the same time in /cgi-bin/koha/acqui/orderreceive.pl page

To test:
1. apply all patches
2. updatedatabase
3. Go to system preferences and allow AcqReceiveMultipleOrderLines
4. In acquisitions module, create a vendor if you don't have one and add
   3 baskets.. one with create items on ordering, one with create items
   on receiving and finally one with create items when cataloguing
5. Fill baskets with orders (There should be at least 15 orders in total). There should be a mix of orders created by suggestions, others by subscriptions and others by neither of those methods.
6. Close all baskets and receive shipment.
CHECK => in /cgi-bin/koha/acqui/parcel.pl page, in top table there is a column with checkboxes, and a button that says "Receive selected"
7. If all orders from all baskets are shown in the table, set the rows per page to 10, so table has more than one page
8. Check some of the checkboxes
CHECK => "Receive selected" button shows how many rows are selected
9. Go to the next page and select some more rows
CHECK => Changing page does not modify how many rows where selected
10. Go back to previous page
CHECK => Previously selected rows are still selected
11. Reload the page to deselect all rows
12. Select only one row and click on "Receive selected" button
CHECK => the page /cgi-bin/koha/acqui/orderreceive.pl behaves just the same as if the "receive" link in the selected row would have been clicked.
13. Click on cancel to go back to parcel.pl page
14. Select all rows (even the ones from the next page of the table) and
    click on "Receive selected"
CHECH => In orderreceive.pl page there is a table with all selected rows
15. Ensure table has more than one page, as in step 7
16. Click on the "edit" link in the last row of the current page
CHECK => A modal window is displayed with 4 tabs within: Info,
Accounting, Receipt history and Items
CHECK => Modal has 4 buttons at the bottom, 'Previous' to go to previos
order, 'Cancel' to close the modal without keeping modifications, 'Save'
to close modal keeping modifications and 'Next' to go to the next order
CHECK => Even that we are at the end of the current page, 'Next' button
is still available
17. Click on 'Next' button
CHECK => The table behind the modal now displays the next page, and the modal was not closed
18. Click on 'Previous'
CHECK => The table behind the modal went back to the first page, and the modal was not closed
19. Click on 'Previous' button till you reach the first row of the first
    page
CHECK => Only when you reach the first row of the first page 'Previous'
button gets disabled
20. Click on 'Next' button till you reach the last row of the last page
CHECK => Only when you reach the last button of the last page 'Next'
button gets disabled
21. Check that behaviour for the different types of order are still the
    same
    a. For orders that where created through suggestion, check that the
suggestion info is present in Info tab. If when suggestion was accepted
you set a reason, a dropdown to change the reason shoul display also.
    b. For orders that where created through subscriptions, check that
the Items tab is disabled, and the Receipt history is enabled. On
accounting tab you should be able to change quantity ordered. If there
were less items received than ordered, the next time you receive this
order the child order generated from this one shoul appear in receipt
history.
    c. For orders that don't come from subscription and creates there items on ordering, Receipt history
should be disabled, and a table with prefilled items shold appear in the
Items tab. You can edit them and the changes should appear in the item's
row.
    d. For orders that don't come from subscription and creates there
items on receiving, Receipt history should be disabled, and a form to
create the items should appear in Items tab. When you add an item a
table should appear.
    e. For orders that don't come from subscription and creates there
ites on cataloguing, Receipt history and Items tabs should be disabled.
    f. Any changes made in quantity (received or ordered) or funds in the modal should be
reflected in the table if you click save from the modal.
22. Once you've done all you checking and verifications click save
23. While saving a progress bar should appear
24. If no error was detected, you should be redirected back to parcel.pl
    page
25. If an error or warning was detected (like there is an order with 0
    items to receive) the save button should be disabled and warnings
are dispayed.
26. prove t/db_dependent/Koha/Acquisition/Fund.t t/db_dependent/Koha/Acquisitoin/Order.t t/db_dependent/Koha/Item.t
Comment 10 Séverine Queune 2020-10-27 09:10:46 UTC
Argh... so sad now 26635 applied correctly !

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 8179: Add tests
Using index info to reconstruct a base tree...
M       t/db_dependent/Koha/Acquisition/Order.t
Falling back to patching base and 3-way merge...
Auto-merging t/db_dependent/Koha/Acquisition/Order.t
CONFLICT (content): Merge conflict in t/db_dependent/Koha/Acquisition/Order.t
Failed to merge in the changes.
Patch failed at 0001 Bug 8179: Add tests
Comment 11 Agustín Moyano 2020-10-27 11:01:29 UTC
Created attachment 112554 [details] [review]
Bug 8179: Add tests

This patch adds tests in:
* t/db_dependent/Koha/Acquisition/Fund.t
* t/db_dependent/Koha/Acquisitoin/Order.t
* t/db_dependent/Koha/Item.t
Comment 12 Agustín Moyano 2020-10-27 11:01:39 UTC
Created attachment 112555 [details] [review]
Bug 8179: Add syspref to database

This patch adds the AcqReceiveMultipleOrderLines syspref by atomicupdate
and in sysprefs.sql
Comment 13 Agustín Moyano 2020-10-27 11:01:49 UTC
Created attachment 112556 [details] [review]
Bug 8179: Add AcqReceiveMultipleOrderLines syspref to preference configuration

This patch adds AcqReceiveMultipleOrderLines to koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref
Comment 14 Agustín Moyano 2020-10-27 11:01:59 UTC
Created attachment 112558 [details] [review]
Bug 8179: Receive multiple orders

This patch implements the code to allow a patron to receive multiple
orders at the same time in /cgi-bin/koha/acqui/orderreceive.pl page

To test:
1. apply all patches
2. updatedatabase
3. Go to system preferences and allow AcqReceiveMultipleOrderLines
4. In acquisitions module, create a vendor if you don't have one and add
   3 baskets.. one with create items on ordering, one with create items
   on receiving and finally one with create items when cataloguing
5. Fill baskets with orders (There should be at least 15 orders in total). There should be a mix of orders created by suggestions, others by subscriptions and others by neither of those methods.
6. Close all baskets and receive shipment.
CHECK => in /cgi-bin/koha/acqui/parcel.pl page, in top table there is a column with checkboxes, and a button that says "Receive selected"
7. If all orders from all baskets are shown in the table, set the rows per page to 10, so table has more than one page
8. Check some of the checkboxes
CHECK => "Receive selected" button shows how many rows are selected
9. Go to the next page and select some more rows
CHECK => Changing page does not modify how many rows where selected
10. Go back to previous page
CHECK => Previously selected rows are still selected
11. Reload the page to deselect all rows
12. Select only one row and click on "Receive selected" button
CHECK => the page /cgi-bin/koha/acqui/orderreceive.pl behaves just the same as if the "receive" link in the selected row would have been clicked.
13. Click on cancel to go back to parcel.pl page
14. Select all rows (even the ones from the next page of the table) and
    click on "Receive selected"
CHECH => In orderreceive.pl page there is a table with all selected rows
15. Ensure table has more than one page, as in step 7
16. Click on the "edit" link in the last row of the current page
CHECK => A modal window is displayed with 4 tabs within: Info,
Accounting, Receipt history and Items
CHECK => Modal has 4 buttons at the bottom, 'Previous' to go to previos
order, 'Cancel' to close the modal without keeping modifications, 'Save'
to close modal keeping modifications and 'Next' to go to the next order
CHECK => Even that we are at the end of the current page, 'Next' button
is still available
17. Click on 'Next' button
CHECK => The table behind the modal now displays the next page, and the modal was not closed
18. Click on 'Previous'
CHECK => The table behind the modal went back to the first page, and the modal was not closed
19. Click on 'Previous' button till you reach the first row of the first
    page
CHECK => Only when you reach the first row of the first page 'Previous'
button gets disabled
20. Click on 'Next' button till you reach the last row of the last page
CHECK => Only when you reach the last button of the last page 'Next'
button gets disabled
21. Check that behaviour for the different types of order are still the
    same
    a. For orders that where created through suggestion, check that the
suggestion info is present in Info tab. If when suggestion was accepted
you set a reason, a dropdown to change the reason shoul display also.
    b. For orders that where created through subscriptions, check that
the Items tab is disabled, and the Receipt history is enabled. On
accounting tab you should be able to change quantity ordered. If there
were less items received than ordered, the next time you receive this
order the child order generated from this one shoul appear in receipt
history.
    c. For orders that don't come from subscription and creates there items on ordering, Receipt history
should be disabled, and a table with prefilled items shold appear in the
Items tab. You can edit them and the changes should appear in the item's
row.
    d. For orders that don't come from subscription and creates there
items on receiving, Receipt history should be disabled, and a form to
create the items should appear in Items tab. When you add an item a
table should appear.
    e. For orders that don't come from subscription and creates there
ites on cataloguing, Receipt history and Items tabs should be disabled.
    f. Any changes made in quantity (received or ordered) or funds in the modal should be
reflected in the table if you click save from the modal.
22. Once you've done all you checking and verifications click save
23. While saving a progress bar should appear
24. If no error was detected, you should be redirected back to parcel.pl
    page
25. If an error or warning was detected (like there is an order with 0
    items to receive) the save button should be disabled and warnings
are dispayed.
26. prove t/db_dependent/Koha/Acquisition/Fund.t t/db_dependent/Koha/Acquisitoin/Order.t t/db_dependent/Koha/Item.t
Comment 15 Agustín Moyano 2020-10-27 11:03:09 UTC
(In reply to Séverine Queune from comment #10)
> Argh... so sad now 26635 applied correctly !
> 
> Apply? [(y)es, (n)o, (i)nteractive] y
> Applying: Bug 8179: Add tests
> Using index info to reconstruct a base tree...
> M       t/db_dependent/Koha/Acquisition/Order.t
> Falling back to patching base and 3-way merge...
> Auto-merging t/db_dependent/Koha/Acquisition/Order.t
> CONFLICT (content): Merge conflict in t/db_dependent/Koha/Acquisition/Order.t
> Failed to merge in the changes.
> Patch failed at 0001 Bug 8179: Add tests

Hi, just rebased this bug. Could you please try again?

Thanks!
Comment 16 Séverine Queune 2020-10-27 15:53:24 UTC
Hi Augustin,
I got an issue with the /cgi-bin/koha/acqui/parcel.pl? page which stays 'Processing' (see here with the console log : https://snipboard.io/V1WPGy.jpg).
I had the same issue testing Bug 20212 last week, but the last version proposed by Tomas on Friday fixed that.
Loading this page is correct when I switch to master, I also try creating a branch with 20212 only and it was correctly display too, so no idea from which other patch it can come from...
Comment 17 Agustín Moyano 2020-10-27 18:03:30 UTC
Created attachment 112588 [details] [review]
Bug 8179: Set render functions in every column

Because when AcqReceiveMultipleOrderLines is set to allow, we add an
extra column at the beginning, general columnDefs of datatables config
pointed to the wrong column. So, instead of using general columnDef,
this patch sets the render function to each column.
Comment 18 Séverine Queune 2020-10-28 09:41:05 UTC
Hi Agustin,
No "Processing" problem anymore !
But I now get this Software error trying to receive an order, whenever I use the current "Receive" link or the new checkbox :
Can't locate Data/Printer.pm in @INC (you may need to install the Data::Printer module) (@INC contains: /var/repositories/koha /home/koha/perl5/lib/perl5/x86_64-linux-gnu-thread-multi /home/koha/perl5/lib/perl5 /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.20.2 /usr/local/share/perl/5.20.2 /usr/lib/x86_64-linux-gnu/perl5/5.20 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.20 /usr/share/perl/5.20 /usr/local/lib/site_perl . /home/koha/koha-dev/var/lib/plugins) at /var/repositories/koha/acqui/orderreceive.pl line 141.
BEGIN failed--compilation aborted at /var/repositories/koha/acqui/orderreceive.pl line 141.

No error when I switch back to master.
I stop the test at step 12, but for step 14, could we imagine to ass the usual options "Check all / Uncheck all" we have on other Koha pages ?
I know it would be useful, especially if we use it combined with filters on basket for example or author if a collection must be receipted.
Comment 19 Agustín Moyano 2020-10-28 14:28:24 UTC
(In reply to Séverine Queune from comment #18)
> Hi Agustin,
> No "Processing" problem anymore !
> But I now get this Software error trying to receive an order, whenever I use
> the current "Receive" link or the new checkbox :
> Can't locate Data/Printer.pm in @INC (you may need to install the
> Data::Printer module) (@INC contains: /var/repositories/koha
> /home/koha/perl5/lib/perl5/x86_64-linux-gnu-thread-multi
> /home/koha/perl5/lib/perl5 /etc/perl
> /usr/local/lib/x86_64-linux-gnu/perl/5.20.2 /usr/local/share/perl/5.20.2
> /usr/lib/x86_64-linux-gnu/perl5/5.20 /usr/share/perl5
> /usr/lib/x86_64-linux-gnu/perl/5.20 /usr/share/perl/5.20
> /usr/local/lib/site_perl . /home/koha/koha-dev/var/lib/plugins) at
> /var/repositories/koha/acqui/orderreceive.pl line 141.
> BEGIN failed--compilation aborted at
> /var/repositories/koha/acqui/orderreceive.pl line 141.
> 
> No error when I switch back to master.
> I stop the test at step 12, but for step 14, could we imagine to ass the
> usual options "Check all / Uncheck all" we have on other Koha pages ?
> I know it would be useful, especially if we use it combined with filters on
> basket for example or author if a collection must be receipted.

Sorry about that.. I'll fix that ASAP.

Regarding check all / uncheck all I thought about that, but wasn't sure what the expected behaviour should be. 

Because this tables are paginated on server, it means that we do not have all rows when render. So this check all should check only the rows that are visible, or all rows that matches the filter?

Maybe we could do something similar to what GMail does, to have a check all that only selects visible rows, and display a label or a button that says something like "Select all 523 rows".

Anyhow, this should be a consistent behaviour for all datatables and deserves it's own bug and discussion. That's the reason why I didn't implement that.
Comment 20 Agustín Moyano 2020-10-28 14:46:47 UTC
Created attachment 112643 [details] [review]
Bug 8179: Add tests

This patch adds tests in:
* t/db_dependent/Koha/Acquisition/Fund.t
* t/db_dependent/Koha/Acquisitoin/Order.t
* t/db_dependent/Koha/Item.t
Comment 21 Agustín Moyano 2020-10-28 14:46:51 UTC
Created attachment 112644 [details] [review]
Bug 8179: Add syspref to database

This patch adds the AcqReceiveMultipleOrderLines syspref by atomicupdate
and in sysprefs.sql
Comment 22 Agustín Moyano 2020-10-28 14:46:56 UTC
Created attachment 112645 [details] [review]
Bug 8179: Add AcqReceiveMultipleOrderLines syspref to preference configuration

This patch adds AcqReceiveMultipleOrderLines to koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref
Comment 23 Agustín Moyano 2020-10-28 14:47:04 UTC
Created attachment 112646 [details] [review]
Bug 8179: Receive multiple orders

This patch implements the code to allow a patron to receive multiple
orders at the same time in /cgi-bin/koha/acqui/orderreceive.pl page

To test:
1. apply all patches
2. updatedatabase
3. Go to system preferences and allow AcqReceiveMultipleOrderLines
4. In acquisitions module, create a vendor if you don't have one and add
   3 baskets.. one with create items on ordering, one with create items
   on receiving and finally one with create items when cataloguing
5. Fill baskets with orders (There should be at least 15 orders in total). There should be a mix of orders created by suggestions, others by subscriptions and others by neither of those methods.
6. Close all baskets and receive shipment.
CHECK => in /cgi-bin/koha/acqui/parcel.pl page, in top table there is a column with checkboxes, and a button that says "Receive selected"
7. If all orders from all baskets are shown in the table, set the rows per page to 10, so table has more than one page
8. Check some of the checkboxes
CHECK => "Receive selected" button shows how many rows are selected
9. Go to the next page and select some more rows
CHECK => Changing page does not modify how many rows where selected
10. Go back to previous page
CHECK => Previously selected rows are still selected
11. Reload the page to deselect all rows
12. Select only one row and click on "Receive selected" button
CHECK => the page /cgi-bin/koha/acqui/orderreceive.pl behaves just the same as if the "receive" link in the selected row would have been clicked.
13. Click on cancel to go back to parcel.pl page
14. Select all rows (even the ones from the next page of the table) and
    click on "Receive selected"
CHECH => In orderreceive.pl page there is a table with all selected rows
15. Ensure table has more than one page, as in step 7
16. Click on the "edit" link in the last row of the current page
CHECK => A modal window is displayed with 4 tabs within: Info,
Accounting, Receipt history and Items
CHECK => Modal has 4 buttons at the bottom, 'Previous' to go to previos
order, 'Cancel' to close the modal without keeping modifications, 'Save'
to close modal keeping modifications and 'Next' to go to the next order
CHECK => Even that we are at the end of the current page, 'Next' button
is still available
17. Click on 'Next' button
CHECK => The table behind the modal now displays the next page, and the modal was not closed
18. Click on 'Previous'
CHECK => The table behind the modal went back to the first page, and the modal was not closed
19. Click on 'Previous' button till you reach the first row of the first
    page
CHECK => Only when you reach the first row of the first page 'Previous'
button gets disabled
20. Click on 'Next' button till you reach the last row of the last page
CHECK => Only when you reach the last button of the last page 'Next'
button gets disabled
21. Check that behaviour for the different types of order are still the
    same
    a. For orders that where created through suggestion, check that the
suggestion info is present in Info tab. If when suggestion was accepted
you set a reason, a dropdown to change the reason shoul display also.
    b. For orders that where created through subscriptions, check that
the Items tab is disabled, and the Receipt history is enabled. On
accounting tab you should be able to change quantity ordered. If there
were less items received than ordered, the next time you receive this
order the child order generated from this one shoul appear in receipt
history.
    c. For orders that don't come from subscription and creates there items on ordering, Receipt history
should be disabled, and a table with prefilled items shold appear in the
Items tab. You can edit them and the changes should appear in the item's
row.
    d. For orders that don't come from subscription and creates there
items on receiving, Receipt history should be disabled, and a form to
create the items should appear in Items tab. When you add an item a
table should appear.
    e. For orders that don't come from subscription and creates there
ites on cataloguing, Receipt history and Items tabs should be disabled.
    f. Any changes made in quantity (received or ordered) or funds in the modal should be
reflected in the table if you click save from the modal.
22. Once you've done all you checking and verifications click save
23. While saving a progress bar should appear
24. If no error was detected, you should be redirected back to parcel.pl
    page
25. If an error or warning was detected (like there is an order with 0
    items to receive) the save button should be disabled and warnings
are dispayed.
26. prove t/db_dependent/Koha/Acquisition/Fund.t t/db_dependent/Koha/Acquisitoin/Order.t t/db_dependent/Koha/Item.t
Comment 24 Agustín Moyano 2020-10-28 14:51:42 UTC
Ok, Séverine, just removed all Data::Printer from code.

Could you please try again?

Thanks
Comment 25 Séverine Queune 2020-10-30 08:18:54 UTC
Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 8179: Add tests
Applying: Bug 8179: Add syspref to database
Applying: Bug 8179: Add AcqReceiveMultipleOrderLines syspref to preference configuration
Applying: Bug 8179: Receive multiple orders
Using index info to reconstruct a base tree...
M       koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt
Falling back to patching base and 3-way merge...
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt
CONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt
Failed to merge in the changes.
Comment 26 Agustín Moyano 2020-10-30 18:46:46 UTC
Created attachment 112744 [details] [review]
Bug 8179: Add tests

This patch adds tests in:
* t/db_dependent/Koha/Acquisition/Fund.t
* t/db_dependent/Koha/Acquisitoin/Order.t
* t/db_dependent/Koha/Item.t
Comment 27 Agustín Moyano 2020-10-30 18:46:52 UTC
Created attachment 112745 [details] [review]
Bug 8179: Add syspref to database

This patch adds the AcqReceiveMultipleOrderLines syspref by atomicupdate
and in sysprefs.sql
Comment 28 Agustín Moyano 2020-10-30 18:46:58 UTC
Created attachment 112746 [details] [review]
Bug 8179: Add AcqReceiveMultipleOrderLines syspref to preference configuration

This patch adds AcqReceiveMultipleOrderLines to koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref
Comment 29 Agustín Moyano 2020-10-30 18:47:05 UTC
Created attachment 112747 [details] [review]
Bug 8179: Receive multiple orders

This patch implements the code to allow a patron to receive multiple
orders at the same time in /cgi-bin/koha/acqui/orderreceive.pl page

To test:
1. apply all patches
2. updatedatabase
3. Go to system preferences and allow AcqReceiveMultipleOrderLines
4. In acquisitions module, create a vendor if you don't have one and add
   3 baskets.. one with create items on ordering, one with create items
   on receiving and finally one with create items when cataloguing
5. Fill baskets with orders (There should be at least 15 orders in total). There should be a mix of orders created by suggestions, others by subscriptions and others by neither of those methods.
6. Close all baskets and receive shipment.
CHECK => in /cgi-bin/koha/acqui/parcel.pl page, in top table there is a column with checkboxes, and a button that says "Receive selected"
7. If all orders from all baskets are shown in the table, set the rows per page to 10, so table has more than one page
8. Check some of the checkboxes
CHECK => "Receive selected" button shows how many rows are selected
9. Go to the next page and select some more rows
CHECK => Changing page does not modify how many rows where selected
10. Go back to previous page
CHECK => Previously selected rows are still selected
11. Reload the page to deselect all rows
12. Select only one row and click on "Receive selected" button
CHECK => the page /cgi-bin/koha/acqui/orderreceive.pl behaves just the same as if the "receive" link in the selected row would have been clicked.
13. Click on cancel to go back to parcel.pl page
14. Select all rows (even the ones from the next page of the table) and
    click on "Receive selected"
CHECH => In orderreceive.pl page there is a table with all selected rows
15. Ensure table has more than one page, as in step 7
16. Click on the "edit" link in the last row of the current page
CHECK => A modal window is displayed with 4 tabs within: Info,
Accounting, Receipt history and Items
CHECK => Modal has 4 buttons at the bottom, 'Previous' to go to previos
order, 'Cancel' to close the modal without keeping modifications, 'Save'
to close modal keeping modifications and 'Next' to go to the next order
CHECK => Even that we are at the end of the current page, 'Next' button
is still available
17. Click on 'Next' button
CHECK => The table behind the modal now displays the next page, and the modal was not closed
18. Click on 'Previous'
CHECK => The table behind the modal went back to the first page, and the modal was not closed
19. Click on 'Previous' button till you reach the first row of the first
    page
CHECK => Only when you reach the first row of the first page 'Previous'
button gets disabled
20. Click on 'Next' button till you reach the last row of the last page
CHECK => Only when you reach the last button of the last page 'Next'
button gets disabled
21. Check that behaviour for the different types of order are still the
    same
    a. For orders that where created through suggestion, check that the
suggestion info is present in Info tab. If when suggestion was accepted
you set a reason, a dropdown to change the reason shoul display also.
    b. For orders that where created through subscriptions, check that
the Items tab is disabled, and the Receipt history is enabled. On
accounting tab you should be able to change quantity ordered. If there
were less items received than ordered, the next time you receive this
order the child order generated from this one shoul appear in receipt
history.
    c. For orders that don't come from subscription and creates there items on ordering, Receipt history
should be disabled, and a table with prefilled items shold appear in the
Items tab. You can edit them and the changes should appear in the item's
row.
    d. For orders that don't come from subscription and creates there
items on receiving, Receipt history should be disabled, and a form to
create the items should appear in Items tab. When you add an item a
table should appear.
    e. For orders that don't come from subscription and creates there
ites on cataloguing, Receipt history and Items tabs should be disabled.
    f. Any changes made in quantity (received or ordered) or funds in the modal should be
reflected in the table if you click save from the modal.
22. Once you've done all you checking and verifications click save
23. While saving a progress bar should appear
24. If no error was detected, you should be redirected back to parcel.pl
    page
25. If an error or warning was detected (like there is an order with 0
    items to receive) the save button should be disabled and warnings
are dispayed.
26. prove t/db_dependent/Koha/Acquisition/Fund.t t/db_dependent/Koha/Acquisitoin/Order.t t/db_dependent/Koha/Item.t
Comment 30 Agustín Moyano 2020-10-30 18:48:26 UTC
(In reply to Séverine Queune from comment #25)
> Apply? [(y)es, (n)o, (i)nteractive] y
> Applying: Bug 8179: Add tests
> Applying: Bug 8179: Add syspref to database
> Applying: Bug 8179: Add AcqReceiveMultipleOrderLines syspref to preference
> configuration
> Applying: Bug 8179: Receive multiple orders
> Using index info to reconstruct a base tree...
> M       koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt
> Falling back to patching base and 3-way merge...
> Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt
> CONFLICT (content): Merge conflict in
> koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt
> Failed to merge in the changes.

Hello Séverine, could you please try once more?
Comment 31 Séverine Queune 2020-11-02 07:06:09 UTC
Definitely bad luck on that one...

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 8179: Add tests
Applying: Bug 8179: Add syspref to database
Applying: Bug 8179: Add AcqReceiveMultipleOrderLines syspref to preference confi                 guration
Applying: Bug 8179: Receive multiple orders
fatal: sha1 information is lacking or useless (koha-tmpl/intranet-tmpl/prog/en/m                 odules/acqui/parcel.tt).
Repository lacks necessary blobs to fall back on 3-way merge.
Cannot fall back to three-way merge.
Patch failed at 0001 Bug 8179: Receive multiple orders
Comment 32 Agustín Moyano 2020-11-02 14:38:12 UTC
(In reply to Séverine Queune from comment #31)
> Definitely bad luck on that one...
> 
> Apply? [(y)es, (n)o, (i)nteractive] y
> Applying: Bug 8179: Add tests
> Applying: Bug 8179: Add syspref to database
> Applying: Bug 8179: Add AcqReceiveMultipleOrderLines syspref to preference
> confi                 guration
> Applying: Bug 8179: Receive multiple orders
> fatal: sha1 information is lacking or useless
> (koha-tmpl/intranet-tmpl/prog/en/m                 odules/acqui/parcel.tt).
> Repository lacks necessary blobs to fall back on 3-way merge.
> Cannot fall back to three-way merge.
> Patch failed at 0001 Bug 8179: Receive multiple orders

20212 is currently FQA, that's why patches don't apply.

We'll have to wait until it changes state.
Comment 33 Agustín Moyano 2020-12-23 20:19:05 UTC
Created attachment 114688 [details] [review]
Bug 8179: Add tests

This patch adds tests in:
* t/db_dependent/Koha/Acquisition/Fund.t
* t/db_dependent/Koha/Acquisitoin/Order.t
* t/db_dependent/Koha/Item.t
Comment 34 Agustín Moyano 2020-12-23 20:19:10 UTC
Created attachment 114689 [details] [review]
Bug 8179: Add syspref to database

This patch adds the AcqReceiveMultipleOrderLines syspref by atomicupdate
and in sysprefs.sql
Comment 35 Agustín Moyano 2020-12-23 20:19:14 UTC
Created attachment 114690 [details] [review]
Bug 8179: Add AcqReceiveMultipleOrderLines syspref to preference configuration

This patch adds AcqReceiveMultipleOrderLines to koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref
Comment 36 Agustín Moyano 2020-12-23 20:19:20 UTC
Created attachment 114691 [details] [review]
Bug 8179: Receive multiple orders

This patch implements the code to allow a patron to receive multiple
orders at the same time in /cgi-bin/koha/acqui/orderreceive.pl page

To test:
1. apply all patches
2. updatedatabase
3. Go to system preferences and allow AcqReceiveMultipleOrderLines
4. In acquisitions module, create a vendor if you don't have one and add
   3 baskets.. one with create items on ordering, one with create items
   on receiving and finally one with create items when cataloguing
5. Fill baskets with orders (There should be at least 15 orders in total). There should be a mix of orders created by suggestions, others by subscriptions and others by neither of those methods.
6. Close all baskets and receive shipment.
CHECK => in /cgi-bin/koha/acqui/parcel.pl page, in top table there is a column with checkboxes, and a button that says "Receive selected"
7. If all orders from all baskets are shown in the table, set the rows per page to 10, so table has more than one page
8. Check some of the checkboxes
CHECK => "Receive selected" button shows how many rows are selected
9. Go to the next page and select some more rows
CHECK => Changing page does not modify how many rows where selected
10. Go back to previous page
CHECK => Previously selected rows are still selected
11. Reload the page to deselect all rows
12. Select only one row and click on "Receive selected" button
CHECK => the page /cgi-bin/koha/acqui/orderreceive.pl behaves just the same as if the "receive" link in the selected row would have been clicked.
13. Click on cancel to go back to parcel.pl page
14. Select all rows (even the ones from the next page of the table) and
    click on "Receive selected"
CHECH => In orderreceive.pl page there is a table with all selected rows
15. Ensure table has more than one page, as in step 7
16. Click on the "edit" link in the last row of the current page
CHECK => A modal window is displayed with 4 tabs within: Info,
Accounting, Receipt history and Items
CHECK => Modal has 4 buttons at the bottom, 'Previous' to go to previos
order, 'Cancel' to close the modal without keeping modifications, 'Save'
to close modal keeping modifications and 'Next' to go to the next order
CHECK => Even that we are at the end of the current page, 'Next' button
is still available
17. Click on 'Next' button
CHECK => The table behind the modal now displays the next page, and the modal was not closed
18. Click on 'Previous'
CHECK => The table behind the modal went back to the first page, and the modal was not closed
19. Click on 'Previous' button till you reach the first row of the first
    page
CHECK => Only when you reach the first row of the first page 'Previous'
button gets disabled
20. Click on 'Next' button till you reach the last row of the last page
CHECK => Only when you reach the last button of the last page 'Next'
button gets disabled
21. Check that behaviour for the different types of order are still the
    same
    a. For orders that where created through suggestion, check that the
suggestion info is present in Info tab. If when suggestion was accepted
you set a reason, a dropdown to change the reason shoul display also.
    b. For orders that where created through subscriptions, check that
the Items tab is disabled, and the Receipt history is enabled. On
accounting tab you should be able to change quantity ordered. If there
were less items received than ordered, the next time you receive this
order the child order generated from this one shoul appear in receipt
history.
    c. For orders that don't come from subscription and creates there items on ordering, Receipt history
should be disabled, and a table with prefilled items shold appear in the
Items tab. You can edit them and the changes should appear in the item's
row.
    d. For orders that don't come from subscription and creates there
items on receiving, Receipt history should be disabled, and a form to
create the items should appear in Items tab. When you add an item a
table should appear.
    e. For orders that don't come from subscription and creates there
ites on cataloguing, Receipt history and Items tabs should be disabled.
    f. Any changes made in quantity (received or ordered) or funds in the modal should be
reflected in the table if you click save from the modal.
22. Once you've done all you checking and verifications click save
23. While saving a progress bar should appear
24. If no error was detected, you should be redirected back to parcel.pl
    page
25. If an error or warning was detected (like there is an order with 0
    items to receive) the save button should be disabled and warnings
are dispayed.
26. prove t/db_dependent/Koha/Acquisition/Fund.t t/db_dependent/Koha/Acquisitoin/Order.t t/db_dependent/Koha/Item.t
Comment 37 Rhonda Kuiper 2021-01-19 18:41:31 UTC
Hi All,
The Koha-US Acquisitions SIG is planning to sign off on this bug at our February 16 meeting.  If you are interested in participating in this sign off, join us.  The Zoom link can be found on the Koha-US.org website.
Comment 38 Andrew Fuerste-Henry 2021-02-02 21:10:43 UTC
Please rebase for testing!
Comment 39 Agustín Moyano 2021-02-09 15:15:48 UTC
Created attachment 116582 [details] [review]
Bug 8179: Add tests

This patch adds tests in:
* t/db_dependent/Koha/Acquisition/Fund.t
* t/db_dependent/Koha/Acquisitoin/Order.t
* t/db_dependent/Koha/Item.t
Comment 40 Agustín Moyano 2021-02-09 15:15:55 UTC
Created attachment 116583 [details] [review]
Bug 8179: Add syspref to database

This patch adds the AcqReceiveMultipleOrderLines syspref by atomicupdate
and in sysprefs.sql
Comment 41 Agustín Moyano 2021-02-09 15:16:01 UTC
Created attachment 116584 [details] [review]
Bug 8179: Add AcqReceiveMultipleOrderLines syspref to preference configuration

This patch adds AcqReceiveMultipleOrderLines to koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref
Comment 42 Agustín Moyano 2021-02-09 15:16:09 UTC
Created attachment 116585 [details] [review]
Bug 8179: Receive multiple orders

This patch implements the code to allow a patron to receive multiple
orders at the same time in /cgi-bin/koha/acqui/orderreceive.pl page

To test:
1. apply all patches
2. updatedatabase
3. Go to system preferences and allow AcqReceiveMultipleOrderLines
4. In acquisitions module, create a vendor if you don't have one and add
   3 baskets.. one with create items on ordering, one with create items
   on receiving and finally one with create items when cataloguing
5. Fill baskets with orders (There should be at least 15 orders in total). There should be a mix of orders created by suggestions, others by subscriptions and others by neither of those methods.
6. Close all baskets and receive shipment.
CHECK => in /cgi-bin/koha/acqui/parcel.pl page, in top table there is a column with checkboxes, and a button that says "Receive selected"
7. If all orders from all baskets are shown in the table, set the rows per page to 10, so table has more than one page
8. Check some of the checkboxes
CHECK => "Receive selected" button shows how many rows are selected
9. Go to the next page and select some more rows
CHECK => Changing page does not modify how many rows where selected
10. Go back to previous page
CHECK => Previously selected rows are still selected
11. Reload the page to deselect all rows
12. Select only one row and click on "Receive selected" button
CHECK => the page /cgi-bin/koha/acqui/orderreceive.pl behaves just the same as if the "receive" link in the selected row would have been clicked.
13. Click on cancel to go back to parcel.pl page
14. Select all rows (even the ones from the next page of the table) and
    click on "Receive selected"
CHECH => In orderreceive.pl page there is a table with all selected rows
15. Ensure table has more than one page, as in step 7
16. Click on the "edit" link in the last row of the current page
CHECK => A modal window is displayed with 4 tabs within: Info,
Accounting, Receipt history and Items
CHECK => Modal has 4 buttons at the bottom, 'Previous' to go to previos
order, 'Cancel' to close the modal without keeping modifications, 'Save'
to close modal keeping modifications and 'Next' to go to the next order
CHECK => Even that we are at the end of the current page, 'Next' button
is still available
17. Click on 'Next' button
CHECK => The table behind the modal now displays the next page, and the modal was not closed
18. Click on 'Previous'
CHECK => The table behind the modal went back to the first page, and the modal was not closed
19. Click on 'Previous' button till you reach the first row of the first
    page
CHECK => Only when you reach the first row of the first page 'Previous'
button gets disabled
20. Click on 'Next' button till you reach the last row of the last page
CHECK => Only when you reach the last button of the last page 'Next'
button gets disabled
21. Check that behaviour for the different types of order are still the
    same
    a. For orders that where created through suggestion, check that the
suggestion info is present in Info tab. If when suggestion was accepted
you set a reason, a dropdown to change the reason shoul display also.
    b. For orders that where created through subscriptions, check that
the Items tab is disabled, and the Receipt history is enabled. On
accounting tab you should be able to change quantity ordered. If there
were less items received than ordered, the next time you receive this
order the child order generated from this one shoul appear in receipt
history.
    c. For orders that don't come from subscription and creates there items on ordering, Receipt history
should be disabled, and a table with prefilled items shold appear in the
Items tab. You can edit them and the changes should appear in the item's
row.
    d. For orders that don't come from subscription and creates there
items on receiving, Receipt history should be disabled, and a form to
create the items should appear in Items tab. When you add an item a
table should appear.
    e. For orders that don't come from subscription and creates there
ites on cataloguing, Receipt history and Items tabs should be disabled.
    f. Any changes made in quantity (received or ordered) or funds in the modal should be
reflected in the table if you click save from the modal.
22. Once you've done all you checking and verifications click save
23. While saving a progress bar should appear
24. If no error was detected, you should be redirected back to parcel.pl
    page
25. If an error or warning was detected (like there is an order with 0
    items to receive) the save button should be disabled and warnings
are dispayed.
26. prove t/db_dependent/Koha/Acquisition/Fund.t t/db_dependent/Koha/Acquisitoin/Order.t t/db_dependent/Koha/Item.t
Comment 43 Agustín Moyano 2021-02-09 15:16:57 UTC
(In reply to Andrew Fuerste-Henry from comment #38)
> Please rebase for testing!

Done!
Comment 44 Agustín Moyano 2021-02-09 15:30:48 UTC
Created attachment 116588 [details] [review]
Bug 8179: Add tests

This patch adds tests in:
* t/db_dependent/Koha/Acquisition/Fund.t
* t/db_dependent/Koha/Acquisitoin/Order.t
* t/db_dependent/Koha/Item.t

Sponsored-by: Virginia Polytechnic Institute and State University
Comment 45 Agustín Moyano 2021-02-09 15:30:54 UTC
Created attachment 116589 [details] [review]
Bug 8179: Add syspref to database

This patch adds the AcqReceiveMultipleOrderLines syspref by atomicupdate
and in sysprefs.sql

Sponsored-by: Virginia Polytechnic Institute and State University
Comment 46 Agustín Moyano 2021-02-09 15:30:59 UTC
Created attachment 116590 [details] [review]
Bug 8179: Add AcqReceiveMultipleOrderLines syspref to preference configuration

This patch adds AcqReceiveMultipleOrderLines to koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref

Sponsored-by: Virginia Polytechnic Institute and State University
Comment 47 Agustín Moyano 2021-02-09 15:31:06 UTC
Created attachment 116591 [details] [review]
Bug 8179: Receive multiple orders

This patch implements the code to allow a patron to receive multiple
orders at the same time in /cgi-bin/koha/acqui/orderreceive.pl page

To test:
1. apply all patches
2. updatedatabase
3. Go to system preferences and allow AcqReceiveMultipleOrderLines
4. In acquisitions module, create a vendor if you don't have one and add
   3 baskets.. one with create items on ordering, one with create items
   on receiving and finally one with create items when cataloguing
5. Fill baskets with orders (There should be at least 15 orders in total). There should be a mix of orders created by suggestions, others by subscriptions and others by neither of those methods.
6. Close all baskets and receive shipment.
CHECK => in /cgi-bin/koha/acqui/parcel.pl page, in top table there is a column with checkboxes, and a button that says "Receive selected"
7. If all orders from all baskets are shown in the table, set the rows per page to 10, so table has more than one page
8. Check some of the checkboxes
CHECK => "Receive selected" button shows how many rows are selected
9. Go to the next page and select some more rows
CHECK => Changing page does not modify how many rows where selected
10. Go back to previous page
CHECK => Previously selected rows are still selected
11. Reload the page to deselect all rows
12. Select only one row and click on "Receive selected" button
CHECK => the page /cgi-bin/koha/acqui/orderreceive.pl behaves just the same as if the "receive" link in the selected row would have been clicked.
13. Click on cancel to go back to parcel.pl page
14. Select all rows (even the ones from the next page of the table) and
    click on "Receive selected"
CHECH => In orderreceive.pl page there is a table with all selected rows
15. Ensure table has more than one page, as in step 7
16. Click on the "edit" link in the last row of the current page
CHECK => A modal window is displayed with 4 tabs within: Info,
Accounting, Receipt history and Items
CHECK => Modal has 4 buttons at the bottom, 'Previous' to go to previos
order, 'Cancel' to close the modal without keeping modifications, 'Save'
to close modal keeping modifications and 'Next' to go to the next order
CHECK => Even that we are at the end of the current page, 'Next' button
is still available
17. Click on 'Next' button
CHECK => The table behind the modal now displays the next page, and the modal was not closed
18. Click on 'Previous'
CHECK => The table behind the modal went back to the first page, and the modal was not closed
19. Click on 'Previous' button till you reach the first row of the first
    page
CHECK => Only when you reach the first row of the first page 'Previous'
button gets disabled
20. Click on 'Next' button till you reach the last row of the last page
CHECK => Only when you reach the last button of the last page 'Next'
button gets disabled
21. Check that behaviour for the different types of order are still the
    same
    a. For orders that where created through suggestion, check that the
suggestion info is present in Info tab. If when suggestion was accepted
you set a reason, a dropdown to change the reason shoul display also.
    b. For orders that where created through subscriptions, check that
the Items tab is disabled, and the Receipt history is enabled. On
accounting tab you should be able to change quantity ordered. If there
were less items received than ordered, the next time you receive this
order the child order generated from this one shoul appear in receipt
history.
    c. For orders that don't come from subscription and creates there items on ordering, Receipt history
should be disabled, and a table with prefilled items shold appear in the
Items tab. You can edit them and the changes should appear in the item's
row.
    d. For orders that don't come from subscription and creates there
items on receiving, Receipt history should be disabled, and a form to
create the items should appear in Items tab. When you add an item a
table should appear.
    e. For orders that don't come from subscription and creates there
ites on cataloguing, Receipt history and Items tabs should be disabled.
    f. Any changes made in quantity (received or ordered) or funds in the modal should be
reflected in the table if you click save from the modal.
22. Once you've done all you checking and verifications click save
23. While saving a progress bar should appear
24. If no error was detected, you should be redirected back to parcel.pl
    page
25. If an error or warning was detected (like there is an order with 0
    items to receive) the save button should be disabled and warnings
are dispayed.
26. prove t/db_dependent/Koha/Acquisition/Fund.t t/db_dependent/Koha/Acquisitoin/Order.t t/db_dependent/Koha/Item.t

Sponsored-by: Virginia Polytechnic Institute and State University
Comment 48 Agustín Moyano 2021-02-09 18:26:33 UTC
(In reply to Rhonda Kuiper from comment #37)
> Hi All,
> The Koha-US Acquisitions SIG is planning to sign off on this bug at our
> February 16 meeting.  If you are interested in participating in this sign
> off, join us.  The Zoom link can be found on the Koha-US.org website.

Hi Rhonda, great that this bug is planed to be signed off. If I may, I'd suggest that before starting the meeting this steps should be ready:

4. In acquisitions module, create a vendor if you don't have one and add
   3 baskets.. one with create items on ordering, one with create items
   on receiving and finally one with create items when cataloguing
5. Fill baskets with orders (There should be at least 15 orders in total). There should be a mix of orders created by suggestions, others by subscriptions and others by neither of those methods.

I've tested this bug a couple of times and this steps are repetitive and tiresome.

Cheers.
Comment 49 Andrew Fuerste-Henry 2021-02-09 19:08:36 UTC
The list of items to be received hangs at Processing if any of your items/orders do not include a replacement price.

Price math is inconsistent between receiving versions. I created an order using the sample data for My Vendor. The order shows:
Quantity=1
Vendor price=3.00
Tax rate= 19.65
Discount= 0.1%

The vendor shows:
List item price includes tax: No
Invoice item price includes tax: No
Discount: 10.0 %
Tax rate: 19.65 %

If I click the old Receive button, orderreceive.pl shows:
retail price: 3
replacement price: 3
budgeted cost: 2.70
actual cost: 2.70

If I select this order along with other and click Receive Selected, the receiving modal shows:
retail price: 3.59
replacement price: 3
budgeted cost: 3.23
actual cost: 3.23055
Comment 50 Agustín Moyano 2021-02-10 16:01:05 UTC
Created attachment 116681 [details] [review]
Bug 8179: Add tests

This patch adds tests in:
* t/db_dependent/Koha/Acquisition/Fund.t
* t/db_dependent/Koha/Acquisitoin/Order.t
* t/db_dependent/Koha/Item.t

Sponsored-by: Virginia Polytechnic Institute and State University
Comment 51 Agustín Moyano 2021-02-10 16:01:11 UTC
Created attachment 116682 [details] [review]
Bug 8179: Add syspref to database

This patch adds the AcqReceiveMultipleOrderLines syspref by atomicupdate
and in sysprefs.sql

Sponsored-by: Virginia Polytechnic Institute and State University
Comment 52 Agustín Moyano 2021-02-10 16:01:16 UTC
Created attachment 116683 [details] [review]
Bug 8179: Add AcqReceiveMultipleOrderLines syspref to preference configuration

This patch adds AcqReceiveMultipleOrderLines to koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref

Sponsored-by: Virginia Polytechnic Institute and State University
Comment 53 Agustín Moyano 2021-02-10 16:01:23 UTC
Created attachment 116684 [details] [review]
Bug 8179: Receive multiple orders

This patch implements the code to allow a patron to receive multiple
orders at the same time in /cgi-bin/koha/acqui/orderreceive.pl page

To test:
1. apply all patches
2. updatedatabase
3. Go to system preferences and allow AcqReceiveMultipleOrderLines
4. In acquisitions module, create a vendor if you don't have one and add
   3 baskets.. one with create items on ordering, one with create items
   on receiving and finally one with create items when cataloguing
5. Fill baskets with orders (There should be at least 15 orders in total). There should be a mix of orders created by suggestions, others by subscriptions and others by neither of those methods.
6. Close all baskets and receive shipment.
CHECK => in /cgi-bin/koha/acqui/parcel.pl page, in top table there is a column with checkboxes, and a button that says "Receive selected"
7. If all orders from all baskets are shown in the table, set the rows per page to 10, so table has more than one page
8. Check some of the checkboxes
CHECK => "Receive selected" button shows how many rows are selected
9. Go to the next page and select some more rows
CHECK => Changing page does not modify how many rows where selected
10. Go back to previous page
CHECK => Previously selected rows are still selected
11. Reload the page to deselect all rows
12. Select only one row and click on "Receive selected" button
CHECK => the page /cgi-bin/koha/acqui/orderreceive.pl behaves just the same as if the "receive" link in the selected row would have been clicked.
13. Click on cancel to go back to parcel.pl page
14. Select all rows (even the ones from the next page of the table) and
    click on "Receive selected"
CHECH => In orderreceive.pl page there is a table with all selected rows
15. Ensure table has more than one page, as in step 7
16. Click on the "edit" link in the last row of the current page
CHECK => A modal window is displayed with 4 tabs within: Info,
Accounting, Receipt history and Items
CHECK => Modal has 4 buttons at the bottom, 'Previous' to go to previos
order, 'Cancel' to close the modal without keeping modifications, 'Save'
to close modal keeping modifications and 'Next' to go to the next order
CHECK => Even that we are at the end of the current page, 'Next' button
is still available
17. Click on 'Next' button
CHECK => The table behind the modal now displays the next page, and the modal was not closed
18. Click on 'Previous'
CHECK => The table behind the modal went back to the first page, and the modal was not closed
19. Click on 'Previous' button till you reach the first row of the first
    page
CHECK => Only when you reach the first row of the first page 'Previous'
button gets disabled
20. Click on 'Next' button till you reach the last row of the last page
CHECK => Only when you reach the last button of the last page 'Next'
button gets disabled
21. Check that behaviour for the different types of order are still the
    same
    a. For orders that where created through suggestion, check that the
suggestion info is present in Info tab. If when suggestion was accepted
you set a reason, a dropdown to change the reason shoul display also.
    b. For orders that where created through subscriptions, check that
the Items tab is disabled, and the Receipt history is enabled. On
accounting tab you should be able to change quantity ordered. If there
were less items received than ordered, the next time you receive this
order the child order generated from this one shoul appear in receipt
history.
    c. For orders that don't come from subscription and creates there items on ordering, Receipt history
should be disabled, and a table with prefilled items shold appear in the
Items tab. You can edit them and the changes should appear in the item's
row.
    d. For orders that don't come from subscription and creates there
items on receiving, Receipt history should be disabled, and a form to
create the items should appear in Items tab. When you add an item a
table should appear.
    e. For orders that don't come from subscription and creates there
ites on cataloguing, Receipt history and Items tabs should be disabled.
    f. Any changes made in quantity (received or ordered) or funds in the modal should be
reflected in the table if you click save from the modal.
22. Once you've done all you checking and verifications click save
23. While saving a progress bar should appear
24. If no error was detected, you should be redirected back to parcel.pl
    page
25. If an error or warning was detected (like there is an order with 0
    items to receive) the save button should be disabled and warnings
are dispayed.
26. prove t/db_dependent/Koha/Acquisition/Fund.t t/db_dependent/Koha/Acquisitoin/Order.t t/db_dependent/Koha/Item.t

Sponsored-by: Virginia Polytechnic Institute and State University
Comment 54 Agustín Moyano 2021-02-10 16:11:11 UTC
Hi Andrew, first thanks for testing!

(In reply to Andrew Fuerste-Henry from comment #49)
> The list of items to be received hangs at Processing if any of your
> items/orders do not include a replacement price.

This one I could not reproduce.. I used the value 0, no value and even a blank space, but it worked for me.. could you give more detail about your test case?
 
> Price math is inconsistent between receiving versions. I created an order
> using the sample data for My Vendor. The order shows:
> Quantity=1
> Vendor price=3.00
> Tax rate= 19.65
> Discount= 0.1%
> 
> The vendor shows:
> List item price includes tax: No
> Invoice item price includes tax: No
> Discount: 10.0 %
> Tax rate: 19.65 %
> 
> If I click the old Receive button, orderreceive.pl shows:
> retail price: 3
> replacement price: 3
> budgeted cost: 2.70
> actual cost: 2.70
> 
> If I select this order along with other and click Receive Selected, the
> receiving modal shows:
> retail price: 3.59
> replacement price: 3
> budgeted cost: 3.23
> actual cost: 3.23055

This one was a bad check on the flag that determined if tax was included or not in prices, and always used tax included prices. Thanks for pointing this out.

Could you please try once more and tell me about the first bug?

Thanks!
Comment 55 Andrew Fuerste-Henry 2021-02-16 15:26:27 UTC
To recreate the issue where receiving hangs on processing when missing a replacement price:
1: have a fresh Koha Testing Docker
2: apply patch, updatedatabase, restart_all
3: have a basket set to create item records on ordering
4: populate basket from a marc file, only setting price and fund for the items
5: close basket
6: click to Receive, create invoice
7: on parcel.pl, "Processing" alert never resolves
The console shows: 
parcel.pl?invoiceid=1:810 Uncaught TypeError: Cannot read property 'format_price' of null
    at render (parcel.pl?invoiceid=1:810)
    at datatables.min_20.1200012.js:57
    at Object.b.fnGetData (datatables.min_20.1200012.js:51)
    at B (datatables.min_20.1200012.js:56)
    at Ha (datatables.min_20.1200012.js:64)
    at P (datatables.min_20.1200012.js:68)
    at vb (datatables.min_20.1200012.js:79)
    at datatables.min_20.1200012.js:76
    at i (datatables.min_20.1200012.js:74)
    at Object.success (datatables.min_20.1200012.js:75)

And that error points toward:
                        "data": "replacement_price",
                        "render": function(data, type, row, meta) {
                            return (row.replacement_price).format_price();
                        },
                    },

In the database, I see that aqorders.replacementprice is null for all of the orders I made. If I do an update to set aqorders.replacementprice=0, then the receiving page populates as expected.
Comment 56 Andrew Fuerste-Henry 2021-02-16 15:30:44 UTC
Additional issue: 
1 - on parcel.pl, check the checkboxes for one or more titles
2 - click the individual Receive link for one of the expected titles
3 - that takes you to orderreceive.pl for that individual title
4 - click Cancel
5 - when you get back to parcel.pl, the checkboxes you checked previously are still marked, but the Receive Selected button indicates you have zero titles selected. You must un-check and re-check the titles to get them to register.

We should un-check those boxes if we leave and then return to the page.
Comment 57 Andrew Fuerste-Henry 2021-02-16 18:00:04 UTC
A couple of typos. To recreate:
1 - select two or more orders to receive
2 - in the multi-receiving modal, update all but one of your orders to have received items
3 - save your changes in the modal
4 - back on the multi-receiving page, get these messages ("X" is the order number):
Order X: No quantity to receive setted. No items will be created.
Order X: An error cocurred while saving

Those should be:
Order 7: No quantity to receive set. No items will be created.
Order 7: An error occurred while saving.
Comment 58 Agustín Moyano 2021-02-17 15:23:42 UTC
Created attachment 116942 [details] [review]
Bug 8179: Add tests

This patch adds tests in:
* t/db_dependent/Koha/Acquisition/Fund.t
* t/db_dependent/Koha/Acquisitoin/Order.t
* t/db_dependent/Koha/Item.t

Sponsored-by: Virginia Polytechnic Institute and State University
Comment 59 Agustín Moyano 2021-02-17 15:23:49 UTC
Created attachment 116943 [details] [review]
Bug 8179: Add syspref to database

This patch adds the AcqReceiveMultipleOrderLines syspref by atomicupdate
and in sysprefs.sql

Sponsored-by: Virginia Polytechnic Institute and State University
Comment 60 Agustín Moyano 2021-02-17 15:23:55 UTC
Created attachment 116944 [details] [review]
Bug 8179: Add AcqReceiveMultipleOrderLines syspref to preference configuration

This patch adds AcqReceiveMultipleOrderLines to koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref

Sponsored-by: Virginia Polytechnic Institute and State University
Comment 61 Agustín Moyano 2021-02-17 15:24:01 UTC
Created attachment 116945 [details] [review]
Bug 8179: Receive multiple orders

This patch implements the code to allow a patron to receive multiple
orders at the same time in /cgi-bin/koha/acqui/orderreceive.pl page

To test:
1. apply all patches
2. updatedatabase
3. Go to system preferences and allow AcqReceiveMultipleOrderLines
4. In acquisitions module, create a vendor if you don't have one and add
   3 baskets.. one with create items on ordering, one with create items
   on receiving and finally one with create items when cataloguing
5. Fill baskets with orders (There should be at least 15 orders in total). There should be a mix of orders created by suggestions, others by subscriptions and others by neither of those methods.
6. Close all baskets and receive shipment.
CHECK => in /cgi-bin/koha/acqui/parcel.pl page, in top table there is a column with checkboxes, and a button that says "Receive selected"
7. If all orders from all baskets are shown in the table, set the rows per page to 10, so table has more than one page
8. Check some of the checkboxes
CHECK => "Receive selected" button shows how many rows are selected
9. Go to the next page and select some more rows
CHECK => Changing page does not modify how many rows where selected
10. Go back to previous page
CHECK => Previously selected rows are still selected
11. Reload the page to deselect all rows
12. Select only one row and click on "Receive selected" button
CHECK => the page /cgi-bin/koha/acqui/orderreceive.pl behaves just the same as if the "receive" link in the selected row would have been clicked.
13. Click on cancel to go back to parcel.pl page
14. Select all rows (even the ones from the next page of the table) and
    click on "Receive selected"
CHECH => In orderreceive.pl page there is a table with all selected rows
15. Ensure table has more than one page, as in step 7
16. Click on the "edit" link in the last row of the current page
CHECK => A modal window is displayed with 4 tabs within: Info,
Accounting, Receipt history and Items
CHECK => Modal has 4 buttons at the bottom, 'Previous' to go to previos
order, 'Cancel' to close the modal without keeping modifications, 'Save'
to close modal keeping modifications and 'Next' to go to the next order
CHECK => Even that we are at the end of the current page, 'Next' button
is still available
17. Click on 'Next' button
CHECK => The table behind the modal now displays the next page, and the modal was not closed
18. Click on 'Previous'
CHECK => The table behind the modal went back to the first page, and the modal was not closed
19. Click on 'Previous' button till you reach the first row of the first
    page
CHECK => Only when you reach the first row of the first page 'Previous'
button gets disabled
20. Click on 'Next' button till you reach the last row of the last page
CHECK => Only when you reach the last button of the last page 'Next'
button gets disabled
21. Check that behaviour for the different types of order are still the
    same
    a. For orders that where created through suggestion, check that the
suggestion info is present in Info tab. If when suggestion was accepted
you set a reason, a dropdown to change the reason shoul display also.
    b. For orders that where created through subscriptions, check that
the Items tab is disabled, and the Receipt history is enabled. On
accounting tab you should be able to change quantity ordered. If there
were less items received than ordered, the next time you receive this
order the child order generated from this one shoul appear in receipt
history.
    c. For orders that don't come from subscription and creates there items on ordering, Receipt history
should be disabled, and a table with prefilled items shold appear in the
Items tab. You can edit them and the changes should appear in the item's
row.
    d. For orders that don't come from subscription and creates there
items on receiving, Receipt history should be disabled, and a form to
create the items should appear in Items tab. When you add an item a
table should appear.
    e. For orders that don't come from subscription and creates there
ites on cataloguing, Receipt history and Items tabs should be disabled.
    f. Any changes made in quantity (received or ordered) or funds in the modal should be
reflected in the table if you click save from the modal.
22. Once you've done all you checking and verifications click save
23. While saving a progress bar should appear
24. If no error was detected, you should be redirected back to parcel.pl
    page
25. If an error or warning was detected (like there is an order with 0
    items to receive) the save button should be disabled and warnings
are dispayed.
26. prove t/db_dependent/Koha/Acquisition/Fund.t t/db_dependent/Koha/Acquisitoin/Order.t t/db_dependent/Koha/Item.t

Sponsored-by: Virginia Polytechnic Institute and State University
Comment 62 Agustín Moyano 2021-02-17 16:11:58 UTC
(In reply to Andrew Fuerste-Henry from comment #55)
> To recreate the issue where receiving hangs on processing when missing a
> replacement price:
> 1: have a fresh Koha Testing Docker
> 2: apply patch, updatedatabase, restart_all
> 3: have a basket set to create item records on ordering
> 4: populate basket from a marc file, only setting price and fund for the
> items
> 5: close basket
> 6: click to Receive, create invoice
> 7: on parcel.pl, "Processing" alert never resolves
> The console shows: 
> parcel.pl?invoiceid=1:810 Uncaught TypeError: Cannot read property
> 'format_price' of null
>     at render (parcel.pl?invoiceid=1:810)
>     at datatables.min_20.1200012.js:57
>     at Object.b.fnGetData (datatables.min_20.1200012.js:51)
>     at B (datatables.min_20.1200012.js:56)
>     at Ha (datatables.min_20.1200012.js:64)
>     at P (datatables.min_20.1200012.js:68)
>     at vb (datatables.min_20.1200012.js:79)
>     at datatables.min_20.1200012.js:76
>     at i (datatables.min_20.1200012.js:74)
>     at Object.success (datatables.min_20.1200012.js:75)
> 
> And that error points toward:
>                         "data": "replacement_price",
>                         "render": function(data, type, row, meta) {
>                             return (row.replacement_price).format_price();
>                         },
>                     },
> 
> In the database, I see that aqorders.replacementprice is null for all of the
> orders I made. If I do an update to set aqorders.replacementprice=0, then
> the receiving page populates as expected.

Well, that was thorough! Thanks so much.

This issue is not related to this bug, but to 20212 where the code was introduced.

I created bug 27719 to fix this issue.
Comment 63 Agustín Moyano 2021-02-17 16:12:45 UTC
(In reply to Andrew Fuerste-Henry from comment #57)
> A couple of typos. To recreate:
> 1 - select two or more orders to receive
> 2 - in the multi-receiving modal, update all but one of your orders to have
> received items
> 3 - save your changes in the modal
> 4 - back on the multi-receiving page, get these messages ("X" is the order
> number):
> Order X: No quantity to receive setted. No items will be created.
> Order X: An error cocurred while saving
> 
> Those should be:
> Order 7: No quantity to receive set. No items will be created.
> Order 7: An error occurred while saving.

Typos fixed!
Comment 64 Agustín Moyano 2021-02-17 16:20:13 UTC
(In reply to Andrew Fuerste-Henry from comment #56)
> Additional issue: 
> 1 - on parcel.pl, check the checkboxes for one or more titles
> 2 - click the individual Receive link for one of the expected titles
> 3 - that takes you to orderreceive.pl for that individual title
> 4 - click Cancel
> 5 - when you get back to parcel.pl, the checkboxes you checked previously
> are still marked, but the Receive Selected button indicates you have zero
> titles selected. You must un-check and re-check the titles to get them to
> register.
> 
> We should un-check those boxes if we leave and then return to the page.

Again, could not reproduce this error.. could you please copy/paste any errors that appear in browsers console?

Thanks
Comment 65 Séverine Queune 2021-04-01 15:16:23 UTC
Sorry Agustín, the patch needs a new rebase...

CONFLICT (content): Merge conflict in t/db_dependent/Koha/Item.t
error: Failed to merge in the changes.
Patch failed at 0001 Bug 8179: Add tests
Comment 66 Agustín Moyano 2021-04-05 14:17:22 UTC
Created attachment 119178 [details] [review]
Bug 8179: Add tests

This patch adds tests in:
* t/db_dependent/Koha/Acquisition/Fund.t
* t/db_dependent/Koha/Acquisitoin/Order.t
* t/db_dependent/Koha/Item.t

Sponsored-by: Virginia Polytechnic Institute and State University
Comment 67 Agustín Moyano 2021-04-05 14:17:29 UTC
Created attachment 119179 [details] [review]
Bug 8179: Add syspref to database

This patch adds the AcqReceiveMultipleOrderLines syspref by atomicupdate
and in sysprefs.sql

Sponsored-by: Virginia Polytechnic Institute and State University
Comment 68 Agustín Moyano 2021-04-05 14:17:35 UTC
Created attachment 119180 [details] [review]
Bug 8179: Add AcqReceiveMultipleOrderLines syspref to preference configuration

This patch adds AcqReceiveMultipleOrderLines to koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref

Sponsored-by: Virginia Polytechnic Institute and State University
Comment 69 Agustín Moyano 2021-04-05 14:17:45 UTC
Created attachment 119181 [details] [review]
Bug 8179: Receive multiple orders

This patch implements the code to allow a patron to receive multiple
orders at the same time in /cgi-bin/koha/acqui/orderreceive.pl page

To test:
1. apply all patches
2. updatedatabase
3. Go to system preferences and allow AcqReceiveMultipleOrderLines
4. In acquisitions module, create a vendor if you don't have one and add
   3 baskets.. one with create items on ordering, one with create items
   on receiving and finally one with create items when cataloguing
5. Fill baskets with orders (There should be at least 15 orders in total). There should be a mix of orders created by suggestions, others by subscriptions and others by neither of those methods.
6. Close all baskets and receive shipment.
CHECK => in /cgi-bin/koha/acqui/parcel.pl page, in top table there is a column with checkboxes, and a button that says "Receive selected"
7. If all orders from all baskets are shown in the table, set the rows per page to 10, so table has more than one page
8. Check some of the checkboxes
CHECK => "Receive selected" button shows how many rows are selected
9. Go to the next page and select some more rows
CHECK => Changing page does not modify how many rows where selected
10. Go back to previous page
CHECK => Previously selected rows are still selected
11. Reload the page to deselect all rows
12. Select only one row and click on "Receive selected" button
CHECK => the page /cgi-bin/koha/acqui/orderreceive.pl behaves just the same as if the "receive" link in the selected row would have been clicked.
13. Click on cancel to go back to parcel.pl page
14. Select all rows (even the ones from the next page of the table) and
    click on "Receive selected"
CHECH => In orderreceive.pl page there is a table with all selected rows
15. Ensure table has more than one page, as in step 7
16. Click on the "edit" link in the last row of the current page
CHECK => A modal window is displayed with 4 tabs within: Info,
Accounting, Receipt history and Items
CHECK => Modal has 4 buttons at the bottom, 'Previous' to go to previos
order, 'Cancel' to close the modal without keeping modifications, 'Save'
to close modal keeping modifications and 'Next' to go to the next order
CHECK => Even that we are at the end of the current page, 'Next' button
is still available
17. Click on 'Next' button
CHECK => The table behind the modal now displays the next page, and the modal was not closed
18. Click on 'Previous'
CHECK => The table behind the modal went back to the first page, and the modal was not closed
19. Click on 'Previous' button till you reach the first row of the first
    page
CHECK => Only when you reach the first row of the first page 'Previous'
button gets disabled
20. Click on 'Next' button till you reach the last row of the last page
CHECK => Only when you reach the last button of the last page 'Next'
button gets disabled
21. Check that behaviour for the different types of order are still the
    same
    a. For orders that where created through suggestion, check that the
suggestion info is present in Info tab. If when suggestion was accepted
you set a reason, a dropdown to change the reason shoul display also.
    b. For orders that where created through subscriptions, check that
the Items tab is disabled, and the Receipt history is enabled. On
accounting tab you should be able to change quantity ordered. If there
were less items received than ordered, the next time you receive this
order the child order generated from this one shoul appear in receipt
history.
    c. For orders that don't come from subscription and creates there items on ordering, Receipt history
should be disabled, and a table with prefilled items shold appear in the
Items tab. You can edit them and the changes should appear in the item's
row.
    d. For orders that don't come from subscription and creates there
items on receiving, Receipt history should be disabled, and a form to
create the items should appear in Items tab. When you add an item a
table should appear.
    e. For orders that don't come from subscription and creates there
ites on cataloguing, Receipt history and Items tabs should be disabled.
    f. Any changes made in quantity (received or ordered) or funds in the modal should be
reflected in the table if you click save from the modal.
22. Once you've done all you checking and verifications click save
23. While saving a progress bar should appear
24. If no error was detected, you should be redirected back to parcel.pl
    page
25. If an error or warning was detected (like there is an order with 0
    items to receive) the save button should be disabled and warnings
are dispayed.
26. prove t/db_dependent/Koha/Acquisition/Fund.t t/db_dependent/Koha/Acquisitoin/Order.t t/db_dependent/Koha/Item.t

Sponsored-by: Virginia Polytechnic Institute and State University
Comment 70 Séverine Queune 2021-04-06 10:52:28 UTC
Hi Agustín !
It's a pleasure to be able to test the full test plan, it's been a while I waited for it !
Everything works fine to me.
I just have a suggestion for point 25.
I get an alert for the different errors spotted during the saving but, as a user, it seemed a bit tiny to me, and as they disappear after the full job process, it seems very quick when there is just a few orders to register, so user can easily don't notice them I think.
Could we imagine to have, for example, the yellow alert displayed once we're back on the receipt page, like we have in circulation pages ?
Comment 71 Séverine Queune 2021-04-06 11:15:27 UTC
Sorry Agustín, I've just tested once more the subscription receipt, and realise the quantity received isn't taken into account : I ordered 12 as quantity and wanted to receive 1, after saving on modal, I still have the message "Receiving 12 out of 12", and order is set "Complete" after saving.
Comment 72 Séverine Queune 2021-04-06 11:24:32 UTC
ok, last message (I hope... next time I'll try to a send a single feedback...).
Columns in acqui/parcel.pl are not sortable anymore.

I add a question about standing order : could it be interesting / is it possible to have informations about the previous receipt ? It's a feature we don't use, but while I tested it, I thought it might be helpful.
Comment 73 Katrin Fischer 2021-04-17 18:27:20 UTC
Do we see a chance for this in 21.05?
Comment 74 Agustín Moyano 2021-05-06 12:45:42 UTC
Created attachment 120620 [details] [review]
Bug 8179: Add tests

This patch adds tests in:
* t/db_dependent/Koha/Acquisition/Fund.t
* t/db_dependent/Koha/Acquisitoin/Order.t
* t/db_dependent/Koha/Item.t

Sponsored-by: Virginia Polytechnic Institute and State University
Comment 75 Agustín Moyano 2021-05-06 12:45:50 UTC
Created attachment 120621 [details] [review]
Bug 8179: Add syspref to database

This patch adds the AcqReceiveMultipleOrderLines syspref by atomicupdate
and in sysprefs.sql

Sponsored-by: Virginia Polytechnic Institute and State University
Comment 76 Agustín Moyano 2021-05-06 12:46:01 UTC
Created attachment 120622 [details] [review]
Bug 8179: Add AcqReceiveMultipleOrderLines syspref to preference configuration

This patch adds AcqReceiveMultipleOrderLines to koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref

Sponsored-by: Virginia Polytechnic Institute and State University
Comment 77 Agustín Moyano 2021-05-06 12:46:09 UTC
Created attachment 120623 [details] [review]
Bug 8179: Receive multiple orders

This patch implements the code to allow a patron to receive multiple
orders at the same time in /cgi-bin/koha/acqui/orderreceive.pl page

To test:
1. apply all patches
2. updatedatabase
3. Go to system preferences and allow AcqReceiveMultipleOrderLines
4. In acquisitions module, create a vendor if you don't have one and add
   3 baskets.. one with create items on ordering, one with create items
   on receiving and finally one with create items when cataloguing
5. Fill baskets with orders (There should be at least 15 orders in total). There should be a mix of orders created by suggestions, others by subscriptions and others by neither of those methods.
6. Close all baskets and receive shipment.
CHECK => in /cgi-bin/koha/acqui/parcel.pl page, in top table there is a column with checkboxes, and a button that says "Receive selected"
7. If all orders from all baskets are shown in the table, set the rows per page to 10, so table has more than one page
8. Check some of the checkboxes
CHECK => "Receive selected" button shows how many rows are selected
9. Go to the next page and select some more rows
CHECK => Changing page does not modify how many rows where selected
10. Go back to previous page
CHECK => Previously selected rows are still selected
11. Reload the page to deselect all rows
12. Select only one row and click on "Receive selected" button
CHECK => the page /cgi-bin/koha/acqui/orderreceive.pl behaves just the same as if the "receive" link in the selected row would have been clicked.
13. Click on cancel to go back to parcel.pl page
14. Select all rows (even the ones from the next page of the table) and
    click on "Receive selected"
CHECH => In orderreceive.pl page there is a table with all selected rows
15. Ensure table has more than one page, as in step 7
16. Click on the "edit" link in the last row of the current page
CHECK => A modal window is displayed with 4 tabs within: Info,
Accounting, Receipt history and Items
CHECK => Modal has 4 buttons at the bottom, 'Previous' to go to previos
order, 'Cancel' to close the modal without keeping modifications, 'Save'
to close modal keeping modifications and 'Next' to go to the next order
CHECK => Even that we are at the end of the current page, 'Next' button
is still available
17. Click on 'Next' button
CHECK => The table behind the modal now displays the next page, and the modal was not closed
18. Click on 'Previous'
CHECK => The table behind the modal went back to the first page, and the modal was not closed
19. Click on 'Previous' button till you reach the first row of the first
    page
CHECK => Only when you reach the first row of the first page 'Previous'
button gets disabled
20. Click on 'Next' button till you reach the last row of the last page
CHECK => Only when you reach the last button of the last page 'Next'
button gets disabled
21. Check that behaviour for the different types of order are still the
    same
    a. For orders that where created through suggestion, check that the
suggestion info is present in Info tab. If when suggestion was accepted
you set a reason, a dropdown to change the reason shoul display also.
    b. For orders that where created through subscriptions, check that
the Items tab is disabled, and the Receipt history is enabled. On
accounting tab you should be able to change quantity ordered. If there
were less items received than ordered, the next time you receive this
order the child order generated from this one shoul appear in receipt
history.
    c. For orders that don't come from subscription and creates there items on ordering, Receipt history
should be disabled, and a table with prefilled items shold appear in the
Items tab. You can edit them and the changes should appear in the item's
row.
    d. For orders that don't come from subscription and creates there
items on receiving, Receipt history should be disabled, and a form to
create the items should appear in Items tab. When you add an item a
table should appear.
    e. For orders that don't come from subscription and creates there
ites on cataloguing, Receipt history and Items tabs should be disabled.
    f. Any changes made in quantity (received or ordered) or funds in the modal should be
reflected in the table if you click save from the modal.
22. Once you've done all you checking and verifications click save
23. While saving a progress bar should appear
24. If no error was detected, you should be redirected back to parcel.pl
    page
25. If an error or warning was detected (like there is an order with 0
    items to receive) the save button should be disabled and warnings
are dispayed.
26. prove t/db_dependent/Koha/Acquisition/Fund.t t/db_dependent/Koha/Acquisitoin/Order.t t/db_dependent/Koha/Item.t

Sponsored-by: Virginia Polytechnic Institute and State University