[Koha-patches] [PATCH] Bug 2505: Enables warnings in opac-readingrecord.pl

Garry Collum gcollum at gmail.com
Tue Feb 2 21:31:49 CET 2010


Enables warnings and fixes the resulting warnings in opac-readingrecord.pl.  The "description" variable in opac-readingrecord.tmpl was pulling a value from another source, probably an included template.  Change the name to 'itypedescription' to resolve the conflict.
---
 .../prog/en/modules/opac-readingrecord.tmpl        |    2 +-
 opac/opac-readingrecord.pl                         |   23 ++++++++++---------
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-readingrecord.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-readingrecord.tmpl
index f8de9a4..ec566a9 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-readingrecord.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-readingrecord.tmpl
@@ -61,7 +61,7 @@ TMPL_ELSE -->Title<!-- /TMPL_UNLESS --></th>
                     <span class="item-details">
                         <!-- TMPL_VAR NAME="author" -->
                     </span></td>
-<!-- TMPL_UNLESS NAME="item-level_itypes" --><td><!-- TMPL_IF NAME="imageurl" --><img src="<!-- TMPL_VAR NAME="imageurl" -->" title="<!-- TMPL_VAR name="description" -->" alt="<!-- TMPL_VAR NAME="description" -->" /><!-- /TMPL_IF --> <!-- TMPL_VAR name="description" --></td><!-- /TMPL_UNLESS -->
+<!-- TMPL_UNLESS NAME="item-level_itypes" --><td><!-- TMPL_IF NAME="imageurl" --><img src="<!-- TMPL_VAR NAME="imageurl" -->" title="<!-- TMPL_VAR name="itypedescription" -->" alt="<!-- TMPL_VAR NAME="itypedescription" -->" /><!-- /TMPL_IF --> <!-- TMPL_VAR name="itypedescription" --></td><!-- /TMPL_UNLESS -->
 <td><!-- TMPL_VAR NAME="itemcallnumber" --></td>
 <td><!-- TMPL_IF NAME="returndate" --><!-- TMPL_VAR NAME="returndate" --><!-- TMPL_ELSE --><em>(Checked out)</em><!-- /TMPL_IF --></td>
 </tr>
diff --git a/opac/opac-readingrecord.pl b/opac/opac-readingrecord.pl
index 595467b..e3c0da0 100755
--- a/opac/opac-readingrecord.pl
+++ b/opac/opac-readingrecord.pl
@@ -17,6 +17,7 @@
 
 
 use strict;
+use warnings;
 
 use CGI;
 
@@ -48,22 +49,21 @@ $template->param($borr);
 my $itemtypes = GetItemTypes();
 
 # get the record
-my $order  = $query->param('order');
-my $order2 = $order;
-if ( $order2 eq '' ) {
-    $order2 = "date_due desc";
+my $order  = $query->param('order') || '';
+if ( $order eq '' ) {
+    $order = "date_due desc";
     $template->param( orderbydate => 1 );
 }
 
-if ( $order2 eq 'title' ) {
+if ( $order eq 'title' ) {
     $template->param( orderbytitle => 1 );
 }
 
-if ( $order2 eq 'author' ) {
+if ( $order eq 'author' ) {
     $template->param( orderbyauthor => 1 );
 }
 
-my $limit = $query->param('limit');
+my $limit = $query->param('limit') || 50;
 if ( $limit eq 'full' ) {
     $limit = 0;
 }
@@ -71,9 +71,8 @@ else {
     $limit = 50;
 }
 
-my ( $count, $issues ) = GetAllIssues( $borrowernumber, $order2, $limit );
+my ( $count, $issues ) = GetAllIssues( $borrowernumber, $order, $limit );
 
-my $borr = GetMemberDetails( $borrowernumber );
 my @bordat;
 $bordat[0] = $borr;
 $template->param( BORROWER_INFO => \@bordat );
@@ -94,8 +93,10 @@ for ( my $i = 0 ; $i < $count ; $i++ ) {
     $line{returndate}     = format_date( $issues->[$i]->{'returndate'} );
     $line{volumeddesc}    = $issues->[$i]->{'volumeddesc'};
     $line{counter}        = $i + 1;
-    $line{'description'} = $itemtypes->{ $issues->[$i]->{'itemtype'} }->{'description'};
-    $line{imageurl}       = getitemtypeimagelocation( 'opac', $itemtypes->{ $issues->[$i]->{'itemtype'}  }->{'imageurl'} );
+    if($issues->[$i]->{'itemtype'}) {
+        $line{'itypedescription'} = $itemtypes->{ $issues->[$i]->{'itemtype'} }->{'description'};
+        $line{imageurl}       = getitemtypeimagelocation( 'opac', $itemtypes->{ $issues->[$i]->{'itemtype'}  }->{'imageurl'} );
+    }
     push( @loop_reading, \%line );
 }
 
-- 
1.5.6.5




More information about the Koha-patches mailing list