From 1637f7fbbfc2fba88000094a8e5ef6be52342550 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Tue, 14 Nov 2017 21:39:43 +0000 Subject: [PATCH] Bug 19532: Show recalls on intranet side This patch - adds Recall tab to the Check out section of member account, and to the Details section of member account - Functionality to cancel recalls on staff side - Fixing cancel on OPAC side (before I was deleting the whole recall instead of cancelling) - Fixing validation when checking whether a recall can be placed on an item that has been recalled by this borrower before. If the old recall is expired or cancelled then they can make a recall again. Signed-off-by: Nick Clemens --- Koha/Recall.pm | 26 +++++++ circ/circulation.pl | 7 +- .../prog/en/includes/recalls.inc | 76 +++++++++++++++++++ .../prog/en/modules/circ/circulation.tt | 9 +++ .../prog/en/modules/members/moremember.tt | 4 + koha-tmpl/intranet-tmpl/prog/js/recalls.js | 29 +++++++ members/moremember.pl | 8 +- opac/opac-recall.pl | 5 +- svc/recall | 51 +++++++++++++ 9 files changed, 210 insertions(+), 5 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/recalls.inc create mode 100644 koha-tmpl/intranet-tmpl/prog/js/recalls.js create mode 100755 svc/recall diff --git a/Koha/Recall.pm b/Koha/Recall.pm index 64779c8943..dccb069651 100644 --- a/Koha/Recall.pm +++ b/Koha/Recall.pm @@ -123,6 +123,32 @@ sub is_requested { return $status && $status eq 'R'; } +=head3 is_overdue + +Returns true if recall is overdue + +=cut + +sub is_overdue { + my ($self) = @_; + + my $status = $self->status; + return $status && $status eq 'O'; +} + +=head3 is_cancelled + +Returns true if recall is cancelled + +=cut + +sub is_cancelled { + my ($self) = @_; + + my $status = $self->status; + return $status && $status eq 'C'; +} + =head1 AUTHOR Aleisha Amohia diff --git a/circ/circulation.pl b/circ/circulation.pl index 5c858f717c..908ee6c441 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -56,6 +56,7 @@ use Koha::Patron::Messages; use Koha::SearchEngine; use Koha::SearchEngine::Search; use Koha::Patron::Modifications; +use Koha::Recalls; use Date::Calc qw( Today @@ -460,13 +461,17 @@ if (@$barcodes) { ################################################################################## # BUILD HTML -# show all reserves of this borrower, and the position of the reservation .... +# show all recalls and reserves of this borrower, and the position of the reservation .... if ($patron) { my $holds = Koha::Holds->search( { borrowernumber => $borrowernumber } ); # FIXME must be Koha::Patron->holds my $waiting_holds = $holds->waiting; + + my $recalls = Koha::Recalls->search({ borrowernumber => $borrowernumber }); + $template->param( holds_count => $holds->count(), WaitingHolds => $waiting_holds, + recalls => $recalls ); } diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/recalls.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/recalls.inc new file mode 100644 index 0000000000..9ee1342f84 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/recalls.inc @@ -0,0 +1,76 @@ +
+[% IF recalls.count %] + + + + + + + + + + + + + + [% FOREACH recall IN recalls %] + + + + + + + + + + + + + + + [% END %] + +
TitlePlaced onExpires onPickup locationStatusCancel
+ + [% recall.biblio.title %] + [% FOREACH s IN recall.biblio.subtitles %] + [% s %] + [% END %] + [% recall.item.enumchron %] + + [% recall.biblio.author %] + + [% recall.recalldate | $KohaDates %] + + [% IF ( recall.is_waiting ) %] + [% IF ( recall.expirationdate ) %] + [% recall.expirationdate | $KohaDates %] + [% ELSE %] + Never expires + [% END %] + [% ELSIF ( recall.has_expired && recall.expirationdate ) %] + [% recall.expirationdate | $KohaDates %] + [% ELSE %] + - + [% END %] + + [% recall.branch.branchname %] + + [% IF ( recall.is_requested ) %] + Requested + [% ELSIF ( recall.is_waiting ) %] + Ready for pickup + [% ELSIF ( recall.has_expired ) %] + Expired + [% END %] + + [% IF ( !recall.cancellationdate ) %] + Cancel + [% ELSE %] + Cancelled + [% END %] +
+ [% ELSE %] + Patron has no current recalls. + [% END %] +
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index 6700b0e581..2a5d5dc55c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -819,6 +819,10 @@ No patron matched [% message | html %] [% END %] + [% IF recalls.count %] +
  • [% recalls.count %] Recall(s)
  • + [% END %] + [% IF Koha.Preference('ArticleRequests') %]
  • [% patron.article_requests_current.count | html %] Article requests @@ -930,6 +934,10 @@ No patron matched [% message | html %] [% END %] +[% IF recalls.count %] + [% INCLUDE 'recalls.inc' %] +[% END %] + [% IF Koha.Preference('ArticleRequests') %] [% INCLUDE 'patron-article-requests.inc' %] [% END %] @@ -986,6 +994,7 @@ No patron matched [% message | html %] [% Asset.js("js/checkouts.js") | $raw %] [% Asset.js("js/holds.js") | $raw %] [% Asset.js("js/circ-patron-search-results.js") | $raw %] + [% Asset.js("js/recalls.js") | $raw %]