Bugzilla – Attachment 48013 Details for
Bug 15632
Move the messages related code to Koha::Patron::Messages
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15632: Koha::Patron::Messages - Remove GetMessagesCount
Bug-15632-KohaPatronMessages---Remove-GetMessagesC.patch (text/plain), 2.50 KB, created by
Kyle M Hall (khall)
on 2016-02-12 19:05:24 UTC
(
hide
)
Description:
Bug 15632: Koha::Patron::Messages - Remove GetMessagesCount
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2016-02-12 19:05:24 UTC
Size:
2.50 KB
patch
obsolete
>From fa97e5ce68d2f4cd311fe97d2b7748a483d8420c Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 20 Jan 2016 17:58:45 +0000 >Subject: [PATCH] Bug 15632: Koha::Patron::Messages - Remove GetMessagesCount > >The GetMessageCount subroutine was only used once, in opac-user.pl, to >know if some messages will be displayed. > >Test plan: >1/ Create messages to display at the OPAC for a patron >2/ Logged this patron in at the OPAC, you should see the messages >displayed. >--- > C4/Members.pm | 32 -------------------------------- > opac/opac-user.pl | 9 ++++++++- > 2 files changed, 8 insertions(+), 33 deletions(-) > >diff --git a/C4/Members.pm b/C4/Members.pm >index 8fe2ef8..518888e 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -100,7 +100,6 @@ BEGIN { > &GetUpcomingMembershipExpires > > &GetMessages >- &GetMessagesCount > > &IssueSlip > GetBorrowersWithEmail >@@ -2231,37 +2230,6 @@ sub GetMessages { > > } > >-=head2 GetMessages >- >- GetMessagesCount( $borrowernumber, $type ); >- >-$type is message type, B for borrower, or L for Librarian. >-Empty type returns all messages of any type. >- >-Returns the number of messages for the given borrowernumber >- >-=cut >- >-sub GetMessagesCount { >- my ( $borrowernumber, $type, $branchcode ) = @_; >- >- if ( ! $type ) { >- $type = '%'; >- } >- >- my $dbh = C4::Context->dbh; >- >- my $query = "SELECT COUNT(*) as MsgCount FROM messages WHERE borrowernumber = ? AND message_type LIKE ?"; >- my $sth = $dbh->prepare($query); >- $sth->execute( $borrowernumber, $type ) ; >- my @results; >- >- my $data = $sth->fetchrow_hashref; >- my $count = $data->{'MsgCount'}; >- >- return $count; >-} >- > =head2 IssueSlip > > IssueSlip($branchcode, $borrowernumber, $quickslip) >diff --git a/opac/opac-user.pl b/opac/opac-user.pl >index 9d1f9b2..5b629e3 100755 >--- a/opac/opac-user.pl >+++ b/opac/opac-user.pl >@@ -38,6 +38,7 @@ use Koha::DateUtils; > use Koha::Borrower::Debarments qw(IsDebarred); > use Koha::Holds; > use Koha::Database; >+use Koha::Patron::Messages; > > use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE'; > >@@ -307,7 +308,13 @@ if (C4::Context->preference("OPACAmazonCoverImages") or > $template->param(JacketImages=>1); > } > >-if ( GetMessagesCount( $borrowernumber, 'B' ) ) { >+my $patron_messages = Koha::Patron::Messages->search( >+ { >+ borrowernumber => $borrowernumber, >+ message_type => 'B', >+ } >+); >+if ( $patron_messages->count ) { > $template->param( bor_messages => 1 ); > } > >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 15632
:
47091
|
47092
|
47093
|
47094
|
47095
|
47096
|
47097
|
47515
|
47516
|
47525
|
47571
|
47572
|
47573
|
47574
|
47575
|
47580
|
47581
|
47582
|
47583
|
47584
|
47585
|
47586
|
47587
|
48004
|
48009
|
48010
|
48011
|
48012
| 48013 |
48014
|
48015
|
48016
|
48017
|
48018
|
48020
|
48422
|
48423
|
48424
|
48425
|
48426
|
48427
|
48591
|
48592
|
48593