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

(-)a/C4/Members.pm (-44 lines)
Lines 99-106 BEGIN { Link Here
99
        &GetExpiryDate
99
        &GetExpiryDate
100
        &GetUpcomingMembershipExpires
100
        &GetUpcomingMembershipExpires
101
101
102
        &GetMessages
103
104
        &IssueSlip
102
        &IssueSlip
105
        GetBorrowersWithEmail
103
        GetBorrowersWithEmail
106
104
Lines 2188-2235 sub ModPrivacy { Link Here
2188
                      privacy        => $privacy );
2186
                      privacy        => $privacy );
2189
}
2187
}
2190
2188
2191
=head2 GetMessages
2192
2193
  GetMessages( $borrowernumber, $type );
2194
2195
$type is message type, B for borrower, or L for Librarian.
2196
Empty type returns all messages of any type.
2197
2198
Returns all messages for the given borrowernumber
2199
2200
=cut
2201
2202
sub GetMessages {
2203
    my ( $borrowernumber, $type, $branchcode ) = @_;
2204
2205
    if ( ! $type ) {
2206
      $type = '%';
2207
    }
2208
2209
    my $dbh  = C4::Context->dbh;
2210
2211
    my $query = "SELECT
2212
                  branches.branchname,
2213
                  messages.*,
2214
                  message_date,
2215
                  messages.branchcode LIKE '$branchcode' AS can_delete
2216
                  FROM messages, branches
2217
                  WHERE borrowernumber = ?
2218
                  AND message_type LIKE ?
2219
                  AND messages.branchcode = branches.branchcode
2220
                  ORDER BY message_date DESC";
2221
    my $sth = $dbh->prepare($query);
2222
    $sth->execute( $borrowernumber, $type ) ;
2223
    my @results;
2224
2225
    while ( my $data = $sth->fetchrow_hashref ) {
2226
        $data->{message_date_formatted} = output_pref( { dt => dt_from_string( $data->{message_date} ), dateonly => 1, dateformat => 'iso' } );
2227
        push @results, $data;
2228
    }
2229
    return \@results;
2230
2231
}
2232
2233
=head2 IssueSlip
2189
=head2 IssueSlip
2234
2190
2235
  IssueSlip($branchcode, $borrowernumber, $quickslip)
2191
  IssueSlip($branchcode, $borrowernumber, $quickslip)
