Bugzilla – Attachment 26112 Details for
Bug 11481
new reservation syspref HoldOnlyWhenAllItemsOnLoan
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11481 HoldOnlyWhenAllItemsOnLoan new syspref
0001-Bug-11481-HoldOnlyWhenAllItemsOnLoan-new-syspref.patch (text/plain), 8.54 KB, created by
Koha Team University Lyon 3
on 2014-03-11 14:40:34 UTC
(
hide
)
Description:
Bug 11481 HoldOnlyWhenAllItemsOnLoan new syspref
Filename:
MIME Type:
Creator:
Koha Team University Lyon 3
Created:
2014-03-11 14:40:34 UTC
Size:
8.54 KB
patch
obsolete
>From 16c0e3d8447769962c471fea3f106ba5560a98a5 Mon Sep 17 00:00:00 2001 >From: Lyon3 Team <koha@univ-lyon3.fr> >Date: Wed, 15 Jan 2014 14:48:19 +0100 >Subject: [PATCH 1/2] Bug 11481 HoldOnlyWhenAllItemsOnLoan new syspref > >This syspref sets the following behavior about reserves : >Placing hold on a document is possible only when all items that can be reserved >according to the issuing rules are on loan. >It's disabled by default. >--- > C4/Reserves.pm | 31 +++++++++++++++++-- > installer/data/mysql/sysprefs.sql | 4 +- > installer/data/mysql/updatedatabase.pl | 7 ++++ > .../en/modules/admin/preferences/circulation.pref | 8 +++++ > .../prog/en/modules/reserve/request.tt | 6 +++- > opac/opac-detail.pl | 8 ++++- > reserve/request.pl | 9 ++++-- > 7 files changed, 62 insertions(+), 11 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 7a914e3..5759919 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -445,8 +445,15 @@ sub CanBookBeReserved{ > push (@$items,@hostitems); > } > >- foreach my $item (@$items){ >- return 1 if CanItemBeReserved($borrowernumber, $item); >+ unless (C4::Context->preference('HoldOnlyWhenAllItemsOnLoan')) { >+ foreach my $item (@$items){ >+ return 1 if CanItemBeReserved($borrowernumber, $item); >+ } >+ }else { >+ foreach my $item (@$items){ >+ return undef if !defined(CanItemBeReserved($borrowernumber, $item)); >+ } >+ return 1; > } > return 0; > } >@@ -553,9 +560,25 @@ sub CanItemBeReserved{ > return 0; > } > } >+ my $holdonly = C4::Context->preference('HoldOnlyWhenAllItemsOnLoan'); >+ if ( !$holdonly ){ >+ return 1; >+ } else { >+ my $querystatus ="SELECT found FROM reserves WHERE itemnumber = ?"; >+ my $sth=$dbh->prepare($querystatus); >+ $sth->execute($itemnumber); >+ my ($status) = $sth->fetchrow_array(); > >- return 1; >-} >+ if ($item->{'onloan'} or $status eq 'W' or $status eq 'T') { >+ return 1; >+ } elsif ( $item->{'notforloan'} or $item->{'withdrawn'} or $item->{'itemlost'} or $item->{'damaged'} ) { >+ return 0; >+ } else { >+ return undef; >+ } >+ } >+ >+ } > #-------------------------------------------------------------------------------- > =head2 GetReserveCount > >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 66c2017..2e13e23 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -428,5 +428,5 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'), > ('yuipath','local','local|http://yui.yahooapis.com/2.5.1/build','Insert the path to YUI libraries, choose local if you use koha offline','Choice'), > ('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'), >-('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo') >-; >+('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo'), >+('HoldOnlyWhenAllItemsOnLoan','0', 'Placing hold on a document is possible only when all items that can be reserved according to the issuing rules are on loan', NULL, 'YesNo') >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 0768a88..20a06c2 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -8037,6 +8037,13 @@ if(CheckVersion($DBversion)) { > SetVersion($DBversion); > } > >+$DBversion = "3.15.00.XXX"; >+if (CheckVersion($DBversion) ) { >+ $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('HoldOnlyWhenAllItemsOnLoan','0', 'Placing hold on a document is possible only when all items that can be reserved according to the issuing rules are on loan', NULL, 'YesNo')"); >+ print "Upgrade to $DBversion done (Add system preference HoldOnlyWhenAllItemsOnLoan)\n"; >+ SetVersion($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 TableExists($table) >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 70ac352..6e265a9 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 >@@ -371,6 +371,14 @@ Circulation: > no: "Don't allow" > - hold requests to be placed on items that are not checked out. > - >+ - To be able to place hold on a document >+ - pref: HoldOnlyWhenAllItemsOnLoan >+ default: 0 >+ choices: >+ yes: "it is necessary" >+ no: "it is not necessary" >+ - that all the items potentially holdable are on loan >+ - > - pref: AllowHoldDateInFuture > choices: > yes: Allow >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 b084e25..b09ba03 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >@@ -243,7 +243,11 @@ function checkMultiHold() { > <li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">[% borrowerfirstname %] [% borrowersurname %]</a> <strong>already has a hold</strong> on this item </li> > [% END %] > [% IF ( none_available ) %] >- <li> <strong>No copies are available</strong> to be placed on hold</li> >+ [% IF ( not_all_holdable_onloan ) %] >+ <li> <strong>All reservable items of the record must be on loan</strong></li> >+ [% ELSE %] >+ <li> <strong>No copies are available</strong> to be placed on hold</li> >+ [% END %] > [% END %] > [% IF ( alreadypossession ) %] > <li> <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">[% borrowerfirstname %] [% borrowersurname %]</a> <strong>is already in possession</strong> of one item</li> >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index 46f76fb..a1dae10 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -404,7 +404,13 @@ if ($session->param('busc')) { > > > $template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') ); >-$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) ); >+if ( C4::Context->preference("HoldOnlyWhenAllItemsOnLoan") ) { >+ $template->param( 'ItemsIssued' => CanBookBeReserved($borrowernumber,$biblionumber) ); >+} else { >+ $template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) ); >+} >+ >+ > > > >diff --git a/reserve/request.pl b/reserve/request.pl >index 1b303c7..461af6c 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -180,14 +180,16 @@ if ($multihold) { > > my $itemdata_enumchron = 0; > my @biblioloop = (); >+my $not_all_holdable_onloan; > foreach my $biblionumber (@biblionumbers) { > > my %biblioloopiter = (); > > my $dat = GetBiblioData($biblionumber); >- >- unless ( CanBookBeReserved($borrowerinfo->{borrowernumber}, $biblionumber) ) { >+ my $canbookbereserved = CanBookBeReserved($borrowerinfo->{borrowernumber}, $biblionumber); >+ unless ( $canbookbereserved ) { > $maxreserves = 1; >+ $not_all_holdable_onloan = 1 if !defined($canbookbereserved); > } > > my $alreadypossession; >@@ -414,7 +416,7 @@ foreach my $biblionumber (@biblionumbers) { > ) > { > $item->{available} = 1; >- $num_available++; >+ $num_available++ unless $not_all_holdable_onloan; > } > elsif ( C4::Context->preference('AllowHoldPolicyOverride') ) { > >@@ -436,6 +438,7 @@ foreach my $biblionumber (@biblionumbers) { > if ( $num_override == scalar( @{ $biblioitem->{itemloop} } ) ) { # That is, if all items require an override > $template->param( override_required => 1 ); > } elsif ( $num_available == 0 ) { >+ $template->param( not_all_holdable_onloan => $not_all_holdable_onloan ); > $template->param( none_available => 1 ); > $biblioloopiter{warn} = 1; > $biblioloopiter{none_avail} = 1; >-- >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 11481
:
23974
|
24397
| 26112