From f5626c43954881033bf7a01909a50feceb3aed58 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 +- .../intranet-tmpl/prog/en/includes/recalls.inc | 76 ++++++++++++++++++++++ .../prog/en/modules/circ/circulation.tt | 9 +++ .../prog/en/modules/members/moremember.tt | 7 ++ koha-tmpl/intranet-tmpl/prog/js/recalls.js | 29 +++++++++ members/moremember.pl | 8 ++- opac/opac-recall.pl | 5 +- svc/recall | 51 +++++++++++++++ 9 files changed, 213 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 64779c8..dccb069 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 93ed09c..f56b314 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -55,6 +55,7 @@ use Koha::Patron::Messages; use Koha::SearchEngine; use Koha::SearchEngine::Search; use Koha::Patron::Modifications; +use Koha::Recalls; use Date::Calc qw( Today @@ -458,13 +459,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 0000000..9ee1342 --- /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 4c66feb..a5e7842 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -818,6 +818,10 @@ No patron matched [% message | html %] [% END %] + [% IF recalls.count %] +
  • [% recalls.count %] Recall(s)
  • + [% END %] + [% IF Koha.Preference('ArticleRequests') %]
  • [% patron.article_requests_current.count %] Article requests @@ -928,6 +932,10 @@ No patron matched [% message | html %] [% END %] +[% IF recalls.count %] + [% INCLUDE 'recalls.inc' %] +[% END %] + [% IF Koha.Preference('ArticleRequests') %] [% INCLUDE 'patron-article-requests.inc' %] [% END %] @@ -984,6 +992,7 @@ No patron matched [% message | html %] + +