[Koha-patches] [PATCH] Fix for Bug 3683 - 'Sort by' column in list interface is not translatable

Owen Leonard oleonard at myacpl.org
Fri Jun 25 18:59:15 CEST 2010


---
 C4/VirtualShelves/Page.pm                          |    7 +++++++
 .../prog/en/modules/virtualshelves/shelves.tmpl    |    4 ++--
 .../opac-tmpl/prog/en/modules/opac-shelves.tmpl    |    6 ++++--
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/C4/VirtualShelves/Page.pm b/C4/VirtualShelves/Page.pm
index f76047d..73ca42d 100644
--- a/C4/VirtualShelves/Page.pm
+++ b/C4/VirtualShelves/Page.pm
@@ -302,6 +302,13 @@ sub shelfpage ($$$$$) {
         my $category  = $shelflist->{$element}->{'category'};
         my $owner     = $shelflist->{$element}->{'owner'};
         my $canmanage = ShelfPossibleAction( $loggedinuser, $element, 'manage' );
+        my $sortfield = $shelflist->{$element}->{'sortfield'};
+        if ( $sortfield eq 'author' ) {
+            $shelflist->{$element}->{"authorsort"} = 'author';
+        }
+        if ( $sortfield eq 'year' ) {
+            $shelflist->{$element}->{"yearsort"} = 'year';
+        }
         $shelflist->{$element}->{"viewcategory$category"} = 1;
         $shelflist->{$element}->{manageshelf} = $canmanage;
         if ( $owner eq $loggedinuser or $canmanage ) {
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tmpl
index 3f7b387..62ee69a 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tmpl
@@ -347,7 +347,7 @@ function placeHold () {
                     <!-- TMPL_IF NAME="toggle" --><tr class="highlight"><!--TMPL_ELSE--><tr><!-- /TMPL_IF -->
         <td><a href="shelves.pl?<!-- TMPL_IF NAME="showprivateshelves" -->display=privateshelves&amp;<!-- /TMPL_IF -->viewshelf=<!-- TMPL_VAR NAME="shelf" -->"><!-- TMPL_VAR NAME="shelfname" ESCAPE="html"  --></a></td>
         <td><!-- TMPL_VAR NAME="count" --> item(s)</td>
-        <td><!-- TMPL_VAR NAME="sortfield" --></td>
+        <td><!-- TMPL_IF NAME="authorsort" -->Author<!-- TMPL_ELSIF NAME="yearsort" -->Year<!-- TMPL_ELSE -->Title<!-- /TMPL_IF --></td>
         <td><!-- TMPL_IF NAME="viewcategory1" -->Private<!-- /TMPL_IF -->
 			<!-- TMPL_IF NAME="viewcategory2" -->Public<!-- /TMPL_IF -->
 			<!-- TMPL_IF NAME="viewcategory3" -->Open<!-- /TMPL_IF -->
@@ -398,7 +398,7 @@ function placeHold () {
                 <!-- TMPL_IF NAME="toggle" --><tr class="highlight"><!--TMPL_ELSE--><tr><!-- /TMPL_IF -->
 		<td><a href="shelves.pl?viewshelf=<!-- TMPL_VAR NAME="shelf" -->"><!-- TMPL_VAR NAME="shelfname" ESCAPE="html"  --></a></td>
 		<td><!-- TMPL_VAR NAME="count" --> item(s)</td>
-        <td><!-- TMPL_VAR NAME="sortfield" --></td>
+        <td><!-- TMPL_IF NAME="authorsort" -->Author<!-- TMPL_ELSIF NAME="yearsort" -->Year<!-- TMPL_ELSE -->Title<!-- /TMPL_IF --></td>
         <td><!-- TMPL_IF NAME="viewcategory1" -->Private<!-- /TMPL_IF -->
 			<!-- TMPL_IF NAME="viewcategory2" -->Public<!-- /TMPL_IF -->
 			<!-- TMPL_IF NAME="viewcategory3" -->Open<!-- /TMPL_IF -->
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl
index 1063eec..bb2078a 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl
@@ -376,7 +376,8 @@ $(function() {
                           <!-- /TMPL_UNLESS -->
                               <td><a href="/cgi-bin/koha/opac-shelves.pl?display=privateshelves&amp;viewshelf=<!-- TMPL_VAR NAME="shelf" -->&amp;sortfield=<!-- TMPL_VAR NAME="sortfield" -->"><!-- TMPL_VAR NAME="shelfname" ESCAPE="html"  --></a></td>
                               <td><!-- TMPL_VAR NAME="count" --> item(s)</td>
-                              <td><!-- TMPL_VAR NAME="sortfield" --></td>
+                              <td><!-- TMPL_IF NAME="authorsort" -->Author<!-- TMPL_ELSIF NAME="yearsort" -->Year<!-- TMPL_ELSE -->Title<!-- /TMPL_IF -->
+                          </td>
                               <td>
                                 <!-- TMPL_IF NAME="viewcategory1" -->Private<!-- /TMPL_IF -->
                                 <!-- TMPL_IF NAME="viewcategory2" -->Public<!-- /TMPL_IF -->
@@ -444,7 +445,8 @@ $(function() {
                       <!-- /TMPL_UNLESS -->
                           <td><a href="/cgi-bin/koha/opac-shelves.pl?viewshelf=<!-- TMPL_VAR NAME="shelf" -->&amp;sortfield=<!-- TMPL_VAR NAME="sortfield" -->"><!-- TMPL_VAR NAME="shelfname" ESCAPE="html"  --></a></td>
                           <td><!-- TMPL_VAR NAME="count" --> item(s)</td>
-                          <td><!-- TMPL_VAR NAME="sortfield" --></td>
+                          <td><!-- TMPL_IF NAME="authorsort" -->Author<!-- TMPL_ELSIF NAME="yearsort" -->Year<!-- TMPL_ELSE -->Title<!-- /TMPL_IF -->
+                          </td>
                           <td>
                             <!-- TMPL_IF NAME="viewcategory1" -->Private<!-- /TMPL_IF -->
                             <!-- TMPL_IF NAME="viewcategory2" -->Public<!-- /TMPL_IF -->
-- 
1.7.0.4



More information about the Koha-patches mailing list