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

(-)a/circ/recalls_waiting.pl (+71 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2017 Aleisha Amohia <aleisha@catalyst.net.nz>
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
use Modern::Perl;
21
use CGI qw ( -utf8 );
22
use C4::Auth;
23
use C4::Output;
24
use Koha::Recalls;
25
use Koha::BiblioFrameworks;
26
use Koha::DateUtils;
27
use Koha::Patrons;
28
29
my $query = new CGI;
30
my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user(
31
    {
32
        template_name   => "circ/recalls_waiting.tt",
33
        query           => $query,
34
        type            => "intranet",
35
        authnotrequired => 0,
36
        flagsrequired   => { circulate => "circulate_remaining_permissions" },
37
        debug           => 1,
38
    }
39
);
40
41
my $op = $query->param('op') || 'list';
42
43
if ($op eq 'expire_recall') {
44
    my $recall_id = $query->param('recall_id');
45
    Koha::Recalls->find($recall_id)->update({ expirationdate => dt_from_string(), status => 'E' });
46
    $op = 'list';
47
}
48
49
if ($op eq 'list') {
50
    my @recalls = Koha::Recalls->search({ status => 'W' });
51
    my $borrower = Koha::Patrons->find($loggedinuser);
52
    my @over;
53
    my $maxdelay = C4::Context->preference('RecallsMaxPickUpDelay') || 7;
54
    my $today = dt_from_string();
55
    foreach my $r (@recalls){
56
        my $lastwaitingday = dt_from_string($r->waitingdate)->add( days => $maxdelay );
57
        if ( $today > $lastwaitingday ){
58
            push @over, $r;
59
        }
60
    }
61
    $template->param(
62
        recalls => \@recalls,
63
        over => \@over,
64
    );
65
}
66
67
# Checking if there is a Fast Cataloging Framework
68
$template->param( fast_cataloging => 1 ) if Koha::BiblioFrameworks->find( 'FA' );
69
70
# writing the template
71
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/installer/data/mysql/atomicupdate/bug_19532_-_add_RecallsMaxPickUpDelay_syspref.sql (+1 lines)
Line 0 Link Here
1
INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ('RecallsMaxPickUpDelay','7','','Define the maximum time a recall can be waiting for pickup','Integer');
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 458-463 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
458
('QueryWeightFields','1',NULL,'If ON, enables field weighting','YesNo'),
458
('QueryWeightFields','1',NULL,'If ON, enables field weighting','YesNo'),
459
('QuoteOfTheDay','0',NULL,'Enable or disable display of Quote of the Day on the OPAC home page','YesNo'),
459
('QuoteOfTheDay','0',NULL,'Enable or disable display of Quote of the Day on the OPAC home page','YesNo'),
460
('RandomizeHoldsQueueWeight','0',NULL,'if ON, the holds queue in circulation will be randomized, either based on all location codes, or by the location codes specified in StaticHoldsQueueWeight','YesNo'),
460
('RandomizeHoldsQueueWeight','0',NULL,'if ON, the holds queue in circulation will be randomized, either based on all location codes, or by the location codes specified in StaticHoldsQueueWeight','YesNo'),
461
('RecallsMaxPickUpDelay','7','','Define the maximum time a recall can be waiting for pickup','Integer'),
461
('RecordLocalUseOnReturn','0',NULL,'If ON, statistically record returns of unissued items as local use, instead of return','YesNo'),
462
('RecordLocalUseOnReturn','0',NULL,'If ON, statistically record returns of unissued items as local use, instead of return','YesNo'),
462
('RefundLostOnReturnControl','CheckinLibrary','CheckinLibrary|ItemHomeBranch|ItemHoldingBranch','If a lost item is returned, choose which branch to pick rules for refunding.','Choice'),
463
('RefundLostOnReturnControl','CheckinLibrary','CheckinLibrary|ItemHomeBranch|ItemHoldingBranch','If a lost item is returned, choose which branch to pick rules for refunding.','Choice'),
463
('RenewalLog','0','','If ON, log information about renewals','YesNo'),
464
('RenewalLog','0','','If ON, log information about renewals','YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+5 lines)
Lines 159-164 Circulation: Link Here
159
            - patrons to submit notes about checked out items.
159
            - patrons to submit notes about checked out items.
160
160
161
    Checkout Policy:
161
    Checkout Policy:
162
        -
163
            - Mark a recall as problematic if it has been waiting to be picked up for
164
            - pref: RecallsMaxPickUpDelay
165
            - class: integer
166
            - days.
162
        -
167
        -
163
            - pref: AllowTooManyOverride
168
            - pref: AllowTooManyOverride
164
              choices:
169
              choices:
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/recalls_waiting.tt (-1 / +163 lines)
Line 0 Link Here
0
- 
1
[% USE Koha %]
2
[% USE KohaDates %]
3
[% INCLUDE 'doc-head-open.inc' %]
4
<title>Koha &rsaquo; Circulation &rsaquo; Recalls awaiting pickup</title>
5
[% INCLUDE 'doc-head-close.inc' %]
6
<style type="text/css"> p { margin-top: 0; }</style>
7
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
8
<script type="text/javascript" src="[% interface %]/[% theme %]/js/recalls.js"></script>
9
[% INCLUDE 'datatables.inc' %]
10
<script type="text/javascript">
11
    $(document).ready(function() {
12
        $('#results').tabs();
13
14
        $("#recallswaiting-table, #recallsover-table").dataTable($.extend(true, {}, dataTablesDefaults, {
15
            "autoWidth": false,
16
            "aoColumnDefs": [
17
                { "aTargets": [ 'nosort' ], "bSortable": false, "bSearchable": false },
18
            ],
19
            "sPaginationType": "four_button"
20
        }));
21
    });
22
</script>
23
</head>
24
<body id="circ_recalls_awaiting_pickup" class="circ">
25
[% INCLUDE 'header.inc' %]
26
[% INCLUDE 'cat-search.inc' %]
27
28
<div id="breadcrumbs">
29
    <a href="/cgi-bin/koha/mainpage.pl">Home</a>
30
    &rsaquo; <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a>
31
    &rsaquo; <a href="/cgi-bin/koha/circ/recalls_waiting.pl">Recalls awaiting pickup</a>
32
</div>
33
34
[% IF Koha.Preference('CircSidebar') %]<div id="doc3" class="yui-t2">[% ELSE %]<div id="doc2" class="yui-t7">[% END %]
35
36
<div id="bd">
37
    <div id="yui-main">
38
        [% IF Koha.Preference('CircSidebar') %]<div class="yui-b">[% END %]
39
            <div class="yui-g">
40
41
                <h1>Recalls awaiting pickup</h1>
42
43
                [% IF recalls.size > 0 %]
44
45
                <div id="results" class="toptabs">
46
47
                    <ul>
48
                        <li><a href="#recallswaiting">Recalls waiting: [% recalls.count %]</a></li>
49
                        <li><a href="#recallsover">Recalls waiting over [% Koha.Preference('RecallsMaxPickUpDelay') %] days: [% over.count %]</a></li>
50
                    </ul>
51
52
                    <div id="recallswaiting">
53
                        [% IF ( recalls.size > 0 ) %]
54
                            <table id="recallswaiting-table">
55
                                <thead><tr>
56
                                    <th class="title-string">Available since</th>
57
                                    <th class="anti-the">Title</th>
58
                                    <th>Requested by</th>
59
                                    <th>Pickup location</th>
60
                                    <th class="nosort">Expire</th>
61
                                </tr></thead>
62
                                <tbody>
63
                                    [% FOREACH recall IN recalls %]<tr>
64
                                        <td>[% recall.waitingdate | $KohaDates %]</td>
65
                                        <td>
66
                                            <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% recall.biblionumber %]">
67
                                                [% recall.biblio.title %]
68
                                                [% FOREACH s IN recall.biblio.subtitles %]
69
                                                    [% s %]
70
                                                [% END %]
71
                                                [% recall.item.enumchron %]
72
                                            </a>
73
                                            [% recall.biblio.author %]
74
                                            <br><i>Barcode: [% recall.item.barcode %]</i>
75
                                        </td>
76
                                        <td>
77
                                            <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% recall.borrowernumber %]">[% recall.borrower.firstname %] [% recall.borrower.surname %]</a>
