From 39d2d593c6328f301874def20885883699028b48 Mon Sep 17 00:00:00 2001 From: Chris Nighswonger Date: Tue, 22 Jul 2008 13:43:30 -0500 Subject: [PATCH] Allow anyone with superlibrarian permission to edit/delete public patron lists Edit functions here are limited to renaming and changing the type. No one can view a list except the list owner unless it is public. Signed-off-by: Galen Charlton Signed-off-by: Joshua Ferraro --- C4/VirtualShelves.pm | 5 ++++- C4/VirtualShelves/Page.pm | 6 ++++-- .../prog/en/modules/virtualshelves/shelves.tmpl | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/C4/VirtualShelves.pm b/C4/VirtualShelves.pm index c4a5754039..e5c8adc93f 100644 --- a/C4/VirtualShelves.pm +++ b/C4/VirtualShelves.pm @@ -26,6 +26,7 @@ use Carp; use C4::Context; use C4::Circulation; use C4::Debug; +use C4::Members; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); @@ -413,9 +414,11 @@ sub ShelfPossibleAction { my $sth = $dbh->prepare($query); $sth->execute($shelfnumber); my ( $owner, $category ) = $sth->fetchrow; - return 1 if ( $category >= 3); # open list + my $borrower = GetMemberDetails($user); + return 1 if ( $category >= 3); # open list return 1 if (($category >= 2) and defined($action) and $action eq 'view'); # public list, anybody can view + return 1 if (($category >= 2) and defined($user) and $borrower->{authflags}->{superlibrarian}); # public list, superlibrarian can edit/delete return 1 if (defined($user) and $owner eq $user ); # user owns this list. Check last. return 0; } diff --git a/C4/VirtualShelves/Page.pm b/C4/VirtualShelves/Page.pm index 17d9c55b0f..af85ed5774 100755 --- a/C4/VirtualShelves/Page.pm +++ b/C4/VirtualShelves/Page.pm @@ -125,18 +125,20 @@ SWITCH: { 'category' => $query->param('category'), 'sortfield' => $query->param('sortfield'), }; - $shelf->{'owner'} = $loggedinuser if $type eq 'intranet'; #we only overwrite the list owner if &ModShelf was called from the staff client ModShelf( $shelfnumber, $shelf ); - $shelflist = GetShelves( $loggedinuser, 2 ); # refresh after mods + $shelflist = GetShelves( $loggedinuser, 2 ); # refresh after mods; this also retrieves all public shelves } elsif ( $op eq 'modif' ) { my ( $shelfnumber2, $shelfname, $owner, $category, $sortfield ) =GetShelf( $shelfnumber ); + my $member = GetMember($owner,'borrowernumber'); + my $ownername = defined($member) ? $member->{firstname} . " " . $member->{surname} : ''; $template->param( edit => 1, shelfnumber => $shelfnumber2, shelfname => $shelfname, owner => $owner, + ownername => $ownername, "category$category" => 1, category => $category, "sort_$sortfield" => 1, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tmpl index 6fa5541e81..03180cc081 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tmpl @@ -224,7 +224,7 @@ $(document).ready(function(){ Edit List
  1. -
  2. " />
  3. +
  4. " />