[Koha-patches] [PATCH] Bug # 3472 - Allows superlibrians to delete any and all messages, reguardless of branchcode.
Kyle M Hall
kyle.m.hall at gmail.com
Mon Sep 28 14:48:17 CEST 2009
---
C4/Members.pm | 11 +++++++++--
circ/circulation.pl | 4 ++--
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/C4/Members.pm b/C4/Members.pm
index 9ce2001..e9a8392 100644
--- a/C4/Members.pm
+++ b/C4/Members.pm
@@ -2090,11 +2090,13 @@ sub AddMessage {
=over 4
-GetMessages( $borrowernumber, $type );
+GetMessages( $borrowernumber, $type, $loggedinuser );
$type is message type, B for borrower, or L for Librarian.
Empty type returns all messages of any type.
+$loggedinuser is the borrowernumber for the currently logged in librarian, if any.
+
Returns all messages for the given borrowernumber
=back
@@ -2102,7 +2104,11 @@ Returns all messages for the given borrowernumber
=cut
sub GetMessages {
- my ( $borrowernumber, $type, $branchcode ) = @_;
+ my ( $borrowernumber, $type, $branchcode, $loggedinuser, ) = @_;
+
+ my $librarian = GetMember( $loggedinuser ) if ( $loggedinuser );
+ my $is_super = C4::Auth::haspermission( $librarian->{'userid'}, { 'superlibrarian' => 1 } ) if ( $librarian );
+ $is_super = $is_super->{'superlibrarian'} if ( $is_super );
if ( ! $type ) {
$type = '%';
@@ -2125,6 +2131,7 @@ sub GetMessages {
my @results;
while ( my $data = $sth->fetchrow_hashref ) {
+ $data->{'can_delete'} = 1 if ( $is_super );
push @results, $data;
}
return \@results;
diff --git a/circ/circulation.pl b/circ/circulation.pl
index ca4b995..10cd975 100755
--- a/circ/circulation.pl
+++ b/circ/circulation.pl
@@ -655,8 +655,8 @@ if ( C4::Context->preference("memberofinstitution") ) {
$template->param(
issued_itemtypes_count_loop => \@issued_itemtypes_count_loop,
- lib_messages_loop => GetMessages( $borrowernumber, 'L', $branch ),
- bor_messages_loop => GetMessages( $borrowernumber, 'B', $branch ),
+ lib_messages_loop => GetMessages( $borrowernumber, 'L', $branch, $loggedinuser ),
+ bor_messages_loop => GetMessages( $borrowernumber, 'B', $branch, $loggedinuser ),
all_messages_del => C4::Context->preference('AllowAllMessageDeletion'),
findborrower => $findborrower,
borrower => $borrower,
--
1.5.6.5
More information about the Koha-patches
mailing list