Bug 10154 - Add collection, location, and callnumber filters to report for most circulated items
Summary: Add collection, location, and callnumber filters to report for most circulate...
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Reports (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Eivin Giske Skaaren
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-29 19:06 UTC by Anthony Laquerre
Modified: 2017-06-14 22:10 UTC (History)
5 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Added functionality for ccode and shelving location (7.77 KB, patch)
2015-10-28 00:29 UTC, Eivin Giske Skaaren
Details | Diff | Splinter Review
Bug 10154 Add Call number in the filter of most circulated items (9.49 KB, patch)
2015-10-28 20:51 UTC, Eivin Giske Skaaren
Details | Diff | Splinter Review
Bug 10154 Add Call number in the filter of most circulated items (9.49 KB, patch)
2015-11-16 18:01 UTC, Eivin Giske Skaaren
Details | Diff | Splinter Review
Bug 10154 Add Call number in the filter of most circulated items (9.49 KB, patch)
2015-11-16 18:15 UTC, Eivin Giske Skaaren
Details | Diff | Splinter Review
Bug 10154 Add Call number in the filter of most circulated items (9.85 KB, patch)
2015-11-16 18:34 UTC, Frédéric Demians
Details | Diff | Splinter Review
Bug 10154: QA follow-up - Spelling and terminology (1.83 KB, patch)
2015-11-30 23:49 UTC, Katrin Fischer
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 10154: QA follow-up - Spelling and terminology (1.93 KB, patch)
2015-12-03 16:16 UTC, Owen Leonard
Details | Diff | Splinter Review
[PASSED QA] Bug 10154 Add Call number in the filter of most circulated items (9.92 KB, patch)
2015-12-03 16:18 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 10154: QA follow-up - Spelling and terminology (1.88 KB, patch)
2015-12-03 16:19 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 Anthony Laquerre 2013-04-29 19:06:34 UTC
Request for enhancement


We would like to add call number in the page "Most-circulated items".
/cgi-bin/koha/reports/cat_issues_top.pl

The goal is to get a list of callnumber that circulated the most ( Ex : "800" for litterature and something similar for LC).

We could mayby take the prefix of the call number and be able to filter/order document with it.
Comment 1 Viktor Sarge 2015-05-17 19:23:11 UTC
We would have good use of drop downs with full call number, shelving location and collection code. 

(regular text fields might of course be an alternative when a drop down might be overly long)
Comment 2 Eivin Giske Skaaren 2015-10-28 00:29:18 UTC Comment hidden (obsolete)
Comment 3 Eivin Giske Skaaren 2015-10-28 20:51:05 UTC Comment hidden (obsolete)
Comment 4 Eivin Giske Skaaren 2015-11-16 18:01:10 UTC Comment hidden (obsolete)
Comment 5 Eivin Giske Skaaren 2015-11-16 18:15:30 UTC Comment hidden (obsolete)
Comment 6 Frédéric Demians 2015-11-16 18:34:29 UTC Comment hidden (obsolete)
Comment 7 Eivin Giske Skaaren 2015-11-16 18:53:04 UTC
Thanks for the signoff Frédéric.
Let me tell you that I am no fan of the style with magic numbers etc either but the alternative would be a complete rewrite of this script I think :)
Comment 8 Frédéric Demians 2015-11-16 19:20:05 UTC
> Let me tell you that I am no fan of the style with magic numbers etc either
> but the alternative would be a complete rewrite of this script I think :)

IMO, your choice not to refactor the script is a good choice. It helps avoiding regression yet increasing this report usefulness. Thks.
Comment 9 Katrin Fischer 2015-11-30 23:47:29 UTC
We should fix these reports sometime... but I am ok with 'not right now' :)

I will attach a patch with some tiny follow-ups to the terminology used, can you please take a look?

