From f4a50cbbd0812286d709c518516df21c5d84c026 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 --- C4/VirtualShelves.pm | 3 ++- C4/VirtualShelves/Page.pm | 3 +++ .../prog/en/modules/virtualshelves/shelves.tt | 10 ++++++++-- .../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 90a00a5..ff4bc29 100644 --- a/C4/VirtualShelves.pm +++ b/C4/VirtualShelves.pm @@ -264,11 +264,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 988244c..bf53563 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 0c71a41..20ae8ee 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 %]
  • @@ -655,6 +656,7 @@ $(function() { [% IF ( sort_title ) %][% ELSE %][% END %] [% IF ( sort_author ) %][% ELSE %][% END %] [% IF ( sort_year ) %][% ELSE %][% END %] + [% IF ( sort_itemcallnumber ) %][% ELSE %][% END %]
  • -- 1.7.2.5