Bug 21385 - Vendor search: Item count is incorrectly updated on partial receive
Summary: Vendor search: Item count is incorrectly updated on partial receive
Status: Pushed to Stable
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: master
Hardware: All All
: P2 major (vote)
Assignee: Martin Renvoize
QA Contact: Testopia
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-09-20 13:31 UTC by Martin Renvoize
Modified: 2018-10-08 08:27 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 21385: Correctly count all items in basket for booksellers list (1.23 KB, patch)
2018-09-21 14:12 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21385: Correctly count all items in basket for booksellers list (1.76 KB, patch)
2018-09-24 09:09 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21385: Add Unit Tests (5.91 KB, patch)
2018-09-24 12:24 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21385: Correctly count all items in basket for booksellers list (1.76 KB, patch)
2018-09-24 12:35 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21385: Add Unit Tests (6.37 KB, patch)
2018-09-24 12:35 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21385: (followup) - make query consistent (1010 bytes, patch)
2018-09-24 12:36 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21385: Correctly count all items in basket for booksellers list (1.76 KB, patch)
2018-09-25 11:14 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21385: Add Unit Tests (6.32 KB, patch)
2018-09-25 11:14 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21385: (followup) - make query consistent (1010 bytes, patch)
2018-09-25 11:14 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21385: (followup) Workaround for bug in get_from_storage method (1.39 KB, patch)
2018-09-25 11:14 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21385: Define the Koha object class for orders (1.24 KB, patch)
2018-10-01 14:38 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21385: Correctly count all items in basket for booksellers list (2.49 KB, patch)
2018-10-01 14:59 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21385: Add Unit Tests (6.47 KB, patch)
2018-10-01 14:59 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21385: (follow-up) make query consistent (1.13 KB, patch)
2018-10-01 14:59 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21385: Define the Koha object class for orders (1.32 KB, patch)
2018-10-01 14:59 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Renvoize 2018-09-20 13:31:41 UTC
To reproduce:

1) Create a basket with 2 biblios, one with 2 items and one with 1 item
2) Search for vendors and note the basket above should contain 'Item count 3', 'Biblio count 2', 'Items expected 3'
3) Receive shipment, and only receive 1 of the items on the biblio with 2 items above.
4) Search for vendors and note that the 'Item count' for the basket above is now '2'.

The item count for a closed basket should remain the same and should differ from the 'items expected' count some items have been recieved.
Comment 1 Martin Renvoize 2018-09-21 14:12:44 UTC
Created attachment 79235 [details] [review]
Bug 21385: Correctly count all items in basket for booksellers list
Comment 2 Martin Renvoize 2018-09-24 09:09:30 UTC
Created attachment 79280 [details] [review]
Bug 21385: Correctly count all items in basket for booksellers list
Comment 3 Martin Renvoize 2018-09-24 09:10:46 UTC
Test additions to follow.
Comment 4 Martin Renvoize 2018-09-24 12:24:10 UTC
Created attachment 79301 [details] [review]
Bug 21385: Add Unit Tests
Comment 5 Martin Renvoize 2018-09-24 12:35:55 UTC
Created attachment 79303 [details] [review]
Bug 21385: Correctly count all items in basket for booksellers list
Comment 6 Martin Renvoize 2018-09-24 12:35:59 UTC
Created attachment 79304 [details] [review]
Bug 21385: Add Unit Tests
Comment 7 Martin Renvoize 2018-09-24 12:36:02 UTC
Created attachment 79305 [details] [review]
Bug 21385: (followup) - make query consistent

The expected items query wasn't consistent with other queries in this
module with regards to identifying cancelled orders
Comment 8 Martin Renvoize 2018-09-24 17:36:02 UTC
I'm struggling on the test.. I'm sure it's testing correctly, but it would appear  the expected items is coming out wrong.. any pointers welcome.
Comment 9 Martin Renvoize 2018-09-25 11:14:40 UTC
Created attachment 79362 [details] [review]
Bug 21385: Correctly count all items in basket for booksellers list
Comment 10 Martin Renvoize 2018-09-25 11:14:43 UTC
Created attachment 79363 [details] [review]
Bug 21385: Add Unit Tests
Comment 11 Martin Renvoize 2018-09-25 11:14:46 UTC
Created attachment 79364 [details] [review]
Bug 21385: (followup) - make query consistent

