[Koha-patches] [PATCH] [replace previous](bug #3497) show publication year, or copyrightdate

Nahuel ANGELINETTI nahuel.angelinetti at biblibre.com
Wed Aug 5 09:49:25 CEST 2009


This change the shelf view in opac, to show publication year, in the column "Year"(that was previously copyrightdate), and is there is no publication year, show copyright date.
---
 C4/VirtualShelves.pm                               |    4 ++--
 C4/VirtualShelves/Page.pm                          |    8 ++++----
 .../opac-tmpl/prog/en/modules/opac-shelves.tmpl    |   12 ++++++------
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/C4/VirtualShelves.pm b/C4/VirtualShelves.pm
index 25fe86f..d096d4a 100644
--- a/C4/VirtualShelves.pm
+++ b/C4/VirtualShelves.pm
@@ -266,8 +266,8 @@ sub GetShelfContents ($;$$$) {
 		($sortfield) = $sth2->fetchrow_array;
 	}
     my $query =
-       " SELECT vc.biblionumber, vc.shelfnumber, vc.dateadded,
-	   			biblio.*, biblioitems.itemtype, itemtypes.*
+       " SELECT vc.biblionumber, vc.shelfnumber, vc.dateadded, itemtypes.*,
+	   			biblio.*, biblioitems.itemtype, biblioitems.publicationyear
          FROM   virtualshelfcontents vc
 		 LEFT JOIN biblio      ON      vc.biblionumber =      biblio.biblionumber
 		 LEFT JOIN biblioitems ON  biblio.biblionumber = biblioitems.biblionumber
diff --git a/C4/VirtualShelves/Page.pm b/C4/VirtualShelves/Page.pm
index 63feec0..5e620dd 100644
--- a/C4/VirtualShelves/Page.pm
+++ b/C4/VirtualShelves/Page.pm
@@ -171,13 +171,13 @@ SWITCH: {
 		if ( ShelfPossibleAction( $loggedinuser, $shelfnumber, 'view' ) ) {
 			my $items;
 			my $authorsort;
-			my $copyrightsort;
+			my $yearsort;
 	                my $sortfield = ($query->param('sortfield') ? $query->param('sortfield') : 'title');
 			if ($sortfield eq 'author') {
 				$authorsort = 'author';
 			}
-			if ($sortfield eq 'copyrightdate'){
-				$copyrightsort = 'copyrightdate';
+			if ($sortfield eq 'year'){
+				$yearsort = 'year';
 			}
 			($items, $totitems) = GetShelfContents($shelfnumber, $shelflimit, $shelfoffset);
 			for my $this_item (@$items) {
@@ -198,7 +198,7 @@ SWITCH: {
 				shelfnumber => $shelfnumber,
 				viewshelf   => $shelfnumber,
 				authorsort   => $authorsort,
-				copyrightsort => $copyrightsort,
+				yearsort => $yearsort,
 				manageshelf => $manageshelf,
 				itemsloop => $items,
 			);
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 2324df1..3569a2f 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl
@@ -79,7 +79,7 @@ $(function() {
         <!-- TMPL_IF NAME="manageshelf" -->
           <!-- TMPL_IF NAME="authorsort" -->
           sortList: [[2,0]],
-          <!-- TMPL_ELSIF NAME="copyrightsort" -->
+          <!-- TMPL_ELSIF NAME="yearsort" -->
           sortList: [[3,1]],
           <!-- TMPL_ELSE -->
           sortList: [[1,0]],
@@ -88,7 +88,7 @@ $(function() {
         <!-- TMPL_ELSE -->
           <!-- TMPL_IF NAME="authorsort" -->
           sortList: [[1,0]],
-          <!-- TMPL_ELSIF NAME="copyrightsort" -->
+          <!-- TMPL_ELSIF NAME="yearsort" -->
           sortList: [[2,1]],
           <!-- TMPL_ELSE -->
           sortList: [[0,0]],
@@ -222,7 +222,7 @@ $(document).ready(function(){
                     <!-- TMPL_UNLESS NAME="item-level_itypes" --><th>Item Type</th><!-- /TMPL_UNLESS -->
                     <th>Title</th>
                     <th>Author</th>
-                    <th>Copyright</th>
+                    <th>Year</th>
                   </tr></thead>
                   <tbody>
                   <!-- TMPL_LOOP NAME="itemsloop" -->
@@ -256,7 +256,7 @@ $(document).ready(function(){
                           <div id="newtag<!-- TMPL_VAR NAME="biblionumber">_status" class="tagstatus results_summary" style="display:none">Tag status here.</div>
                         </td>
                         <td><!-- TMPL_VAR NAME="author" --></td>
-                        <td><!-- TMPL_VAR NAME="copyrightdate" --></td>
+                        <td><!-- TMPL_VAR NAME="year" --></td>
                       </tr>
                   <!-- /TMPL_LOOP --><!-- /itemsloop -->
                     </tbody>
@@ -295,7 +295,7 @@ $(document).ready(function(){
                         <select name="sortfield" id="sortfield">
                           <!-- TMPL_IF NAME="sort_title" --><option value="title" selected="selected">Title</option><!-- TMPL_ELSE --><option value="title">Title</option><!-- /TMPL_IF -->
                           <!-- TMPL_IF NAME="sort_author" --><option value="author" selected="selected">Author</option><!-- TMPL_ELSE --><option value="author">Author</option><!-- /TMPL_IF -->
-                          <!-- TMPL_IF NAME="sort_copyrightdate" --><option value="copyrightdate" selected="selected">Copyrightdate</option><!-- TMPL_ELSE --><option value="copyrightdate">Copyrightdate</option><!-- /TMPL_IF -->
+                          <!-- TMPL_IF NAME="sort_year" --><option value="year" selected="selected">Year</option><!-- TMPL_ELSE --><option value="year">Year</option><!-- /TMPL_IF -->
                         </select>
                       </li>
                       <li>
@@ -483,7 +483,7 @@ $(document).ready(function(){
                         <select name="sortfield" id="sortfield">
                           <!-- TMPL_IF NAME="sort_title" --><option value="title" selected="selected">Title</option><!-- TMPL_ELSE --><option value="title">Title</option><!-- /TMPL_IF -->
                           <!-- TMPL_IF NAME="sort_author" --><option value="author" selected="selected">Author</option><!-- TMPL_ELSE --><option value="author">Author</option><!-- /TMPL_IF -->
-                          <!-- TMPL_IF NAME="sort_copyrightdate" --><option value="copyrightdate" selected="selected">Copyrightdate</option><!-- TMPL_ELSE --><option value="copyrightdate">Copyrightdate</option><!-- /TMPL_IF -->
+                          <!-- TMPL_IF NAME="sort_year" --><option value="year" selected="selected">Year</option><!-- TMPL_ELSE --><option value="year">Year</option><!-- /TMPL_IF -->
                         </select>
                       </li>
                       <li>
-- 
1.6.0.4




More information about the Koha-patches mailing list