From 6ecf823300ae0be6dd210b998837a07e11dbd0dc Mon Sep 17 00:00:00 2001 From: Owen Leonard 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=utf8 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 Signed-off-by: Jonathan Druart Signed-off-by: Brendan A Gallagher --- 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 550bf304ec..3cf5cd17b4 100755 --- a/circ/reserveratios.pl +++ b/circ/reserveratios.pl @@ -103,15 +103,15 @@ my $strsth = items.itemcallnumber, items.itemnumber, GROUP_CONCAT(DISTINCT items.itemcallnumber - ORDER BY items.itemnumber SEPARATOR '
') as listcall, + ORDER BY items.itemnumber SEPARATOR '|') as listcall, GROUP_CONCAT(DISTINCT homebranch - ORDER BY items.itemnumber SEPARATOR '
') as homebranch_list, + ORDER BY items.itemnumber SEPARATOR '|') as homebranch_list, GROUP_CONCAT(DISTINCT holdingbranch - ORDER BY items.itemnumber SEPARATOR '
') as holdingbranch_list, + ORDER BY items.itemnumber SEPARATOR '|') as holdingbranch_list, GROUP_CONCAT(DISTINCT items.location - ORDER BY items.itemnumber SEPARATOR '
') as l_location, + ORDER BY items.itemnumber SEPARATOR '|') as l_location, GROUP_CONCAT(DISTINCT items.itype - ORDER BY items.itemnumber SEPARATOR '
') as l_itype, + ORDER BY items.itemnumber SEPARATOR '|') as l_itype, reserves.found, biblio.title, @@ -158,18 +158,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 67f4226e34..b92ca7014e 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' %] Koha › Circulation › Hold ratios [% 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; } @@ -72,11 +76,41 @@

[% reserveloo.thisratio %]

[% INCLUDE 'biblio-default-view.inc' biblionumber = reserveloo.biblionumber %][% reserveloo.title |html %] [% IF ( reserveloo.subtitle ) %][% FOREACH subtitl IN reserveloo.subtitle %][% subtitl.subfield %][% END %][% END %][% IF ( reserveloo.author ) %] by [% reserveloo.author %][% END %] -

[% reserveloo.homebranch_list %]

-

[% reserveloo.holdingbranch_list %]

-

[% reserveloo.location %]

-

[% reserveloo.itype %]

-

[% reserveloo.listcall %]

+ +
    + [% FOREACH homebranch IN reserveloo.homebranch_list %] +
  • [% Branches.GetName ( homebranch ) %]
  • + [% END %] +
+ + +
    + [% FOREACH holdingbranch IN reserveloo.holdingbranch_list %] +
  • [% Branches.GetName ( holdingbranch ) %]
  • + [% END %] +
+ + +
    + [% FOREACH location IN reserveloo.location %] +
  • [% AuthorisedValues.GetByCode( 'LOC', location )%]
  • + [% END %] +
+ + +
    + [% FOREACH itype IN reserveloo.itype %] +
  • [% ItemTypes.GetDescription( itype ) %]
  • + [% END %] +
+ + +
    + [% FOREACH listcall IN reserveloo.listcall %] +
  • [% listcall %]
  • + [% END %] +
+ [% IF ( reserveloo.thisratio_atleast1 ) %]

[% IF ( CAN_user_acquisition && basketno && booksellerid ) %][% END %][% reserveloo.ratiocalc %] to order[% IF ( CAN_user_acquisition && basketno && booksellerid ) %][% END %] [% IF ( reserveloo.pendingorders ) %]
[% reserveloo.pendingorders %] pending[% END %]

[% END %] -- 2.20.1