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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc (-7 / +18 lines)
Lines 58-71 Link Here
58
                <a href="/cgi-bin/koha/opac-search-history.pl">your search history</a></li>
58
                <a href="/cgi-bin/koha/opac-search-history.pl">your search history</a></li>
59
            [% END %]
59
            [% END %]
60
60
61
            [% IF ( opacreadinghistory ) %]
61
            [% IF opacreadinghistory || Koha.Preference('OPACHoldsHistory') == 1 %]
62
                [% IF ( readingrecview ) %]
62
                [% IF opacreadinghistory %]
63
                    <li class="active">
63
                    [% IF ( readingrecview ) %]
64
                [% ELSE %]
64
                        <li class="active">
65
                    <li>
65
                    [% ELSE %]
66
                        <li>
67
                    [% END %]
68
                    <a href="/cgi-bin/koha/opac-readingrecord.pl">your reading history</a></li>
66
                [% END %]
69
                [% END %]
67
                <a href="/cgi-bin/koha/opac-readingrecord.pl">your reading history</a></li>
70
                [% IF ( OPACPrivacy || Koha.Preference('OPACHoldsPrivacy') == 1 ) %]
68
                [% IF ( OPACPrivacy ) %]
69
                    [% IF ( privacyview ) %]
71
                    [% IF ( privacyview ) %]
70
                        <li class="active">
72
                        <li class="active">
71
                    [% ELSE %]
73
                    [% ELSE %]
Lines 75-80 Link Here
75
                [% END %]
77
                [% END %]
