[Koha-devel] Catalogue Statistics report - limiting by dewey number

Nicholas van Oudtshoorn vanoudt at gmail.com
Fri Jul 19 04:51:43 CEST 2013


Greetings all!

Got a bit of a question here. As part of our academic (re)accreditation 
process, we need to provide a list of books aquired in a specific 
subject area over the past year. Fantastic - the Catalogue Report should 
do all that. (Well, it should do it when the patches in bug report 10608 
are applied!)

My problem: how to restrict the report according to the dewey number of 
the items. (This is, I think, the easiest way for us to show which books 
relevant to a specific subject area). However, looking at the code, it 
appears in catalogue_stats.pl that $has_dewey is disabled (in fact, the 
comment says it doesn't work - not sure why it and its remnants remain 
in both the perl and the templates???)

So, unable to filter on dewey number, I've taken to filtering on the 
koha full call number. The problem is that I want to filter on the dewey 
part of the call number - not the full string. And this causes problems. 
Let me demonstrate. Using the current code path, if I'm searching for 
items between 227.0 and 227.15, I get 299 records (see APPENDIX A). 
Changing the code to cast the call number to a float as below (which 
gives me just the dewey localtion)

         if (@$filters[4]){
                 @$filters[4]=~ s/\*/%/g ;
                 $strcalc .= " AND items.itemcallnumber >= (0+" . 
$dbh->quote(@$filters[4]) .")";
         }

         if (@$filters[5]){
                 @$filters[5]=~ s/\*/%/g;
                 $strcalc .= " AND items.itemcallnumber <= (0+" . 
$dbh->quote(@$filters[5]) .")";
         }

now gives me 308 records (see APPENDIX B) - including ones like 227 BRU 
where the decimal component (227.0) is implied.

My question (at last!): is changing the code as above the right way to 
go about fixing this problem? (I realise that ideally one would want to 
make it an option in the report....).

This same issue applies to other report modules - such as the 
circulation stats....

Any suggestions? How do other libraries deal with this?


God bless,
Nicholas van Oudtshoorn
IT - Perth Bible College
http://library.pbc.wa.edu.au/


APPENDIX A: THE ORIGINAL CODE PATH'S OUTPUT
----------------------------------------------------------------------------------------

