[Koha-bugs] [Bug 13914] The holds statistics report return random data

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Mar 26 13:33:09 CET 2015


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13914

--- Comment #1 from Jonathan Druart <jonathan.druart at biblibre.com> ---
Created attachment 37267
  -->
http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=37267&action=edit
Bug 13914: Holds statistics report should add values from reserves and
old_reserves

And not pick one randomly...

To reproduce:
1/ Go on Reports › Holds statistics

2/ Fill the form with:
Hold status: All checked (Asked Processing Waiting Satisfied Cancelled)
Hold Date From 01/01/2014 To 31/01/2014

Pickup library => empty
Holding library => empty
Home library => empty

Row is "Hold status", Column is "Pickup library".

3/ Submit!

4/ Look at the results

5/ Restart mysql

6/ Ctrl+R to resubmit the form

7/ Look at the results

The generated query looks like ( SELECT stuffs FROM reserves ) UNION (
SELECT stuffs FROM old_reserves )
It returns something like:
+------+---------------+-------------+
| line | col           | calculation |
+------+---------------+-------------+
|    1 | BRANCHCODE1   |           1 | < from the reserves table
|    1 | BRANCHCODE1   |          11 | < from the old_reserves table
|    1 | BRANCHCODE2   |           2 |
|    1 | BRANCHCODE2   |          22 |
|    2 | BRANCHCODE1   |           4 |
|    2 | BRANCHCODE1   |          44 |
|    2 | BRANCHCODE2   |           5 |
|    2 | BRANCHCODE2   |          55 |
+------+---------------+-------------+

The screen will display 1 OR 11 for the BRANCHCODE1 line 1.
Since ( line, col ) is not uniq, fetchall_hashref (l.280) was not a good
idea here.
This patch replaces it with fetchall_arrayref, reconstruct the variables
used later and add the values from reserves and old_reserves.

Test plan:
Confirm that the results are now relevant.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list