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

(-)a/C4/Reserves.pm (-4 / +27 lines)
Lines 445-452 sub CanBookBeReserved{ Link Here
445
    push (@$items,@hostitems);
445
    push (@$items,@hostitems);
446
    }
446
    }
447
447
448
    foreach my $item (@$items){
448
    unless (C4::Context->preference('HoldOnlyWhenAllItemsOnLoan')) {
449
        return 1 if CanItemBeReserved($borrowernumber, $item);
449
        foreach my $item (@$items){
450
            return 1 if CanItemBeReserved($borrowernumber, $item);
451
        }
452
    }else {
453
        foreach my $item (@$items){
454
           return undef if !defined(CanItemBeReserved($borrowernumber, $item));
455
        }
456
        return 1;
450
    }
457
    }
451
    return 0;
458
    return 0;
452
}
459
}
Lines 553-561 sub CanItemBeReserved{ Link Here
553
            return 0;
560
            return 0;
554
        }
561
        }
555
    }
562
    }
563
    my $holdonly = C4::Context->preference('HoldOnlyWhenAllItemsOnLoan');
564
    if ( !$holdonly ){
565
        return 1;
566
    } else {
567
        my $querystatus ="SELECT found FROM reserves WHERE itemnumber = ?";
568
        my $sth=$dbh->prepare($querystatus);
569
        $sth->execute($itemnumber);
570
        my ($status) = $sth->fetchrow_array();
556
571
557
    return 1;
572
        if ($item->{'onloan'} or $status eq 'W' or $status eq 'T') {
558
}
573
            return 1;
574
        } elsif ( $item->{'notforloan'} or $item->{'withdrawn'} or $item->{'itemlost'} or $item->{'damaged'} ) {
575
            return 0;
576
        } else {
577
            return undef;
578
        }
579
    }
580
581
        }
559
#--------------------------------------------------------------------------------
582
#--------------------------------------------------------------------------------
560
=head2 GetReserveCount
583
=head2 GetReserveCount
561
584
(-)a/installer/data/mysql/sysprefs.sql (-2 / +2 lines)
Lines 428-432 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
428
('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'),
428
('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'),
429
('yuipath','local','local|http://yui.yahooapis.com/2.5.1/build','Insert the path to YUI libraries, choose local if you use koha offline','Choice'),
429
('yuipath','local','local|http://yui.yahooapis.com/2.5.1/build','Insert the path to YUI libraries, choose local if you use koha offline','Choice'),
430
('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
430
('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
431
('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo')
431
('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo'),
432
;
432
('HoldOnlyWhenAllItemsOnLoan','0', 'Placing hold on a document is possible only when all items that can be reserved according to the issuing rules are on loan', NULL, 'YesNo')
(-)a/installer/data/mysql/updatedatabase.pl (+7 lines)
Lines 8037-8042 if(CheckVersion($DBversion)) { Link Here
8037
    SetVersion($DBversion);
8037
    SetVersion($DBversion);
8038
}
8038
}
8039
8039
8040
$DBversion = "3.15.00.XXX";
8041
if (CheckVersion($DBversion) ) {
8042
     $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('HoldOnlyWhenAllItemsOnLoan','0', 'Placing hold on a document is possible only when all items that can be reserved according to the issuing rules are on loan', NULL, 'YesNo')");
8043
    print "Upgrade to $DBversion done (Add system preference HoldOnlyWhenAllItemsOnLoan)\n";
8044
    SetVersion($DBversion);
8045
}
8046
8040
=head1 FUNCTIONS
8047
=head1 FUNCTIONS
8041
8048
8042
=head2 TableExists($table)
8049
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+8 lines)
Lines 371-376 Circulation: Link Here
371
                  no: "Don't allow"
371
                  no: "Don't allow"
372
            - hold requests to be placed on items that are not checked out.
372
            - hold requests to be placed on items that are not checked out.
373
        -
373
        -
374
            - To be able to place hold on a document
375
            - pref: HoldOnlyWhenAllItemsOnLoan
376
              default: 0
377
              choices:
378
                  yes: "it is necessary"
379
                  no: "it is not necessary"
380
            - that all the items potentially holdable are on loan
381
        -
374
            - pref: AllowHoldDateInFuture
382
            - pref: AllowHoldDateInFuture
375
              choices:
383
              choices:
376
                  yes: Allow