The expected items query wasn't consistent with other queries in this
module with regards to identifying cancelled orders
Comment 12 Martin Renvoize 2018-09-25 11:14:50 UTC
Created attachment 79365 [details] [review]
Bug 21385: (followup) Workaround for bug in get_from_storage method
Comment 13 Martin Renvoize 2018-09-25 11:18:14 UTC
Test fixed.
Comment 14 Caroline Cyr La Rose 2018-09-28 17:35:33 UTC
Item count stays the same.
Comment 15 Jonathan Druart 2018-09-30 21:44:02 UTC
(In reply to Caroline Cyr La Rose from comment #14)
> Item count stays the same.

You changed the status to "Signed Off", I guess it was not expected :)
Comment 16 Caroline Cyr La Rose 2018-10-01 13:16:44 UTC
The signoff was good. It worked as expected. 

The patch was meant to make sure the item count in a basket stayed the same even when the order was partially received.
Comment 17 Jonathan Druart 2018-10-01 14:38:47 UTC
Created attachment 79721 [details] [review]
Bug 21385: Define the Koha object class for orders

It fixes the following issue:
t/db_dependent/Acquisition/GetBasketsInfosByBookseller.t .. 1/40 Can't
locate object method "_new_from_dbic" via package "Koha::Aqorder"
(perhaps you forgot to load "Koha::Aqorder"?) at
/home/vagrant/kohaclone/Koha/Object.pm line 230.
Comment 18 Jonathan Druart 2018-10-01 14:59:10 UTC
Created attachment 79727 [details] [review]
Bug 21385: Correctly count all items in basket for booksellers list

To reproduce:

1) Create a basket with 2 biblios, one with 2 items and one with 1 item
2) Search for vendors and note the basket above should contain 'Item
count 3', 'Biblio count 2', 'Items expected 3'
3) Receive shipment, and only receive 1 of the items on the biblio with
2 items above.
4) Search for vendors and note that the 'Item count' for the basket
above is now '2'.

The item count for a closed basket should remain the same and should
differ from the 'items expected' count some items have been recieved.

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Amended patch:
FAIL   C4/Acquisition.pm
   FAIL   spelling
     RECIEVED  ==> RECEIVED
Comment 19 Jonathan Druart 2018-10-01 14:59:15 UTC
Created attachment 79728 [details] [review]
Bug 21385: Add Unit Tests

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 20 Jonathan Druart 2018-10-01 14:59:19 UTC
Created attachment 79729 [details] [review]
Bug 21385: (follow-up) make query consistent

The expected items query wasn't consistent with other queries in this
module with regards to identifying cancelled orders

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 21 Jonathan Druart 2018-10-01 14:59:23 UTC
Created attachment 79730 [details] [review]
Bug 21385: Define the Koha object class for orders

It fixes the following issue:
t/db_dependent/Acquisition/GetBasketsInfosByBookseller.t .. 1/40 Can't
locate object method "_new_from_dbic" via package "Koha::Aqorder"
(perhaps you forgot to load "Koha::Aqorder"?) at
/home/vagrant/kohaclone/Koha/Object.pm line 230.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 22 Martin Renvoize 2018-10-01 16:59:47 UTC
Thanks for adding the followup Jonathan, my brain was struggling to work that one out (even after asking Kyle for assistance).. Now I know what to look if I come across a similar issue.
Comment 23 Nick Clemens 2018-10-02 00:13:49 UTC
Awesome work all!

Pushed to master for 18.11
Comment 24 Martin Renvoize 2018-10-08 08:27:18 UTC
Pushed to 18.05.x for 18.05.05