From aad2599fb1ac5c38afcf678e437dcfd3a9c020b0 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Mon, 5 Nov 2012 14:22:55 +0100 Subject: [PATCH] Bug 8032: Sort lists by call number Precaution: Joining the items table makes that the table is sorted on the item call number of the first item (in case there are more items). Signed-off-by: Melia Meggs Passed-QA-by: Jonathan Druart Signed-off-by: Jared Camins-Esakov --- C4/VirtualShelves.pm | 3 ++- C4/VirtualShelves/Page.pm | 3 +++ .../prog/en/modules/virtualshelves/shelves.tt | 10 ++++++++-- koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt | 2 ++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/C4/VirtualShelves.pm b/C4/VirtualShelves.pm index b7b0c779ee..0bb4b56ec1 100644 --- a/C4/VirtualShelves.pm +++ b/C4/VirtualShelves.pm @@ -266,11 +266,12 @@ sub GetShelfContents { ($sortfield) = $sth2->fetchrow_array; } my $query = - " SELECT vc.biblionumber, vc.shelfnumber, vc.dateadded, itemtypes.*, + " SELECT DISTINCT vc.biblionumber, vc.shelfnumber, vc.dateadded, itemtypes.*, biblio.*, biblioitems.itemtype, biblioitems.publicationyear as year, biblioitems.publishercode, biblioitems.place, biblioitems.size, biblioitems.pages FROM virtualshelfcontents vc JOIN biblio ON vc.biblionumber = biblio.biblionumber LEFT JOIN biblioitems ON biblio.biblionumber = biblioitems.biblionumber + LEFT JOIN items ON items.biblionumber=vc.biblionumber LEFT JOIN itemtypes ON biblioitems.itemtype = itemtypes.itemtype WHERE vc.shelfnumber=? "; my @params = ($shelfnumber); diff --git a/C4/VirtualShelves/Page.pm b/C4/VirtualShelves/Page.pm index 988244c92c..bf53563751 100644 --- a/C4/VirtualShelves/Page.pm +++ b/C4/VirtualShelves/Page.pm @@ -304,6 +304,7 @@ sub shelfpage { viewshelf => $shelfnumber, authorsort => $authorsort, yearsort => $yearsort, + itemcallnumbersort => $sortfield eq 'itemcallnumber', manageshelf => $manageshelf, allowremovingitems => ShelfPossibleAction( $loggedinuser, $shelfnumber, 'delete'), allowaddingitem => ShelfPossibleAction( $loggedinuser, $shelfnumber, 'add'), @@ -418,6 +419,8 @@ sub shelfpage { $shelflist->{$element}->{"authorsort"} = 'author'; } elsif ( $sortfield eq 'year' ) { $shelflist->{$element}->{"yearsort"} = 'year'; + } elsif ( $sortfield eq 'itemcallnumber' ) { + $shelflist->{$element}->{"itemcallnumbersort"} = 'itemcallnumber'; } } $shelflist->{$element}->{"viewcategory$category"} = 1; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt index 0c71a41680..20ae8eef97 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt @@ -210,6 +210,7 @@ function placeHold () { Title Author Date added + Call number   [% FOREACH itemsloo IN itemsloop %] @@ -238,6 +239,9 @@ function placeHold () { [% itemsloo.author %] [% itemsloo.dateadded %] + [% FOREACH result IN itemsloo.ITEM_RESULTS %][% result.itemcallnumber %][% UNLESS loop.last %], [% END %][% END %] + + [% UNLESS ( itemsloo.notforloan ) %] Holds [% END %] @@ -299,6 +303,7 @@ function placeHold () { [% IF ( sort_title ) %][% ELSE %][% END %] [% IF ( sort_author ) %][% ELSE %][% END %] [% IF ( sort_copyrightdate ) %][% ELSE %][% END %] + [% IF ( sort_itemcallnumber ) %][% ELSE %][% END %]
  • @@ -677,6 +678,7 @@ $(function() { [% IF ( sort_title ) %][% ELSE %][% END %] [% IF ( sort_author ) %][% ELSE %][% END %] [% IF ( sort_year ) %][% ELSE %][% END %] + [% IF ( sort_itemcallnumber ) %][% ELSE %][% END %]
  • -- 2.39.5