[Koha-patches] [PATCH] Bug 9140 - Untranslatable strings in item circulation history

Owen Leonard oleonard at myacpl.org
Mon Nov 26 16:32:16 CET 2012


This patch removes the text of a message from the script
to the template. The lastmove sub now returns either the date
or 0, and the template displays the "no transfers" message
if the date doesn't exist.

To test, view the circulation history for items which
do and do not have a transfer history. A date should be displayed
for items which have a transfer history. A messages should
be displayed for those which do not.

This patch also adds a <span> around the text "Never" which
was not getting picked up by the translation script. To test
this change, run "perl translate update <lang>" from misc/translator,
then check if the string shows up in the po file. (Thanks kf!)
---
 circ/bookcount.pl                                  |    6 +++---
 .../prog/en/modules/circ/bookcount.tt              |    5 +++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/circ/bookcount.pl b/circ/bookcount.pl
index 228772e..8405ff2 100755
--- a/circ/bookcount.pl
+++ b/circ/bookcount.pl
@@ -89,7 +89,7 @@ $template->param(
     biblioitemnumber        => $bi,
     homebranch              => $homebranch,
     holdingbranch           => $holdingbranch,
-    lastdate                => $lastdate ?  format_date($lastdate) : $message,
+    lastdate                => $lastdate ?  format_date($lastdate) : 0,
     count                   => $count,
     branchloop              => $branchloop,
 );
@@ -112,13 +112,13 @@ sub lastmove {
     );
     $sth->execute($itemnumber);
     my ($date) = $sth->fetchrow_array;
-    return ( 0, "Item has no branch transfers record" ) if not $date;
+    return ( 0, 1 ) if not $date;
     $sth = $dbh->prepare(
 "SELECT * FROM branchtransfers WHERE branchtransfers.itemnumber=? and branchtransfers.datearrived=?"
     );
     $sth->execute( $itemnumber, $date );
     my ($data) = $sth->fetchrow_hashref;
-    return ( 0, "Item has no branch transfers record" ) if not $data;
+    return ( 0, 1 ) if not $data;
     return ( $data, "" );
 }
 
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/bookcount.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/bookcount.tt
index b53cffb..cabb45c 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/bookcount.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/bookcount.tt
@@ -28,7 +28,7 @@ $(document).ready(function(){
 		
 		<tr><td>[% homebranch %]</td>
             <td>[% holdingbranch %]</td>
-            <td>[% lastdate %]</td>
+            <td>[% IF ( lastdate ) %][% lastdate %][% ELSE %]Item has no transfer record[% END %]</td>
             <td>[% count %]</td>
         </tr>
 </table>
@@ -50,7 +50,8 @@ $(document).ready(function(){
                     <span style="display:none;">[% branchloo.seen %][% branchloo.seentime %]</span>
                     <!-- invisible span for eventual use by tablesorter -->
                     [% branchloo.seen %] [% branchloo.seentime %]
-                [% ELSE %]Never
+                [% ELSE %]
+                    <span>Never</span>
                 [% END %]
             </td>
         </tr>
-- 
1.7.9.5


More information about the Koha-patches mailing list