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

(-)a/Koha/Recall.pm (+26 lines)
Lines 123-128 sub is_requested { Link Here
123
    return $status && $status eq 'R';
123
    return $status && $status eq 'R';
124
}
124
}
125
125
126
=head3 is_overdue
127
128
Returns true if recall is overdue
129
130
=cut
131
132
sub is_overdue {
133
    my ($self) = @_;
134
135
    my $status = $self->status;
136
    return $status && $status eq 'O';
137
}
138
139
=head3 is_cancelled
140
141
Returns true if recall is cancelled
142
143
=cut
144
145
sub is_cancelled {
146
    my ($self) = @_;
147
148
    my $status = $self->status;
149
    return $status && $status eq 'C';
150
}
151
126
=head1 AUTHOR
152
=head1 AUTHOR
127
153
128
Aleisha Amohia <aleisha@catalyst.net.nz>
154
Aleisha Amohia <aleisha@catalyst.net.nz>
(-)a/circ/circulation.pl (-1 / +6 lines)
Lines 56-61 use Koha::Patron::Messages; Link Here
56
use Koha::SearchEngine;
56
use Koha::SearchEngine;
57
use Koha::SearchEngine::Search;
57
use Koha::SearchEngine::Search;
58
use Koha::Patron::Modifications;
58
use Koha::Patron::Modifications;
59
use Koha::Recalls;
59
60
60
use Date::Calc qw(
61
use Date::Calc qw(
61
  Today
62
  Today
Lines 443-455 if (@$barcodes) { Link Here
443
444
444
##################################################################################
445
##################################################################################
445
# BUILD HTML
446
# BUILD HTML
446
# show all reserves of this borrower, and the position of the reservation ....
447
# show all recalls and reserves of this borrower, and the position of the reservation ....
447
if ($patron) {
448
if ($patron) {
448
    my $holds = Koha::Holds->search( { borrowernumber => $borrowernumber } ); # FIXME must be Koha::Patron->holds
449
    my $holds = Koha::Holds->search( { borrowernumber => $borrowernumber } ); # FIXME must be Koha::Patron->holds
449
    my $waiting_holds = $holds->waiting;
450
    my $waiting_holds = $holds->waiting;
451
452
    my $recalls = Koha::Recalls->search({ borrowernumber => $borrowernumber });
453
450
    $template->param(
454
    $template->param(
451
        holds_count  => $holds->count(),
455
        holds_count  => $holds->count(),
452
        WaitingHolds => $waiting_holds,
456
        WaitingHolds => $waiting_holds,
457
        recalls => $recalls
453
    );
458
    );
454
459
455
    my $category_type = $patron->category->category_type;
460
    my $category_type = $patron->category->category_type;
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/recalls.inc (+76 lines)
Line 0 Link Here
1
<div id="recalls">
2
[% IF recalls.count %]
3
    <table id="recalls-table" class="table table-bordered table-striped">
4
        <thead>
5
            <tr>
6
                <th class="recall-title anti-the">Title</th>
7
                <th class="recall-date psort title-string">Placed on</th>
8
                <th class="recall-expiry title-string">Expires on</th>
9
                <th class="recall-branch">Pickup location</th>
10
                <th class="recall-status">Status</th>
11
                <th class="recall-cancel">Cancel</th>
12
            </tr>
13
        </thead>
14
15
        <tbody>
16
            [% FOREACH recall IN recalls %]
17
                <tr>
18
                    <td class="recall-title">
19
                        <a class="recall-title" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% recall.biblionumber %]">
20
                            [% recall.biblio.title %]
21
                            [% FOREACH s IN recall.biblio.subtitles %]
22
                                [% s %]
23
                            [% END %]
24
                            [% recall.item.enumchron %]
25
                        </a>
26
                        [% recall.biblio.author %]
27
                    </td>
28
29
                    <td class="recall-date">
30
                        [% recall.recalldate | $KohaDates %]
31
                    </td>
32
33
                    <td class="recall-expiry">
34
                        [% IF ( recall.is_waiting ) %]
35
                            [% IF ( recall.expirationdate ) %]
36
                                [% recall.expirationdate | $KohaDates %]
37
                            [% ELSE %]
38
                                Never expires
39
                            [% END %]
40
                        [% ELSIF ( recall.has_expired && recall.expirationdate ) %]
41
                            [% recall.expirationdate | $KohaDates %]
42
                        [% ELSE %]
43
                            -
44
                        [% END %]
45
                    </td>
46
47
                    <td class="recall-branch">
48
                        [% recall.branch.branchname %]
49
                    </td>
50
51
                    <td class="recall-status">
52
                        [% IF ( recall.is_requested ) %]
53
                            Requested
54
                        [% ELSIF ( recall.is_waiting ) %]
55
                            Ready for pickup
56
                        [% ELSIF ( recall.has_expired ) %]
57
                            Expired
58
                        [% END %]
59
                    </td>
60
61
                    <td class="recall-cancel">
62
                        [% IF ( !recall.cancellationdate ) %]
63
                            <a class="btn btn-sm btn-danger" id="cancel_recall" data-id="[% recall.recall_id %]"><i class="fa fa-times"></i> Cancel</a>
64
                        [% ELSE %]
65
                            Cancelled
66
                        [% END %]
67
                    </td>
68
69
                </tr>
70
            [% END %]
71
        </tbody>
72
    </table>
73
    [% ELSE %]
74
        Patron has no current recalls.
75
    [% END %]
76
</div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (+9 lines)
Lines 27-32 Link Here
27
<script type="text/javascript" src="[% interface %]/[% theme %]/js/pages/circulation.js"></script>
27
<script type="text/javascript" src="[% interface %]/[% theme %]/js/pages/circulation.js"></script>
28
<script type="text/javascript" src="[% interface %]/[% theme %]/js/checkouts.js"></script>
28
<script type="text/javascript" src="[% interface %]/[% theme %]/js/checkouts.js"></script>
29
<script type="text/javascript" src="[% interface %]/[% theme %]/js/holds.js"></script>
29
<script type="text/javascript" src="[% interface %]/[% theme %]/js/holds.js"></script>
30
<script type="text/javascript" src="[% interface %]/[% theme %]/js/recalls.js"></script>
30
<script type="text/javascript">
31
<script type="text/javascript">
31
//<![CDATA[
32
//<![CDATA[
32
/* Set some variable needed in circulation.js */
33
/* Set some variable needed in circulation.js */
Lines 943-948 No patron matched <span class="ex">[% message | html %]</span> Link Here
943
        [% END %]
944
        [% END %]
944
    </li>
945
    </li>
945
946
947
    [% IF recalls.count %]
948
        <li><a href="#recalls" id+"recalls-tab">[% recalls.count %] Recall(s)</a></li>
949
    [% END %]
950
946
    [% IF Koha.Preference('ArticleRequests') %]
951
    [% IF Koha.Preference('ArticleRequests') %]
947
        <li>
952
        <li>
948
            <a href="#article-requests" id="article-requests-tab"> [% patron.article_requests_current.count %] Article requests</a>
953
            <a href="#article-requests" id="article-requests-tab"> [% patron.article_requests_current.count %] Article requests</a>
Lines 1053-1058 No patron matched <span class="ex">[% message | html %]</span> Link Here
1053
[% END %]
1058
[% END %]
1054
</div> <!-- reservesloop -->
1059
</div> <!-- reservesloop -->
1055
1060
1061
[% IF recalls.count %]
1062
    [% INCLUDE 'recalls.inc' %]
1063
[% END %]
1064
1056
[% IF Koha.Preference('ArticleRequests') %]
1065
[% IF Koha.Preference('ArticleRequests') %]
1057
    [% INCLUDE 'patron-article-requests.inc' %]
1066
    [% INCLUDE 'patron-article-requests.inc' %]
1058
[% END %]
1067
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (+7 lines)
Lines 24-29 Link Here
24
<script type="text/javascript" src="[% interface %]/[% theme %]/js/pages/circulation.js"></script>
24
<script type="text/javascript" src="[% interface %]/[% theme %]/js/pages/circulation.js"></script>
25
<script type="text/javascript" src="[% interface %]/[% theme %]/js/checkouts.js"></script>
25
<script type="text/javascript" src="[% interface %]/[% theme %]/js/checkouts.js"></script>
26
<script type="text/javascript" src="[% interface %]/[% theme %]/js/holds.js"></script>
26
<script type="text/javascript" src="[% interface %]/[% theme %]/js/holds.js"></script>
27
<script type="text/javascript" src="[% interface %]/[% theme %]/js/recalls.js"></script>
27
<script type="text/JavaScript">
28
<script type="text/JavaScript">
28
//<![CDATA[
29
//<![CDATA[
29
/* Set some variable needed in circulation.js */
30
/* Set some variable needed in circulation.js */
Lines 515-520 function validate1(date) { Link Here
515
                <a href="#reserves" id="holds-tab">0 Holds</a>
516
                <a href="#reserves" id="holds-tab">0 Holds</a>
516
            [% END %]
517
            [% END %]
517
        </li>
518
        </li>
519
        [% IF recalls.count %]
520
            <li><a href="#recalls" id+"recalls-tab">[% recalls.count %] Recall(s)</a></li>
521
        [% END %]
518
        [% IF Koha.Preference('ArticleRequests') %]
522
        [% IF Koha.Preference('ArticleRequests') %]
519
            <li>
523
            <li>
520
                <a href="#article-requests" id="article-requests-tab"> [% patron.article_requests_current.count %] Article requests</a>
524
                <a href="#article-requests" id="article-requests-tab"> [% patron.article_requests_current.count %] Article requests</a>
Lines 627-632 function validate1(date) { Link Here
627
    [% ELSE %]<p>Patron has nothing on hold.</p>[% END %]
631
    [% ELSE %]<p>Patron has nothing on hold.</p>[% END %]
628
	</div>
632
	</div>
629
633
634
[% IF recalls %]
635
    [% INCLUDE 'recalls.inc' %]
636
[% END %]
630
637
631
[% IF Koha.Preference('ArticleRequests') %]
638
[% IF Koha.Preference('ArticleRequests') %]
632
    [% INCLUDE 'patron-article-requests.inc' %]
639
    [% INCLUDE 'patron-article-requests.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/recalls.js (+29 lines)
Line 0 Link Here
1
$(document).ready(function() {
2
3
        $("#cancel_recall").click(function(e){
4
            if (confirmDelete(_("Are you sure you want to remove this recall?"))){
5
                var $self = $(this);
6
                var $recall_id = $(this).data('id');
7
                var ajaxData = {
8
                    'recall_id': $recall_id,
9
                };
10
11
                $.ajax({
12
                    url: '/cgi-bin/koha/svc/recall',
13
                    type: 'POST',
14
                    dataType: 'json',
15
                    data: ajaxData,
16
                })
17
                .done(function(data) {
18
                    var message = "";
19
                    if(data.success == 0) {
20
                        message = "The recall may have already been cancelled. Please refresh the page.";
21
                    } else {
22
                        message = "Cancelled"
23
                    }
24
                    $self.parent().html(message);
25
                });
26
            }
27
        });
28
29
});
(-)a/members/moremember.pl (-2 / +6 lines)
Lines 55-60 use Koha::AuthorisedValues; Link Here
55
use Koha::CsvProfiles;
55
use Koha::CsvProfiles;
56
use Koha::Patron::Debarments qw(GetDebarments);
56
use Koha::Patron::Debarments qw(GetDebarments);
57
use Koha::Patron::Images;
57
use Koha::Patron::Images;
58
use Koha::Recalls;
58
use Module::Load;
59
use Module::Load;
59
if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) {
60
if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) {
60
    load Koha::NorwegianPatronDB, qw( NLGetSyncDataFromBorrowernumber );
61
    load Koha::NorwegianPatronDB, qw( NLGetSyncDataFromBorrowernumber );
Lines 252-262 if ( $data->{dateofbirth} ) { Link Here
252
253
253
### ###############################################################################
254
### ###############################################################################
254
# BUILD HTML
255
# BUILD HTML
255
# show all reserves of this borrower, and the position of the reservation ....
256
# show all recalls and reserves of this borrower, and the position of the reservation ....
256
if ($borrowernumber) {
257
if ($borrowernumber) {
258
    my $recalls = Koha::Recalls->search({ borrowernumber => $borrowernumber });
257
    $template->param(
259
    $template->param(
258
        holds_count => Koha::Database->new()->schema()->resultset('Reserve')
260
        holds_count => Koha::Database->new()->schema()->resultset('Reserve')
259
          ->count( { borrowernumber => $borrowernumber } ) );
261
          ->count( { borrowernumber => $borrowernumber } ),
262
        recalls => $recalls
263
    );
260
}
264
}
261
265
262
# current alert subscriptions
266
# current alert subscriptions
(-)a/opac/opac-recall.pl (-2 / +3 lines)
Lines 53-60 if ($op eq 'request'){ Link Here
53
    # can't place recall if not logged in
53
    # can't place recall if not logged in
54
        $error = 'notloggedin';
54
        $error = 'notloggedin';
55
        print $query->redirect('/cgi-bin/koha/opac-detail.pl?biblionumber='.$item->biblionumber);
55
        print $query->redirect('/cgi-bin/koha/opac-detail.pl?biblionumber='.$item->biblionumber);
56
    } elsif (defined $recalled && $recalled->borrowernumber == $borrowernumber){
56
    } elsif ( defined $recalled && $recalled->borrowernumber == $borrowernumber && ($recalled->is_requested || $recalled->is_waiting || $recalled->is_overdue) ){
57
    # can't place a recall on an item that this borrower has already recalled
57
    # can't place a recall on an item that this borrower has already recalled
58
    # if recall is expired or cancelled, user may recall again
58
        $error = 'duplicate';
59
        $error = 'duplicate';
59
    } else {
60
    } else {
60
    # can recall
61
    # can recall
Lines 87-93 if ($op eq 'request'){ Link Here
87
    }
88
    }
88
} elsif ($op eq 'cancel'){
89
} elsif ($op eq 'cancel'){
89
    my $recall_id = $query->param('recall_id');
90
    my $recall_id = $query->param('recall_id');
90
    Koha::Recalls->find($recall_id)->delete;
91
    Koha::Recalls->find($recall_id)->update({ cancellationdate => dt_from_string(), status => 'C' });
91
    print $query->redirect('/cgi-bin/koha/opac-user.pl');
92
    print $query->redirect('/cgi-bin/koha/opac-user.pl');
92
}
93
}
93
94
(-)a/svc/recall (-1 / +51 lines)
Line 0 Link Here
0
- 
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 under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
use CGI;
23
use JSON qw(encode_json);
24
25
use C4::Context;
26
use C4::Auth qw(check_cookie_auth);
27
use C4::Output qw(output_with_http_headers);
28
use Koha::Recalls;
29
use Koha::DateUtils;
30
31
my $input = new CGI;
32
33
my ( $auth_status, $sessionID ) =
34
  check_cookie_auth( $input->cookie('CGISESSID'), { circulate => 'circulate_remaining_permissions' } );
35
36
if ( $auth_status ne "ok" ) {
37
    print $input->header(-type => 'text/plain', -status => '403 Forbidden');
38
    exit 0;
39
}
40
41
my $recall_id = $input->param('recall_id');
42
my $recall = Koha::Recalls->find($recall_id);
43
unless ($recall) {
44
    my $json = encode_json( { success => 0 } );
45
    output_with_http_headers( $input, undef, $json, "json" );
46
    exit;
47
}
48
49
$recall->update({ cancellationdate => dt_from_string(), status => 'C' });
50
my $json = encode_json( { success => 1 } );
51
output_with_http_headers( $input, undef, $json, "json" );

Return to bug 19532