View | Details | Raw Unified | Return to bug 15632
Collapse All | Expand All

(-)a/C4/Members.pm (-32 lines)
Lines 100-106 BEGIN { Link Here
100
        &GetUpcomingMembershipExpires
100
        &GetUpcomingMembershipExpires
101
101
102
        &GetMessages
102
        &GetMessages
103
        &GetMessagesCount
104
103
105
        &IssueSlip
104
        &IssueSlip
106
        GetBorrowersWithEmail
105
        GetBorrowersWithEmail
Lines 2231-2267 sub GetMessages { Link Here
2231
2230
2232
}
2231
}
2233
2232
2234
=head2 GetMessages
2235
2236
  GetMessagesCount( $borrowernumber, $type );
2237
2238
$type is message type, B for borrower, or L for Librarian.
2239
Empty type returns all messages of any type.
2240
2241
Returns the number of messages for the given borrowernumber
2242
2243
=cut
2244
2245
sub GetMessagesCount {
2246
    my ( $borrowernumber, $type, $branchcode ) = @_;
2247
2248
    if ( ! $type ) {
2249
      $type = '%';
2250
    }
2251
2252
    my $dbh  = C4::Context->dbh;
2253
2254
    my $query = "SELECT COUNT(*) as MsgCount FROM messages WHERE borrowernumber = ? AND message_type LIKE ?";
2255
    my $sth = $dbh->prepare($query);
2256
    $sth->execute( $borrowernumber, $type ) ;
2257
    my @results;
2258
2259
    my $data = $sth->fetchrow_hashref;
2260
    my $count = $data->{'MsgCount'};
2261
2262
    return $count;
2263
}
2264
2265
=head2 IssueSlip
2233
=head2 IssueSlip
2266
2234
2267
  IssueSlip($branchcode, $borrowernumber, $quickslip)
2235
  IssueSlip($branchcode, $borrowernumber, $quickslip)
(-)a/opac/opac-user.pl (-2 / +8 lines)
Lines 38-43 use Koha::DateUtils; Link Here
38
use Koha::Borrower::Debarments qw(IsDebarred);
38
use Koha::Borrower::Debarments qw(IsDebarred);
39
use Koha::Holds;
39
use Koha::Holds;
40
use Koha::Database;
40
use Koha::Database;
41
use Koha::Patron::Messages;
41
42
42
use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE';
43
use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE';
43
44
Lines 307-313 if (C4::Context->preference("OPACAmazonCoverImages") or Link Here
307
        $template->param(JacketImages=>1);
308
        $template->param(JacketImages=>1);
308
}
309
}
309
310
310
if ( GetMessagesCount( $borrowernumber, 'B' ) ) {
311
my $patron_messages = Koha::Patron::Messages->search(
312
    {
313
        borrowernumber => $borrowernumber,
314
        message_type => 'B',
315
    }
316
);
317
if ( $patron_messages->count ) {
311
    $template->param( bor_messages => 1 );
318
    $template->param( bor_messages => 1 );
312
}
319
}
313
320
314
- 

Return to bug 15632