384
                  yes: Allow
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (-1 / +5 lines)
Lines 243-249 function checkMultiHold() { Link Here
243
          <li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">[% borrowerfirstname %] [% borrowersurname %]</a> <strong>already has a hold</strong> on this item </li>
243
          <li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">[% borrowerfirstname %] [% borrowersurname %]</a> <strong>already has a hold</strong> on this item </li>
244
        [% END %]
244
        [% END %]
245
        [% IF ( none_available ) %]
245
        [% IF ( none_available ) %]
246
          <li> <strong>No copies are available</strong> to be placed on hold</li>
246
          [% IF ( not_all_holdable_onloan ) %]
247
              <li> <strong>All reservable items of the record must be on loan</strong></li>
248
          [% ELSE %]
249
              <li> <strong>No copies are available</strong> to be placed on hold</li>
250
          [% END %]
247
        [% END %]
251
        [% END %]
248
        [% IF ( alreadypossession ) %]
252
        [% IF ( alreadypossession ) %]
249
          <li> <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">[% borrowerfirstname %] [% borrowersurname %]</a> <strong>is already in possession</strong> of one item</li>
253
          <li> <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">[% borrowerfirstname %] [% borrowersurname %]</a> <strong>is already in possession</strong> of one item</li>
(-)a/opac/opac-detail.pl (-1 / +7 lines)
Lines 404-410 if ($session->param('busc')) { Link Here
404
404
405
405
406
$template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
406
$template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
407
$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) );
407
if ( C4::Context->preference("HoldOnlyWhenAllItemsOnLoan") ) {
408
    $template->param( 'ItemsIssued' => CanBookBeReserved($borrowernumber,$biblionumber) );
409
} else {
410
    $template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) );
411
}
412
413
408
414
409
415
410
416
(-)a/reserve/request.pl (-4 / +6 lines)
Lines 180-193 if ($multihold) { Link Here
180
180
181
my $itemdata_enumchron = 0;
181
my $itemdata_enumchron = 0;
182
my @biblioloop = ();
182
my @biblioloop = ();
183
my $not_all_holdable_onloan;
183
foreach my $biblionumber (@biblionumbers) {
184
foreach my $biblionumber (@biblionumbers) {
184
185
185
    my %biblioloopiter = ();
186
    my %biblioloopiter = ();
186
187
187
    my $dat = GetBiblioData($biblionumber);
188
    my $dat = GetBiblioData($biblionumber);
188
189
    my $canbookbereserved = CanBookBeReserved($borrowerinfo->{borrowernumber}, $biblionumber);
189
    unless ( CanBookBeReserved($borrowerinfo->{borrowernumber}, $biblionumber) ) {
190
    unless ( $canbookbereserved ) {
190
        $maxreserves = 1;
191
        $maxreserves = 1;
192
        $not_all_holdable_onloan = 1 if !defined($canbookbereserved);
191
    }
193
    }
192
194
193
    my $alreadypossession;
195
    my $alreadypossession;
Lines 414-420 foreach my $biblionumber (@biblionumbers) { Link Here
414
              )
416
              )
415
            {
417
            {
416
                $item->{available} = 1;
418
                $item->{available} = 1;
417
                $num_available++;
419
                $num_available++ unless $not_all_holdable_onloan;
418
            }
420
            }
419
            elsif ( C4::Context->preference('AllowHoldPolicyOverride') ) {
421
            elsif ( C4::Context->preference('AllowHoldPolicyOverride') ) {
420
422
Lines 436-441 foreach my $biblionumber (@biblionumbers) { Link Here
436
        if ( $num_override == scalar( @{ $biblioitem->{itemloop} } ) ) { # That is, if all items require an override
438
        if ( $num_override == scalar( @{ $biblioitem->{itemloop} } ) ) { # That is, if all items require an override
437
            $template->param( override_required => 1 );
439
            $template->param( override_required => 1 );
438
        } elsif ( $num_available == 0 ) {
440
        } elsif ( $num_available == 0 ) {
441
            $template->param( not_all_holdable_onloan => $not_all_holdable_onloan );
439
            $template->param( none_available => 1 );
442
            $template->param( none_available => 1 );
440
            $biblioloopiter{warn} = 1;
443
            $biblioloopiter{warn} = 1;
441
            $biblioloopiter{none_avail} = 1;
444
            $biblioloopiter{none_avail} = 1;
442
- 

Return to bug 11481