From e7e8708400e75c8fbe319101e9257c71dee8d320 Mon Sep 17 00:00:00 2001
From: Owen Leonard <oleonard@myacpl.org>
Date: Wed, 16 Mar 2016 10:00:40 -0400
Subject: [PATCH] Bug 15672 [Revised] Show descriptions instead of codes on
the hold ratios report
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This patch revises the hold ratios report so that it uses template
plugins to display descriptions instead of codes for item holding
branch, item home branch, item type, and shelving location.
To test you should have multiple items on the hold ratio report (set the
ratio to a small number to increase the number of results). It should
include one or more items which have a shelving location set.
View the hold ratios report and confirm that library names, shelving
location descriptions, and item type descriptions are shown instead of
codes.
This revised patch steals from Bug 15560 to enable the correct display
of multiple home libraries, holding libraries, shelving locations, item
types, and call numbers. To properly test you should have records in
your report which have multiple values for each of those fields.
Followed test plan, works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>
---
circ/reserveratios.pl | 20 ++++-----
.../prog/en/modules/circ/reserveratios.tt | 44 +++++++++++++++++---
2 files changed, 49 insertions(+), 15 deletions(-)
diff --git a/circ/reserveratios.pl b/circ/reserveratios.pl
index bd51b7c..5d3063c 100755
--- a/circ/reserveratios.pl
+++ b/circ/reserveratios.pl
@@ -93,15 +93,15 @@ my $strsth =
items.itemcallnumber,
items.itemnumber,
GROUP_CONCAT(DISTINCT items.itemcallnumber
- ORDER BY items.itemnumber SEPARATOR '<br/>') as listcall,
+ ORDER BY items.itemnumber SEPARATOR '|') as listcall,
GROUP_CONCAT(DISTINCT homebranch
- ORDER BY items.itemnumber SEPARATOR '<br/>') as homebranch_list,
+ ORDER BY items.itemnumber SEPARATOR '|') as homebranch_list,
GROUP_CONCAT(DISTINCT holdingbranch
- ORDER BY items.itemnumber SEPARATOR '<br/>') as holdingbranch_list,
+ ORDER BY items.itemnumber SEPARATOR '|') as holdingbranch_list,
GROUP_CONCAT(DISTINCT items.location
- ORDER BY items.itemnumber SEPARATOR '<br/>') as l_location,
+ ORDER BY items.itemnumber SEPARATOR '|') as l_location,
GROUP_CONCAT(DISTINCT items.itype
- ORDER BY items.itemnumber SEPARATOR '<br/>') as l_itype,
+ ORDER BY items.itemnumber SEPARATOR '|') as l_itype,
reserves.found,
biblio.title,
@@ -147,18 +147,18 @@ while ( my $data = $sth->fetchrow_hashref ) {
itemnum => $data->{itemnumber},
biblionumber => $data->{biblionumber},
holdingbranch => $data->{holdingbranch},
- homebranch_list => $data->{homebranch_list},
- holdingbranch_list => $data->{holdingbranch_list},
+ homebranch_list => [split('\|', $data->{homebranch_list})],
+ holdingbranch_list => [split('\|', $data->{holdingbranch_list})],
branch => $data->{branch},
itemcallnumber => $data->{itemcallnumber},
- location => $data->{l_location},
- itype => $data->{l_itype},
+ location => => [split('\|', $data->{l_location})],
+ itype => => [split('\|', $data->{l_itype})],
reservecount => $data->{reservecount},
itemcount => $data->{itemcount},
ratiocalc => sprintf( "%.0d", $ratio_atleast1 ? ( $thisratio / $ratio ) : $thisratio ),
thisratio => sprintf( "%.2f", $thisratio ),
thisratio_atleast1 => ( $thisratio >= 1 ) ? 1 : 0,
- listcall => $data->{listcall}
+ listcall => [split('\|', $data->{listcall})]
}
);
}
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/reserveratios.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/reserveratios.tt
index 67f4226..b92ca70 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/reserveratios.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/reserveratios.tt
@@ -1,4 +1,7 @@
[% USE KohaDates %]
+[% USE AuthorisedValues %]
+[% USE Branches %]
+[% USE ItemTypes %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Circulation › Hold ratios</title>
[% INCLUDE 'doc-head-close.inc' %]
@@ -30,6 +33,7 @@
.sql { display: none; }
.ulined { text-decoration: underline; }
.ratiolimit { color: blue; cursor: pointer; }
+ #holdst ul li { list-style: outside url("[% interface %]/[% theme %]/img/item-bullet.gif") disc; }
</style>
</head>
<body id="circ_reserveratios" class="circ">
@@ -72,11 +76,41 @@
<td><p class="ratiolimit">[% reserveloo.thisratio %]</p></td>
<td> [% INCLUDE 'biblio-default-view.inc' biblionumber = reserveloo.biblionumber %][% reserveloo.title |html %] [% IF ( reserveloo.subtitle ) %][% FOREACH subtitl IN reserveloo.subtitle %][% subtitl.subfield %][% END %][% END %]</a>[% IF ( reserveloo.author ) %] by [% reserveloo.author %][% END %]
</td>
- <td><p>[% reserveloo.homebranch_list %]</p></td>
- <td><p>[% reserveloo.holdingbranch_list %]</p></td>
- <td><p>[% reserveloo.location %]</p></td>
- <td><p>[% reserveloo.itype %]</p></td>
- <td><p>[% reserveloo.listcall %]</p></td>
+ <td>
+ <ul>
+ [% FOREACH homebranch IN reserveloo.homebranch_list %]
+ <li>[% Branches.GetName ( homebranch ) %]</li>
+ [% END %]
+ </ul>
+ </td>
+ <td>
+ <ul>
+ [% FOREACH holdingbranch IN reserveloo.holdingbranch_list %]
+ <li>[% Branches.GetName ( holdingbranch ) %]</li>
+ [% END %]
+ </ul>
+ </td>
+ <td>
+ <ul>
+ [% FOREACH location IN reserveloo.location %]
+ <li>[% AuthorisedValues.GetByCode( 'LOC', location )%]</li>
+ [% END %]
+ </ul>
+ </td>
+ <td>
+ <ul>
+ [% FOREACH itype IN reserveloo.itype %]
+ <li>[% ItemTypes.GetDescription( itype ) %]</li>
+ [% END %]
+ </ul>
+ </td>
+ <td>
+ <ul>
+ [% FOREACH listcall IN reserveloo.listcall %]
+ <li>[% listcall %]</li>
+ [% END %]
+ </ul>
+ </td>
<td>[% IF ( reserveloo.thisratio_atleast1 ) %]<p>[% IF ( CAN_user_acquisition && basketno && booksellerid ) %]<!-- [% reserveloo.ratiocalc %] --><a href="/cgi-bin/koha/acqui/neworderempty.pl?biblionumber=[% reserveloo.biblionumber %]&booksellerid=[% booksellerid %]&basketno=[% basketno %]&rr_quantity_to_order=[% reserveloo.ratiocalc %]">[% END %]<b>[% reserveloo.ratiocalc %] to order</b>[% IF ( CAN_user_acquisition && basketno && booksellerid ) %]</a>[% END %]
[% IF ( reserveloo.pendingorders ) %]<br><b>[% reserveloo.pendingorders %] pending</b>[% END %]</p>[% END %]</td>
</tr>
--
1.7.10.4