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

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-renewal-modal-strings.inc (+7 lines)
Line 0 Link Here
1
<script>
2
    var note = _("Note");
3
    var out_of = _("out of");
4
    var renewals_logged = _("renewals have been logged")
5
    var renewed_on = _("Renewed on");
6
    var by = _("by");
7
</script>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-renewal-modal.inc (+18 lines)
Line 0 Link Here
1
<div id="patronRenewals" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="patronRenewalsLabel" aria-hidden="true">
2
	<div class="modal-dialog">
3
		<div class="modal-content">
4
			<div class="modal-header">
5
				<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
6
				<h3 id="patronRenewalsLabel"> Item renewals</h3>
7
			</div>
8
			<div class="modal-body">
9
                <div id="retrieving" class="alert" style="display:none">Retrieving renewals...</div>
10
                <div id="incomplete" class="alert" style="display:none"></div>
11
                <ul id="results" style="display:none"></ul>
12
			</div>
13
			<div class="modal-footer">
14
				<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
15
			</div>
16
		</div>
17
	</div>
18
</div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt (-1 / +10 lines)
Lines 87-93 Link Here
87
          </td>
87
          </td>
88
88
89
          <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% issue.itemnumber | uri %]&amp;biblionumber=[% issue.biblionumber | uri %]&amp;bi=[% issue.biblioitemnumber | uri %]#item[% issue.itemnumber | uri %]">[% issue.barcode | html %]</a></td>
89
          <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% issue.itemnumber | uri %]&amp;biblionumber=[% issue.biblionumber | uri %]&amp;bi=[% issue.biblioitemnumber | uri %]#item[% issue.itemnumber | uri %]">[% issue.barcode | html %]</a></td>
90
          <td>[% issue.renewals | html %]</td>
90
          <td>
91
              [% issue.renewals | html %]
92
              [% itemid = issue.itemnumber %]
93
              [% IF logged_items.$itemid %]
94
                  [ <a class="patron_renewals_view" data-renewals=[% issue.renewals | html %] data-itemid="[% itemid | html %]" data-patronid="[% patron.borrowernumber | html %]" href="#">View</a> ]
95
              [% END %]
96
          </td>
91
          <td>
97
          <td>
92
            <span title="[% issue.issuedate | html %]">[% issue.issuedate |$KohaDates  with_hours => 1 %]</span>
98
            <span title="[% issue.issuedate | html %]">[% issue.issuedate |$KohaDates  with_hours => 1 %]</span>
93
          </td>
99
          </td>
Lines 129-134 Link Here
129
    [% Asset.js("js/members-menu.js") | $raw %]
135
    [% Asset.js("js/members-menu.js") | $raw %]
130
    [% INCLUDE 'datatables.inc' %]
136
    [% INCLUDE 'datatables.inc' %]
131
    [% INCLUDE 'columns_settings.inc' %]
137
    [% INCLUDE 'columns_settings.inc' %]
138
    [% INCLUDE 'patron-renewal-modal.inc' %]
139
    [% INCLUDE 'patron-renewal-modal-strings.inc' %]
140
    [% Asset.js("js/patron-renewal-modal.js") | $raw %]
132
    <script id="js">
141
    <script id="js">
