@@ -, +, @@
---
C4/Reserves.pm | 7 ++++++-
.../opac-tmpl/bootstrap/en/modules/opac-user.tt | 7 +++++++
opac/opac-reserve.pl | 6 ++++--
opac/opac-user.pl | 18 ++++++++----------
4 files changed, 25 insertions(+), 13 deletions(-)
--- a/C4/Reserves.pm
+++ a/C4/Reserves.pm
@@ -23,6 +23,7 @@ package C4::Reserves;
use strict;
#use warnings; FIXME - Bug 2505
+
use C4::Context;
use C4::Biblio;
use C4::Members;
@@ -42,6 +43,10 @@ use Koha::Calendar;
use Koha::Database;
use List::MoreUtils qw( firstidx any );
+use Carp;
+use Readonly;
+
+Readonly our $ALREADY_ON_HOLD => -1;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
@@ -162,7 +167,7 @@ sub AddReserve {
);
if ( $count > 0 ) {
carp("AddReserve: borrower $borrowernumber already has $count holds for biblionumber $biblionumber");
- return;
+ return $ALREADY_ON_HOLD;
}
my $fee =
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt
+++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt
@@ -48,6 +48,13 @@
[% IF ( patronupdate ) %]
Thank you!
Your corrections have been submitted to the library, and a staff member will update your record as soon as possible.
[% END %]
+ [% IF already_on_hold %]
+
+
Notice:
+
One or more holds were not placed due to existing holds.
+
+ [% END %]
+
[% IF ( BORROWER_INF.warndeparture ) %]
Please note: Your card will expire on [% BORROWER_INF.warndeparture | $KohaDates %]. Please contact the library for more information.
--- a/opac/opac-reserve.pl
+++ a/opac/opac-reserve.pl
@@ -215,6 +215,7 @@ if ( $query->param('place_reserve') ) {
&get_out($query, $cookie, $template->output);
}
+ my $already_on_hold;
while (@selectedItems) {
my $biblioNum = shift(@selectedItems);
my $itemNum = shift(@selectedItems);
@@ -277,7 +278,7 @@ if ( $query->param('place_reserve') ) {
# Here we actually do the reserveration. Stage 3.
if ($canreserve) {
- AddReserve(
+ my $ret = AddReserve(
$branch, $borrowernumber,
$biblioNum, 'a',
[$biblioNum], $rank,
@@ -285,11 +286,12 @@ if ( $query->param('place_reserve') ) {
$notes, $biblioData->{title},
$itemNum, $found
);
+ $already_on_hold++ if $ret == $C4::Reserves::ALREADY_ON_HOLD;
++$reserve_cnt;
}
}
- print $query->redirect("/cgi-bin/koha/opac-user.pl#opac-user-holds");
+ print $query->redirect("/cgi-bin/koha/opac-user.pl?already_on_hold=$already_on_hold#opac-user-holds");
exit;
}
--- a/opac/opac-user.pl
+++ a/opac/opac-user.pl
@@ -383,17 +383,15 @@ if ( $borr->{'opacnote'} ) {
}
$template->param(
- bor_messages_loop => GetMessages( $borrowernumber, 'B', 'NONE' ),
- waiting_count => $wcount,
- patronupdate => $patronupdate,
- OpacRenewalAllowed => C4::Context->preference("OpacRenewalAllowed"),
- userview => 1,
-);
-
-$template->param(
- SuspendHoldsOpac => C4::Context->preference('SuspendHoldsOpac'),
+ userview => 1,
+ waiting_count => $wcount,
+ patronupdate => $patronupdate,
+ already_on_hold => $query->param('already_on_hold'),
+ bor_messages_loop => GetMessages( $borrowernumber, 'B', 'NONE' ),
+ OpacRenewalAllowed => C4::Context->preference("OpacRenewalAllowed"),
+ SuspendHoldsOpac => C4::Context->preference('SuspendHoldsOpac'),
AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'),
- OpacHoldNotes => C4::Context->preference('OpacHoldNotes'),
+ OpacHoldNotes => C4::Context->preference('OpacHoldNotes'),
);
output_html_with_http_headers $query, $cookie, $template->output;
--