Bug 21982 - Circulation statistics wizard does not count deleted items
Summary: Circulation statistics wizard does not count deleted items
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Reports (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor
Assignee: Katrin Fischer
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-10 22:24 UTC by Caroline Cyr La Rose
Modified: 2023-12-28 20:43 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This patch corrects a bug in the Circulation statistics wizard. Previously, the wizard only looked at existing items to calculate statistics. It now includes transactions made on items that are now deleted.
Version(s) released in:
22.11.00,21.11, 22.05.05
Circulation function:


Attachments
Bug 21982: Statistic assistant - Circulation (1.54 KB, patch)
2021-11-25 15:55 UTC, Jérémy Breuillard
Details | Diff | Splinter Review
BZ 34887: Statistic assistant - Circulation (1.54 KB, patch)
2021-11-25 16:17 UTC, Jérémy Breuillard
Details | Diff | Splinter Review
Bug 21982: Circulation statistics wizard does not count deleted items (1.54 KB, patch)
2021-11-25 16:24 UTC, Jérémy Breuillard
Details | Diff | Splinter Review
Bug 21982: Circulation statistics wizard does not count deleted items (1.52 KB, patch)
2021-11-26 08:42 UTC, Jérémy Breuillard
Details | Diff | Splinter Review
Bug 21982: Circulation statistics wizard does not count deleted items (1.58 KB, patch)
2022-07-25 09:54 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 21982: Circulation statistics wizard does not count deleted items (1.64 KB, patch)
2022-07-25 22:09 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Caroline Cyr La Rose 2018-12-10 22:24:10 UTC
A client noticed that deleted items are not counted in circulation stats when using the statistics wizard.

Here is the test plan:
1) Search the catalog for a record with an available item
2) Loan out that item to a user and return it
3) Go in Reports > Statistics wizards > Circulation
4) Fill in the form
    - Choose a period that includes today
    - Choose "Type" = Checkout
    - Choose Item type for both "Row" and "Column"
5) Leave the rest as is and click "Submit"
6) Note the quantity of loans for the itemtype of your item
7) Go back to your item and delete it
8) Go back to your report and refresh
9) Notice that the amount of loans is less than it was before

It's not because the item is deleted that the loan didn't happen

The wizard should look at both items and deleted_items to calculate the amount of circulation transactions.
Comment 1 Caroline Cyr La Rose 2018-12-10 23:15:03 UTC
It would be great for troubleshooting if the SQL query created by the wizard was available through a button on the page (like regular SQL reports).
Comment 2 Andrew Fuerste-Henry 2020-10-22 17:48:19 UTC
+1 on this, having just run into the same question.

By default, the circ wizard is limiting based on homebranch and holdingbranch, but only based on the items table, where items.homebranch and items.holdingbranch are null for things that only exist in deleteditems. If you set those dropdowns to blank and don't limit based on anything else that exists in items rather than statistics, then the wizard will include stats for deleted items.

I'd be ok with an immediate quick-fix of just not making this default to limiting based on homebranch and holdingbranch.

I'd be even happier about making the wizard look at both items and deleteditems.

If we could also get some way to see the SQL used by the wizard, for diagnostic purposes, that'd be amazing.
Comment 3 Jérémy Breuillard 2021-11-25 15:55:41 UTC Comment hidden (obsolete)
Comment 4 Jérémy Breuillard 2021-11-25 16:17:54 UTC Comment hidden (obsolete)
Comment 5 Jérémy Breuillard 2021-11-25 16:24:36 UTC Comment hidden (obsolete)
Comment 6 Jérémy Breuillard 2021-11-26 08:42:01 UTC
Created attachment 128026 [details] [review]
Bug 21982: Circulation statistics wizard does not count deleted items

By default statistic assistant filter is set on the
existing items and doesn't mind about deleted items.
The patch corrects this. Items belong to the same library.

Test plan:
1)Make sure to have at least 1 or more item(s) in deleteditems database table
2)Home > Reports > Circulation statistics
3)Fill up 'Issuing library', 'Home library' and 'Holding library'
4)Submit
5)Notice that only statistics for active items are shown
6)Apply patch and repeat from 2) to 5)
7)Now active items and deleted items are shown
Comment 7 Sally 2022-07-25 09:54:03 UTC
Works as described, signing off.  Thanks for the patch!
Comment 8 ByWater Sandboxes 2022-07-25 09:54:47 UTC
Created attachment 138075 [details] [review]
Bug 21982: Circulation statistics wizard does not count deleted items

By default statistic assistant filter is set on the
existing items and doesn't mind about deleted items.
The patch corrects this. Items belong to the same library.

Test plan:
1)Make sure to have at least 1 or more item(s) in deleteditems database table
2)Home > Reports > Circulation statistics
3)Fill up 'Issuing library', 'Home library' and 'Holding library'
4)Submit
5)Notice that only statistics for active items are shown
6)Apply patch and repeat from 2) to 5)
7)Now active items and deleted items are shown

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Comment 9 Katrin Fischer 2022-07-25 22:09:28 UTC
Created attachment 138106 [details] [review]
Bug 21982: Circulation statistics wizard does not count deleted items

By default statistic assistant filter is set on the
existing items and doesn't mind about deleted items.
The patch corrects this. Items belong to the same library.

Test plan:
1)Make sure to have at least 1 or more item(s) in deleteditems database table
2)Home > Reports > Circulation statistics
3)Fill up 'Issuing library', 'Home library' and 'Holding library'
4)Submit
5)Notice that only statistics for active items are shown
6)Apply patch and repeat from 2) to 5)
7)Now active items and deleted items are shown

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 10 Tomás Cohen Arazi (tcohen) 2022-07-26 12:34:33 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 11 Lucas Gass (lukeg) 2022-09-02 20:11:28 UTC
Backported to 22.05.x for 22.05.05
Comment 12 Arthur Suzuki 2022-09-14 12:58:13 UTC
Thanks!

Pushed to 21.11 for 21.11.12
Comment 13 Victor Grousset/tuxayo 2022-09-20 18:50:12 UTC
Not backported to oldoldstable (21.05.x). Feel free to ask if it's needed.

Nothing to document it seems, marking resolved.