133
        $(document).ready(function() {
142
        $(document).ready(function() {
134
            var columns_settings = [% ColumnsSettings.GetColumns('members', 'checkouthistory', 'checkouthistory-table', 'json') %];
143
            var columns_settings = [% ColumnsSettings.GetColumns('members', 'checkouthistory', 'checkouthistory-table', 'json') %];
(-)a/koha-tmpl/intranet-tmpl/prog/js/patron-renewal-modal.js (+26 lines)
Line 0 Link Here
1
$(document).ready(function(){
2
    // Display the modal containing patron renewals details
3
    $('.patron_renewals_view').on('click', function(e) {
4
        e.preventDefault();
5
        $('#patronRenewals #incomplete').html('').hide();
6
        $('#patronRenewals #results').html('').hide();
7
        $('#patronRenewals').modal({show:true});
8
        var renewals = $(this).data('renewals');
9
        var itemid = $(this).data('itemid');
10
        var patronid = $(this).data('patronid');
11
        $('#patronRenewals #retrieving').show();
12
        $.get('/api/v1/patrons/'+patronid+'/renewals?item_id='+itemid+'&embed=patron,renewed_by', function(data) {
13
            if (data.length < renewals) {
14
                $('#patronRenewals #incomplete').append(note + ': ' + data.length + ' ' + out_of + ' ' + renewals + ' ' + renewals_logged).show();
15
            }
16
            var items = data.map(function(item) {
17
                return createLi(item);
18
            });
19
            $('#patronRenewals #retrieving').hide();
20
            $('#patronRenewals #results').append(items).show();
21
        });
22
    });
23
    function createLi(renewal) {
24
        return '<li>' + renewed_on + ' <span style="font-weight:bold">' + renewal.timestamp + '</span> ' + by + ' <span style="font-weight:bold">' + renewal.renewed_by.firstname + ' ' + renewal.renewed_by.surname + '</li>';
25
    }
26
});
(-)a/members/readingrec.pl (-1 / +20 lines)
Lines 25-34 use Modern::Perl; Link Here
25
use CGI qw ( -utf8 );
25
use CGI qw ( -utf8 );
26
26
27
use C4::Auth;
27
use C4::Auth;
28
use C4::Context;
28
use C4::Output;
29
use C4::Output;
29
use C4::Members;
30
use C4::Members;
30
use List::MoreUtils qw/any uniq/;
31
use List::MoreUtils qw/any uniq/;
31
use Koha::DateUtils;
32
use Koha::DateUtils;
33
use Koha::ActionLogs;
32
34
33
use Koha::Patrons;
35
use Koha::Patrons;
34
use Koha::Patron::Categories;
36
use Koha::Patron::Categories;
Lines 60-65 output_and_exit_if_error( $input, $cookie, $template, { module => 'members', log Link Here
60
my $order = 'date_due desc';
62
my $order = 'date_due desc';
61
my $limit = 0;
63
my $limit = 0;
62
my $issues = ();
64
my $issues = ();
65
my $logged_item_ids = {};
63
# Do not request the old issues of anonymous patron
66
# Do not request the old issues of anonymous patron
64
if ( $patron->borrowernumber eq C4::Context->preference('AnonymousPatron') ){
67
if ( $patron->borrowernumber eq C4::Context->preference('AnonymousPatron') ){
65
    # use of 'eq' in the above comparison is intentional -- the
68
    # use of 'eq' in the above comparison is intentional -- the
Lines 67-72 if ( $patron->borrowernumber eq C4::Context->preference('AnonymousPatron') ){ Link Here
67
    $template->param( is_anonymous => 1 );
70
    $template->param( is_anonymous => 1 );
68
} else {
71
} else {
69
    $issues = GetAllIssues($patron->borrowernumber,$order,$limit);
72
    $issues = GetAllIssues($patron->borrowernumber,$order,$limit);
73
    # Establish if:
74
    # a) renewal logging is turned on
75
    # b) which of the issued items have corresponding renewal logs in the
76
    #    action logs
77
    # This will determine whether we should show the "View" renewals link
78
    # A hashref of all log entries relating to renewals - ensures each item
79
    # id only appears once, it also aids lookup
80
    if (C4::Context->preference("RenewalLog")) {
81
        my $patron_renew_logs = Koha::ActionLogs->search(
82
            { object => $patron->borrowernumber, action => 'RENEWAL' },
83
            { columns => [ qw/info/ ] }
84
        )->unblessed;
85
        foreach my $log(@{$patron_renew_logs}) {
86
            $logged_item_ids->{$log->{info}} = 1;
87
        }
88
    }
70
}
89
}
71
90
72
#   barcode export
91
#   barcode export
Lines 99-104 $template->param( Link Here
99
    patron            => $patron,
118
    patron            => $patron,
100
    readingrecordview => 1,
119
    readingrecordview => 1,
101
    loop_reading      => $issues,
120
    loop_reading      => $issues,
121
    logged_items      => $logged_item_ids
102
);
122
);
103
output_html_with_http_headers $input, $cookie, $template->output;
123
output_html_with_http_headers $input, $cookie, $template->output;
104
124
105
- 

Return to bug 23838