Bugzilla – Attachment 7832 Details for
Bug 6976
User hold limit can be avoided by users in OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 6976 - User hold limit can be avoided by users in OPAC
Bug-6976---User-hold-limit-can-be-avoided-by-users.patch (text/plain), 4.72 KB, created by
Kyle M Hall
on 2012-02-23 14:36:11 UTC
(
hide
)
Description:
Bug 6976 - User hold limit can be avoided by users in OPAC
Filename:
MIME Type:
Creator:
Kyle M Hall
Created:
2012-02-23 14:36:11 UTC
Size:
4.72 KB
patch
obsolete
>From 71a8afe8e00628f8878424b16cfb4366240488ea Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Thu, 23 Feb 2012 09:33:40 -0500 >Subject: [PATCH] Bug 6976 - User hold limit can be avoided by users in OPAC > >Adds a check to see if a multi-hold request would possibly >exceed the maximum number of allowed holds. If it is possible, >then we display an error message if the borrower has more checkboxes >checked than new holds that can be placed. >--- > .../opac-tmpl/prog/en/modules/opac-reserve.tt | 13 ++++++++ > opac/opac-reserve.pl | 32 +++++++++++++------- > 2 files changed, 34 insertions(+), 11 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt >index 64ed80c..ecb96f6 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt >@@ -4,6 +4,7 @@ > <script type="text/javascript"> > // <![CDATA[ > var MSG_NO_COPY_SELECTED = _("Expecting a specific copy selection."); >+ var MSG_MAX_HOLDS_EXCEEDED = _("You cannot place this many more holds, please reduce the amount of holds requested to [% new_reserves_allowed %] or less."); > > function prefixOf (s, tok) { > var index = s.indexOf(tok); >@@ -111,6 +112,13 @@ > return false; > } > >+ [% IF ( new_reserves_allowed ) %] >+ if ($(".confirmjs:checked").size() > [% new_reserves_allowed %]) { >+ alert(MSG_MAX_HOLDS_EXCEEDED); >+ return false; >+ } >+ [% END %] >+ > // Find the items with the 'Hold' box checked > var badBib = null; > $(".confirmjs:checked").each(function() { >@@ -163,6 +171,11 @@ > <div id="bd"> > <div id="yui-g"> > <div id="holds" class="container"> >+ [% IF ( new_reserves_allowed ) %] >+ <div id="new_reserves_allowed" class="dialog alert"> >+ <p><strong>Sorry</strong>, you cannot place holds on all these items. You can only place [% new_reserves_allowed %] more hold(s). Please choose the items you wish to be held.</p> >+ </div> >+ [% END %] > [% IF ( message ) %] > [% IF ( GNA ) %] > <div id="gna" class="dialog alert"> >diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl >index b2144a9..81cf375 100755 >--- a/opac/opac-reserve.pl >+++ b/opac/opac-reserve.pl >@@ -33,7 +33,7 @@ use C4::Overdues; > use C4::Debug; > # use Data::Dumper; > >-my $MAXIMUM_NUMBER_OF_RESERVES = C4::Context->preference("maxreserves"); >+my $maxreserves = C4::Context->preference("maxreserves"); > > my $query = new CGI; > my ( $template, $borrowernumber, $cookie ) = get_template_and_user( >@@ -92,6 +92,7 @@ if (($#biblionumbers < 0) && (! $query->param('place_reserve'))) { > &get_out($query, $cookie, $template->output); > } > >+ > # pass the pickup branch along.... > my $branch = $query->param('branch') || $borr->{'branchcode'} || C4::Context->userenv->{branch} || '' ; > ($branches->{$branch}) or $branch = ""; # Confirm branch is real >@@ -268,32 +269,41 @@ if ( $borr->{'amountoutstanding'} && ($borr->{'amountoutstanding'} > $maxoutstan > if ( $borr->{gonenoaddress} && ($borr->{gonenoaddress} eq 1) ) { > $noreserves = 1; > $template->param( >- message => 1, >- GNA => 1 >- ); >+ message => 1, >+ GNA => 1 >+ ); > } > if ( $borr->{lost} && ($borr->{lost} eq 1) ) { > $noreserves = 1; > $template->param( >- message => 1, >- lost => 1 >- ); >+ message => 1, >+ lost => 1 >+ ); > } > if ( CheckBorrowerDebarred($borrowernumber) ) { > $noreserves = 1; > $template->param( >- message => 1, >- debarred => 1 >- ); >+ message => 1, >+ debarred => 1 >+ ); > } > > my @reserves = GetReservesFromBorrowernumber( $borrowernumber ); >+my $reserves_count = scalar(@reserves); > $template->param( RESERVES => \@reserves ); >-if ( $MAXIMUM_NUMBER_OF_RESERVES && (scalar(@reserves) >= $MAXIMUM_NUMBER_OF_RESERVES) ) { >+if ( $maxreserves && ( $reserves_count >= $maxreserves ) ) { > $template->param( message => 1 ); > $noreserves = 1; > $template->param( too_many_reserves => scalar(@reserves)); > } >+ >+unless ( $noreserves ) { >+ my $requested_reserves_count = scalar( @biblionumbers ); >+ if ( $maxreserves && ( $reserves_count + $requested_reserves_count >= $maxreserves ) ) { >+ $template->param( new_reserves_allowed => $maxreserves - $reserves_count ); >+ } >+} >+ > foreach my $res (@reserves) { > foreach my $biblionumber (@biblionumbers) { > if ( $res->{'biblionumber'} == $biblionumber && $res->{'borrowernumber'} == $borrowernumber) { >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 6976
:
6371
|
7832
|
11872
|
11874
|
11876