78
                                            [% IF ( recall.borrower.phone ) %]<br />[% recall.borrower.phone %][% END %]
79
                                            [% IF ( recall.borrower.email ) %]<br /><a href="mailto:[% recall.borrower.email %]?subject=Recall waiting: [% recall.biblio.title %]">[% recall.borrower.email %]</a>[% END %]
80
                                        </td>
81
                                        <td>[% recall.branch.branchname %]</td>
82
                                        <td>
83
                                            <form action="/cgi-bin/koha/circ/recalls_waiting.pl" method="post">
84
                                                <input type="hidden" name="recall_id" value="[% recall.recall_id %]">
85
                                                <input type="hidden" name="op" value="expire_recall">
86
                                                <fieldset class="action">
87
                                                    <button type="submit" class="btn btn-default btn-xs" id="expire_recall"><i class="fa fa-times"></i> Expire</button>
88
                                                </fieldset>
89
                                            </form>
90
                                        </td>
91
                                    </tr>[% END %]
92
                                </tbody>
93
                            </table>
94
                        [% ELSE %]
95
                            <div class="dialog message">No recalls waiting.</div>
96
                        [% END %]
97
                    </div>
98
99
                    <div id="recallsover">
100
                        [% IF ( over.size > 0 ) %]
101
                            [% IF ( Koha.Preference('RecallsMaxPickUpDelay') ) %]<p>Recalls listed here have been awaiting pickup for more than [% Koha.Preference('RecallsMaxPickUpDelay') %] days.</p>[% END %]
102
                            <table id="recallsover-table">
103
                                <thead><tr>
104
                                    <th class="title-string">Available since</th>
105
                                    <th class="anti-the">Title</th>
106
                                    <th>Requested by</th>
107
                                    <th>Pickup location</th>
108
                                    <th class="nosort">Expire</th>
109
                                </tr></thead>
110
                                <tbody>
111
                                    [% FOREACH recall IN over %]<tr>
112
                                        <td>[% recall.waitingdate | $KohaDates %]</td>
113
                                        <td>
114
                                            <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% recall.biblionumber %]">
115
                                                [% recall.biblio.title %]
116
                                                [% FOREACH s IN recall.biblio.subtitles %]
117
                                                    [% s %]
118
                                                [% END %]
119
                                                [% recall.item.enumchron %]
120
                                            </a>
121
                                            [% recall.biblio.author %]
122
                                            <br><i>Barcode: [% recall.item.barcode %]</i>
123
                                        </td>
124
                                        <td>
125
                                            <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% recall.borrowernumber %]">[% recall.borrower.firstname %] [% recall.borrower.surname %]</a>
126
                                            [% IF ( recall.borrower.phone ) %]<br />[% recall.borrower.phone %][% END %]
127
                                            [% IF ( recall.borrower.email ) %]<br /><a href="mailto:[% recall.borrower.email %]?subject=Recall waiting: [% recall.biblio.title %]">[% recall.borrower.email %]</a>[% END %]
128
                                        </td>
129
                                        <td>[% recall.branch.branchname %]</td>
130
                                        <td>
131
                                            <form action="/cgi-bin/koha/circ/recalls_waiting.pl" method="post">
132
                                                <input type="hidden" name="recall_id" value="[% recall.recall_id %]">
133
                                                <input type="hidden" name="op" value="expire_recall">
134
                                                <fieldset class="action">
135
                                                    <button type="submit" class="btn btn-default btn-xs" id="expire_recall"><i class="fa fa-times"></i> Expire</button>
136
                                                </fieldset>
137
                                            </form>
138
                                        </td>
139
                                    </tr>[% END %]
140
                                </tbody>
141
                            </table>
142
                        [% ELSE %]
143
                            <div class="dialog message">No recalls waiting.</div>
144
                        [% END %]
145
                    </div>
146
147
                </div>
148
149
                [% END %]
150
151
            </div>
152
        </div>
153
154
    </div>
155
156
    [% IF Koha.Preference('CircSidebar') %]
157
        <div class="yui-b noprint">
158
            [% INCLUDE 'circ-nav.inc' %]
159
        </div>
160
    [% END %]
161
</div>
162
163
[% INCLUDE 'intranet-bottom.inc' %]

Return to bug 19532