From d7e747fea827ce2fb2c546a9768a0b3e6525c300 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 6 Jan 2015 09:50:24 -0500 Subject: [PATCH] Bug 5144 [3] - Add message for patron --- 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(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index e04c3fc..fd93495 100644 --- a/C4/Reserves.pm +++ b/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 = diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt index f4cbddb..93c202d 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/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. diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index ba778db..da11435 100755 --- a/opac/opac-reserve.pl +++ b/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; } diff --git a/opac/opac-user.pl b/opac/opac-user.pl index ad4f339..8512645 100755 --- a/opac/opac-user.pl +++ b/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; -- 1.7.2.5