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. Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
This commit is contained in:
parent
e6bd28682e
commit
74180472ad
2 changed files with 8 additions and 33 deletions
|
@ -97,7 +97,6 @@ BEGIN {
|
||||||
&GetUpcomingMembershipExpires
|
&GetUpcomingMembershipExpires
|
||||||
|
|
||||||
&GetMessages
|
&GetMessages
|
||||||
&GetMessagesCount
|
|
||||||
|
|
||||||
&IssueSlip
|
&IssueSlip
|
||||||
GetBorrowersWithEmail
|
GetBorrowersWithEmail
|
||||||
|
@ -2174,37 +2173,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
|
=head2 IssueSlip
|
||||||
|
|
||||||
IssueSlip($branchcode, $borrowernumber, $quickslip)
|
IssueSlip($branchcode, $borrowernumber, $quickslip)
|
||||||
|
|
|
@ -38,6 +38,7 @@ use Koha::DateUtils;
|
||||||
use Koha::Borrower::Debarments qw(IsDebarred);
|
use Koha::Borrower::Debarments qw(IsDebarred);
|
||||||
use Koha::Holds;
|
use Koha::Holds;
|
||||||
use Koha::Database;
|
use Koha::Database;
|
||||||
|
use Koha::Patron::Messages;
|
||||||
|
|
||||||
use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE';
|
use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE';
|
||||||
|
|
||||||
|
@ -312,7 +313,13 @@ if (C4::Context->preference("OPACAmazonCoverImages") or
|
||||||
$template->param(JacketImages=>1);
|
$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 );
|
$template->param( bor_messages => 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue