View | Details | Raw Unified | Return to bug 5786
Collapse All | Expand All

(-)a/C4/Auth.pm (-1 lines)
Lines 412-418 sub get_template_and_user { Link Here
412
            OPACAmazonReviews         => C4::Context->preference("OPACAmazonReviews"),
412
            OPACAmazonReviews         => C4::Context->preference("OPACAmazonReviews"),
413
            OPACFRBRizeEditions       => C4::Context->preference("OPACFRBRizeEditions"),
413
            OPACFRBRizeEditions       => C4::Context->preference("OPACFRBRizeEditions"),
414
            OpacHighlightedWords       => C4::Context->preference("OpacHighlightedWords"),
414
            OpacHighlightedWords       => C4::Context->preference("OpacHighlightedWords"),
415
            OPACItemHolds             => C4::Context->preference("OPACItemHolds"),
416
            OPACShelfBrowser          => "". C4::Context->preference("OPACShelfBrowser"),
415
            OPACShelfBrowser          => "". C4::Context->preference("OPACShelfBrowser"),
417
            OpacShowRecentComments    => C4::Context->preference("OpacShowRecentComments"),
416
            OpacShowRecentComments    => C4::Context->preference("OpacShowRecentComments"),
418
            OPACURLOpenInNewWindow    => "" . C4::Context->preference("OPACURLOpenInNewWindow"),
417
            OPACURLOpenInNewWindow    => "" . C4::Context->preference("OPACURLOpenInNewWindow"),
(-)a/C4/ILSDI/Services.pm (-1 / +1 lines)
Lines 485-491 sub GetServices { Link Here
485
    my $canbookbereserved = CanBookBeReserved( $borrower, $biblionumber );
485
    my $canbookbereserved = CanBookBeReserved( $borrower, $biblionumber );
486
    if ($canbookbereserved) {
486
    if ($canbookbereserved) {
487
        push @availablefor, 'title level hold';
487
        push @availablefor, 'title level hold';
488
        my $canitembereserved = IsAvailableForItemLevelRequest($itemnumber);
488
        my $canitembereserved = IsAvailableForItemLevelRequest($item, $borrower);
489
        if ($canitembereserved) {
489
        if ($canitembereserved) {
490
            push @availablefor, 'item level hold';
490
            push @availablefor, 'item level hold';
491
        }
491
        }
(-)a/C4/Items.pm (+2 lines)
Lines 164-169 sub GetItem { Link Here
164
        ($data->{'serialseq'} , $data->{'publisheddate'}) = $ssth->fetchrow_array();
164
        ($data->{'serialseq'} , $data->{'publisheddate'}) = $ssth->fetchrow_array();
165
    }
165
    }
166
	#if we don't have an items.itype, use biblioitems.itemtype.
166
	#if we don't have an items.itype, use biblioitems.itemtype.
167
    # FIXME this should respect the itypes systempreference
168
    # if (C4::Context->preference('item-level_itypes')) {
167
	if( ! $data->{'itype'} ) {
169
	if( ! $data->{'itype'} ) {
168
		my $sth = $dbh->prepare("SELECT itemtype FROM biblioitems  WHERE biblionumber = ?");
170
		my $sth = $dbh->prepare("SELECT itemtype FROM biblioitems  WHERE biblionumber = ?");
169
		$sth->execute($data->{'biblionumber'});
171
		$sth->execute($data->{'biblionumber'});
(-)a/C4/Reserves.pm (-37 / +118 lines)
Lines 123-128 BEGIN { Link Here
123
        &AutoUnsuspendReserves
123
        &AutoUnsuspendReserves
124
124
125
        &IsAvailableForItemLevelRequest
125
        &IsAvailableForItemLevelRequest
126
127
        &OPACItemHoldsAllowed
126
        
128
        
127
        &AlterPriority
129
        &AlterPriority
128
        &ToggleLowestPriority
130
        &ToggleLowestPriority
Lines 489-495 sub CanItemBeReserved{ Link Here
489
    if(my $rowcount = $sthcount->fetchrow_hashref()){
491
    if(my $rowcount = $sthcount->fetchrow_hashref()){
490
        $reservecount = $rowcount->{count};
492
        $reservecount = $rowcount->{count};
491
    }
493
    }
492
    
493
    # we check if it's ok or not
494
    # we check if it's ok or not
494
    if( $reservecount < $allowedreserves ){
495
    if( $reservecount < $allowedreserves ){
495
        return 1;
496
        return 1;
Lines 1375-1381 sub GetReserveInfo { Link Here
1375
1376
1376
=head2 IsAvailableForItemLevelRequest
1377
=head2 IsAvailableForItemLevelRequest
1377
1378
1378
  my $is_available = IsAvailableForItemLevelRequest($itemnumber);
1379
  my $is_available = IsAvailableForItemLevelRequest($item_record,$borrower_record);
1379
1380
1380
Checks whether a given item record is available for an
1381
Checks whether a given item record is available for an
1381
item-level hold request.  An item is available if
1382
item-level hold request.  An item is available if
Lines 1385-1396 item-level hold request. An item is available if Link Here
1385
* it is not withdrawn AND 
1386
* it is not withdrawn AND 
1386
* does not have a not for loan value > 0
1387
* does not have a not for loan value > 0
1387
1388
1388
Whether or not the item is currently on loan is 
1389
Need to check the issuingrules onshelfholds column,
1389
also checked - if the AllowOnShelfHolds system preference
1390
if this is set items on the shelf can be placed on hold
1390
is ON, an item can be requested even if it is currently
1391
on loan to somebody else.  If the system preference
1392
is OFF, an item that is currently checked out cannot
1393
be the target of an item-level hold request.
1394
1391
1395
Note that IsAvailableForItemLevelRequest() does not
1392
Note that IsAvailableForItemLevelRequest() does not
1396
check if the staff operator is authorized to place
1393
check if the staff operator is authorized to place
Lines 1401-1450 and canreservefromotherbranches. Link Here
1401
=cut
1398
=cut
1402
1399
1403
sub IsAvailableForItemLevelRequest {
1400
sub IsAvailableForItemLevelRequest {
1404
    my $itemnumber = shift;
1401
    my $item = shift;
1405
   
1402
    my $borrower = shift;
1406
    my $item = GetItem($itemnumber);
1407
1403
1404
    my $dbh = C4::Context->dbh;
1408
    # must check the notforloan setting of the itemtype
1405
    # must check the notforloan setting of the itemtype
1409
    # FIXME - a lot of places in the code do this
1406
    # FIXME - a lot of places in the code do this
1410
    #         or something similar - need to be
1407
    #         or something similar - need to be
1411
    #         consolidated
1408
    #         consolidated
1412
    my $dbh = C4::Context->dbh;
1409
    my $itype;
1413
    my $notforloan_query;
1414
    if (C4::Context->preference('item-level_itypes')) {
1410
    if (C4::Context->preference('item-level_itypes')) {
1415
        $notforloan_query = "SELECT itemtypes.notforloan
1411
	# We cant trust GetItem to honour the syspref, so safest to do it ourselves
1416
                             FROM items
1412
	# When GetItem is fixed, we can remove this
1417
                             JOIN itemtypes ON (itemtypes.itemtype = items.itype)
1413
	$itype = $item->{itype};
1418
                             WHERE itemnumber = ?";
1419
    } else {
1420
        $notforloan_query = "SELECT itemtypes.notforloan
1421
                             FROM items
1422
                             JOIN biblioitems USING (biblioitemnumber)
1423
                             JOIN itemtypes USING (itemtype)
1424
                             WHERE itemnumber = ?";
1425
    }
1414
    }
1426
    my $sth = $dbh->prepare($notforloan_query);
1415
    else {
1427
    $sth->execute($itemnumber);
1416
        # XXX This is a bit dodgy. It relies on biblio itemtype column having different name.
1428
    my $notforloan_per_itemtype = 0;
1417
        # So if we already have a biblioitems join when calling this function,
1429
    if (my ($notforloan) = $sth->fetchrow_array) {
1418
        # we don't need to access the database again
1430
        $notforloan_per_itemtype = 1 if $notforloan;
1419
	$itype = $item->{itemtype};
1420
    }
1421
    unless ($itype) {
1422
	my $query = "SELECT itemtype FROM biblioitems WHERE biblioitemnumber = ? ";
1423
	my $sth = $dbh->prepare($query);
1424
	$sth->execute($item->{biblioitemnumber});
1425
	if (my $data = $sth->fetchrow_hashref()){
1426
	    $itype = $data->{itemtype};
1427
	}
1431
    }
1428
    }
1432
1429
1433
    my $available_per_item = 1;
1430
    my $notforloan_per_itemtype
1434
    $available_per_item = 0 if $item->{itemlost} or
1431
      = $dbh->selectrow_array("SELECT notforloan FROM itemtypes WHERE itemtype = ?",
1435
                               ( $item->{notforloan} > 0 ) or
1432
                              undef, $itype);
1436
                               ($item->{damaged} and not C4::Context->preference('AllowHoldsOnDamagedItems')) or
1437
                               $item->{wthdrawn} or
1438
                               $notforloan_per_itemtype;
1439
1433
1434
    return 0 if
1435
        $notforloan_per_itemtype ||
1436
        $item->{itemlost}        ||
1437
        $item->{notforloan} > 0  ||
1438
        $item->{wthdrawn}        ||
1439
        ($item->{damaged} && !C4::Context->preference('AllowHoldsOnDamagedItems'));
1440
1440
1441
    if (C4::Context->preference('AllowOnShelfHolds')) {
1441
1442
        return $available_per_item;
1442
    if (OnShelfHoldsAllowed($itype,$borrower->{categorycode},$item->{holdingbranch})) {
1443
        return 1;
1443
    } else {
1444
    } else {
1444
        return ($available_per_item and ($item->{onloan} or GetReserveStatus($itemnumber) eq "W")); 
1445
        return $item->{onloan} || GetReserveStatus($item->{itemnumber}) eq "W";
1445
    }
1446
    }
1446
}
1447
}
1447
1448
1449
=head2 OnShelfHoldsAllowed
1450
1451
  OnShelfHoldsAllowed($itemtype,$borrowercategory,$branchcode);
1452
1453
Checks issuingrules, using the borrowers categorycode, the itemtype, and branchcode to see if onshelf
1454
holds are allowed, returns true if so.
1455
1456
=cut
1457
1458
sub OnShelfHoldsAllowed {
1459
    my ($itype,$borrowercategory,$branchcode) = @_;
1460
1461
    my $query = "SELECT onshelfholds FROM issuingrules WHERE
1462
          (issuingrules.categorycode = ? OR issuingrules.categorycode = '*')
1463
        AND
1464
          (issuingrules.itemtype = ? OR issuingrules.itemtype = '*')
1465
        AND
1466
          (issuingrules.branchcode = ? OR issuingrules.branchcode = '*')
1467
        ORDER BY
1468
          issuingrules.categorycode desc,
1469
          issuingrules.itemtype desc,
1470
          issuingrules.branchcode desc
1471
       LIMIT 1";
1472
    my $dbh = C4::Context->dbh;
1473
    my $onshelfholds = $dbh->selectrow_array($query, undef, $borrowercategory,$itype,$branchcode);
1474
    return $onshelfholds;
1475
}
1476
1448
=head2 AlterPriority
1477
=head2 AlterPriority
1449
1478
1450
  AlterPriority( $where, $borrowernumber, $biblionumber, $reservedate );
1479
  AlterPriority( $where, $borrowernumber, $biblionumber, $reservedate );
Lines 1967-1972 sub _ShiftPriorityByDateAndPriority { Link Here
1967
    return $new_priority;  # so the caller knows what priority they wind up receiving
1996
    return $new_priority;  # so the caller knows what priority they wind up receiving
1968
}
1997
}
1969
1998
1999
=head2 OPACItemHoldsAllowed
2000
2001
  OPACItemHoldsAllowed($item_record,$borrower_record);
2002
2003
Checks issuingrules, using the borrowers categorycode, the itemtype, and branchcode to see
2004
if specific item holds are allowed, returns true if so.
2005
2006
=cut
2007
2008
sub OPACItemHoldsAllowed {
2009
    my ($item,$borrower) = @_;
2010
2011
    my $branchcode = $item->{homebranch} or die "No homebranch";
2012
    my $itype;
2013
    my $dbh = C4::Context->dbh;
2014
    if (C4::Context->preference('item-level_itypes')) {
2015
       # We cant trust GetItem to honour the syspref, so safest to do it ourselves
2016
       # When GetItem is fixed, we can remove this
2017
       $itype = $item->{itype};
2018
    }
2019
    else {
2020
       my $query = "SELECT itemtype FROM biblioitems WHERE biblioitemnumber = ? ";
2021
       my $sth = $dbh->prepare($query);
2022
       $sth->execute($item->{biblioitemnumber});
2023
       if (my $data = $sth->fetchrow_hashref()){
2024
           $itype = $data->{itemtype};
2025
       }
2026
    }
2027
2028
    my $query = "SELECT opacitemholds,categorycode,itemtype,branchcode FROM issuingrules WHERE
2029
          (issuingrules.categorycode = ? OR issuingrules.categorycode = '*')
2030
        AND
2031
          (issuingrules.itemtype = ? OR issuingrules.itemtype = '*')
2032
        AND
2033
          (issuingrules.branchcode = ? OR issuingrules.branchcode = '*')
2034
        ORDER BY
2035
          issuingrules.categorycode desc,
2036
          issuingrules.itemtype desc,
2037
          issuingrules.branchcode desc
2038
       LIMIT 1";
2039
    my $dbh = C4::Context->dbh;
2040
    my $sth = $dbh->prepare($query);
2041
    $sth->execute($borrower->{categorycode},$itype,$branchcode);
2042
    my $data = $sth->fetchrow_hashref;
2043
    if ($data->{opacitemholds}){
2044
       return 1;
2045
    }
2046
    else {
2047
       return 0;
2048
    }
2049
}
2050
1970
=head2 MoveReserve
2051
=head2 MoveReserve
1971
2052
1972
  MoveReserve( $itemnumber, $borrowernumber, $cancelreserve )
2053
  MoveReserve( $itemnumber, $borrowernumber, $cancelreserve )
(-)a/C4/VirtualShelves/Page.pm (-1 lines)
Lines 238-244 sub shelfpage { Link Here
238
            # explicitly fetch this shelf
238
            # explicitly fetch this shelf
239
            my ($shelfnumber2,$shelfname,$owner,$category,$sorton) = GetShelf($shelfnumber);
239
            my ($shelfnumber2,$shelfname,$owner,$category,$sorton) = GetShelf($shelfnumber);
240
240
241
            $template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
242
            if (C4::Context->preference('TagsEnabled')) {
241
            if (C4::Context->preference('TagsEnabled')) {
243
                $template->param(TagsEnabled => 1);
242
                $template->param(TagsEnabled => 1);
244
                    foreach (qw(TagsShowOnList TagsInputOnList)) {
243
                    foreach (qw(TagsShowOnList TagsInputOnList)) {
(-)a/admin/smart-rules.pl (-8 / +11 lines)
Lines 101-112 elsif ($op eq 'delete-branch-item') { Link Here
101
# save the values entered
101
# save the values entered
102
elsif ($op eq 'add') {
102
elsif ($op eq 'add') {
103
    my $sth_search = $dbh->prepare('SELECT COUNT(*) AS total FROM issuingrules WHERE branchcode=? AND categorycode=? AND itemtype=?');
103
    my $sth_search = $dbh->prepare('SELECT COUNT(*) AS total FROM issuingrules WHERE branchcode=? AND categorycode=? AND itemtype=?');
104
    my $sth_insert = $dbh->prepare('INSERT INTO issuingrules (branchcode, categorycode, itemtype, maxissueqty, renewalsallowed, reservesallowed, issuelength, lengthunit, hardduedate, hardduedatecompare, fine, finedays, firstremind, chargeperiod,rentaldiscount, overduefinescap) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)');
104
    my $sth_insert = $dbh->prepare('INSERT INTO issuingrules (branchcode, categorycode, itemtype, maxissueqty, renewalsallowed, reservesallowed, issuelength, lengthunit, hardduedate, hardduedatecompare, fine, finedays, firstremind, chargeperiod,rentaldiscount, onshelfholds, opacitemholds, reservesmaxpickupdelay, overduefinescap) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)');
105
    my $sth_update=$dbh->prepare("UPDATE issuingrules SET fine=?, finedays=?, firstremind=?, chargeperiod=?, maxissueqty=?, renewalsallowed=?, reservesallowed=?, issuelength=?, lengthunit = ?, hardduedate=?, hardduedatecompare=?, rentaldiscount=?, overduefinescap=?  WHERE branchcode=? AND categorycode=? AND itemtype=?");
105
    my $sth_update=$dbh->prepare("UPDATE issuingrules SET fine=?, finedays=?, firstremind=?, chargeperiod=?, maxissueqty=?, renewalsallowed=?, reservesallowed=?, issuelength=?, lengthunit=?, hardduedate=?, hardduedatecompare=?, rentaldiscount=?, onshelfholds=?, opacitemholds=?, reservesmaxpickupdelay=?, overduefinescap=? WHERE branchcode=? AND categorycode=? AND itemtype=?");
106
    
106
    
107
    my $br = $branch; # branch
107
    my $br = $branch; # branch
108
    my $bor  = $input->param('categorycode'); # borrower category
108
    my $bor  = $input->param('categorycode'); # borrower category
109
    my $cat  = $input->param('itemtype');     # item type
109
    my $itemtype  = $input->param('itemtype');     # item type
110
    my $fine = $input->param('fine');
110
    my $fine = $input->param('fine');
111
    my $finedays     = $input->param('finedays');
111
    my $finedays     = $input->param('finedays');
112
    my $firstremind  = $input->param('firstremind');
112
    my $firstremind  = $input->param('firstremind');
Lines 114-119 elsif ($op eq 'add') { Link Here
114
    my $maxissueqty  = $input->param('maxissueqty');
114
    my $maxissueqty  = $input->param('maxissueqty');
115
    my $renewalsallowed  = $input->param('renewalsallowed');
115
    my $renewalsallowed  = $input->param('renewalsallowed');
116
    my $reservesallowed  = $input->param('reservesallowed');
116
    my $reservesallowed  = $input->param('reservesallowed');
117
    my $onshelfholds     = $input->param('onshelfholds') || 0;
117
    $maxissueqty =~ s/\s//g;
118
    $maxissueqty =~ s/\s//g;
118
    $maxissueqty = undef if $maxissueqty !~ /^\d+/;
119
    $maxissueqty = undef if $maxissueqty !~ /^\d+/;
119
    my $issuelength  = $input->param('issuelength');
120
    my $issuelength  = $input->param('issuelength');
Lines 122-136 elsif ($op eq 'add') { Link Here
122
    $hardduedate = format_date_in_iso($hardduedate);
123
    $hardduedate = format_date_in_iso($hardduedate);
123
    my $hardduedatecompare = $input->param('hardduedatecompare');
124
    my $hardduedatecompare = $input->param('hardduedatecompare');
124
    my $rentaldiscount = $input->param('rentaldiscount');
125
    my $rentaldiscount = $input->param('rentaldiscount');
126
    my $reservesmaxpickupdelay = $input->param('reservesmaxpickupdelay');
127
    my $opacitemholds = $input->param('opacitemholds') || 0;
125
    my $overduefinescap = $input->param('overduefinescap') || undef;
128
    my $overduefinescap = $input->param('overduefinescap') || undef;
126
    $debug and warn "Adding $br, $bor, $cat, $fine, $maxissueqty";
129
    $debug and warn "Adding $br, $bor, $itemtype, $fine, $maxissueqty";
127
130
128
    $sth_search->execute($br,$bor,$cat);
131
    $sth_search->execute($br,$bor,$itemtype);
129
    my $res = $sth_search->fetchrow_hashref();
132
    my $res = $sth_search->fetchrow_hashref();
130
    if ($res->{total}) {
133
    if ($res->{total}) {
131
        $sth_update->execute($fine, $finedays,$firstremind, $chargeperiod, $maxissueqty, $renewalsallowed,$reservesallowed, $issuelength,$lengthunit, $hardduedate,$hardduedatecompare,$rentaldiscount,$overduefinescap, $br,$bor,$cat);
134
        $sth_update->execute($fine, $finedays,$firstremind, $chargeperiod, $maxissueqty, $renewalsallowed,$reservesallowed, $issuelength,$lengthunit, $hardduedate,$hardduedatecompare,$rentaldiscount, $onshelfholds, $opacitemholds, $reservesmaxpickupdelay, $overduefinescap, $br,$bor,$itemtype);
132
    } else {
135
    } else {
133
        $sth_insert->execute($br,$bor,$cat,$maxissueqty,$renewalsallowed,$reservesallowed,$issuelength,$lengthunit,$hardduedate,$hardduedatecompare,$fine,$finedays,$firstremind,$chargeperiod,$rentaldiscount,$overduefinescap);
136
        $sth_insert->execute($br,$bor,$itemtype,$maxissueqty,$renewalsallowed,$reservesallowed,$issuelength,$lengthunit,$hardduedate,$hardduedatecompare,$fine,$finedays,$firstremind,$chargeperiod,$rentaldiscount,$onshelfholds,$opacitemholds,$reservesmaxpickupdelay,$overduefinescap);
134
    }
137
    }
135
} 
138
} 
136
elsif ($op eq "set-branch-defaults") {
139
elsif ($op eq "set-branch-defaults") {
Lines 385-391 while (my $row = $sth2->fetchrow_hashref) { Link Here
385
    $row->{'humancategorycode'} ||= $row->{'categorycode'};
388
    $row->{'humancategorycode'} ||= $row->{'categorycode'};
386
    $row->{'default_humancategorycode'} = 1 if $row->{'humancategorycode'} eq '*';
389
    $row->{'default_humancategorycode'} = 1 if $row->{'humancategorycode'} eq '*';
387
    $row->{'fine'} = sprintf('%.2f', $row->{'fine'});
390
    $row->{'fine'} = sprintf('%.2f', $row->{'fine'});
388
    if ($row->{'hardduedate'} ne '0000-00-00') {
391
    if ($row->{'hardduedate'} && $row->{'hardduedate'} ne '0000-00-00') {
389
       $row->{'hardduedate'} = format_date( $row->{'hardduedate'});
392
       $row->{'hardduedate'} = format_date( $row->{'hardduedate'});
390
       $row->{'hardduedatebefore'} = 1 if ($row->{'hardduedatecompare'} == -1);
393
       $row->{'hardduedatebefore'} = 1 if ($row->{'hardduedatecompare'} == -1);
391
       $row->{'hardduedateexact'} = 1 if ($row->{'hardduedatecompare'} ==  0);
394
       $row->{'hardduedateexact'} = 1 if ($row->{'hardduedatecompare'} ==  0);
(-)a/admin/systempreferences.pl (-2 lines)
Lines 186-192 $tabsysprefs{HomeOrHoldingBranch} = "Circulation"; Link Here
186
$tabsysprefs{HomeOrHoldingBranchReturn}      = "Circulation";
186
$tabsysprefs{HomeOrHoldingBranchReturn}      = "Circulation";
187
$tabsysprefs{RandomizeHoldsQueueWeight}      = "Circulation";
187
$tabsysprefs{RandomizeHoldsQueueWeight}      = "Circulation";
188
$tabsysprefs{StaticHoldsQueueWeight}         = "Circulation";
188
$tabsysprefs{StaticHoldsQueueWeight}         = "Circulation";
189
$tabsysprefs{AllowOnShelfHolds}              = "Circulation";
190
$tabsysprefs{AllowHoldsOnDamagedItems}       = "Circulation";
189
$tabsysprefs{AllowHoldsOnDamagedItems}       = "Circulation";
191
$tabsysprefs{UseBranchTransferLimits}        = "Circulation";
190
$tabsysprefs{UseBranchTransferLimits}        = "Circulation";
192
$tabsysprefs{AllowHoldPolicyOverride}        = "Circulation";
191
$tabsysprefs{AllowHoldPolicyOverride}        = "Circulation";
Lines 375-381 $tabsysprefs{suggestion} = "OPAC"; Link Here
375
$tabsysprefs{OpacTopissue}         = "OPAC";
374
$tabsysprefs{OpacTopissue}         = "OPAC";
376
$tabsysprefs{OpacBrowser}          = "OPAC";
375
$tabsysprefs{OpacBrowser}          = "OPAC";
377
$tabsysprefs{OpacRenewalAllowed}   = "OPAC";
376
$tabsysprefs{OpacRenewalAllowed}   = "OPAC";
378
$tabsysprefs{OPACItemHolds}        = "OPAC";
379
$tabsysprefs{OPACGroupResults}     = "OPAC";
377
$tabsysprefs{OPACGroupResults}     = "OPAC";
380
$tabsysprefs{XSLTDetailsDisplay}   = "OPAC";
378
$tabsysprefs{XSLTDetailsDisplay}   = "OPAC";
381
$tabsysprefs{XSLTResultsDisplay}   = "OPAC";
379
$tabsysprefs{XSLTResultsDisplay}   = "OPAC";
(-)a/installer/data/mysql/it-IT/necessari/system_preferences.sql (-1 lines)
Lines 17-23 Link Here
17
-- 51 Franklin Street' WHERE variable = ' Fifth Floor' WHERE variable = ' Boston' WHERE variable = ' MA 02110-1301 USA.
17
-- 51 Franklin Street' WHERE variable = ' Fifth Floor' WHERE variable = ' Boston' WHERE variable = ' MA 02110-1301 USA.
18
18
19
UPDATE systempreferences SET value = 'cataloguing' WHERE variable = 'AcqCreateItem';
19
UPDATE systempreferences SET value = 'cataloguing' WHERE variable = 'AcqCreateItem';
20
UPDATE systempreferences SET value = '1' WHERE variable = 'AllowOnShelfHolds';
21
UPDATE systempreferences SET value = '1' WHERE variable = 'AllowRenewalLimitOverride';
20
UPDATE systempreferences SET value = '1' WHERE variable = 'AllowRenewalLimitOverride';
22
UPDATE systempreferences SET value = 'annual' WHERE variable = 'autoBarcode';
21
UPDATE systempreferences SET value = 'annual' WHERE variable = 'autoBarcode';
23
UPDATE systempreferences SET value = 'email' WHERE variable = 'AutoEmailPrimaryAddress';
22
UPDATE systempreferences SET value = 'email' WHERE variable = 'AutoEmailPrimaryAddress';
(-)a/installer/data/mysql/kohastructure.sql (+3 lines)
Lines 999-1004 CREATE TABLE `issuingrules` ( -- circulation and fine rules Link Here
999
  `reservesallowed` smallint(6) NOT NULL default "0", -- how many holds are allowed
999
  `reservesallowed` smallint(6) NOT NULL default "0", -- how many holds are allowed
1000
  `branchcode` varchar(10) NOT NULL default '', -- the branch this rule is for (branches.branchcode)
1000
  `branchcode` varchar(10) NOT NULL default '', -- the branch this rule is for (branches.branchcode)
1001
  overduefinescap decimal default NULL, -- the maximum amount of an overdue fine
1001
  overduefinescap decimal default NULL, -- the maximum amount of an overdue fine
1002
  onshelfholds tinyint(1) NOT NULL default 0, -- allow holds for items that are on shelf
1003
  opacitemholds tinyint(1) NOT NULL default "0", -- allow opac users to place specific items on hold
1004
  reservesmaxpickupdelay smallint(6) default NULL, -- max pickup delay
1002
  PRIMARY KEY  (`branchcode`,`categorycode`,`itemtype`),
1005
  PRIMARY KEY  (`branchcode`,`categorycode`,`itemtype`),
1003
  KEY `categorycode` (`categorycode`),
1006
  KEY `categorycode` (`categorycode`),
1004
  KEY `itemtype` (`itemtype`)
1007
  KEY `itemtype` (`itemtype`)
(-)a/installer/data/mysql/sysprefs.sql (-2 lines)
Lines 193-199 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES Link Here
193
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OAI-PMH:archiveID','KOHA-OAI-TEST','OAI-PMH archive identification',NULL,'Free');
193
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OAI-PMH:archiveID','KOHA-OAI-TEST','OAI-PMH archive identification',NULL,'Free');
194
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OAI-PMH:MaxCount','50','OAI-PMH maximum number of records by answer to ListRecords and ListIdentifiers queries',NULL,'Integer');
194
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OAI-PMH:MaxCount','50','OAI-PMH maximum number of records by answer to ListRecords and ListIdentifiers queries',NULL,'Integer');
195
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OAI-PMH:ConfFile','','If empty, Koha OAI Server operates in normal mode, otherwise it operates in extended mode.',NULL,'File');
195
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OAI-PMH:ConfFile','','If empty, Koha OAI Server operates in normal mode, otherwise it operates in extended mode.',NULL,'File');
196
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACItemHolds','1','Allow OPAC users to place hold on specific items. If OFF, users can only request next available copy.','','YesNo');
197
196
198
INSERT INTO `systempreferences` (variable, value,options,type, explanation) VALUES ('AddPatronLists','categorycode','categorycode|category_type','Choice','Allow user to choose what list to pick up from when adding patrons');
197
INSERT INTO `systempreferences` (variable, value,options,type, explanation) VALUES ('AddPatronLists','categorycode','categorycode|category_type','Choice','Allow user to choose what list to pick up from when adding patrons');
199
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ExtendedPatronAttributes','0','Use extended patron IDs and attributes',NULL,'YesNo');
198
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ExtendedPatronAttributes','0','Use extended patron IDs and attributes',NULL,'YesNo');
Lines 226-232 INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES Link Here
226
('XSLTDetailsDisplay','','','Enable XSL stylesheet control over details page display on intranet','Free'),
225
('XSLTDetailsDisplay','','','Enable XSL stylesheet control over details page display on intranet','Free'),
227
('XSLTResultsDisplay','','','Enable XSL stylesheet control over results page display on intranet','Free');
226
('XSLTResultsDisplay','','','Enable XSL stylesheet control over results page display on intranet','Free');
228
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');
227
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');
229
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');
230
INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('AllowHoldsOnDamagedItems', '1', '', 'Allow hold requests to be placed on damaged items', 'YesNo');
228
INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('AllowHoldsOnDamagedItems', '1', '', 'Allow hold requests to be placed on damaged items', 'YesNo');
231
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');
229
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');
232
-- FIXME: add FrameworksLoaded, noOPACUserLogin?
230
-- FIXME: add FrameworksLoaded, noOPACUserLogin?
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +35 lines)
Lines 2092-2098 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
2092
    $dbh->do("UPDATE `systempreferences` SET options='10' WHERE variable='globalDueDate'");
2092
    $dbh->do("UPDATE `systempreferences` SET options='10' WHERE variable='globalDueDate'");
2093
    $dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='numSearchResults'");
2093
    $dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='numSearchResults'");
2094
    $dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='OPACnumSearchResults'");
2094
    $dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='OPACnumSearchResults'");
2095
    $dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='ReservesMaxPickupDelay'");
2096
    $dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='TransfersMaxDaysWarning'");
2095
    $dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='TransfersMaxDaysWarning'");
2097
    $dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='StaticHoldsQueueWeight'");
2096
    $dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='StaticHoldsQueueWeight'");
2098
    $dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='holdCancelLength'");
2097
    $dbh->do("UPDATE `systempreferences` SET type='Integer' WHERE variable='holdCancelLength'");
Lines 5566-5571 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
5566
    SetVersion ($DBversion);
5565
    SetVersion ($DBversion);
5567
}
5566
}
5568
5567
5568
5569
5570
$DBversion = '3.09.00.XXX';
5571
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
5572
    # First create the column
5573
    $dbh->do("ALTER TABLE issuingrules ADD onshelfholds tinyint(1) default 0");
5574
    # Now update the column
5575
    if (C4::Context->preference("AllowOnShelfHolds")){
5576
	      # Pref is on, set allow for all rules
5577
	      $dbh->do("UPDATE issuingrules SET onshelfholds=1");
5578
    } else {
5579
        # If the preference is not set, leave off
5580
	      $dbh->do("UPDATE issuingrules SET onshelfholds=0");
5581
    }
5582
    $dbh->do("ALTER TABLE issuingrules MODIFY onshelfholds tinyint(1) default 0 NOT NULL");
5583
    # Remove from the systempreferences table
5584
    $dbh->do("DELETE FROM systempreferences WHERE variable = 'AllowOnShelfHolds'");
5585
5586
    # First create the column
5587
    $dbh->do("ALTER TABLE issuingrules ADD opacitemholds tinyint(1) DEFAULT 0");
5588
    # Now update the column
5589
    if (C4::Context->preference("OPACItemHolds")){
5590
       # Pref is on, set allow for all rules
5591
       $dbh->do("UPDATE issuingrules SET opacitemholds=1");
5592
    }
5593
    # If the preference is not set, leave off
5594
    # Remove from the systempreferences table
5595
    $dbh->do("DELETE FROM systempreferences WHERE variable = 'OPACItemHolds'");
5596
5597
    $dbh->do("ALTER TABLE issuingrules ADD reservesmaxpickupdelay smallint(6) DEFAULT NULL");
5598
5599
    print "Upgrade to $DBversion done (Move AllowOnShelfHolds to circulation matrix; Move OPACItemHolds system preference to circulation matrix; ReservesMaxPickupDelay circulation rule)\n";
5600
    SetVersion ($DBversion);
5601
}
5602
5569
=head1 FUNCTIONS
5603
=head1 FUNCTIONS
5570
5604
5571
=head2 TableExists($table)
5605
=head2 TableExists($table)
(-)a/installer/html-template-to-template-toolkit.pl (-1 / +1 lines)
Lines 32-38 my @globals = ("themelang","JacketImages","OPACAmazonCoverImages","GoogleJackets Link Here
32
"SyndeticsEnabled", "OpacRenewalAllowed", "item_level_itypes","noItemTypeImages",
32
"SyndeticsEnabled", "OpacRenewalAllowed", "item_level_itypes","noItemTypeImages",
33
"virtualshelves", "RequestOnOpac", "COinSinOPACResults", "OPACXSLTResultsDisplay",
33
"virtualshelves", "RequestOnOpac", "COinSinOPACResults", "OPACXSLTResultsDisplay",
34
"OPACItemsResultsDisplay", "LibraryThingForLibrariesID", "opacuserlogin", "TagsEnabled",
34
"OPACItemsResultsDisplay", "LibraryThingForLibrariesID", "opacuserlogin", "TagsEnabled",
35
"TagsShowOnList", "TagsInputOnList","loggedinusername","AllowOnShelfHolds","opacbookbag",
35
"TagsShowOnList", "TagsInputOnList","loggedinusername","opacbookbag",
36
"OPACAmazonEnabled", "SyndeticsCoverImages","using_https");
36
"OPACAmazonEnabled", "SyndeticsCoverImages","using_https");
37
37
38
# Arguments:
38
# Arguments:
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (-6 lines)
Lines 268-279 Circulation: Link Here
268
                  no: "Don't allow"
268
                  no: "Don't allow"
269
            - hold requests to be placed on damaged items.
269
            - hold requests to be placed on damaged items.
270
        -
270
        -
271
            - pref: AllowOnShelfHolds
272
              choices:
273
                  yes: Allow
274
                  no: "Don't allow"
275
            - hold requests to be placed on items that are not checked out.
276
        -
277
            - pref: AllowHoldDateInFuture
271
            - pref: AllowHoldDateInFuture
278
              choices:
272
              choices:
279
                  yes: Allow
273
                  yes: Allow
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-6 lines)
Lines 384-395 OPAC: Link Here
384
#              choices:
384
#              choices:
385
#            - If ON, enables subject cloud on OPAC
385
#            - If ON, enables subject cloud on OPAC
386
        -
386
        -
387
            - pref: OPACItemHolds
388
              choices:
389
                  yes: Allow
390
                  no: "Don't allow"
391
            - 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.
392
        -
393
            - pref: OpacRenewalAllowed
387
            - pref: OpacRenewalAllowed
394
              choices:
388
              choices:
395
                  yes: Allow
389
                  yes: Allow
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (-1 / +10 lines)
Lines 76-81 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
76
                <th>Suspension in days (day)</th>
76
                <th>Suspension in days (day)</th>
77
                <th>Renewals allowed (count)</th>
77
                <th>Renewals allowed (count)</th>
78
                <th>Holds allowed (count)</th>
78
                <th>Holds allowed (count)</th>
79
		<th>On Shelf Holds Allowed</th>
80
		<th>Allow OPAC Users to place Holds on Items</th>
81
                <th>Holds Max Pickup Delay (day)</th>
79
		<th>Rental discount (%)</th>
82
		<th>Rental discount (%)</th>
80
				<th>&nbsp;</th>
83
				<th>&nbsp;</th>
81
            </tr>
84
            </tr>
Lines 121-126 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
121
							<td>[% rule.finedays %]</td>
124
							<td>[% rule.finedays %]</td>
122
							<td>[% rule.renewalsallowed %]</td>
125
							<td>[% rule.renewalsallowed %]</td>
123
							<td>[% rule.reservesallowed %]</td>
126
							<td>[% rule.reservesallowed %]</td>
127
							<td>[% IF rule.onshelfholds %]Yes[% ELSE %]No[% END %]</td>
128
							<td>[% IF rule.opacitemholds %]Yes[% ELSE %]No[% END %]</td>
129
							<td>[% rule.reservesmaxpickupdelay %]</td>
124
							<td>[% rule.rentaldiscount %]</td>
130
							<td>[% rule.rentaldiscount %]</td>
125
							<td>
131
							<td>
126
								<a class="button" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&amp;itemtype=[% rule.itemtype %]&amp;categorycode=[% rule.categorycode %]&amp;branch=[% rule.current_branch %]">Delete</a>
132
								<a class="button" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&amp;itemtype=[% rule.itemtype %]&amp;categorycode=[% rule.categorycode %]&amp;branch=[% rule.current_branch %]">Delete</a>
Lines 167-173 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
167
                    <td><input name="finedays" size="3" /> </td>
173
                    <td><input name="finedays" size="3" /> </td>
168
                    <td><input name="renewalsallowed" size="2" /></td>
174
                    <td><input name="renewalsallowed" size="2" /></td>
169
                    <td><input name="reservesallowed" size="2" /></td>
175
                    <td><input name="reservesallowed" size="2" /></td>
170
		    <td><input name="rentaldiscount" size="2" /></td>
176
		    <td><input type="checkbox" name="onshelfholds" value="1" /></td>
177
		    <td><input type="checkbox" name="opacitemholds" value="1" /></td>
178
                    <td><input name="reservesmaxpickupdelay" size="2" /></td>
179
		            <td><input name="rentaldiscount" size="2" /></td>
171
                    <td><input type="hidden" name="branch" value="[% current_branch %]"/><input type="submit" value="Add" class="submit" /></td>
180
                    <td><input type="hidden" name="branch" value="[% current_branch %]"/><input type="submit" value="Add" class="submit" /></td>
172
                </tr>
181
                </tr>
173
            </table>
182
            </table>
(-)a/koha-tmpl/opac-tmpl/prog/en/includes/opac-detail-sidebar.inc (-7 / +1 lines)
Lines 2-14 Link Here
2
    [% UNLESS ( norequests ) %]
2
    [% UNLESS ( norequests ) %]
3
        [% IF ( opacuserlogin ) %]
3
        [% IF ( opacuserlogin ) %]
4
            [% IF ( RequestOnOpac ) %]
4
            [% IF ( RequestOnOpac ) %]
5
                [% IF ( AllowOnShelfHolds ) %]
5
                <li><a class="reserve" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% biblionumber %]">Place hold</a></li>
6
                    <li><a class="reserve" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% biblionumber %]">Place hold</a></li>
7
                [% ELSE %]
8
                    [% IF ( ItemsIssued ) %]
9
                        <li><a class="reserve" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% biblionumber %]">Place hold</a></li>
10
                    [% END %]
11
                [% END %]
12
            [% END %]
6
            [% END %]
13
        [% END %]
7
        [% END %]
14
    [% END %]
8
    [% END %]
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt (-102 / +73 lines)
Lines 209-231 Link Here
209
            [% IF ( bad_data ) %]
209
            [% IF ( bad_data ) %]
210
              <div id="bad_data" class="dialog alert">ERROR: Internal error: incomplete hold request.</div>
210
              <div id="bad_data" class="dialog alert">ERROR: Internal error: incomplete hold request.</div>
211
            [% END %]
211
            [% END %]
212
          [% ELSE %]
212
          [% ELSIF ( none_available ) %]
213
            [% IF ( none_available ) %]
214
                <div id="none_available" class="dialog alert"><strong>Sorry</strong>, none of these items can be placed on hold.
213
                <div id="none_available" class="dialog alert"><strong>Sorry</strong>, none of these items can be placed on hold.
215
                </div>
214
                </div>
216
              [% END %]
217
          [% END %]<!-- NAME="message" -->
215
          [% END %]<!-- NAME="message" -->
218
216
219
      [% UNLESS ( message ) %][% UNLESS ( none_available ) %]<h3>Confirm holds for:
217
      [% UNLESS ( message ) %][% UNLESS ( none_available ) %]<h3>Confirm holds for:
220
                      [% FOREACH USER_INF IN USER_INFO %]
218
                      [% FOREACH USER_INF IN USER_INFO %]
221
                        [% USER_INF.firstname %] [% USER_INF.surname %] ([% USER_INF.cardnumber %])
219
                        [% USER_INF.firstname %] [% USER_INF.surname %] ([% USER_INF.cardnumber %])
222
                      [% END %]
220
                      [% END %]
223
                    </h3>[% END %]
221
                    </h3>
224
	      [% IF (RESERVE_CHARGE) %]
222
          [% IF (RESERVE_CHARGE) %]
225
	      <div class="dialog alert" id="reserve_fee">
223
	      <div class="dialog alert" id="reserve_fee">
226
	        There is a charge of [% RESERVE_CHARGE %] for placing this hold
224
	        There is a charge of [% RESERVE_CHARGE %] for placing this hold
227
	      </div>
225
	      </div>
228
	      [% END %]
226
          [% END %]
227
      [% END %][% END %]
229
228
230
            <form action="/cgi-bin/koha/opac-reserve.pl" method="post" id="hold-request-form">
229
            <form action="/cgi-bin/koha/opac-reserve.pl" method="post" id="hold-request-form">
231
            <input type="hidden" name="place_reserve" value="1"/>
230
            <input type="hidden" name="place_reserve" value="1"/>
Lines 234-271 Link Here
234
            <input type="hidden" name="biblionumbers" id="biblionumbers"/>
233
            <input type="hidden" name="biblionumbers" id="biblionumbers"/>
235
            <input type="hidden" name="selecteditems" id="selections"/>
234
            <input type="hidden" name="selecteditems" id="selections"/>
236
            <div id="bigloop">
235
            <div id="bigloop">
236
            [% extra_cols = 2 %]
237
              <table id="bibitemloop">
237
              <table id="bibitemloop">
238
                [% UNLESS ( none_available ) %]<tr>
238
                <tr>
239
                [% UNLESS ( none_available ) %]
239
                  <th>Hold</th>
240
                  <th>Hold</th>
241
                [% END %]
240
                  <th>Title</th>
242
                  <th>Title</th>
241
                  [% UNLESS ( item_level_itypes ) %]
243
                [% UNLESS ( item_level_itypes ) %]
242
                    <th>Item type</th>
244
                    <th>Item type</th>
243
                  [% END %]
245
                [% END %]
246
                [% UNLESS ( none_available ) %]
244
                  [% IF showholds && showpriority %]
247
                  [% IF showholds && showpriority %]
248
                    [% extra_cols = extra_cols + 1 %]
245
                  <th>Holds and priority</th>
249
                  <th>Holds and priority</th>
246
                  [% ELSIF showholds %]
250
                  [% ELSIF showholds %]
251
                    [% extra_cols = extra_cols + 1 %]
247
                  <th>Holds</th>
252
                  <th>Holds</th>
248
                  [% ELSIF showpriority %]
253
                  [% ELSIF showpriority %]
254
                    [% extra_cols = extra_cols + 1 %]
249
                  <th>Priority</th>
255
                  <th>Priority</th>
250
                  [% END %]
256
                  [% END %]
251
		  [% IF ( reserve_in_future ) %]
257
		  [% IF ( reserve_in_future ) %]
258
                    [% extra_cols = extra_cols + 1 %]
252
        <th>Hold starts on date</th>
259
        <th>Hold starts on date</th>
253
		  [% END %]
260
		  [% END %]
254
        <th>Hold not needed after</th>
261
        <th>Hold not needed after</th>
255
                  [% IF ( OPACItemHolds ) %]
256
                    <th id="place_on_hdr" style="display:none">Place on</th>
262
                    <th id="place_on_hdr" style="display:none">Place on</th>
257
                  [% END %]
258
                  [% UNLESS ( singleBranchMode ) %]
263
                  [% UNLESS ( singleBranchMode ) %]
259
		    [% IF ( choose_branch ) %]
264
		    [% IF ( choose_branch ) %]
265
                      [% extra_cols = extra_cols + 1 %]
260
                        <th>Pickup location</th>
266
                        <th>Pickup location</th>
261
		    [% END %]
267
		    [% END %]
262
                  [% END %]
268
                  [% END %]
263
                </tr>[% ELSE %]<tr><th colspan="5">Title</th></tr>[% END %]
269
                [% END %]
270
                </tr>
264
271
265
                [% FOREACH bibitemloo IN bibitemloop %]
272
                [% FOREACH bibitemloo IN bibitemloop %]
266
                  <tr>
273
                  <tr>
267
                      [% IF ( bibitemloo.holdable ) %]
274
                    [% UNLESS none_available %]
268
					  <td>
275
			<td>
276
                        [% IF ( bibitemloo.holdable ) %]
269
                      <input class="reserve_mode" name="reserve_mode" type="hidden" value="single"/>
277
                      <input class="reserve_mode" name="reserve_mode" type="hidden" value="single"/>
270
                      <input class="single_bib" name="single_bib" type="hidden" value="[% bibitemloo.biblionumber %]"/>
278
                      <input class="single_bib" name="single_bib" type="hidden" value="[% bibitemloo.biblionumber %]"/>
271
                        <span class="confirmjs_hold" title="[% bibitemloo.biblionumber %]"></span>
279
                        <span class="confirmjs_hold" title="[% bibitemloo.biblionumber %]"></span>
Lines 276-313 Link Here
276
                                 value="any" />
284
                                 value="any" />
277
                          <label class="confirm_label" for="[% bibitemloo.checkitem_bib %]">Next available copy</label>
285
                          <label class="confirm_label" for="[% bibitemloo.checkitem_bib %]">Next available copy</label>
278
                        </span>
286
                        </span>
279
					</td>
287
                        [% ELSE %]
280
                      [% ELSE %]
288
                        &nbsp;
281
					  [% UNLESS ( none_available ) %]<td>&nbsp;</td>[% END %]
289
                        [% END %]
282
                      [% END %]
290
			</td>
283
                    [% IF ( bibitemloo.holdable ) %]<td>[% ELSE %]<td colspan="5">[% END %]
291
                    [% END %]
292
                    <td>
284
                      <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% bibitemloo.biblionumber %]">[% bibitemloo.title |html %][% IF ( bibitemloo.subtitle ) %] [% FOREACH subtitl IN bibitemloo.subtitle %][% subtitl.subfield %][% END %][% END %]</a>
293
                      <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% bibitemloo.biblionumber %]">[% bibitemloo.title |html %][% IF ( bibitemloo.subtitle ) %] [% FOREACH subtitl IN bibitemloo.subtitle %][% subtitl.subfield %][% END %][% END %]</a>
285
                      [% IF ( bibitemloo.author ) %],  by [% bibitemloo.author %][% END %]
294
                      [% IF ( bibitemloo.author ) %],  by [% bibitemloo.author %][% END %]
286
295
287
                      [% UNLESS ( bibitemloo.holdable ) %]
296
                      [% UNLESS ( bibitemloo.holdable ) %]
288
297
                          <div class="bibmessage">
289
                        [% IF ( bibitemloo.already_reserved ) %]
298
                        [% IF ( bibitemloo.already_reserved ) %]
290
                          <div class="bibmessage">You have already requested this title.</div>
299
                            You have already requested this title.
300
                        [% ELSIF ( bibitemloo.bib_available ) %]
301
                            No available items.
291
                        [% ELSE %]
302
                        [% ELSE %]
292
                          [% UNLESS ( bibitemloo.bib_available ) %]
303
                            This title cannot be requested.
293
                            <div class="bibmessage">No available items.</div>
294
                          [% ELSE %]
295
                            <div class="bibmessage">This title cannot be requested.</div>
296
                          [% END %]
297
                        [% END %]
298
299
300
                        [% END %]
304
                        [% END %]
301
305
                          </div>
306
                      [% END %]
302
                    </td>
307
                    </td>
303
                    [% IF ( bibitemloo.holdable ) %]
304
            <!-- HOLDABLE -->
305
                        [% UNLESS ( item_level_itypes ) %]
308
                        [% UNLESS ( item_level_itypes ) %]
306
                        <td>
309
                        <td>
307
                            [% IF ( bibitemloo.imageurl ) %]<img src="[% bibitemloo.imageurl %]" alt="" />[% END %]
310
                            [% IF ( bibitemloo.imageurl ) %]<img src="[% bibitemloo.imageurl %]" alt="" />[% END %]
308
                            [% bibitemloo.description %]
311
                            [% bibitemloo.description %]
309
                        </td>
312
                        </td>
310
                        [% END %]
313
                        [% END %]
314
                    [% IF ( bibitemloo.holdable ) %]
315
            <!-- HOLDABLE -->
311
                        [% IF showholds || showpriority %]
316
                        [% IF showholds || showpriority %]
312
                        <td>
317
                        <td>
313
                        [% IF showpriority %] [% bibitemloo.rank %] [% END %]
318
                        [% IF showpriority %] [% bibitemloo.rank %] [% END %]
Lines 332-399 Link Here
332
        <input name="expiration_date_[% bibitemloo.biblionumber %]" id="to" size="10" readonly="readonly" class="datepickerto" />
337
        <input name="expiration_date_[% bibitemloo.biblionumber %]" id="to" size="10" readonly="readonly" class="datepickerto" />
333
      <p style="margin:.3em 2em;">
338
      <p style="margin:.3em 2em;">
334
      <a href="#" style="font-size:85%;text-decoration:none;" onclick="document.getElementById('expiration_date_[% bibitemloo.biblionumber %]').value='';return false;">Clear date</a></p>
339
      <a href="#" style="font-size:85%;text-decoration:none;" onclick="document.getElementById('expiration_date_[% bibitemloo.biblionumber %]').value='';return false;">Clear date</a></p>
335
    </td>[% END %]
340
    </td>
336
341
337
                    [% IF ( bibitemloo.holdable ) %]
342
                        <td class="place_on_type" style="display:none">
338
		    <!-- HOLD ABLE -->
339
		    [% IF ( OPACItemHolds ) %]
340
		    <!-- ITEM HOLDS -->
343
		    <!-- ITEM HOLDS -->
341
                                          <td class="place_on_type" style="display:none">
344
                          <ul>
342
                                            <ul>
345
                              <li>
343
                                                <li>
346
                                  <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
344
                                                  [% UNLESS ( bibitemloo.holdable ) %]
347
                                         id="reqany_[% bibitemloo.biblionumber %]"
345
                                                    <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
348
                                         class="selectany"
346
                                                           id="reqany_[% bibitemloo.biblionumber %]"
349
                                         value="Any"
347
                                                           class="selectany"
350
                                         checked="checked"
348
                                                           value="Any"
351
                                  />
349
                                                           disabled="disabled"
352
                                <label for="reqany_[% bibitemloo.biblionumber %]">Next available copy</label>
350
                                                    />
353
                              </li>
351
                                                  [% ELSE %]
354
                        [% IF ( bibitemloo.itemholdable ) %]
352
                                                    <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
355
                              <li>
353
                                                           id="reqany_[% bibitemloo.biblionumber %]"
356
                                  <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
354
                                                           class="selectany"
357
                                         id="reqspecific_[% bibitemloo.biblionumber %]"
355
                                                           value="Any"
358
                                         class="selectspecific"
356
                                                           checked="checked"
359
                                         value="Specific"
357
                                                    />
360
                                  />
358
                                                  [% END %]
361
                                <label for="reqspecific_[% bibitemloo.biblionumber %]">A specific copy</label>
359
                                                  <label for="reqany_[% bibitemloo.biblionumber %]">Next available copy</label>
362
                              </li>
360
                                                </li>
363
                        [% END %]
361
                                                <li>
364
                          </ul>
362
                                                  [% UNLESS ( bibitemloo.holdable ) %]
365
                        </td>
363
                                                    <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
366
364
                                                           id="reqspecific_[% bibitemloo.biblionumber %]"
367
                        [% UNLESS ( singleBranchMode ) %]
365
                                                           class="selectspecific"
366
                                                           disabled="disabled"
367
                                                           value="Specific"
368
                                                    />
369
                                                  [% ELSE %]
370
                                                    <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
371
                                                           id="reqspecific_[% bibitemloo.biblionumber %]"
372
                                                           class="selectspecific"
373
                                                           value="Specific"
374
                                                    />
375
                                                  [% END %]
376
                                                  <label for="reqspecific_[% bibitemloo.biblionumber %]">A specific copy</label>
377
                                                </li>
378
                                            </ul>
379
                                          </td>
380
                                        [% END %][% END %]
381
382
                    [% UNLESS ( singleBranchMode ) %]
383
                        [% IF ( bibitemloo.holdable ) %]
384
			    [% IF ( choose_branch ) %]
368
			    [% IF ( choose_branch ) %]
385
			                   <td>
369
			<td>
386
                         [% UNLESS ( bibitemloo.holdable ) %]
387
                            <select name="branch" id="branch_[% bibitemloo.biblionumber %]" disabled="disabled">
388
                              [% FOREACH branchChoicesLoo IN bibitemloo.branchChoicesLoop %]
389
                                [% IF ( branchChoicesLoo.selected ) %]
390
                                  <option value="[% branchChoicesLoo.value %]" selected="selected">[% branchChoicesLoo.branchname %]</option>
391
                                [% ELSE %]
392
                                  <option value="[% branchChoicesLoo.value %]">[% branchChoicesLoo.branchname %]</option>
393
                                [% END %]
394
                              [% END %]
395
                          </select>
396
                          [% ELSE %]
397
                            <select name="branch" id="branch_[% bibitemloo.biblionumber %]">
370
                            <select name="branch" id="branch_[% bibitemloo.biblionumber %]">
398
                              [% FOREACH branchChoicesLoo IN bibitemloo.branchChoicesLoop %]
371
                              [% FOREACH branchChoicesLoo IN bibitemloo.branchChoicesLoop %]
399
                                [% IF ( branchChoicesLoo.selected ) %]
372
                                [% IF ( branchChoicesLoo.selected ) %]
Lines 403-417 Link Here
403
                                [% END %]
376
                                [% END %]
404
                              [% END %]
377
                              [% END %]
405
                            </select>
378
                            </select>
406
                          [% END %]
407
                       </td>
379
                       </td>
408
			    [% END %]
380
                            [% END %]
409
		        [% END %]
381
                        [% END %]
410
                    [% END %]
382
                    [% ELSIF NOT none_available %]
383
                       <td colspan="[% extra_cols %]">&nbsp;</td>
384
                    [% END # holdable%]
411
                  </tr>
385
                  </tr>
412
386
413
                  [% IF ( OPACItemHolds ) %]
387
                    [% IF ( bibitemloo.itemholdable ) %]
414
                  [% IF ( bibitemloo.holdable ) %]
415
                    <tr class="copiesrow" id="copiesrow_[% bibitemloo.biblionumber %]">
388
                    <tr class="copiesrow" id="copiesrow_[% bibitemloo.biblionumber %]">
416
                      <td>&nbsp;</td>
389
                      <td>&nbsp;</td>
417
                      <td colspan="[% itemtable_colspan %]">
390
                      <td colspan="[% itemtable_colspan %]">
Lines 490-500 Link Here
490
                        </table>
463
                        </table>
491
                      </td>
464
                      </td>
492
                    </tr>
465
                    </tr>
493
                  [% END %]<!-- bib_available -->
466
                    [% END # itemholdable%]
494
                  [% END %]<!-- OPACItemHolds -->
467
                [% END %]<!-- bibitemloop -->
495
                [% END %]
468
              </table>
496
              </table><!-- bibitemloop -->
497
              [% END %] <!-- if message -->
498
            </div><!-- bigloop -->
469
            </div><!-- bigloop -->
499
470
500
            [% UNLESS ( message ) %]
471
            [% UNLESS ( message ) %]
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results-grouped.tt (-5 / +1 lines)
Lines 260-271 function highlightOn() { Link Here
260
                                [% IF ( RequestOnOpac ) %]
260
                                [% IF ( RequestOnOpac ) %]
261
					[% UNLESS ( GROUP_RESULT.norequests ) %]
261
					[% UNLESS ( GROUP_RESULT.norequests ) %]
262
						[% IF ( opacuserlogin ) %]
262
						[% IF ( opacuserlogin ) %]
263
							[% IF ( AllowOnShelfHolds ) %]
263
							[% IF ( GROUP_RESULT.holdable ) %]
264
                                <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-->
264
                                <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-->
265
							[% ELSE %]
266
								[% IF ( GROUP_RESULT.itemsissued ) %]
267
                                    <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-->
268
								[% END %]
269
							[% END %]
265
							[% END %]
270
						[% END %]
266
						[% END %]
271
					[% END %]
267
					[% END %]
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt (-5 / +1 lines)
Lines 567-578 $(document).ready(function(){ Link Here
567
                [% IF ( RequestOnOpac ) %]
567
                [% IF ( RequestOnOpac ) %]
568
                    [% UNLESS ( SEARCH_RESULT.norequests ) %]
568
                    [% UNLESS ( SEARCH_RESULT.norequests ) %]
569
                        [% IF ( opacuserlogin ) %]
569
                        [% IF ( opacuserlogin ) %]
570
                            [% IF ( AllowOnShelfHolds ) %]
570
                            [% IF ( SEARCH_RESULT.holdable ) %]
571
                                <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-->
571
                                <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-->
572
                            [% ELSE %]
573
                                [% IF ( SEARCH_RESULT.itemsissued ) %]
574
                                    <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-->
575
                                [% END %]
576
                            [% END %]
572
                            [% END %]
577
                        [% END %]
573
                        [% END %]
578
                    [% END %]
574
                    [% END %]
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt (-1 / +1 lines)
Lines 382-388 $(function() { Link Here
382
      [% IF ( RequestOnOpac ) %]
382
      [% IF ( RequestOnOpac ) %]
383
          [% UNLESS ( itemsloo.norequests ) %]
383
          [% UNLESS ( itemsloo.norequests ) %]
384
            [% IF ( opacuserlogin ) %]
384
            [% IF ( opacuserlogin ) %]
385
              [% IF ( AllowOnShelfHolds ) %]
385
              [% IF ( itemsloo.allow_onshelf_holds ) %]
386
                <a class="hold" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% itemsloo.biblionumber %]">Place hold</a><!-- add back when available 0 holds in queue-->
386
                <a class="hold" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% itemsloo.biblionumber %]">Place hold</a><!-- add back when available 0 holds in queue-->
387
              [% ELSE %]
387
              [% ELSE %]
388
                [% IF ( itemsloo.itemsissued ) %]
388
                [% IF ( itemsloo.itemsissued ) %]
(-)a/opac/opac-ISBDdetail.pl (-7 / +2 lines)
Lines 70-86 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
70
my $biblionumber = $query->param('biblionumber');
70
my $biblionumber = $query->param('biblionumber');
71
71
72
# get biblionumbers stored in the cart
72
# get biblionumbers stored in the cart
73
my @cart_list;
73
if(my $cart_list = $query->cookie("bib_list")){
74
74
    my @cart_list = split(/\//, $cart_list);
75
if($query->cookie("bib_list")){
76
    my $cart_list = $query->cookie("bib_list");
77
    @cart_list = split(/\//, $cart_list);
78
    if ( grep {$_ eq $biblionumber} @cart_list) {
75
    if ( grep {$_ eq $biblionumber} @cart_list) {
79
        $template->param( incart => 1 );
76
        $template->param( incart => 1 );
80
    }
77
    }
81
}
78
}
82
79
83
$template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
84
$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) );
80
$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) );
85
81
86
my $marcflavour      = C4::Context->preference("marcflavour");
82
my $marcflavour      = C4::Context->preference("marcflavour");
Lines 163-169 foreach ( @$reviews ) { Link Here
163
159
164
$template->param(
160
$template->param(
165
    RequestOnOpac       => C4::Context->preference("RequestOnOpac"),
161
    RequestOnOpac       => C4::Context->preference("RequestOnOpac"),
166
    AllowOnShelfHolds   => C4::Context->preference('AllowOnShelfHolds'),
167
    norequests   => $norequests,
162
    norequests   => $norequests,
168
    ISBD         => $res,
163
    ISBD         => $res,
169
    biblionumber => $biblionumber,
164
    biblionumber => $biblionumber,
(-)a/opac/opac-MARCdetail.pl (-6 / +2 lines)
Lines 82-98 $template->param( Link Here
82
);
82
);
83
83
84
# get biblionumbers stored in the cart
84
# get biblionumbers stored in the cart
85
my @cart_list;
85
if(my $cart_list = $query->cookie("bib_list")){
86
86
    my @cart_list = split(/\//, $cart_list);
87
if($query->cookie("bib_list")){
88
    my $cart_list = $query->cookie("bib_list");
89
    @cart_list = split(/\//, $cart_list);
90
    if ( grep {$_ eq $biblionumber} @cart_list) {
87
    if ( grep {$_ eq $biblionumber} @cart_list) {
91
        $template->param( incart => 1 );
88
        $template->param( incart => 1 );
92
    }
89
    }
93
}
90
}
94
91
95
$template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
96
$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) );
92
$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) );
97
93
98
# adding the $RequestOnOpac param
94
# adding the $RequestOnOpac param
(-)a/opac/opac-detail.pl (-2 lines)
Lines 387-394 if ($session->param('busc')) { Link Here
387
}
387
}
388
388
389
389
390
391
$template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
392
$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) );
390
$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) );
393
391
394
392
(-)a/opac/opac-reserve.pl (-18 / +25 lines)
Lines 380-385 foreach my $biblioNum (@biblionumbers) { Link Here
380
380
381
    $biblioLoopIter{itemLoop} = [];
381
    $biblioLoopIter{itemLoop} = [];
382
    my $numCopiesAvailable = 0;
382
    my $numCopiesAvailable = 0;
383
    my $numCopiesOPACAvailable = 0;
383
    foreach my $itemInfo (@{$biblioData->{itemInfos}}) {
384
    foreach my $itemInfo (@{$biblioData->{itemInfos}}) {
384
        my $itemNum = $itemInfo->{itemnumber};
385
        my $itemNum = $itemInfo->{itemnumber};
385
        my $itemLoopIter = {};
386
        my $itemLoopIter = {};
Lines 472-487 foreach my $biblioNum (@biblionumbers) { Link Here
472
473
473
        my $branch = C4::Circulation::_GetCircControlBranch($itemLoopIter, $borr);
474
        my $branch = C4::Circulation::_GetCircControlBranch($itemLoopIter, $borr);
474
475
475
        my $branchitemrule = GetBranchItemRule( $branch, $itemInfo->{'itype'} );
476
        my $policy_holdallowed = !$itemLoopIter->{already_reserved};
476
        my $policy_holdallowed = 1;
477
        if ($policy_holdallowed) {
477
478
            if (my $branchitemrule = GetBranchItemRule( $branch, $itemInfo->{'itype'} )) {
478
        if ( $branchitemrule->{'holdallowed'} == 0 ||
479
                $policy_holdallowed =
479
                ( $branchitemrule->{'holdallowed'} == 1 && $borr->{'branchcode'} ne $itemInfo->{'homebranch'} ) ) {
480
                  ($branchitemrule->{'holdallowed'} == 2) ||
480
            $policy_holdallowed = 0;
481
                  ($branchitemrule->{'holdallowed'} == 1
482
                      && $borr->{'branchcode'} eq $itemInfo->{'homebranch'});
483
            } else {
484
                $policy_holdallowed = 0; # No rule - not allowed
485
            }
481
        }
486
        }
482
487
        $policy_holdallowed &&=
483
        if (IsAvailableForItemLevelRequest($itemNum) and $policy_holdallowed and CanItemBeReserved($borrowernumber,$itemNum) and ($itemLoopIter->{already_reserved} ne 1)) {
488
            IsAvailableForItemLevelRequest($itemInfo,$borr) &&
484
            $itemLoopIter->{available} = 1;
489
            CanItemBeReserved($borrowernumber,$itemNum);
490
491
        if ($policy_holdallowed) {
492
            if ( OPACItemHoldsAllowed( $itemInfo, $borr ) ) {
493
                $itemLoopIter->{available} = 1;
494
                $numCopiesOPACAvailable++;
495
            }
485
            $numCopiesAvailable++;
496
            $numCopiesAvailable++;
486
        }
497
        }
487
498
Lines 507-524 foreach my $biblioNum (@biblionumbers) { Link Here
507
        $numBibsAvailable++;
518
        $numBibsAvailable++;
508
        $biblioLoopIter{bib_available} = 1;
519
        $biblioLoopIter{bib_available} = 1;
509
        $biblioLoopIter{holdable} = 1;
520
        $biblioLoopIter{holdable} = 1;
510
        $anyholdable = 1;
521
        $biblioLoopIter{itemholdable} = 1 if $numCopiesOPACAvailable;
511
    }
522
    }
512
    if ($biblioLoopIter{already_reserved}) {
523
    if ($biblioLoopIter{already_reserved}) {
513
        $biblioLoopIter{holdable} = undef;
524
        $biblioLoopIter{holdable} = undef;
514
        $anyholdable = undef;
525
        $biblioLoopIter{itemholdable} = undef;
515
    }
516
    if(not CanBookBeReserved($borrowernumber,$biblioNum)){
517
        $biblioLoopIter{holdable} = undef;
518
        $anyholdable = undef;
519
    }
526
    }
527
    $biblioLoopIter{holdable} &&= CanBookBeReserved($borrowernumber,$biblioNum);
520
528
521
    push @$biblioLoop, \%biblioLoopIter;
529
    push @$biblioLoop, \%biblioLoopIter;
530
531
    $anyholdable = 1 if $biblioLoopIter{holdable};
522
}
532
}
523
533
524
if ( $numBibsAvailable == 0 || !$anyholdable) {
534
if ( $numBibsAvailable == 0 || !$anyholdable) {
Lines 526-534 if ( $numBibsAvailable == 0 || !$anyholdable) { Link Here
526
}
536
}
527
537
528
my $itemTableColspan = 7;
538
my $itemTableColspan = 7;
529
if (! $template->{VARS}->{'OPACItemHolds'}) {
530
    $itemTableColspan--;
531
}
532
if (! $template->{VARS}->{'singleBranchMode'}) {
539
if (! $template->{VARS}->{'singleBranchMode'}) {
533
    $itemTableColspan--;
540
    $itemTableColspan--;
534
}
541
}
(-)a/opac/opac-search.pl (-1 / +18 lines)
Lines 51-56 use C4::Tags qw(get_tags); Link Here
51
use C4::Branch; # GetBranches
51
use C4::Branch; # GetBranches
52
use C4::SocialData;
52
use C4::SocialData;
53
use C4::Ratings;
53
use C4::Ratings;
54
use C4::Members;
55
use C4::Reserves;
54
56
55
use POSIX qw(ceil floor strftime);
57
use POSIX qw(ceil floor strftime);
56
use URI::Escape;
58
use URI::Escape;
Lines 124-130 if (C4::Context->preference("marcflavour") eq "UNIMARC" ) { Link Here
124
elsif (C4::Context->preference("marcflavour") eq "MARC21" ) {
126
elsif (C4::Context->preference("marcflavour") eq "MARC21" ) {
125
    $template->param('usmarc' => 1);
127
    $template->param('usmarc' => 1);
126
}
128
}
127
$template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
129
128
$template->param( 'OPACNoResultsFound' => C4::Context->preference('OPACNoResultsFound') );
130
$template->param( 'OPACNoResultsFound' => C4::Context->preference('OPACNoResultsFound') );
129
131
130
$template->param(
132
$template->param(
Lines 505-512 if ($@ || $error) { Link Here
505
    exit;
507
    exit;
506
}
508
}
507
509
510
my $borrower = $borrowernumber ? GetMember( borrowernumber => $borrowernumber ) : undef;
511
508
# At this point, each server has given us a result set
512
# At this point, each server has given us a result set
509
# now we build that set for template display
513
# now we build that set for template display
514
my %allow_onshelf_holds;
510
my @sup_results_array;
515
my @sup_results_array;
511
for (my $i=0;$i<@servers;$i++) {
516
for (my $i=0;$i<@servers;$i++) {
512
    my $server = $servers[$i];
517
    my $server = $servers[$i];
Lines 521-531 for (my $i=0;$i<@servers;$i++) { Link Here
521
                # we need to set the offset parameter of searchResults to 0
526
                # we need to set the offset parameter of searchResults to 0
522
                my @group_results = searchResults( 'opac', $query_desc, $group->{'group_count'},$results_per_page, 0, $scan,
527
                my @group_results = searchResults( 'opac', $query_desc, $group->{'group_count'},$results_per_page, 0, $scan,
523
                                                   $group->{"RECORDS"});
528
                                                   $group->{"RECORDS"});
529
                if ($borrower) {
530
                    $_->{holdable} =
531
                        IsAvailableForItemLevelRequest($_, $borrower) &&
532
                        OPACItemHoldsAllowed($_, $borrower)
533
                      foreach @group_results;
534
                }
524
                push @newresults, { group_label => $group->{'group_label'}, GROUP_RESULTS => \@group_results };
535
                push @newresults, { group_label => $group->{'group_label'}, GROUP_RESULTS => \@group_results };
525
            }
536
            }
526
        } else {
537
        } else {
527
            @newresults = searchResults('opac', $query_desc, $hits, $results_per_page, $offset, $scan,
538
            @newresults = searchResults('opac', $query_desc, $hits, $results_per_page, $offset, $scan,
528
                                        $results_hashref->{$server}->{"RECORDS"});
539
                                        $results_hashref->{$server}->{"RECORDS"});
540
            if ($borrower) {
541
                $_->{holdable} =
542
                    IsAvailableForItemLevelRequest($_, $borrower) &&
543
                    OPACItemHoldsAllowed($_, $borrower)
544
                  foreach @newresults;
545
            }
529
        }
546
        }
530
547
531
        # must define a value for size if not present in DB
548
        # must define a value for size if not present in DB
(-)a/reserve/request.pl (-2 / +1 lines)
Lines 456-462 foreach my $biblionumber (@biblionumbers) { Link Here
456
            if (
456
            if (
457
                   $policy_holdallowed
457
                   $policy_holdallowed
458
                && !$item->{cantreserve}
458
                && !$item->{cantreserve}
459
                && IsAvailableForItemLevelRequest($itemnumber)
459
                && IsAvailableForItemLevelRequest($item, $borrowerinfo)
460
                && CanItemBeReserved(
460
                && CanItemBeReserved(
461
                    $borrowerinfo->{borrowernumber}, $itemnumber
461
                    $borrowerinfo->{borrowernumber}, $itemnumber
462
                )
462
                )
463
- 

Return to bug 5786