Bugzilla – Attachment 18148 Details for
Bug 10247
Too many reserves due to syspref does not show warning
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch
0001-Bug-10247-Too-many-reserves-due-to-syspref-does-not-.patch (text/plain), 6.98 KB, created by
Fridolin Somers
on 2013-05-15 10:00:25 UTC
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2013-05-15 10:00:25 UTC
Size:
6.98 KB
patch
obsolete
>From df7a9d214561c1126a12993aa74f22487e1c6422 Mon Sep 17 00:00:00 2001 >From: Fridolyn SOMERS <fridolyn.somers@biblibre.com> >Date: Wed, 15 May 2013 11:52:57 +0200 >Subject: [PATCH] Bug 10247 - Too many reserves due to syspref does not show > warning > >On intranet, when placing a reserve : >If borrower as reached the reserves quota, a warning should appear : > Cannot place hold > * Too Many Holds: TEST has too many holds. > >This works when quota defined in circulation rules is reached but not when quota specified in syspref maxreserves is reached, in case this quota is lower than the one defined is circulation rules. > >This is because template param maxreserves is set twice, this patch corrects this bug. >Also moves warnings and messages conditionnal variable from perl to template because it cause the same bug as for maxreserves. > >Test plan : >- Select a borrower and an item >- Look at reserve quota for the borrower category, the item branch and the item type >- Set maxreserves syspref with a quota lower than the circulation quota >- Perform reserves for borrower to reach the quota >- Try to perform one more reserve >=> You get the warning "too many holds" >- Set maxreserves syspref with a quota higher than the circulation quota >- Try to perform one more reserve >=> You get the warning "too many holds" >Check you get a warning for alreadyreserved, none_available and alreadypossession cases. >Check you get a message for expiry and diffbranch cases. >--- > .../prog/en/modules/reserve/request.tt | 8 +++--- > reserve/request.pl | 27 +++++--------------- > 2 files changed, 11 insertions(+), 24 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >index 122b2d0..91bf2a8 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >@@ -198,7 +198,7 @@ function checkMultiHold() { > </form> > [% ELSE %] > >-[% IF ( warnings ) %] >+[% IF ( maxreserves || alreadyreserved || none_available || alreadypossession ) %] > <div class="dialog alert"> > > [% UNLESS ( multi_hold ) %] >@@ -224,13 +224,13 @@ function checkMultiHold() { > </div> > [% END %] > >-[% IF ( messages ) %] >- <div class="dialog message"><ul> >+[% IF ( expiry || diffbranch ) %] >+<div class="dialog message"><ul> > [% IF ( expiry ) %] > <li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">[% borrowerfirstname %] [% borrowersurname %]</a>'s <strong>account has expired</strong></li> > [% END %] > >-[% IF ( diffbranch ) %] >+ [% IF ( diffbranch ) %] > <li> <strong>Pickup library is different</strong> than <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">[% borrowerfirstname %] [% borrowersurname %]</a>'s home library ([% borrower_branchname %] / [% borrower_branchcode %] )</li> > [% END %] > >diff --git a/reserve/request.pl b/reserve/request.pl >index 5bcaca2..167692f 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -78,8 +78,7 @@ $findborrower =~ s|,| |g; > my $borrowernumber_hold = $input->param('borrowernumber') || ''; > my $borrowerslist; > my $messageborrower; >-my $warnings; >-my $messages; >+my $maxreserves; > > my $date = C4::Dates->today('iso'); > my $action = $input->param('action'); >@@ -127,7 +126,6 @@ if ($borrowernumber_hold && !$action) { > my $diffbranch; > my @getreservloop; > my $count_reserv = 0; >- my $maxreserves; > > # we check the reserves of the borrower, and if he can reserv a document > # FIXME At this time we have a simple count of reservs, but, later, we could improve the infos "title" ... >@@ -136,7 +134,6 @@ if ($borrowernumber_hold && !$action) { > GetReserveCount( $borrowerinfo->{'borrowernumber'} ); > > if ( C4::Context->preference('maxreserves') && ($number_reserves >= C4::Context->preference('maxreserves')) ) { >- $warnings = 1; > $maxreserves = 1; > } > >@@ -145,12 +142,11 @@ if ($borrowernumber_hold && !$action) { > my $expiry = 0; # flag set if patron account has expired > if ($expiry_date and $expiry_date ne '0000-00-00' and > Date_to_Days(split /-/,$date) > Date_to_Days(split /-/,$expiry_date)) { >- $messages = $expiry = 1; >+ $expiry = 1; > } > > # check if the borrower make the reserv in a different branch > if ( $borrowerinfo->{'branchcode'} ne C4::Context->userenv->{'branch'} ) { >- $messages = 1; > $diffbranch = 1; > } > >@@ -169,11 +165,8 @@ if ($borrowernumber_hold && !$action) { > borrowercategory => $borrowerinfo->{'category'}, > borrowerreservs => $count_reserv, > cardnumber => $borrowerinfo->{'cardnumber'}, >- maxreserves => $maxreserves, > expiry => $expiry, > diffbranch => $diffbranch, >- messages => $messages, >- warnings => $warnings > ); > } > >@@ -227,18 +220,15 @@ my @biblioloop = (); > foreach my $biblionumber (@biblionumbers) { > > my %biblioloopiter = (); >- my $maxreserves; > > my $dat = GetBiblioData($biblionumber); > > unless ( CanBookBeReserved($borrowerinfo->{borrowernumber}, $biblionumber) ) { >- $warnings = 1; > $maxreserves = 1; > } > > my $alreadypossession; > if (not C4::Context->preference('AllowHoldsOnPatronsPossessions') and CheckIfIssuedToPatron($borrowerinfo->{borrowernumber},$biblionumber)) { >- $warnings = 1; > $alreadypossession = 1; > } > >@@ -253,19 +243,16 @@ foreach my $biblionumber (@biblionumbers) { > } > > if ( defined $borrowerinfo && ($borrowerinfo->{borrowernumber} eq $res->{borrowernumber}) ) { >- $warnings = 1; > $alreadyreserved = 1; > $biblioloopiter{warn} = 1; > $biblioloopiter{alreadyres} = 1; > } > } > >- $template->param( alreadyreserved => $alreadyreserved, >- messages => $messages, >- warnings => $warnings, >- maxreserves=>$maxreserves, >- alreadypossession => $alreadypossession, >- ); >+ $template->param( >+ alreadyreserved => $alreadyreserved, >+ alreadypossession => $alreadypossession, >+ ); > > > # FIXME think @optionloop, is maybe obsolete, or must be switchable by a systeme preference fixed rank or not >@@ -489,7 +476,6 @@ foreach my $biblionumber (@biblionumbers) { > $template->param( override_required => 1 ); > } elsif ( $num_available == 0 ) { > $template->param( none_available => 1 ); >- $template->param( warnings => 1 ); > $biblioloopiter{warn} = 1; > $biblioloopiter{none_avail} = 1; > } >@@ -618,6 +604,7 @@ foreach my $biblionumber (@biblionumbers) { > > $template->param( biblioloop => \@biblioloop ); > $template->param( biblionumbers => $biblionumbers ); >+$template->param( maxreserves => $maxreserves ); > > if ($multihold) { > $template->param( multi_hold => 1 ); >-- >1.7.10.4 >
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 10247
:
18148
|
18827
|
19190