items.itemcallnumber / items.homebranch 	TOTAL
227.02 BAR 	1
227.02 BIR 	1
227.02 DAV 	1
227.02 DOD 	1
227.02 DUN 	1
227.02 ELL 	1
227.02 ENG 	1
227.02 GOM 	1
227.02 GOO 	1
227.02 GOR 	1
227.02 GRI 	1
227.02 KRU 	1
227.02 LOA 	1
227.02 MCR 	1
227.02 MEY 	1
227.02 NEY 	1
227.02 OBR 	1
227.02 RAM 	1
227.02 REY 	2
227.02 RID 	1
227.02 ROB 	1
227.02 SCH 	3
227.02 SEI 	1
227.02 SOB 	1
227.02 STE 	1
227.02 STR 	2
227.02 TOI 	2
227.02 WIL 	1
227.02 WRI 	3
227.02 YOU 	1
227.02 ZIE 	1
227.03 HAW 	1
227.05 GAS 	2
227.06 CAM 	1
227.06 ELL 	1
227.06 FOW 	1
227.06 GRO 	1
227.06 HAF 	1
227.06 HAN 	2
227.06 KEC 	1
227.06 KRE 	1
227.06 MAR 	1
227.06 REA 	1
227.06 SCR 	1
227.06 STE 	1
227.06 THI 	1
227.06 WHI 	1
227.066 BAN 	2
227.066 DOT 	1
227.066 HAN 	1
227.066 REI 	1
227.07 WES 	1
227.08 WIL 	1
227.08251 MUR 	1
227.09 ARM 	1
227.09 CON 	2
227.09 GRO 	1
227.09 HOW 	1
227.09 MEI 	1
227.09 OAK 	1
227.09 PIN 	1
227.09 RIC 	1
227.09 SCH 	1
227.091 RAM 	1
227.092 DUN 	2
227.092 OBR 	1
227.092 WHI 	1
227.1 ACH 	1
227.1 BAR 	10
227.1 BAR v.1 	1
227.1 BAR v.2 	1
227.1 BAR v.3 	1
227.1 BAR v.4 	1
227.1 BES 	3
227.1 BLA 	3
227.1 BOI 	1
227.1 BOI v.3c.1 	1
227.1 BOW 	1
227.1 BRA 	1
227.1 BRA v.6c.2 	1
227.1 BRI 	1
227.1 BRU 	3
227.1 BUR 	1
227.1 BYR 	1
227.1 CHA 	1
227.1 COA 	1
227.1 COF 	1
227.1 COS 	1
227.1 CRA 	3
227.1 DAV 	1
227.1 DAW 	1
227.1 DEH 	1
227.1 DEW 	1
227.1 DOD 	4
227.1 DON 	1
227.1 DUN v.1 	1
227.1 DUN v.2 	1
227.1 DYK 	1
227.1 EDW 	2
227.1 ELL 	2
227.1 EPP 	2
227.1 EPP V.1 	1
227.1 EPP V.2 	1
227.1 FIT 	1
227.1 FOR 	1
227.1 GOD v.1c.1 	1
227.1 GOD v.2c.1 	1
227.1 GRA 	1
227.1 GRI 	1
227.1 HAL 	2
227.1 HAR 	2
227.1 HEN 	2
227.1 HOD 	2
227.1 HOY 	1
227.1 HUN 	4
227.1 IRO 	2
227.1 JOH 	2
227.1 JOH v.1 	1
227.1 JOH v.2 	1
227.1 KAS 	2
227.1 KEE 	1
227.1 KEL 	1
227.1 KIR 	1
227.1 KRO 	1
227.1 KRU 	1
227.1 KUN 	1
227.1 LEN 	1
227.1 LLO v.11 	1
227.1 LLO v.12 	1
227.1 LLO v.1c.1 	1
227.1 LLO v.2c.1 	1
227.1 LLO v.3 	1
227.1 LLO v.3c.2 	1
227.1 LLO v.4 	1
227.1 LLO v.4c.2 	1
227.1 LLO v.5c.1 	1
227.1 LLO v.5c.2 	1
227.1 LLO v.6 	1
227.1 LLO v.6c.2 	1
227.1 LLO v.7 	1
227.1 LLO v.7c.2 	1
227.1 LLO v.8 	1
227.1 LLO v.9c.1 	1
227.1 LOA 	1
227.1 LUT 	2
227.1 MAC 	1
227.1 MAC v.1c.1 	1
227.1 MAC v.2c.1 	1
227.1 MAL 	1
227.1 MAT 	1
227.1 MCC 	2
227.1 MCD 	1
227.1 MEE 	1
227.1 MIT 	2
227.1 MOO 	7
227.1 MOR 	3
227.1 MOU 	6
227.1 MUR 	2
227.1 MUR v.1c.2 	1
227.1 NAS 	3
227.1 NEW 	2
227.1 NYG 	2
227.1 NYS 	1
227.1 OLS 	1
227.1 OSB 	1
227.1 PAI 	1
227.1 PAL 	1
227.1 PAT 	1
227.1 PBC v.10 	1
227.1 PBC v.1c.1 	1
227.1 PBC v.2c.1 	1
227.1 PBC v.3c.1 	1
227.1 PBC v.4c.1 	1
227.1 PBC v.5c.1 	1
227.1 PBC v.6c.1 	1
227.1 PBC v.7c.1 	1
227.1 PBC v.8c.1 	1
227.1 PBC v.9c.1 	1
227.1 PET 	1
227.1 PHI 	1
227.1 PHI v.1 	1
227.1 PHI v.2 	1
227.1 RAT 	1
227.1 RHY 	1
227.1 RID 	3
227.1 SAN 	3
227.1 SCH 	5
227.1 SCO 	1
227.1 SCR 	1
227.1 SEC 	1
227.1 SHU 	1
227.1 SPR 	1
227.1 STE 	2
227.1 STH 	1
227.1 STO 	3
227.1 STO v.1c.1 	1
227.1 STO v.1c.2 	1
227.1 STU 	1
227.1 THO v.1c.1 	1
227.1 THO v.2c.1 	1
227.1 THO v.3c.1 	1
227.1 THR 	1
227.1 TUC 	1
227.1 VIN 	1
227.1 WIE 	2
227.1 WIL 	1
227.1 WUE 	3
227.1 ZIE 	1
227.104 IRO 	1
227.105 SWA 	1
227.106 DEI 	1
227.106 GAT 	1
227.106 GRE 	1
227.106 MOU 	1
227.106 SAB 	1
227.106 SOD 	1
227.107 PAU 	1
227.108 WAL 	1
227.12 GAM 	1
TOTAL 	299

