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

(-)a/C4/Members.pm (-44 lines)
Lines 96-103 BEGIN { Link Here
96
        &GetExpiryDate
96
        &GetExpiryDate
97
        &GetUpcomingMembershipExpires
97
        &GetUpcomingMembershipExpires
98
98
99
        &GetMessages
100
101
        &IssueSlip
99
        &IssueSlip
102
        GetBorrowersWithEmail
100
        GetBorrowersWithEmail
103
101
Lines 2127-2174 sub ModPrivacy { Link Here
2127
                      privacy        => $privacy );
2125
                      privacy        => $privacy );
2128
}
2126
}
2129
2127
2130
=head2 GetMessages
2131
2132
  GetMessages( $borrowernumber, $type );
2133
2134
$type is message type, B for borrower, or L for Librarian.
2135
Empty type returns all messages of any type.
2136
2137
Returns all messages for the given borrowernumber
2138
2139
=cut
2140
2141
sub GetMessages {
2142
    my ( $borrowernumber, $type, $branchcode ) = @_;
2143
2144
    if ( ! $type ) {
2145
      $type = '%';
2146
    }
2147
2148
    my $dbh  = C4::Context->dbh;
2149
2150
    my $query = "SELECT
2151
                  branches.branchname,
2152
                  messages.*,
2153
                  message_date,
2154
                  messages.branchcode LIKE '$branchcode' AS can_delete
2155
                  FROM messages, branches
2156
                  WHERE borrowernumber = ?
2157
                  AND message_type LIKE ?
2158
                  AND messages.branchcode = branches.branchcode
2159
                  ORDER BY message_date DESC";
2160
    my $sth = $dbh->prepare($query);
2161
    $sth->execute( $borrowernumber, $type ) ;
2162
    my @results;
2163
2164
    while ( my $data = $sth->fetchrow_hashref ) {
2165
        $data->{message_date_formatted} = output_pref( { dt => dt_from_string( $data->{message_date} ), dateonly => 1, dateformat => 'iso' } );
2166
        push @results, $data;
2167
    }
2168
    return \@results;
2169
2170
}
2171
2172
=head2 IssueSlip
2128
=head2 IssueSlip
2173
2129
2174
  IssueSlip($branchcode, $borrowernumber, $quickslip)
2130
  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 546-556 if ( $borrowernumber && $borrower->{'category_type'} eq 'C') { Link Here
546
    $template->param( 'catcode' =>    $catcodes->[0])  if $cnt == 1;
547
    $template->param( 'catcode' =>    $catcodes->[0])  if $cnt == 1;
547
}
548
}
548
549
549
my $lib_messages_loop = GetMessages( $borrowernumber, 'L', $branch );
550
my $librarian_messages = Koha::Patron::Messages->search(
550
if($lib_messages_loop){ $template->param(flagged => 1 ); }
551
    {
552
        borrowernumber => $borrowernumber,
553
        message_type => 'L',
554
    }
555
);
556
557
my $patron_messages = Koha::Patron::Messages->search(
558
    {
559
        borrowernumber => $borrowernumber,
560
        message_type => 'B',
561
    }
562
);
551
563
552
my $bor_messages_loop = GetMessages( $borrowernumber, 'B', $branch );
564
if( $librarian_messages->count or $patron_messages->count ) {
553
if($bor_messages_loop){ $template->param(flagged => 1 ); }
565
    $template->param(flagged => 1)
566
}
554
567
555
my $fast_cataloging = 0;
568
my $fast_cataloging = 0;
556
if (defined getframeworkinfo('FA')) {
569
if (defined getframeworkinfo('FA')) {
Lines 589-597 if ($restoreduedatespec || $stickyduedate) { Link Here
589
}
602
}
590
603
591
$template->param(
604
$template->param(
592
    lib_messages_loop => $lib_messages_loop,
605
    librarian_messages => $librarian_messages,
593
    bor_messages_loop => $bor_messages_loop,
606
    patron_messages   => $patron_messages,
594
    all_messages_del  => C4::Context->preference('AllowAllMessageDeletion'),
595
    findborrower      => $findborrower,
607
    findborrower      => $findborrower,
596
    borrower          => $borrower,
608
    borrower          => $borrower,
597
    borrowernumber    => $borrowernumber,
609
    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  | $KohaDates %]
847
                        [% message.message_date | $KohaDates %]
848
                                                [% Branches.GetName( lib_messages_loo.branchcode ) %]
848
                        [% Branches.GetName( lib_messages_loo.branchcode ) %]
849
						<i>"[% lib_messages_loo.message %]"</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 %] [% Branches.GetName( 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  | $KohaDates %] [% Branches.GetName( bor_messages_loo.branchcode ) %] <i>"[% bor_messages_loo.message %]"</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 %]</strong><br>
35
                                        <strong>[% message.message %]</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 / +1 lines)
Lines 346-352 if ( C4::Context->preference('AllowPatronToSetCheckoutsVisibilityForGuarantor' Link Here
346
346
347
$template->param(
347
$template->param(
348
    borrower                 => $borr,
348
    borrower                 => $borr,
349
    bor_messages_loop        => GetMessages( $borrowernumber, 'B', 'NONE' ),
349
    patron_messages          => $patron_messages,
350
    patronupdate             => $patronupdate,
350
    patronupdate             => $patronupdate,
351
    OpacRenewalAllowed       => C4::Context->preference("OpacRenewalAllowed"),
351
    OpacRenewalAllowed       => C4::Context->preference("OpacRenewalAllowed"),
352
    userview                 => 1,
352
    userview                 => 1,
353
- 

Return to bug 15632