Bug 15672 [Revised] Show descriptions instead of codes on the hold ratios report
authorOwen Leonard <oleonard@myacpl.org>
Wed, 16 Mar 2016 14:00:40 +0000 (10:00 -0400)
committerBrendan A Gallagher <brendan@bywatersolutions.com>
Wed, 23 Mar 2016 21:07:04 +0000 (21:07 +0000)
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>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
circ/reserveratios.pl
koha-tmpl/intranet-tmpl/prog/en/modules/circ/reserveratios.tt

index 550bf30..3cf5cd1 100755 (executable)
@@ -103,15 +103,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,
@@ -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})]
         }
     );
 }
index 67f4226..b92ca70 100644 (file)
@@ -1,4 +1,7 @@
 [% USE KohaDates %]
+[% USE AuthorisedValues %]
+[% USE Branches %]
+[% USE ItemTypes %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Circulation &rsaquo; 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">
             <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 %]&amp;booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]&amp;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>