76
            [% END # / opacreadinghistory %]
78
            [% END # / opacreadinghistory %]
77
79
80
            [% IF Koha.Preference('OPACHoldsHistory') == 1 %]
81
                [% IF ( holdshistoryview ) %]
82
                    <li class="active">
83
                [% ELSE %]
84
                    <li>
85
                [% END %]
86
                <a href="/cgi-bin/koha/opac-holdshistory.pl">your holds history</a></li>
87
            [% END %]
88
78
            [% IF Koha.Preference( 'suggestion' ) == 1 %]
89
            [% IF Koha.Preference( 'suggestion' ) == 1 %]
79
                [% IF ( suggestionsview ) %]
90
                [% IF ( suggestionsview ) %]
80
                    <li class="active">
91
                    <li class="active">
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-holdshistory.tt (+188 lines)
Line 0 Link Here
1
[% USE raw %]
2
[% USE Koha %]
3
[% USE KohaDates %]
4
[% USE ColumnsSettings %]
5
[% INCLUDE 'doc-head-open.inc' %]
6
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo; Your holds history</title>
7
[% INCLUDE 'doc-head-close.inc' %]
8
[% BLOCK cssinclude %]
9
    <style>
10
        .controls {
11
            font-size: 75%;
12
        }
13
14
        .controls .paginate_button {
15
            font-family: 'FontAwesome';
16
            text-decoration: none;
17
        }
18
19
        .controls .paginate_button:not(.disabled) {
20
            cursor: pointer;
21
        }
22
23
        .controls .paginate_button.disabled {
24
            color: grey;
25
        }
26
27
        .controls .previous:before {
28
            content: "\f104";
29
            padding-right: .5em;
30
        }
31
32
        .controls .next:after {
33
            content: "\f105";
34
            padding-left: .5em;
35
        }
36
    </style>
37
[% END %]
38
</head>
39
[% INCLUDE 'bodytag.inc' bodyid='opac-holdshistory' %]
40
[% INCLUDE 'masthead.inc' %]
41
42
<div class="main">
43
    <ul class="breadcrumb">
44
        <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
45
        <li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> <span class="divider">&rsaquo;</span></li>
46
        <li><a href="#">Your holds history</a></li>
47
    </ul>
48
49
    <div class="container-fluid">
50
        <div class="row-fluid">
51
            <div class="span2">
52
                <div id="navigation">
53
                    [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
54
                </div>
55
            </div>
56
            <div class="span10">
57
                <div id="userholdshistory">
58
                    <h3>Holds history</h3>
59
60
                    [% IF !holds %]
61
                        You have never placed a hold from this library.
62
                    [% ELSE %]
63
                        <div id="opac-user-holdsrec">
64
                            <div id="tabs-container" style="overflow:auto">
65
                                <div class="controls">
66
                                    <div class="resultscontrol resort">
67
                                        <form id="sortform" action="/cgi-bin/koha/opac-holdshistory.pl" method="get">
68
                                            [% IF ( unlimit ) %]<input type="hidden" name="unlimit" value="1" />[% END %]
69
                                            <select name="sort" id="sort">
70
                                                [% IF ( sort == 'reservedate' ) %]<option value="reservedate" selected="selected">Order by date</option>[% ELSE %]<option value="reservedate">Order by date</option>[% END %]
71
                                                [% IF ( sort == 'biblio.title' ) %]<option value="biblio.title" selected="selected">Order by title</option>[% ELSE %]<option value="biblio.title">Order by title</option>[% END %]
72
                                                [% IF ( sort == 'biblio.author' ) %]<option value="biblio.author" selected="selected">Order by author</option>[% ELSE %]<option value="biblio.author">Order by author</option>[% END %]
73
                                            </select>
74
                                            <input type="submit" value="Go" id="sortsubmit" class="submit clearfix" />
75
                                        </form>
76
                                    </div>
77
78
                                    [% UNLESS unlimit %]
79
                                        <p>
80
                                            Showing 50 items. <a href="/cgi-bin/koha/opac-holdshistory.pl?unlimit=1[% IF ( sort ) %]&amp;sort=[% sort | url %][% END %]">Show all items</a>
81
                                        </p>
82
                                    [% ELSE %]
83
                                        <p>
84
                                            Showing all items. <a href="/cgi-bin/koha/opac-holdshistory.pl[% IF ( sort ) %]?sort=[% sort | url %][% END %]">Show 50 items</a>
85
                                        </p>
86
                                    [% END %]
87
                                </div>
88
                                <table id="table_holdshistory" class="table table-bordered table-striped">
89
                                    <thead>
90
                                        <tr>
91
                                        <th class="anti-the">Title</th>
92
                                        <th>Author</th>
93
                                        <th>Barcode</th>
94
                                        <th>Library</th>
95
                                        <th class="title-string">Hold date</th>
96
                                        <th class="title-string">Expiration date</th>
97
                                        <th class="title-string">Waiting date</th>
98
                                        <th class="title-string">Cancellation date</th>
99
                                        [% IF show_itemtype_column %]
100
                                        <th>Requested item type</th>
101
                                        [% END %]
102
                                        <th>Status</th>
103
                                        </tr>
104
                                    </thead>
105
                                    <tbody>
106
                                    [% FOREACH hold IN holds %]
107
                                        <tr>
108
                                        <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% hold.biblio.biblionumber | uri %]">[% INCLUDE 'biblio-title.inc' biblio=hold.biblio %]</a></td>
109
                                        <td>[% hold.biblio.author | html %]</td>
110
                                        <td>[% hold.item.barcode | html %]</td>
111
                                        <td>[% Branches.GetName( hold.branchcode ) | html %]</td>
112
                                        <td><span title="[% hold.reservedate | html %]">[% hold.reservedate | $KohaDates %]</span></td>
113
                                        <td>
114
                                            [% IF hold.expirationdate %]
115
                                                <span title="[% hold.expirationdate | html %]">[% hold.expirationdate | $KohaDates %]</span>
116
                                            [% ELSE %]
117
                                                <span title="0000-00-00"></span>
118
                                            [% END %]
119
                                        </td>
120
                                        <td>
121
                                            [% IF hold.waitingdate %]
122
                                                <span title="[% hold.waitingdate | html %]">[% hold.waitingdate | $KohaDates %]</span>
123
                                            [% ELSE %]
124
                                                <span title="0000-00-00"></span>
125
                                            [% END %]
126
                                        </td>
127
                                        <td>
128
                                            [% IF hold.cancellationdate %]
129
                                                <span title="[% hold.cancellationdate | html %]">[% hold.cancellationdate | $KohaDates %]</span>
130
                                            [% ELSE %]
131
                                                <span title="0000-00-00"></span>
132
                                            [% END %]
133
                                        </td>
134
                                        [% IF show_itemtype_column %]
135
                                            <td>
136
                                            [% IF hold.itemtype %]
137
                                                [% ItemTypes.GetDescription( hold.itemtype ) | html %]
138
                                            [% ELSE %]
139
                                                <span>Any item type</span>
140
                                            [% END %]
141
                                            </td>
142
                                        [% END %]
143
                                        <td>
144
                                        [% IF hold.found == 'F' %]
145
                                            Fulfilled
146
                                        [% ELSIF hold.cancellationdate %]
147
                                            Cancelled
148
                                        [% ELSIF hold.found == 'W' %]
149
                                            Waiting
150
                                        [% ELSIF hold.found == 'T' %]
151
                                            In transit
152
                                        [% ELSE %]
153
                                            Pending
154
                                        [% END %]
155
                                        </td>
156
                                        </tr>
157
                                    [% END %]
158
                                    </tbody>
159
                                </table>
160
                            </div> <!-- / .tabs-container -->
161
                        </div> <!-- / .opac-user-holdsrec -->
162
                    [% END # / IF old_holds_count %]
163
                </div> <!-- / .userholdshistory -->
164
            </div> <!-- / .span10 -->
165
        </div> <!-- / .row-fluid -->
166
    </div> <!-- / .container-fluid -->
167
</div> <!-- / .main -->
168
169
[% INCLUDE 'opac-bottom.inc' %]
170
[% BLOCK jsinclude %]
171
[% INCLUDE 'datatables.inc' %]
172
<script>
173
    $(document).ready(function() {
174
        $('#sort').change(function() {
175
            $('#sortform').submit();
176
        });
177
        var table = $("table_holdshistory").dataTable($.extend(true, {}, dataTablesDefaults, {
178
            "sPaginationType": "four_button",
179
            "aaSorting": [[4, 'desc']],
180
            "sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
181
            "aoColumnDefs": [
182
                { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
183
                { "sType": "title-string", "aTargets" : [ "title-string" ] }
184
            ]
185
        }));
186
    });
187
</script>
188
[% END %]
(-)a/opac/opac-holdshistory.pl (-1 / +83 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
19
use Modern::Perl;
20
21
use CGI qw ( -utf8 );
22
23
use C4::Auth;
24
use C4::Output;
25
26
use Koha::Patrons;
27
28
my $query = new CGI;
29
my @all_holds;
30
31
# if opacreadinghistory is disabled, leave immediately
32
unless ( C4::Context->preference('OPACHoldsHistory') ) {
33
    print $query->redirect("/cgi-bin/koha/errors/404.pl");
34
    exit;
35
}
36
37
my ( $template, $patron_id, $cookie ) = get_template_and_user(
38
    {
39
        template_name   => "opac-holdshistory.tt",
40
        query           => $query,
41
        type            => "opac"
42
    }
43
);
44
45
my $patron = Koha::Patrons->find( $patron_id );
46
47
my $holds = $patron->holds;
48
my $old_holds = $patron->old_holds;
49
50
while (my $hold = $holds->next) {
51
    push @all_holds, $hold;
52
}
53
54
while (my $hold = $old_holds->next) {
55
    push @all_holds, $hold;
56
}
57
58
my $sort = $query->param('sort');
59
60
$sort = 'reservedate' unless $sort;
61
62
if($sort eq 'reservedate') {
63
    @all_holds = sort {$b->$sort cmp $a->$sort} @all_holds;
64
} else {
65
    my ($obj, $col) = split /\./, $sort;
66
    @all_holds = sort {$a->$obj->$col cmp $b->$obj->$col} @all_holds;
67
}
68
69
my $unlimit = $query->param('unlimit');
70
71
unless($unlimit) {
72
    @all_holds = splice(@all_holds, 0, 50);
73
}
74
75
$template->param(
76
    holdshistoryview => 1,
77
    patron           => $patron,
78
    holds            => \@all_holds,
79
    unlimit          => $unlimit,
80
    sort             => $sort
81
);
82
83
output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };

Return to bug 20936