[Koha-patches] [PATCH] Bug # 3472 - Allows superlibrians to delete any and all messages, reguardless of branchcode.
Kyle Hall
kyle.m.hall at gmail.com
Mon Sep 28 14:58:29 CEST 2009
Hey all,
I thought it I should let everyone know that I've been doing some
freelance development work on Koha for PTFS. I've worked on some great
features that I think will be a huge benefit for all. The messaging
system is one of those things ( at least all the updates since I
pulled it from my own github repository ). If anyone has any questions
about anything with an author like PTFS <kohaprogrammers at ptfs.com> or
PTFS <koha-dev at ptfs.com>, it's most likely my work. For some reason, I
can't get my name to stick to the commits unless I edit the patches by
hand.
Kyle
http://www.kylehall.info
Information Technology
Crawford County Federated Library System ( http://www.ccfls.org )
On Mon, Sep 28, 2009 at 8:48 AM, Kyle M Hall <kyle.m.hall at gmail.com> wrote:
> ---
> 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