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

(-)a/C4/Reserves.pm (-4 / +27 lines)
Lines 431-438 sub CanBookBeReserved{ Link Here
431
    push (@$items,@hostitems);
431
    push (@$items,@hostitems);
432
    }
432
    }
433
433
434
    foreach my $item (@$items){
434
    unless (C4::Context->preference('HoldOnlyWhenAllItemsOnLoan')) {
435
        return 1 if CanItemBeReserved($borrowernumber, $item);
435
        foreach my $item (@$items){
436
            return 1 if CanItemBeReserved($borrowernumber, $item);
437
        }
438
    }else {
439
        foreach my $item (@$items){
440
           return undef if !defined(CanItemBeReserved($borrowernumber, $item));
441
        }
442
        return 1;
436
    }
443
    }
437
    return 0;
444
    return 0;
438
}
445
}
Lines 535-543 sub CanItemBeReserved{ Link Here
535
            return 0;
542
            return 0;
536
        }
543
        }
537
    }
544
    }
545
    my $holdonly = C4::Context->preference('HoldOnlyWhenAllItemsOnLoan');
546
    if ( !$holdonly ){
547
        return 1;
548
    } else {
549
        my $querystatus ="SELECT found FROM reserves WHERE itemnumber = ?";
550
        my $sth=$dbh->prepare($querystatus);
551
        $sth->execute($itemnumber);
552
        my ($status) = $sth->fetchrow_array();
538
553
539
    return 1;
554
        if ($item->{'onloan'} or $status eq 'W' or $status eq 'T') {
540
}
555
            return 1;
556
        } elsif ( !($item->{'notforloan'} and $item->{'withdrawn'} and $item->{'itemlost'} and $item->{'damaged'}) ) {
557
            return 0;
558
        } else {
559
            return undef;
560
        }
561
    }
562
563
        }
541
#--------------------------------------------------------------------------------
564
#--------------------------------------------------------------------------------
542
=head2 GetReserveCount
565
=head2 GetReserveCount
543
566
(-)a/installer/data/mysql/sysprefs.sql (-2 / +2 lines)
Lines 424-428 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
424
('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'),
424
('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'),
425
('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'),
425
('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'),
426
('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
426
('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
427
('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo')
427
('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo'),
428
;
428
('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 7885-7890 if(CheckVersion($DBversion)) { Link Here
7885
    SetVersion($DBversion);
7885
    SetVersion($DBversion);
7886
}
7886
}
7887
7887
7888
$DBversion = "3.15.00.XXX";
7889
if (CheckVersion($DBversion) ) {
7890
     $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')");
7891
    print "Upgrade to $DBversion done (Add system preference HoldOnlyWhenAllItemsOnLoan)\n";
7892
    SetVersion($DBversion);
7893
}
7894
7888
=head1 FUNCTIONS
7895
=head1 FUNCTIONS
7889
7896
7890
=head2 TableExists($table)
7897
=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 possesion</strong> of one item</li>
253
          <li> <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">[% borrowerfirstname %] [% borrowersurname %]</a> <strong>is already in possesion</strong> of one item</li>
(-)a/opac/opac-detail.pl (-1 / +7 lines)
Lines 403-409 if ($session->param('busc')) { Link Here
403
403
404
404
405
$template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
405
$template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
406
$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) );
406
if ( C4::Context->preference("HoldOnlyWhenAllItemsOnLoan") ) {
407
    $template->param( 'ItemsIssued' => CanBookBeReserved($borrowernumber,$biblionumber) );
408
} else {
409
    $template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) );
410
}
411
412
407
413
408
414
409
415
(-)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 413-419 foreach my $biblionumber (@biblionumbers) { Link Here
413
              )
415
              )
414
            {
416
            {
415
                $item->{available} = 1;
417
                $item->{available} = 1;
416
                $num_available++;
418
                $num_available++ unless $not_all_holdable_onloan;
417
            }
419
            }
418
            elsif ( C4::Context->preference('AllowHoldPolicyOverride') ) {
420
            elsif ( C4::Context->preference('AllowHoldPolicyOverride') ) {
419
421
Lines 442-447 foreach my $biblionumber (@biblionumbers) { Link Here
442
        if ( $num_override == scalar( @{ $biblioitem->{itemloop} } ) ) { # That is, if all items require an override
444
        if ( $num_override == scalar( @{ $biblioitem->{itemloop} } ) ) { # That is, if all items require an override
443
            $template->param( override_required => 1 );
445
            $template->param( override_required => 1 );
444
        } elsif ( $num_available == 0 ) {
446
        } elsif ( $num_available == 0 ) {
447
            $template->param( not_all_holdable_onloan => $not_all_holdable_onloan );
445
            $template->param( none_available => 1 );
448
            $template->param( none_available => 1 );
446
            $biblioloopiter{warn} = 1;
449
            $biblioloopiter{warn} = 1;
447
            $biblioloopiter{none_avail} = 1;
450
            $biblioloopiter{none_avail} = 1;
448
- 

Return to bug 11481