[Koha-patches] [PATCH] Bug # 3472 - Allows superlibrians todelete any and all messages, reguardless of branchcode.

Wagner, Jane jwagner at ptfs.com
Mon Sep 28 15:07:21 CEST 2009


We've been happy to work with Kyle, and he's produced a lot of good features.  One minor note, though, to follow up on his message -- we're using the kohaprogrammers at ptfs.com address on all our bugzilla reports (including ones written by other developers than Kyle), so check with us if you have a question on anything and we'll route it to the right person.

Jane Wagner
Library Systems Analyst
PTFS Inc.
Content Management and Library Solutions
6400 Goldsboro Road, Suite 200
Bethesda, MD  20817
(301) 654-8088 x 151
jwagner at ptfs.com


-----Original Message-----
From: koha-patches-bounces at lists.koha.org [mailto:koha-patches-bounces at lists.koha.org] On Behalf Of Kyle Hall
Sent: Monday, September 28, 2009 8:58 AM
To: patches at koha.org
Subject: Re: [Koha-patches] [PATCH] Bug # 3472 - Allows superlibrians todelete any and all messages, reguardless of branchcode.

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
>
>
_______________________________________________
Koha-patches mailing list
Koha-patches at lists.koha.org
http://lists.koha.org/mailman/listinfo/koha-patches



More information about the Koha-patches mailing list