Bug 18393

Summary: Statistics wizard for acquisitions not filtering correctly by collection code
Product: Koha Reporter: Barton Chittenden <barton>
Component: ReportsAssignee: Katrin Fischer <katrin.fischer>
Status: CLOSED FIXED QA Contact: Martin Renvoize <martin.renvoize>
Severity: minor    
Priority: P5 - low CC: fridolin.somers, katrin.fischer, lucas, martin.renvoize, nick
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: report settings
Report results, all collection codes
Report results, choose collection code 'music only'
Bug 18939: Acquisition statistics - Fix wrong template variable name for collection filter
Bug 18939: Acquisition statistics - Fix wrong template variable name for collection filter

Description Barton Chittenden 2017-04-05 21:37:20 UTC
Created attachment 61929 [details]
report settings

The canned report under Home › Reports › Acquisitions statistics is not filtering on collection code.

To replicate:

'Received on'
    check 'row'
    Filter: From: 01/01/2016 To: 12/31/2016
    (or use a date range that corresponds to acquisitions on your system)

'Collection code'
    check 'column'
    Filter: Select 'All'

Cell value
    Choose 'Count items'

Output
    Choose 'To screen into the browser'

Click Submit.

You will see columns of collection codes, with each row being a separate date. All collection codes will be displayed.

Use the browser's back button, change the collection code

'Collection code'
    check 'column'
    Filter: Select 'Music'
    (or a collection code on your system)

Click submit.

We would expect to see a single column showing the 'Music' collection code -- instead we see all collection codes again.

See screenshots for report settings and output.
Comment 1 Barton Chittenden 2017-04-05 21:38:22 UTC
Created attachment 61930 [details]
Report results, all collection codes
Comment 2 Barton Chittenden 2017-04-05 21:39:17 UTC
Created attachment 61931 [details]
Report results, choose collection code 'music only'
Comment 3 Katrin Fischer 2019-02-10 19:44:01 UTC
It looks like a template issue, the codes in the values are missing:

<select name="Filter">
<option value="" selected="selected">All</option>                       
<option value="">Fiction</option>
<option value="">Non-fiction</option>
<option value="">Reference</option>
Comment 4 Katrin Fischer 2019-02-10 19:57:27 UTC
Created attachment 84948 [details] [review]
Bug 18939: Acquisition statistics - Fix wrong template variable name for collection filter

The template variable was wrong, so the filter never submitted the
collection code for the query.

Before:
<option value="">Fiction</option>
<option value="">Non-fiction</option>

After:
<option value="FIC">Fiction</option>
<option value="NFIC">Non-fiction</option>

To test:
- Go to Reports > Statistics wizards > Acquisitions
- Pick a row and column
- Compare results with and without collection filter
- Verify the table is always the same
- Apply patch
- Repeat comparison, verify the filter works now
Comment 5 Martin Renvoize 2019-02-12 15:05:48 UTC
Created attachment 85023 [details] [review]
Bug 18939: Acquisition statistics - Fix wrong template variable name for collection filter

The template variable was wrong, so the filter never submitted the
collection code for the query.

Before:
<option value="">Fiction</option>
<option value="">Non-fiction</option>

After:
<option value="FIC">Fiction</option>
<option value="NFIC">Non-fiction</option>

To test:
- Go to Reports > Statistics wizards > Acquisitions
- Pick a row and column
- Compare results with and without collection filter
- Verify the table is always the same
- Apply patch
- Repeat comparison, verify the filter works now

https://bugs.koha-community.org/show_bug.cgi?id=18393
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 6 Martin Renvoize 2019-02-12 15:06:22 UTC
Nice work Katrin, another great fix that I'm going to go straight for PQA on.. works well, no regressions found.
Comment 7 Nick Clemens 2019-02-15 18:47:45 UTC
Awesome work all!

Pushed to master for 19.05
Comment 8 Martin Renvoize 2019-02-25 13:52:25 UTC
Pushed to 18.11.x for 18.11.04 - I corrected the commit message to state the correct bug number on push too.. 18939 -> 18393
Comment 9 Lucas Gass 2019-03-05 21:13:51 UTC
backported to 18.05.x for 18.05.11