[Koha-patches] [PATCH] bug_5786: moved AllowOnShelfHolds to circ matrix (issuingrules)
Marc Balmer
marc at msys.ch
Wed Dec 21 15:22:24 CET 2011
Please stop putting column names in backquotes, it is a MySQLism and hinders my efforts to run Koha on PostgreSQL,
Am 21.12.2011 um 04:28 schrieb Srdjan Jankovic <srdjan at catalyst.net.nz>:
> ---
> C4/Circulation.pm | 3 +-
> C4/Items.pm | 2 +
> C4/Reserves.pm | 72 ++++++++++++++++---
> C4/VirtualShelves/Page.pm | 1 -
> admin/smart-rules.pl | 9 ++-
> admin/systempreferences.pl | 1 -
> .../mysql/it-IT/necessari/system_preferences.sql | 1 -
> installer/data/mysql/kohastructure.sql | 3 +-
> installer/data/mysql/sysprefs.sql | 1 -
> installer/data/mysql/updatedatabase.pl | 19 +++++
> installer/html-template-to-template-toolkit.pl | 2 +-
> .../en/modules/admin/preferences/circulation.pref | 6 --
> .../prog/en/modules/admin/preferences/opac.pref | 6 --
> .../prog/en/modules/admin/smart-rules.tt | 25 +++++--
> .../prog/en/modules/help/reserve/request.tt | 2 +-
> .../opac-tmpl/prog/en/modules/opac-ISBDdetail.tt | 6 --
> .../opac-tmpl/prog/en/modules/opac-MARCdetail.tt | 6 --
> koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 12 +---
> .../prog/en/modules/opac-results-grouped.tt | 6 --
> .../opac-tmpl/prog/en/modules/opac-results.tt | 8 +--
> .../opac-tmpl/prog/en/modules/opac-shelves.tt | 6 --
> opac/opac-ISBDdetail.pl | 2 -
> opac/opac-MARCdetail.pl | 1 -
> opac/opac-detail.pl | 2 -
> opac/opac-reserve.pl | 2 +-
> opac/opac-search.pl | 2 +-
> 26 files changed, 115 insertions(+), 91 deletions(-)
>
> diff --git a/C4/Circulation.pm b/C4/Circulation.pm
> index 9a6f4f2..df202e1 100644
> --- a/C4/Circulation.pm
> +++ b/C4/Circulation.pm
> @@ -2200,7 +2200,8 @@ sub CanBookBeRenewed {
> LEFT JOIN biblioitems USING (biblioitemnumber)
>
> WHERE
> - (issuingrules.categorycode = borrowers.categorycode OR issuingrules.categorycode = '*')
> + (issuingrules.categorycode = borrowers.categorycode
> + OR issuingrules.categorycode = '*')
> AND
> (issuingrules.itemtype = $itype OR issuingrules.itemtype = '*')
> AND
> diff --git a/C4/Items.pm b/C4/Items.pm
> index 8802a4c..7c3a26f 100644
> --- a/C4/Items.pm
> +++ b/C4/Items.pm
> @@ -160,6 +160,8 @@ sub GetItem {
> ($data->{'serialseq'} , $data->{'publisheddate'}) = $ssth->fetchrow_array();
> }
> #if we don't have an items.itype, use biblioitems.itemtype.
> + # FIXME this should respect the itypes systempreference
> + # if (C4::Context->preference('item-level_itypes')) {
> if( ! $data->{'itype'} ) {
> my $sth = $dbh->prepare("SELECT itemtype FROM biblioitems WHERE biblionumber = ?");
> $sth->execute($data->{'biblionumber'});
> diff --git a/C4/Reserves.pm b/C4/Reserves.pm
> index 359bbad..5a2d819 100644
> --- a/C4/Reserves.pm
> +++ b/C4/Reserves.pm
> @@ -479,7 +479,6 @@ sub CanItemBeReserved{
> if(my $rowcount = $sthcount->fetchrow_hashref()){
> $reservecount = $rowcount->{count};
> }
> -
> # we check if it's ok or not
> if( $reservecount < $allowedreserves ){
> return 1;
> @@ -1321,7 +1320,7 @@ sub GetReserveInfo {
>
> =head2 IsAvailableForItemLevelRequest
>
> - my $is_available = IsAvailableForItemLevelRequest($itemnumber);
> + my $is_available = IsAvailableForItemLevelRequest($itemnumber,$borrowernumber,$branchcode);
>
> Checks whether a given item record is available for an
> item-level hold request. An item is available if
> @@ -1331,12 +1330,8 @@ item-level hold request. An item is available if
> * it is not withdrawn AND
> * does not have a not for loan value > 0
>
> -Whether or not the item is currently on loan is
> -also checked - if the AllowOnShelfHolds system preference
> -is ON, an item can be requested even if it is currently
> -on loan to somebody else. If the system preference
> -is OFF, an item that is currently checked out cannot
> -be the target of an item-level hold request.
> +Need to check the issuingrules onshelfholds column,
> +if this is set items on the shelf can be placed on hold
>
> Note that IsAvailableForItemLevelRequest() does not
> check if the staff operator is authorized to place
> @@ -1348,9 +1343,9 @@ and canreservefromotherbranches.
>
> sub IsAvailableForItemLevelRequest {
> my $itemnumber = shift;
> -
> + my $borrowernumber = shift;
> + my $branchcode = shift;
> my $item = GetItem($itemnumber);
> -
> # must check the notforloan setting of the itemtype
> # FIXME - a lot of places in the code do this
> # or something similar - need to be
> @@ -1383,14 +1378,67 @@ sub IsAvailableForItemLevelRequest {
> $item->{wthdrawn} or
> $notforloan_per_itemtype;
>
> -
> - if (C4::Context->preference('AllowOnShelfHolds')) {
> + # check issuingrules
> +
> + if (OnShelfHoldsAllowed($itemnumber,$borrowernumber,$branchcode)) {
> return $available_per_item;
> } else {
> return ($available_per_item and ($item->{onloan} or GetReserveStatus($itemnumber) eq "W"));
> }
> }
>
> +=head2 OnShelfHoldsAllowed
> +
> + OnShelfHoldsAllowed($itemnumber,$borrowernumber,$branchcode);
> +
> +Checks issuingrules, using the borrowers categorycode, the itemtype, and branchcode to see if onshelf
> +holds are allowed, returns true if so.
> +
> +=cut
> +
> +sub OnShelfHoldsAllowed {
> + my ($itemnumber,$borrowernumber,$branchcode) = @_;
> + my $item = GetItem($itemnumber);
> + my $borrower = C4::Members::GetMember(borrowernumber => $borrowernumber);
> + my $itype;
> + my $dbh = C4::Context->dbh;
> + if (C4::Context->preference('item-level_itypes')) {
> + # We cant trust GetItem to honour the syspref, so safest to do it ourselves
> + # When GetItem is fixed, we can remove this
> + $itype = $item->{itype};
> + }
> + else {
> + my $query = "SELECT itemtype FROM biblioitems WHERE biblioitemnumber = ? ";
> + my $sth = $dbh->prepare($query);
> + $sth->execute($item->{biblioitemnumber});
> + if (my $data = $sth->fetchrow_hashref()){
> + $itype = $data->{itemtype};
> + }
> + }
> +
> + my $query = "SELECT onshelfholds,categorycode,itemtype,branchcode FROM issuingrules WHERE
> + (issuingrules.categorycode = ? OR issuingrules.categorycode = '*')
> + AND
> + (issuingrules.itemtype = ? OR issuingrules.itemtype = '*')
> + AND
> + (issuingrules.branchcode = ? OR issuingrules.branchcode = '*')
> + ORDER BY
> + issuingrules.categorycode desc,
> + issuingrules.itemtype desc,
> + issuingrules.branchcode desc
> + LIMIT 1";
> + my $dbh = C4::Context->dbh;
> + my $sth = $dbh->prepare($query);
> + $sth->execute($borrower->{categorycode},$itype,$branchcode);
> + my $data = $sth->fetchrow_hashref;
> + if ($data->{onshelfholds}){
> + return 1;
> + }
> + else {
> + return 0;
> + }
> +}
> +
> =head2 AlterPriority
>
> AlterPriority( $where, $borrowernumber, $biblionumber, $reservedate );
> diff --git a/C4/VirtualShelves/Page.pm b/C4/VirtualShelves/Page.pm
> index 523527e..ff55dc0 100644
> --- a/C4/VirtualShelves/Page.pm
> +++ b/C4/VirtualShelves/Page.pm
> @@ -183,7 +183,6 @@ sub shelfpage ($$$$$) {
> # explicitly fetch this shelf
> my ($shelfnumber2,$shelfname,$owner,$category,$sorton) = GetShelf($shelfnumber);
>
> - $template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
> if (C4::Context->preference('TagsEnabled')) {
> $template->param(TagsEnabled => 1);
> foreach (qw(TagsShowOnList TagsInputOnList)) {
> diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl
> index f290934..5bfdc7d 100755
> --- a/admin/smart-rules.pl
> +++ b/admin/smart-rules.pl
> @@ -101,8 +101,8 @@ elsif ($op eq 'delete-branch-item') {
> # save the values entered
> elsif ($op eq 'add') {
> my $sth_search = $dbh->prepare("SELECT COUNT(*) AS total FROM issuingrules WHERE branchcode=? AND categorycode=? AND itemtype=?");
> - my $sth_insert = $dbh->prepare("INSERT INTO issuingrules (branchcode, categorycode, itemtype, maxissueqty, renewalsallowed, reservesallowed, issuelength, hardduedate, hardduedatecompare, fine, finedays, firstremind, chargeperiod,rentaldiscount) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
> - my $sth_update=$dbh->prepare("UPDATE issuingrules SET fine=?, finedays=?, firstremind=?, chargeperiod=?, maxissueqty=?, renewalsallowed=?, reservesallowed=?, issuelength=?, hardduedate=?, hardduedatecompare=?, rentaldiscount=? WHERE branchcode=? AND categorycode=? AND itemtype=?");
> + my $sth_insert = $dbh->prepare("INSERT INTO issuingrules (branchcode, categorycode, itemtype, maxissueqty, renewalsallowed, reservesallowed, issuelength, hardduedate, hardduedatecompare, fine, finedays, firstremind, chargeperiod, rentaldiscount, onshelfholds) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
> + my $sth_update=$dbh->prepare("UPDATE issuingrules SET fine=?, finedays=?, firstremind=?, chargeperiod=?, maxissueqty=?, renewalsallowed=?, reservesallowed=?, issuelength=?, hardduedate=?, hardduedatecompare=?, rentaldiscount=?, onshelfholds=? WHERE branchcode=? AND categorycode=? AND itemtype=?");
>
> my $br = $branch; # branch
> my $bor = $input->param('categorycode'); # borrower category
> @@ -114,6 +114,7 @@ elsif ($op eq 'add') {
> my $maxissueqty = $input->param('maxissueqty');
> my $renewalsallowed = $input->param('renewalsallowed');
> my $reservesallowed = $input->param('reservesallowed');
> + my $onshelfholds = $input->param('onshelfholds');
> $maxissueqty =~ s/\s//g;
> $maxissueqty = undef if $maxissueqty !~ /^\d+/;
> my $issuelength = $input->param('issuelength');
> @@ -126,9 +127,9 @@ elsif ($op eq 'add') {
> $sth_search->execute($br,$bor,$cat);
> my $res = $sth_search->fetchrow_hashref();
> if ($res->{total}) {
> - $sth_update->execute($fine, $finedays,$firstremind, $chargeperiod, $maxissueqty, $renewalsallowed,$reservesallowed, $issuelength,$hardduedate,$hardduedatecompare,$rentaldiscount, $br,$bor,$cat);
> + $sth_update->execute($fine, $finedays,$firstremind, $chargeperiod, $maxissueqty, $renewalsallowed,$reservesallowed, $issuelength,$hardduedate,$hardduedatecompare,$rentaldiscount, $onshelfholds, $br,$bor,$cat);
> } else {
> - $sth_insert->execute($br,$bor,$cat,$maxissueqty,$renewalsallowed,$reservesallowed,$issuelength,$hardduedate,$hardduedatecompare,$fine,$finedays,$firstremind,$chargeperiod,$rentaldiscount);
> + $sth_insert->execute($br,$bor,$cat,$maxissueqty,$renewalsallowed,$reservesallowed,$issuelength,$hardduedate,$hardduedatecompare,$fine,$finedays,$firstremind,$chargeperiod,$rentaldiscount,$onshelfholds);
> }
> }
> elsif ($op eq "set-branch-defaults") {
> diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl
> index 78d0768..6bd68ee 100755
> --- a/admin/systempreferences.pl
> +++ b/admin/systempreferences.pl
> @@ -186,7 +186,6 @@ $tabsysprefs{HomeOrHoldingBranch} = "Circulation";
> $tabsysprefs{HomeOrHoldingBranchReturn} = "Circulation";
> $tabsysprefs{RandomizeHoldsQueueWeight} = "Circulation";
> $tabsysprefs{StaticHoldsQueueWeight} = "Circulation";
> -$tabsysprefs{AllowOnShelfHolds} = "Circulation";
> $tabsysprefs{AllowHoldsOnDamagedItems} = "Circulation";
> $tabsysprefs{UseBranchTransferLimits} = "Circulation";
> $tabsysprefs{AllowHoldPolicyOverride} = "Circulation";
> diff --git a/installer/data/mysql/it-IT/necessari/system_preferences.sql b/installer/data/mysql/it-IT/necessari/system_preferences.sql
> index b4ddfa0..7aaa066 100644
> --- a/installer/data/mysql/it-IT/necessari/system_preferences.sql
> +++ b/installer/data/mysql/it-IT/necessari/system_preferences.sql
> @@ -17,7 +17,6 @@
> -- 51 Franklin Street' WHERE variable = ' Fifth Floor' WHERE variable = ' Boston' WHERE variable = ' MA 02110-1301 USA.
>
> UPDATE systempreferences SET value = 'cataloguing' WHERE variable = 'AcqCreateItem';
> -UPDATE systempreferences SET value = '1' WHERE variable = 'AllowOnShelfHolds';
> UPDATE systempreferences SET value = '1' WHERE variable = 'AllowRenewalLimitOverride';
> UPDATE systempreferences SET value = 'annual' WHERE variable = 'autoBarcode';
> UPDATE systempreferences SET value = 'email' WHERE variable = 'AutoEmailPrimaryAddress';
> diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql
> index a03bd23..b6adbd6 100644
> --- a/installer/data/mysql/kohastructure.sql
> +++ b/installer/data/mysql/kohastructure.sql
> @@ -970,6 +970,7 @@ CREATE TABLE `issues` ( -- information related to check outs or issues
>
> DROP TABLE IF EXISTS `issuingrules`;
> CREATE TABLE `issuingrules` (
> + `branchcode` varchar(10) NOT NULL default '',
> `categorycode` varchar(10) NOT NULL default '',
> `itemtype` varchar(10) NOT NULL default '',
> `restrictedtype` tinyint(1) default NULL,
> @@ -987,7 +988,7 @@ CREATE TABLE `issuingrules` (
> `hardduedatecompare` tinyint NOT NULL default "0",
> `renewalsallowed` smallint(6) NOT NULL default "0",
> `reservesallowed` smallint(6) NOT NULL default "0",
> - `branchcode` varchar(10) NOT NULL default '',
> + `onshelfholds` tinyint(1) NOT NULL default 0,
> PRIMARY KEY (`branchcode`,`categorycode`,`itemtype`),
> KEY `categorycode` (`categorycode`),
> KEY `itemtype` (`itemtype`)
> diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql
> index 128c9b2..a1a913a 100755
> --- a/installer/data/mysql/sysprefs.sql
> +++ b/installer/data/mysql/sysprefs.sql
> @@ -223,7 +223,6 @@ INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES
> ('XSLTDetailsDisplay','0','','Enable XSL stylesheet control over details page display on intranet','YesNo'),
> ('XSLTResultsDisplay','0','','Enable XSL stylesheet control over results page display on intranet','YesNo');
> INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('AdvancedSearchTypes','itemtypes','itemtypes|ccode','Select which set of fields comprise the Type limit in the advanced search','Choice');
> -INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('AllowOnShelfHolds', '0', '', 'Allow hold requests to be placed on items that are not on loan', 'YesNo');
> INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('AllowHoldsOnDamagedItems', '1', '', 'Allow hold requests to be placed on damaged items', 'YesNo');
> INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('OpacSuppression', '0', '', 'Turn ON the OPAC Suppression feature, requires further setup, ask your system administrator for details', 'YesNo');
> -- FIXME: add FrameworksLoaded, noOPACUserLogin?
> diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
> index 0063a75..e039407 100755
> --- a/installer/data/mysql/updatedatabase.pl
> +++ b/installer/data/mysql/updatedatabase.pl
> @@ -4578,6 +4578,25 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
> SetVersion($DBversion);
> }
>
> +$DBversion = '3.06.02.XXX';
> +if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
> + print "Upgrade to $DBversion done (Bug 5786 move AllowOnShelfHolds to circulation matrix)\n";
> + # First create the column
> + $dbh->do("ALTER TABLE issuingrules ADD onshelfholds tinyint(1) default 0");
> + # Now update the column
> + if (C4::Context->preference("AllowOnShelfHolds")){
> + # Pref is on, set allow for all rules
> + $dbh->do("UPDATE issuingrules SET onshelfholds=1");
> + } else {
> + # If the preference is not set, leave off
> + $dbh->do("UPDATE issuingrules SET onshelfholds=0");
> + }
> + $dbh->do("ALTER TABLE issuingrules MODIFY onshelfholds tinyint(1) default 0 NOT NULL");
> + # Remove from the systempreferences table
> + $dbh->do("DELETE FROM systempreferences WHERE variable = 'AllowOnShelfHolds'");
> + SetVersion ($DBversion);
> +}
> +
> =head1 FUNCTIONS
>
> =head2 DropAllForeignKeys($table)
> diff --git a/installer/html-template-to-template-toolkit.pl b/installer/html-template-to-template-toolkit.pl
> index e99b195..5f0e0ac 100755
> --- a/installer/html-template-to-template-toolkit.pl
> +++ b/installer/html-template-to-template-toolkit.pl
> @@ -32,7 +32,7 @@ my @globals = ("themelang","JacketImages","OPACAmazonCoverImages","GoogleJackets
> "SyndeticsEnabled", "OpacRenewalAllowed", "item_level_itypes","noItemTypeImages",
> "virtualshelves", "RequestOnOpac", "COinSinOPACResults", "OPACXSLTResultsDisplay",
> "OPACItemsResultsDisplay", "LibraryThingForLibrariesID", "opacuserlogin", "TagsEnabled",
> -"TagsShowOnList", "TagsInputOnList","loggedinusername","AllowOnShelfHolds","opacbookbag",
> +"TagsShowOnList", "TagsInputOnList","loggedinusername","opacbookbag",
> "OPACAmazonEnabled", "SyndeticsCoverImages","using_https");
>
> # Arguments:
> 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 f4946b5..4cb60ae 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
> @@ -236,12 +236,6 @@ Circulation:
> no: "Don't allow"
> - hold requests to be placed on damaged items.
> -
> - - pref: AllowOnShelfHolds
> - choices:
> - yes: Allow
> - no: "Don't allow"
> - - hold requests to be placed on items that are not checked out.
> - -
> - pref: AllowHoldDateInFuture
> choices:
> yes: Allow
> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
> index d6ae2b2..0b076ca 100644
> --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
> +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
> @@ -319,12 +319,6 @@ OPAC:
> # choices:
> # - If ON, enables subject cloud on OPAC
> -
> - - pref: OPACItemHolds
> - choices:
> - yes: Allow
> - no: "Don't allow"
> - - patrons to place holds on specific items in the OPAC. If this is disabled, users can only put a hold on the next available item.
> - -
> - pref: OpacRenewalAllowed
> choices:
> yes: Allow
> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt
> index d2f314f..e38e446 100644
> --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt
> +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt
> @@ -80,7 +80,8 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
> <th>Suspension in Days (day)</th>
> <th>Renewals Allowed (count)</th>
> <th>Holds Allowed (count)</th>
> - <th>Rental Discount (%)</th>
> + <th>On Shelf Holds Allowed</th>
> + <th>Rental Discount (%)</th>
> <th> </th>
> </tr>
> [% FOREACH rule IN rules %]
> @@ -108,19 +109,26 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
> [% END %]
> </td>
> <td>[% rule.issuelength %]</td>
> - <td>[% IF ( rule.hardduedate ) %]
> - [% IF ( rule.hardduedatebefore ) %]before [% rule.hardduedate %]</td>
> - [% ELSE %][% IF ( rule.hardduedateexact ) %]on [% rule.hardduedate %]</td>
> - [% ELSE %][% IF ( rule.hardduedateafter ) %]after [% rule.hardduedate %]</td>[% END %]
> - [% END %]
> - [% END %]
> - [% ELSE %]None defined[% END %]
> + <td>[% IF ( rule.hardduedate ) %]
> + [% IF ( rule.hardduedatebefore ) %]
> + before
> + [% ELSIF ( rule.hardduedateexact ) %]
> + on
> + [% ELSIF ( rule.hardduedateafter ) %]
> + after
> + [% END %]
> + [% rule.hardduedate %]
> + [% ELSE %]
> + None defined
> + [% END %]
> + </td>
> <td>[% rule.fine %]</td>
> <td>[% rule.chargeperiod %]</td>
> <td>[% rule.firstremind %]</td>
> <td>[% rule.finedays %]</td>
> <td>[% rule.renewalsallowed %]</td>
> <td>[% rule.reservesallowed %]</td>
> + <td>[% IF rule.onshelfholds %]Yes[% ELSE %]No[% END %]</td>
> <td>[% rule.rentaldiscount %]</td>
> <td>
> <a class="button" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&itemtype=[% rule.itemtype %]&categorycode=[% rule.categorycode %]&branch=[% rule.current_branch %]">Delete</a>
> @@ -175,6 +183,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
> <td><input name="finedays" size="3" /> </td>
> <td><input name="renewalsallowed" size="2" /></td>
> <td><input name="reservesallowed" size="2" /></td>
> + <td><input type="radio" name="onshelfholds" value="1">Yes <input type="radio" name="onshelfholds" value="0">No</td>
> <td><input name="rentaldiscount" size="2" /></td>
> <td><input type="hidden" name="branch" value="[% current_branch %]"/><input type="submit" value="Add" class="submit" /></td>
> </tr>
> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/help/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/help/reserve/request.tt
> index 3d7381b..a5a5cd0 100644
> --- a/koha-tmpl/intranet-tmpl/prog/en/modules/help/reserve/request.tt
> +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/help/reserve/request.tt
> @@ -72,4 +72,4 @@
>
> <p><strong>See the full documentation for Holds in the <a href="http://manual.koha-community.org/3.6/en/holds.html">manual</a> (online).</strong></p>
>
> -[% INCLUDE 'help-bottom.inc' %]
> \ No newline at end of file
> +[% INCLUDE 'help-bottom.inc' %]
> diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-ISBDdetail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-ISBDdetail.tt
> index f9984a7..d04e7b1 100644
> --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-ISBDdetail.tt
> +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-ISBDdetail.tt
> @@ -51,13 +51,7 @@
> [% UNLESS ( norequests ) %]
> [% IF ( opacuserlogin ) %]
> [% IF ( RequestOnOpac ) %]
> - [% IF ( AllowOnShelfHolds ) %]
> <li><a class="reserve" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% biblionumber %]">Place Hold</a></li>
> - [% ELSE %]
> - [% IF ( ItemsIssued ) %]
> - <li><a class="reserve" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% biblionumber %]">Place Hold</a></li>
> - [% END %]
> - [% END %]
>
> [% END %]
> [% END %]
> diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-MARCdetail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-MARCdetail.tt
> index 284154e..200c0ed 100644
> --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-MARCdetail.tt
> +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-MARCdetail.tt
> @@ -206,13 +206,7 @@ $(document).ready(function(){
> [% UNLESS ( norequests ) %]
> [% IF ( opacuserlogin ) %]
> [% IF ( RequestOnOpac ) %]
> - [% IF ( AllowOnShelfHolds ) %]
> <li><a class="reserve" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% biblionumber %]">Place Hold</a></li>
> - [% ELSE %]
> - [% IF ( ItemsIssued ) %]
> - <li><a class="reserve" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% biblionumber %]">Place Hold</a></li>
> - [% END %]
> - [% END %]
>
> [% END %]
> [% END %]
> diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt
> index d1b6570..fb367ca 100755
> --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt
> +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt
> @@ -1016,16 +1016,10 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
> <ul id="action">
>
> [% UNLESS ( norequests ) %]
> - [% IF ( opacuserlogin ) %]
> + [% IF ( opacuserlogin ) %]
> [% IF ( RequestOnOpac ) %]
> - [% IF ( AllowOnShelfHolds ) %]
> - <li><a class="reserve" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% biblionumber %]">Place Hold</a></li>
> - [% ELSE %]
> - [% IF ( ItemsIssued ) %]
> - <li><a class="reserve" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% biblionumber %]">Place Hold</a></li>
> - [% END %]
> - [% END %]
> - [% END %]
> + <li><a class="reserve" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% biblionumber %]">Place Hold</a></li>
> + [% END %]
> [% END %]
> [% END %]
> <li><a class="print" href="#" onclick="window.print();">Print</a></li>
> diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results-grouped.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results-grouped.tt
> index 9e1b855..e08f7f9 100644
> --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results-grouped.tt
> +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results-grouped.tt
> @@ -260,13 +260,7 @@ function highlightOn() {
> [% IF ( RequestOnOpac ) %]
> [% UNLESS ( GROUP_RESULT.norequests ) %]
> [% IF ( opacuserlogin ) %]
> - [% IF ( AllowOnShelfHolds ) %]
> <a class="hold" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% GROUP_RESULT.biblionumber %]">Place Hold</a><!-- add back when available 0 holds in queue-->
> - [% ELSE %]
> - [% IF ( GROUP_RESULT.itemsissued ) %]
> - <a class="hold" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% GROUP_RESULT.biblionumber %]">Place Hold</a><!-- add back when available 0 holds in queue-->
> - [% END %]
> - [% END %]
> [% END %]
> [% END %]
> [% END %]
> diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt
> index 798e0d8..2256b3e 100755
> --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt
> +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt
> @@ -510,13 +510,7 @@ $(document).ready(function(){
> [% IF ( RequestOnOpac ) %]
> [% UNLESS ( SEARCH_RESULT.norequests ) %]
> [% IF ( opacuserlogin ) %]
> - [% IF ( AllowOnShelfHolds ) %]
> - <a class="hold" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Place Hold</a><!-- add back when available 0 holds in queue-->
> - [% ELSE %]
> - [% IF ( SEARCH_RESULT.itemsissued ) %]
> - <a class="hold" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Place Hold</a><!-- add back when available 0 holds in queue-->
> - [% END %]
> - [% END %]
> + <a class="hold" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Place Hold</a><!-- add back when available 0 holds in queue-->
> [% END %]
> [% END %]
> [% END %]
> diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt
> index 391037f..b9e2ed4 100644
> --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt
> +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt
> @@ -308,13 +308,7 @@ $(function() {
> [% IF ( RequestOnOpac ) %]
> [% UNLESS ( itemsloo.norequests ) %]
> [% IF ( opacuserlogin ) %]
> - [% IF ( AllowOnShelfHolds ) %]
> <a class="hold" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% itemsloo.biblionumber %]">Place Hold</a><!-- add back when available 0 holds in queue-->
> - [% ELSE %]
> - [% IF ( itemsloo.itemsissued ) %]
> - <a class="hold" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% itemsloo.biblionumber %]">Place Hold</a><!-- add back when available 0 holds in queue-->
> - [% END %]
> - [% END %]
> [% END %]
> [% END %]
> [% END %]
> diff --git a/opac/opac-ISBDdetail.pl b/opac/opac-ISBDdetail.pl
> index c80d41c..d978357 100755
> --- a/opac/opac-ISBDdetail.pl
> +++ b/opac/opac-ISBDdetail.pl
> @@ -69,7 +69,6 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
>
> my $biblionumber = $query->param('biblionumber');
>
> -$template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
> $template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) );
>
> my $marcflavour = C4::Context->preference("marcflavour");
> @@ -152,7 +151,6 @@ foreach ( @$reviews ) {
>
> $template->param(
> RequestOnOpac => C4::Context->preference("RequestOnOpac"),
> - AllowOnShelfHolds => C4::Context->preference('AllowOnShelfHolds'),
> norequests => $norequests,
> ISBD => $res,
> biblionumber => $biblionumber,
> diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl
> index ffa0a6d..476fe50 100755
> --- a/opac/opac-MARCdetail.pl
> +++ b/opac/opac-MARCdetail.pl
> @@ -81,7 +81,6 @@ $template->param(
> bibliotitle => $biblio->{title},
> );
>
> -$template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
> $template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) );
>
> # adding the $RequestOnOpac param
> diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl
> index f82dde2..8111e9d 100755
> --- a/opac/opac-detail.pl
> +++ b/opac/opac-detail.pl
> @@ -347,8 +347,6 @@ if ($session->param('busc')) {
> }
>
>
> -
> -$template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
> $template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) );
>
> my $record = GetMarcBiblio($biblionumber);
> diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl
> index b2144a9..3e573fc 100755
> --- a/opac/opac-reserve.pl
> +++ b/opac/opac-reserve.pl
> @@ -471,7 +471,7 @@ foreach my $biblioNum (@biblionumbers) {
> $policy_holdallowed = 0;
> }
>
> - if (IsAvailableForItemLevelRequest($itemNum) and $policy_holdallowed and CanItemBeReserved($borrowernumber,$itemNum) and ($itemLoopIter->{already_reserved} ne 1)) {
> + if (IsAvailableForItemLevelRequest($itemNum,$borr->{'borrowernumber'},$itemInfo->{'homebranch'}) and $policy_holdallowed and CanItemBeReserved($borrowernumber,$itemNum) and !$itemLoopIter->{already_reserved}) {
> $itemLoopIter->{available} = 1;
> $numCopiesAvailable++;
> }
> diff --git a/opac/opac-search.pl b/opac/opac-search.pl
> index aba23a8..081bc81 100755
> --- a/opac/opac-search.pl
> +++ b/opac/opac-search.pl
> @@ -100,7 +100,7 @@ if (C4::Context->preference("marcflavour") eq "UNIMARC" ) {
> elsif (C4::Context->preference("marcflavour") eq "MARC21" ) {
> $template->param('usmarc' => 1);
> }
> -$template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
> +
> $template->param( 'OPACNoResultsFound' => C4::Context->preference('OPACNoResultsFound') );
>
> if (C4::Context->preference('BakerTaylorEnabled')) {
> --
> 1.6.5
>
> _______________________________________________
> Koha-patches mailing list
> Koha-patches at lists.koha-community.org
> http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches
> website : http://www.koha-community.org/
> git : http://git.koha-community.org/
> bugs : http://bugs.koha-community.org/
More information about the Koha-patches
mailing list