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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc (+9 lines)
Lines 74-79 Link Here
74
                [% END %]
74
                [% END %]
75
            [% END # / opacreadinghistory %]
75
            [% END # / opacreadinghistory %]
76
76
77
            [% IF Koha.Preference('OPACHoldsHistory') == 1 %]
78
                [% IF ( holdshistoryview ) %]
79
                    <li class="active">
80
                [% ELSE %]
81
                    <li>
82
                [% END %]
83
                <a href="/cgi-bin/koha/opac-holdshistory.pl">your holds history</a></li>
84
            [% END %]
85
77
            [% IF Koha.Preference( 'suggestion' ) == 1 %]
86
            [% IF Koha.Preference( 'suggestion' ) == 1 %]
78
                [% IF ( suggestionsview ) %]
87
                [% IF ( suggestionsview ) %]
79
                    <li class="active">
88
                    <li class="active">
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-holdshistory.tt (+184 lines)
Line 0 Link Here
1
[% USE raw %]
2
[% USE Koha %]
3
[% USE KohaDates %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo; Your holds history</title>
6
[% INCLUDE 'doc-head-close.inc' %]
7
[% BLOCK cssinclude %]
8
    <style>
9
10
        .controls .paginate_button {
11
            font-family: 'FontAwesome';
12
            text-decoration: none;
13
        }
14
15
        .controls .paginate_button:not(.disabled) {
16
            cursor: pointer;
17
        }
18
19
        .controls .paginate_button.disabled {
20
            color: grey;
21
        }
22
23
        .controls .previous:before {
24
            content: "\f104";
25
            padding-right: .5em;
26
        }
27
28
        .controls .next:after {
29
            content: "\f105";
30
            padding-left: .5em;
31
        }
32
    </style>
33
[% END %]
34
</head>
35
[% INCLUDE 'bodytag.inc' bodyid='opac-holdshistory' %]
36
[% INCLUDE 'masthead.inc' %]
37
38
<div class="main">
39
    <ul class="breadcrumb">
40
        <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
41
        <li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> <span class="divider">&rsaquo;</span></li>
42
        <li><a href="#">Your holds history</a></li>
43
    </ul>
44
45
    <div class="container-fluid">
46
        <div class="row">
47
            <div class="col col-lg-2 order-2 order-lg-1">
48
                <div id="navigation">
49
                    [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
50
                </div>
51
            </div>
52
            <div class="col-md-12 col-lg-10 order-1">
53
                <div id="userholdshistory">
54
                    <h3>Holds history</h3>
55
56
                    [% IF !holds %]
57
                        You have never placed a hold from this library.
58
                    [% ELSE %]
59
                        <div id="opac-user-holdsrec">
60
                            <div id="tabs-container" style="overflow:auto">
61
                                <div class="controls">
62
                                    <div class="resultscontrol resort">
63
                                        <form id="sortform" action="/cgi-bin/koha/opac-holdshistory.pl" method="get">
64
                                            [% IF ( unlimit ) %]<input type="hidden" name="unlimit" value="1" />[% END %]
65
                                            <select name="sort" id="sort">
66
                                                [% IF ( sort == 'reservedate' ) %]<option value="reservedate" selected="selected">Order by date</option>[% ELSE %]<option value="reservedate">Order by date</option>[% END %]
67
                                                [% IF ( sort == 'biblio.title' ) %]<option value="biblio.title" selected="selected">Order by title</option>[% ELSE %]<option value="biblio.title">Order by title</option>[% END %]
68
                                                [% IF ( sort == 'biblio.author' ) %]<option value="biblio.author" selected="selected">Order by author</option>[% ELSE %]<option value="biblio.author">Order by author</option>[% END %]
69
                                            </select>
70
                                            <input type="submit" value="Go" id="sortsubmit" class="submit clearfix" />
71
                                        </form>
72
                                    </div>
73
74
                                    [% UNLESS unlimit %]
75
                                        <p>
76
                                            Showing 50 items. <a href="/cgi-bin/koha/opac-holdshistory.pl?unlimit=1[% IF ( sort ) %]&amp;sort=[% sort | url %][% END %]">Show all items</a>
77
                                        </p>
78
                                    [% ELSE %]
79
                                        <p>
80
                                            Showing all items. <a href="/cgi-bin/koha/opac-holdshistory.pl[% IF ( sort ) %]?sort=[% sort | url %][% END %]">Show 50 items</a>
81
                                        </p>
82
                                    [% END %]
83
                                </div>
84
                                <table id="table_holdshistory" class="table table-bordered table-striped">
85
                                    <thead>
86
                                        <tr>
87
                                        <th class="anti-the">Title</th>
88
                                        <th>Author</th>
89
                                        <th>Barcode</th>
90
                                        <th>Library</th>
91
                                        <th class="title-string">Hold date</th>
92
                                        <th class="title-string">Expiration date</th>
93
                                        <th class="title-string">Waiting date</th>
94
                                        <th class="title-string">Cancellation date</th>
95
                                        [% IF show_itemtype_column %]
96
                                        <th>Requested item type</th>
97
                                        [% END %]
98
                                        <th>Status</th>
99
                                        </tr>
100
                                    </thead>
101
                                    <tbody>
102
                                    [% FOREACH hold IN holds %]
103
                                        <tr>
104
                                        <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% hold.biblio.biblionumber | uri %]">[% INCLUDE 'biblio-title.inc' biblio=hold.biblio %]</a></td>
105
                                        <td>[% hold.biblio.author | html %]</td>
106
                                        <td>[% hold.item.barcode | html %]</td>
107
                                        <td>[% Branches.GetName( hold.branchcode ) | html %]</td>
108
                                        <td><span title="[% hold.reservedate | html %]">[% hold.reservedate | $KohaDates %]</span></td>
109
                                        <td>
110
                                            [% IF hold.expirationdate %]
111
                                                <span title="[% hold.expirationdate | html %]">[% hold.expirationdate | $KohaDates %]</span>
112
                                            [% ELSE %]
113
                                                <span title="0000-00-00"></span>
114
                                            [% END %]
115
                                        </td>
116
                                        <td>
117
                                            [% IF hold.waitingdate %]
118
                                                <span title="[% hold.waitingdate | html %]">[% hold.waitingdate | $KohaDates %]</span>
119
                                            [% ELSE %]
120
                                                <span title="0000-00-00"></span>
121
                                            [% END %]
122
                                        </td>
123
                                        <td>
124
                                            [% IF hold.cancellationdate %]
125
                                                <span title="[% hold.cancellationdate | html %]">[% hold.cancellationdate | $KohaDates %]</span>
126
                                            [% ELSE %]
127
                                                <span title="0000-00-00"></span>
128
                                            [% END %]
129
                                        </td>
130
                                        [% IF show_itemtype_column %]
131
                                            <td>
132
                                            [% IF hold.itemtype %]
133
                                                [% ItemTypes.GetDescription( hold.itemtype ) | html %]
134
                                            [% ELSE %]
135
                                                <span>Any item type</span>
136
                                            [% END %]
137
                                            </td>
138
                                        [% END %]
139
                                        <td>
140
                                        [% IF hold.found == 'F' %]
141
                                            Fulfilled
142
                                        [% ELSIF hold.cancellationdate %]
143
                                            Cancelled
144
                                        [% ELSIF hold.found == 'W' %]
145
                                            Waiting
146
                                        [% ELSIF hold.found == 'T' %]
147
                                            In transit
148
                                        [% ELSE %]
149
                                            Pending
150
                                        [% END %]
151
                                        </td>
152
                                        </tr>
153
                                    [% END %]
154
                                    </tbody>
155
                                </table>
156
                            </div> <!-- / .tabs-container -->
157
                        </div> <!-- / .opac-user-holdsrec -->
158
                    [% END # / IF old_holds_count %]
159
                </div> <!-- / .userholdshistory -->
160
            </div> <!-- / .span10 -->
161
        </div> <!-- / .row-fluid -->
162
    </div> <!-- / .container-fluid -->
163
</div> <!-- / .main -->
164
165
[% INCLUDE 'opac-bottom.inc' %]
166
[% BLOCK jsinclude %]
167
[% INCLUDE 'datatables.inc' %]
168
<script>
169
    $(document).ready(function() {
170
        $('#sort').change(function() {
171
            $('#sortform').submit();
172
        });
173
        var table = $("table_holdshistory").dataTable($.extend(true, {}, dataTablesDefaults, {
174
            "sPaginationType": "four_button",
175
            "aaSorting": [[4, 'desc']],
176
            "sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
177
            "aoColumnDefs": [
178
                { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
179
                { "sType": "title-string", "aTargets" : [ "title-string" ] }
180
            ]
181
        }));
182
    });
183
</script>
184
[% 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 = CGI->new;
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