Bugzilla – Attachment 14266 Details for
Bug 9206
Only allow place holds in records that the patron don't have in his possession
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9206 - Only allow place holds in records that the patron don't have in his possession
Bug-9206---Only-allow-place-holds-in-records-that-.patch (text/plain), 8.21 KB, created by
Jonathan Druart
on 2012-12-26 14:02:42 UTC
(
hide
)
Description:
Bug 9206 - Only allow place holds in records that the patron don't have in his possession
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2012-12-26 14:02:42 UTC
Size:
8.21 KB
patch
obsolete
>From 9129fcac7d63480ad8c748529e600a47438118ae Mon Sep 17 00:00:00 2001 >From: Vitor FERNANDES <vfernandes@keep.pt> >Date: Tue, 4 Dec 2012 15:57:35 +0000 >Subject: [PATCH] Bug 9206 - Only allow place holds in records that the patron > don't have in his possession > >Added a system preference to turn on/off this feature. >By default the system allow the patron to place holds even if it is in his possession. >Script to place holds check if the system preference is off and if patron has at least one item to block holds. >Messages to say that are already in patron possession added to templates. >Method to check if patron has one issue from one record added to C4::Circulation > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> >--- > C4/Circulation.pm | 21 ++++++++++++++++++++ > installer/data/mysql/sysprefs.sql | 1 + > installer/data/mysql/updatedatabase.pl | 8 ++++++++ > .../en/modules/admin/preferences/circulation.pref | 6 ++++++ > .../prog/en/modules/reserve/request.tt | 3 +++ > .../opac-tmpl/prog/en/modules/opac-reserve.tt | 8 ++++++-- > opac/opac-reserve.pl | 5 +++++ > reserve/request.pl | 8 +++++++- > 8 files changed, 57 insertions(+), 3 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 8215752..36aff3e 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -3445,6 +3445,27 @@ sub TransferSlip { > ); > } > >+=head2 CheckIfIssuedToPatron >+ >+ CheckIfIssuedToPatron($borrowernumber, $biblionumber) >+ >+ Return 1 if any record item is issued to patron, otherwise return 0 >+ >+=cut >+ >+sub CheckIfIssuedToPatron { >+ my ($borrowernumber, $biblionumber) = @_; >+ my $isissued = 0; >+ >+ my $items = GetItemsByBiblioitemnumber($biblionumber); >+ >+ foreach my $item (@{$items}) { >+ $isissued = 1 if ($item->{borrowernumber} && $item->{borrowernumber} eq $borrowernumber); >+ } >+ >+ return $isissued; >+} >+ > > 1; > >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index ccb3fcf..0f5f07d 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -400,3 +400,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacSeparateHoldings', '0', 'Separate current branch holdings from other holdings (OPAC)', NULL, 'YesNo'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacSeparateHoldingsBranch', 'homebranch', 'Branch used to separate holdings (OPAC)', 'homebranch|holdingbranch', 'Choice'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('RenewalSendNotice','0', NULL, '', 'YesNo'); >+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowHoldsOnPatronsPossessions', '1', 'Allow holds on records that patron have items of it',NULL,'YesNo'); >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index d93de4e..f78849a 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -6111,6 +6111,14 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { > print "Upgrade to $DBversion done (Bug 8782: Add field subscription.closed)\n"; > SetVersion($DBversion); > } >+$DBversion = "XXX"; >+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { >+ $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowHoldsOnPatronsPossessions', '1', 'Allow holds on records that patron have items of it',NULL,'YesNo')" >+ print "Upgrade to $DBversion done (Bug 9206: Only allow place holds in records that the patron don't have in his possession)\n"; >+ SetVersion($DBversion); >+} >+ >+ > > $DBversion = "3.11.00.005"; > if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >index f32b5b1..af3f565 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >@@ -441,6 +441,12 @@ Circulation: > - pref: decreaseLoanHighHoldsValue > class: integer > - holds. >+ - >+ - pref: AllowHoldsOnPatronsPossessions >+ choices: >+ yes: Allow >+ no: "Don't allow" >+ - patrons to place holds on records that he already have any item of it in his possession. > Fines Policy: > - > - Calculate fines based on days overdue >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 0ad5d23..05470eb 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >@@ -213,6 +213,9 @@ function checkMultiHold() { > [% IF ( none_available ) %] > <li> <strong>No copies are available</strong> to be placed on hold</li> > [% END %] >+ [% IF ( alreadypossession ) %] >+ <li> <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">[% borrowerfirstname %] [% borrowersurname %]</a> <strong>is already in possesion</strong> of one item</li> >+ [% END %] > </ul> > [% ELSE %] > <h3>Cannot place hold on some items</h3> >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 e206561..1c5205d 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt >@@ -293,8 +293,12 @@ > [% UNLESS ( bibitemloo.bib_available ) %] > <div class="bibmessage">No available items.</div> > [% ELSE %] >- <div class="bibmessage">This title cannot be requested.</div> >- [% END %] >+ [% IF ( bibitemloo.already_patron_possession ) %] >+ <div class="bibmessage">This title cannot be requested because it's already in your possession.</div> >+ [% ELSE %] >+ <div class="bibmessage">This title cannot be requested.</div> >+ [% END %] >+ [% END %] > [% END %] > > >diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl >index fbc9dd7..4ff9478 100755 >--- a/opac/opac-reserve.pl >+++ b/opac/opac-reserve.pl >@@ -537,6 +537,11 @@ foreach my $biblioNum (@biblionumbers) { > $biblioLoopIter{holdable} = undef; > $anyholdable = undef; > } >+ if(not C4::Context->preference('AllowHoldsOnPatronsPossessions') and CheckIfIssuedToPatron($borrowernumber,$biblioNum)) { >+ $biblioLoopIter{holdable} = undef; >+ $biblioLoopIter{already_patron_possession} = 1; >+ $anyholdable = undef; >+ } > > push @$biblioLoop, \%biblioLoopIter; > } >diff --git a/reserve/request.pl b/reserve/request.pl >index c34a614..d8c99d7 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -247,6 +247,11 @@ foreach my $biblionumber (@biblionumbers) { > $warnings = 1; > $maxreserves = 1; > } >+ if (not C4::Context->preference('AllowHoldsOnPatronsPossessions') and CheckIfIssuedToPatron($borrowerinfo->{borrowernumber},$biblionumber)) { >+ $warnings = 1; >+ $alreadypossession = 1; >+ } >+ > # get existing reserves ..... > my ( $count, $reserves ) = GetReservesFromBiblionumber($biblionumber,1); > my $totalcount = $count; >@@ -268,7 +273,8 @@ foreach my $biblionumber (@biblionumbers) { > $template->param( alreadyreserved => $alreadyreserved, > messages => $messages, > warnings => $warnings, >- maxreserves=>$maxreserves >+ maxreserves=>$maxreserves, >+ alreadypossession => $alreadypossession, > ); > > >-- >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 9206
:
13881
|
14126
|
14127
| 14266 |
14267
|
14268