Also a question, why these commented out lines?
+      # These limits does not currently exist, maybe later?
+      # $colfilter[0] = @$filters[6] if ($column =~ /ccode/ )  ;
+      # $colfilter[0] = @$filters[7] if ($column =~ /location/ )  ;
+        $colfilter[0] = @$filters[8] if ($column =~ /category/ )  ;
+      # This commented out row (sort2) was not removed when adding new filters for ccode, shelving location and call number
Comment 10 Katrin Fischer 2015-11-30 23:49:13 UTC Comment hidden (obsolete)
Comment 11 Eivin Giske Skaaren 2015-12-01 08:17:35 UTC
(In reply to Katrin Fischer from comment #9)
> We should fix these reports sometime... but I am ok with 'not right now' :)
> 
> I will attach a patch with some tiny follow-ups to the terminology used, can
> you please take a look?
> 
> Also a question, why these commented out lines?
> +      # These limits does not currently exist, maybe later?
> +      # $colfilter[0] = @$filters[6] if ($column =~ /ccode/ )  ;
> +      # $colfilter[0] = @$filters[7] if ($column =~ /location/ )  ;
> +        $colfilter[0] = @$filters[8] if ($column =~ /category/ )  ;
> +      # This commented out row (sort2) was not removed when adding new
> filters for ccode, shelving location and call number

I will take a look at the QA follow up tonight.

For the commented out lines there were 2 considerations:

1. One already commented out line that seemed out of place but I did not remove it.

2. Fill in gaps just to make the magic numbers less confusing. It is easy to overlook a missing row etc in this type of code.

I can remove the commented out code if that is preferred.
Comment 12 Eivin Giske Skaaren 2015-12-01 20:00:53 UTC
(In reply to Katrin Fischer from comment #10)
> Created attachment 45246 [details] [review] [review]
> Bug 10154: QA follow-up - Spelling and terminology
> 
> - Changing capitalization: Any Patron category > Any patron category
> - Changing Collection code > Collection

Sure we can change this. Before I reupload could you please let me know about what is preferred regarding the commented out lines.

(Also since this is very minor changes perhaps you will just apply them when looking at this instead of me reuploading?)
Comment 13 Katrin Fischer 2015-12-02 23:26:16 UTC
I understand now why the lines have been added, I am ok with keeping them. If you want and agree, you can sign off my QA follow-up patch.
Comment 14 Owen Leonard 2015-12-03 16:16:26 UTC Comment hidden (obsolete)
Comment 15 Katrin Fischer 2015-12-03 16:18:51 UTC
Created attachment 45377 [details] [review]
[PASSED QA] Bug 10154 Add Call number in the filter of most circulated items

This patch adds call number, collection code and shelving location to
the filter.

To test:

It is of course a prerequisite to have items in the DB with the correct
MARC fields and that they have been checked out etc. to get a valid
result when testing.

1. Apply patch to koha synced to master.
2. Go to /cgi-bin/koha/reports/cat_issues_top.pl
3. Select filters, the new ones are Call number, Collection code and
   Shelving location
4. Hit submit.

Expected result:
The filters chosen will be printed under "Filtered on".
A table with the result is shown.

For manual verification here is some SQL to run:

SELECT DISTINCT biblio.title, COUNT(biblio.biblionumber) AS RANK, biblio.biblionumber AS ID, itemcallnumber as CALLNUM, ccode as CCODE, location as LOC FROM `old_issues`
                  LEFT JOIN items USING(itemnumber)
                  LEFT JOIN biblio USING(biblionumber)
                  LEFT JOIN biblioitems USING(biblionumber)
                  LEFT JOIN borrowers USING(borrowernumber)
                  WHERE 1 AND biblioitems.itemtype like 'BK' AND itemcallnumber like '005.2/762' AND ccode like 'NFIC' AND location like 'CART' AND borrowers.categorycode like 'PT' group by biblio.biblionumber order by RANK DESC;

Put in your valid values in the WHERE clause for the values in the
single quotes ''.

Sponsored-by: Halland county library

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
  It works as described. Valid results, tested in various combinations.
  Follows the coding (awful) style of the original script, without
  introducing any regression. It would have been great to have
  callnumber interval, but anyway...

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 16 Katrin Fischer 2015-12-03 16:19:07 UTC
Created attachment 45378 [details] [review]
Bug 10154: QA follow-up - Spelling and terminology

- Changing capitalization: Any Patron category > Any patron category
- Changing Collection code > Collection

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 17 Kyle M Hall 2015-12-31 16:17:18 UTC
Pushed to master, thanks Eivin and Katrin!