(-)a/circ/circulation.pl (-7 / +19 lines)
Lines 46-51 use C4::Members::Attributes qw(GetBorrowerAttributes); Link Here
46
use Koha::Borrower::Debarments qw(GetDebarments IsDebarred);
46
use Koha::Borrower::Debarments qw(GetDebarments IsDebarred);
47
use Koha::DateUtils;
47
use Koha::DateUtils;
48
use Koha::Database;
48
use Koha::Database;
49
use Koha::Patron::Messages;
49
50
50
use Date::Calc qw(
51
use Date::Calc qw(
51
  Today
52
  Today
Lines 555-565 if ( $borrowernumber && $borrower->{'category_type'} eq 'C') { Link Here
555
    $template->param( 'catcode' =>    $catcodes->[0])  if $cnt == 1;
556
    $template->param( 'catcode' =>    $catcodes->[0])  if $cnt == 1;
556
}
557
}
557
558
558
my $lib_messages_loop = GetMessages( $borrowernumber, 'L', $branch );
559
my $librarian_messages = Koha::Patron::Messages->search(
559
if($lib_messages_loop){ $template->param(flagged => 1 ); }
560
    {
561
        borrowernumber => $borrowernumber,
562
        message_type => 'L',
563
    }
564
);
565
566
my $patron_messages = Koha::Patron::Messages->search(
567
    {
568
        borrowernumber => $borrowernumber,
569
        message_type => 'B',
570
    }
571
);
560
572
561
my $bor_messages_loop = GetMessages( $borrowernumber, 'B', $branch );
573
if( $librarian_messages->count or $patron_messages->count ) {
562
if($bor_messages_loop){ $template->param(flagged => 1 ); }
574
    $template->param(flagged => 1)
575
}
563
576
564
my $fast_cataloging = 0;
577
my $fast_cataloging = 0;
565
if (defined getframeworkinfo('FA')) {
578
if (defined getframeworkinfo('FA')) {
Lines 598-606 if ($restoreduedatespec || $stickyduedate) { Link Here
598
}
611
}
599
612
600
$template->param(
613
$template->param(
601
    lib_messages_loop => $lib_messages_loop,
614
    librarian_messages => $librarian_messages,
602
    bor_messages_loop => $bor_messages_loop,
615
    patron_messages   => $patron_messages,
603
    all_messages_del  => C4::Context->preference('AllowAllMessageDeletion'),
604
    findborrower      => $findborrower,
616
    findborrower      => $findborrower,
605
    borrower          => $borrower,
617
    borrower          => $borrower,
606
    borrowernumber    => $borrowernumber,
618
    borrowernumber    => $borrowernumber,
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-27 / +22 lines)
Lines 838-872 No patron matched <span class="ex">[% message %]</span> Link Here
838
838
839
    <!-- /If notes -->[% END %]
839
    <!-- /If notes -->[% END %]
840
840
841
	<div id="messages" class="circmessage">
841
    <div id="messages" class="circmessage">
842
		<h4>Messages:</h4>
842
        <h4>Messages:</h4>
843
		<ul>
843
        <ul>
844
			[% FOREACH lib_messages_loo IN lib_messages_loop %]
844
            [% FOREACH message  IN librarian_messages %]
845
				<li>
845
                <li>
846
					<span class="circ-hlt">
846
                    <span class="circ-hlt">
847
						[% lib_messages_loo.message_date_formatted %]
847
                        [% message.message_date | $KohaDates %]
848
						[% lib_messages_loo.branchcode %]
848
                        [% message.branchcode %]
849
                        <i>"[% lib_messages_loo.message.raw %]"</i>
849
                        <i>"[% message.message.raw %]"</i>
850
					</span>
850
                    </span>
851
					[% IF ( lib_messages_loo.can_delete ) %]
851
                    [% IF message.branchcode == branch OR Koha.Preference('AllowAllMessageDeletion') %]
852
						<a href="/cgi-bin/koha/circ/del_message.pl?message_id=[% lib_messages_loo.message_id %]&amp;borrowernumber=[% lib_messages_loo.borrowernumber %]">[Delete]</a>
852
                        <a href="/cgi-bin/koha/circ/del_message.pl?message_id=[% message.message_id %]&amp;borrowernumber=[% message.borrowernumber %]">[Delete]</a>
853
					[% ELSE %]
853
                    [% END %]
854
						[% IF ( all_messages_del ) %]
854
                </li>
855
							<a href="/cgi-bin/koha/circ/del_message.pl?message_id=[% lib_messages_loo.message_id %]&amp;borrowernumber=[% lib_messages_loo.borrowernumber %]">[Delete]</a>
855
            [% END %]
856
						[% END %]
856
            [% FOREACH message IN patron_messages %]
857
					[% END %]
857
                <li><span class="">[% message.message_date | $KohaDates %] [% message.branchcode %] <i>"[% message.message.raw %]"</i></span>
858
				</li>
858
                [% IF message.branchcode == branch OR Koha.Preference('AllowAllMessageDeletion') %]
859
			[% END %]
859
                    <a href="/cgi-bin/koha/circ/del_message.pl?message_id=[% message.message_id %]&amp;borrowernumber=[% message.borrowernumber %]">[Delete]</a>
860
			[% FOREACH bor_messages_loo IN bor_messages_loop %]
861
                <li><span class="">[% bor_messages_loo.message_date_formatted %] [% bor_messages_loo.branchcode %] <i>"[% bor_messages_loo.message.raw %]"</i></span> [% IF ( bor_messages_loo.can_delete ) %]<a href="/cgi-bin/koha/circ/del_message.pl?message_id=[% bor_messages_loo.message_id %]&amp;borrowernumber=[% bor_messages_loo.borrowernumber %]">[Delete]</a>
862
                [% ELSIF ( all_messages_del ) %]
863
                    <a href="/cgi-bin/koha/circ/del_message.pl?message_id=[% bor_messages_loo.message_id %]&amp;borrowernumber=[% bor_messages_loo.borrowernumber %]">[Delete]</a>
864
                [% END %]</li>
860
                [% END %]</li>
865
			[% END %]
861
            [% END %]
862
        </ul>
863
    </div>
866
864
867
		</ul>
868
	</div>	
869
	
870
     <!-- /If flagged -->[% END %]
865
     <!-- /If flagged -->[% END %]
871
866
872
	
867
	
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt (-4 / +5 lines)
Lines 1-5 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE KohaDates %]
2
[% USE KohaDates %]
3
[% USE Branches %]
3
4
4
[% INCLUDE 'doc-head-open.inc' %]
5
[% INCLUDE 'doc-head-open.inc' %]
5
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; Your library home</title>
6
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; Your library home</title>
Lines 29-45 Link Here
29
                        <div class="alert alert-info">
30
                        <div class="alert alert-info">
30
                            <h3>Messages for you</h3>
31
                            <h3>Messages for you</h3>
31
                                <ul>
32
                                <ul>
32
                                    [% FOREACH bor_messages_loo IN bor_messages_loop %]
33
                                    [% FOREACH message IN patron_messages %]
33
                                        <li>
34
                                        <li>
34
                                        <strong>[% bor_messages_loo.message.raw %]</strong><br>
35
                                        <strong>[% message.message.raw %]</strong><br>
35
                                        &nbsp;&nbsp;&nbsp;<i>Written on [% bor_messages_loo.message_date | $KohaDates %] by [% bor_messages_loo.branchname %]</i>
36
                                        &nbsp;&nbsp;&nbsp;<i>Written on [% message.message_date | $KohaDates %] by [% Branches.GetName(message.branchcode) %]</i>
36
                                        </li>
37
                                        </li>
37
                                    [% END %]
38
                                    [% END %]
38
39
39
                                    [% IF ( opacnote ) %]<li>[% opacnote %]</li>[% END %]
40
                                    [% IF ( opacnote ) %]<li>[% opacnote %]</li>[% END %]
40
                                </ul>
41
                                </ul>
41
                        </div>
42
                        </div>
42
                    [% END # / IF bor_messages %]
43
                    [% END %]
43
                    <h2>Hello, [% INCLUDE 'patron-title.inc' category_type = BORROWER_INFO.category_type firstname = BORROWER_INFO.firstname surname = BORROWER_INFO.surname othernames = BORROWER_INFO.othernames cardnumber = BORROWER_INFO.cardnumber %]
44
                    <h2>Hello, [% INCLUDE 'patron-title.inc' category_type = BORROWER_INFO.category_type firstname = BORROWER_INFO.firstname surname = BORROWER_INFO.surname othernames = BORROWER_INFO.othernames cardnumber = BORROWER_INFO.cardnumber %]
44
                    </h2>
45
                    </h2>
45
46
(-)a/opac/opac-user.pl (-2 / +7 lines)
Lines 339-347 if ( C4::Context->preference('AllowPatronToSetCheckoutsVisibilityForGuarantor' Link Here
339
    $template->param( relatives => \@relatives );
339
    $template->param( relatives => \@relatives );
340
}
340
}
341
341
342
my $patron_messages = Koha::Patron::Messages->search(
343
    {
344
        borrowernumber => $borrowernumber,
345
        message_type => 'B',
346
    }
347
);
342
$template->param(
348
$template->param(
343
    borrower                 => $borr,
349
    borrower                 => $borr,
344
    bor_messages_loop        => GetMessages( $borrowernumber, 'B', 'NONE' ),
350
    patron_messages          => $patron_messages,
345
    patronupdate             => $patronupdate,
351
    patronupdate             => $patronupdate,
346
    OpacRenewalAllowed       => C4::Context->preference("OpacRenewalAllowed"),
352
    OpacRenewalAllowed       => C4::Context->preference("OpacRenewalAllowed"),
347
    userview                 => 1,
353
    userview                 => 1,
348
- 

Return to bug 15632