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    |   18 ++++++++++++------
 3 files changed, 18 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..f34361c 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,13 @@ $(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_IF NAME="publicationyear" -->
+                                               <!-- TMPL_VAR 
NAME="publicationyear" -->
+                                       <!-- TMPL_ELSE -->
+                                               <!-- TMPL_VAR 
NAME="copyrightdate" -->
+                                       <!-- /TMPL_IF -->
+                        </td>
                       </tr>
                   <!-- /TMPL_LOOP --><!-- /itemsloop -->
                     </tbody>
@@ -295,7 +301,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 +489,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

_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha.org/mailman/listinfo/koha-patches

Reply via email to