[Koha-cvs] koha/opac opac-shelves.pl [rel_2_2]

Ryan Higgins rch at liblime.com
Thu Apr 5 07:48:10 CEST 2007


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_2_2
Changes by:	Ryan Higgins <rych>	07/04/05 05:48:10

Modified files:
	opac           : opac-shelves.pl 

Log message:
	sort shelf list by name and shelfcontents by syspref ; hide private shelves

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-shelves.pl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.3.2.8&r2=1.3.2.9

Patches:
Index: opac-shelves.pl
===================================================================
RCS file: /sources/koha/koha/opac/opac-shelves.pl,v
retrieving revision 1.3.2.8
retrieving revision 1.3.2.9
diff -u -b -r1.3.2.8 -r1.3.2.9
--- opac-shelves.pl	8 Mar 2006 13:46:55 -0000	1.3.2.8
+++ opac-shelves.pl	5 Apr 2007 05:48:10 -0000	1.3.2.9
@@ -2,7 +2,7 @@
 #script to provide bookshelf management
 # WARNING: This file uses 4-character tabs!
 #
-# $Header: /sources/koha/koha/opac/opac-shelves.pl,v 1.3.2.8 2006/03/08 13:46:55 tipaul Exp $
+# $Header: /sources/koha/koha/opac/opac-shelves.pl,v 1.3.2.9 2007/04/05 05:48:10 rych Exp $
 #
 # Copyright 2000-2002 Katipo Communications
 #
@@ -87,7 +87,7 @@
 
 my $color='';
 my @shelvesloop;
-foreach my $element (sort keys %$shelflist) {
+foreach my $element (sort { lc($shelflist->{$a}->{'shelfname'}) cmp lc($shelflist->{$b}->{'shelfname'}) } keys %$shelflist) {
 		my %line;
 		($color eq 0) ? ($color=1) : ($color=0);
 		$line{'color'}= $color;
@@ -99,8 +99,9 @@
 		$line{'canmanage'} = ShelfPossibleAction($loggedinuser,$element,'manage');
 		$line{'firstname'}=$shelflist->{$element}->{'firstname'} unless $shelflist->{$element}->{'owner'} eq $loggedinuser;
 		$line{'surname'}=$shelflist->{$element}->{'surname'} unless $shelflist->{$element}->{'owner'} eq $loggedinuser;
-;
+		if($loggedinuser || $shelflist->{$element}->{'category'} > 1) {
 		push (@shelvesloop, \%line);
+		}
 }
 $template->param(shelvesloop => \@shelvesloop);
 
@@ -161,7 +162,9 @@
 	my $item='';
 	my $color='';
 	my @itemsloop;
-	foreach $item (sort {$a->{'barcode'} cmp $b->{'barcode'}} @$itemlist) {
+    my $vsort = C4::Context->preference('VirtualShelfSort') || 'barcode';
+	    #FIXME: should select sort functions here, and not rely on syspref to be correct..
+    foreach $item (sort {$a->{$vsort} cmp $b->{$vsort}} @$itemlist) {
 		my %line;
 		($color eq 0) ? ($color=1) : ($color=0);
 		$line{'color'}=$color;
@@ -172,6 +175,8 @@
 		$line{'classification'}=$item->{'classification'};		
 		$line{'itemtype'}=$item->{'itemtype'};		
 		$line{biblionumber} = $item->{biblionumber};
+		$line{'year'}=$item->{'copyrightdate'} || $item->{'publicationyear'}; 
+
 		push(@itemsloop, \%line);
 	}
 	$template->param(	itemsloop => \@itemsloop,
@@ -184,6 +189,9 @@
 
 #
 # $Log: opac-shelves.pl,v $
+# Revision 1.3.2.9  2007/04/05 05:48:10  rych
+# sort shelf list by name and shelfcontents by syspref ; hide private shelves
+#
 # Revision 1.3.2.8  2006/03/08 13:46:55  tipaul
 # some opac systempreferences are set by all pages.
 # Moving the $template->param where the template is open. This way, nothing can be forgotten, and code is more readable. Feel free to move to Auth.pm any new systempref





More information about the Koha-cvs mailing list