APPENDIX B: THE MODIFIED CODE PATH'S OUTPUT:
---------------------------------------------------------------------------------
items.itemcallnumber / items.homebranch 	TOTAL
227 BRU 	1
227 FAL 	1
227 HEB 	1
227 LAK 	1
227 MAC 	1
227 RIC 	1
227 SHE 	1
227 STE 	1
227 WAY 	1
227.02 BAR 	1
227.02 BIR 	1
227.02 DAV 	1
227.02 DOD 	1
227.02 DUN 	1
227.02 ELL 	1
227.02 ENG 	1
227.02 GOM 	1
227.02 GOO 	1
227.02 GOR 	1
227.02 GRI 	1
227.02 KRU 	1
227.02 LOA 	1
227.02 MCR 	1
227.02 MEY 	1
227.02 NEY 	1
227.02 OBR 	1
227.02 RAM 	1
227.02 REY 	2
227.02 RID 	1
227.02 ROB 	1
227.02 SCH 	3
227.02 SEI 	1
227.02 SOB 	1
227.02 STE 	1
227.02 STR 	2
227.02 TOI 	2
227.02 WIL 	1
227.02 WRI 	3
227.02 YOU 	1
227.02 ZIE 	1
227.03 HAW 	1
227.05 GAS 	2
227.06 CAM 	1
227.06 ELL 	1
227.06 FOW 	1
227.06 GRO 	1
227.06 HAF 	1
227.06 HAN 	2
227.06 KEC 	1
227.06 KRE 	1
227.06 MAR 	1
227.06 REA 	1
227.06 SCR 	1
227.06 STE 	1
227.06 THI 	1
227.06 WHI 	1
227.066 BAN 	2
227.066 DOT 	1
227.066 HAN 	1
227.066 REI 	1
227.07 WES 	1
227.08 WIL 	1
227.08251 MUR 	1
227.09 ARM 	1
227.09 CON 	2
227.09 GRO 	1
227.09 HOW 	1
227.09 MEI 	1
227.09 OAK 	1
227.09 PIN 	1
227.09 RIC 	1
227.09 SCH 	1
227.091 RAM 	1
227.092 DUN 	2
227.092 OBR 	1
227.092 WHI 	1
227.1 ACH 	1
227.1 BAR 	10
227.1 BAR v.1 	1
227.1 BAR v.2 	1
227.1 BAR v.3 	1
227.1 BAR v.4 	1
227.1 BES 	3
227.1 BLA 	3
227.1 BOI 	1
227.1 BOI v.3c.1 	1
227.1 BOW 	1
227.1 BRA 	1
227.1 BRA v.6c.2 	1
227.1 BRI 	1
227.1 BRU 	3
227.1 BUR 	1
227.1 BYR 	1
227.1 CHA 	1
227.1 COA 	1
227.1 COF 	1
227.1 COS 	1
227.1 CRA 	3
227.1 DAV 	1
227.1 DAW 	1
227.1 DEH 	1
227.1 DEW 	1
227.1 DOD 	4
227.1 DON 	1
227.1 DUN v.1 	1
227.1 DUN v.2 	1
227.1 DYK 	1
227.1 EDW 	2
227.1 ELL 	2
227.1 EPP 	2
227.1 EPP V.1 	1
227.1 EPP V.2 	1
227.1 FIT 	1
227.1 FOR 	1
227.1 GOD v.1c.1 	1
227.1 GOD v.2c.1 	1
227.1 GRA 	1
227.1 GRI 	1
227.1 HAL 	2
227.1 HAR 	2
227.1 HEN 	2
227.1 HOD 	2
227.1 HOY 	1
227.1 HUN 	4
227.1 IRO 	2
227.1 JOH 	2
227.1 JOH v.1 	1
227.1 JOH v.2 	1
227.1 KAS 	2
227.1 KEE 	1
227.1 KEL 	1
227.1 KIR 	1
227.1 KRO 	1
227.1 KRU 	1
227.1 KUN 	1
227.1 LEN 	1
227.1 LLO v.11 	1
227.1 LLO v.12 	1
227.1 LLO v.1c.1 	1
227.1 LLO v.2c.1 	1
227.1 LLO v.3 	1
227.1 LLO v.3c.2 	1
227.1 LLO v.4 	1
227.1 LLO v.4c.2 	1
227.1 LLO v.5c.1 	1
227.1 LLO v.5c.2 	1
227.1 LLO v.6 	1
227.1 LLO v.6c.2 	1
227.1 LLO v.7 	1
227.1 LLO v.7c.2 	1
227.1 LLO v.8 	1
227.1 LLO v.9c.1 	1
227.1 LOA 	1
227.1 LUT 	2
227.1 MAC 	1
227.1 MAC v.1c.1 	1
227.1 MAC v.2c.1 	1
227.1 MAL 	1
227.1 MAT 	1
227.1 MCC 	2
227.1 MCD 	1
227.1 MEE 	1
227.1 MIT 	2
227.1 MOO 	7
227.1 MOR 	3
227.1 MOU 	6
227.1 MUR 	2
227.1 MUR v.1c.2 	1
227.1 NAS 	3
227.1 NEW 	2
227.1 NYG 	2
227.1 NYS 	1
227.1 OLS 	1
227.1 OSB 	1
227.1 PAI 	1
227.1 PAL 	1
227.1 PAT 	1
227.1 PBC v.10 	1
227.1 PBC v.1c.1 	1
227.1 PBC v.2c.1 	1
227.1 PBC v.3c.1 	1
227.1 PBC v.4c.1 	1
227.1 PBC v.5c.1 	1
227.1 PBC v.6c.1 	1
227.1 PBC v.7c.1 	1
227.1 PBC v.8c.1 	1
227.1 PBC v.9c.1 	1
227.1 PET 	1
227.1 PHI 	1
227.1 PHI v.1 	1
227.1 PHI v.2 	1
227.1 RAT 	1
227.1 RHY 	1
227.1 RID 	3
227.1 SAN 	3
227.1 SCH 	5
227.1 SCO 	1
227.1 SCR 	1
227.1 SEC 	1
227.1 SHU 	1
227.1 SPR 	1
227.1 STE 	2
227.1 STH 	1
227.1 STO 	3
227.1 STO v.1c.1 	1
227.1 STO v.1c.2 	1
227.1 STU 	1
227.1 THO v.1c.1 	1
227.1 THO v.2c.1 	1
227.1 THO v.3c.1 	1
227.1 THR 	1
227.1 TUC 	1
227.1 VIN 	1
227.1 WIE 	2
227.1 WIL 	1
227.1 WUE 	3
227.1 ZIE 	1
227.104 IRO 	1
227.105 SWA 	1
227.106 DEI 	1
227.106 GAT 	1
227.106 GRE 	1
227.106 MOU 	1
227.106 SAB 	1
227.106 SOD 	1
227.107 PAU 	1
227.108 WAL 	1
227.12 GAM 	1
TOTAL 	308




More information about the Koha-devel mailing list