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

(-)a/C4/Reserves.pm (+6 lines)
Lines 420-425 sub CanItemBeReserved { Link Here
420
        $branchfield = "items.homebranch";
420
        $branchfield = "items.homebranch";
421
        $branchcode  = $item->homebranch;
421
        $branchcode  = $item->homebranch;
422
    }
422
    }
423
    elsif ( $controlbranch eq "ItemHoldingLibrary" ) {
424
        $branchfield = "items.holdingbranch";
425
        $branchcode  = $item->holdingbranch;
426
    }
423
    elsif ( $controlbranch eq "PatronLibrary" ) {
427
    elsif ( $controlbranch eq "PatronLibrary" ) {
424
        $branchfield = "borrowers.branchcode";
428
        $branchfield = "borrowers.branchcode";
425
        $branchcode  = $borrower->{branchcode};
429
        $branchcode  = $borrower->{branchcode};
Lines 2169-2174 sub GetReservesControlBranch { Link Here
2169
2173
2170
    my $branchcode =
2174
    my $branchcode =
2171
        ( $reserves_control eq 'ItemHomeLibrary' ) ? $item->{'homebranch'}
2175
        ( $reserves_control eq 'ItemHomeLibrary' ) ? $item->{'homebranch'}
2176
      : ( $reserves_control eq 'ItemHoldingLibrary' ) ? $item->{'holdingbranch'}
2172
      : ( $reserves_control eq 'PatronLibrary' )   ? $borrower->{'branchcode'}
2177
      : ( $reserves_control eq 'PatronLibrary' )   ? $borrower->{'branchcode'}
2173
      :                                              undef;
2178
      :                                              undef;
2174
2179
Lines 2273-2278 sub GetMaxPatronHoldsForRecord { Link Here
2273
        my $itemtype = $item->effective_itemtype();
2278
        my $itemtype = $item->effective_itemtype();
2274
2279
2275
        $branchcode = $item->homebranch if ( $controlbranch eq "ItemHomeLibrary" );
2280
        $branchcode = $item->homebranch if ( $controlbranch eq "ItemHomeLibrary" );
2281
        $branchcode = $item->holdingbranch if ( $controlbranch eq "ItemHoldingLibrary" );
2276
2282
2277
        my $rule = Koha::CirculationRules->get_effective_rule({
2283
        my $rule = Koha::CirculationRules->get_effective_rule({
2278
            categorycode => $categorycode,
2284
            categorycode => $categorycode,
(-)a/installer/data/mysql/atomicupdate/bug_22562.perl (+11 lines)
Line 0 Link Here
1
$DBversion = 'XXX';
2
if( CheckVersion( $DBversion ) ) {
3
    $dbh->do(q{
4
        UPDATE systempreferences
5
        SET options = 'ItemHomeLibrary|ItemHoldingLibrary|PatronLibrary'
6
        WHERE variable = 'ReservesControlBranch'
7
    });
8
9
    SetVersion( $DBversion );
10
    print "Upgrade to $DBversion done (Bug 22562 - Add ItemHoldingLibrary to ReservesControlBranch)\n";
11
}
(-)a/installer/data/mysql/mandatory/sysprefs.sql (-1 / +1 lines)
Lines 567-573 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
567
('ReportsLog','0',NULL,'If ON, log information about reports.','YesNo'),
567
('ReportsLog','0',NULL,'If ON, log information about reports.','YesNo'),
568
('RequestOnOpac','1',NULL,'If ON, globally enables patron holds on OPAC','YesNo'),
568
('RequestOnOpac','1',NULL,'If ON, globally enables patron holds on OPAC','YesNo'),
569
('RequireStrongPassword','1','','Require a strong login password for staff and patrons','YesNo'),
569
('RequireStrongPassword','1','','Require a strong login password for staff and patrons','YesNo'),
570
('ReservesControlBranch','PatronLibrary','ItemHomeLibrary|PatronLibrary','Branch checked for members reservations rights','Choice'),
570
('ReservesControlBranch','PatronLibrary','ItemHomeLibrary|ItemHoldingLibrary|PatronLibrary','Branch checked for members reservations rights','Choice'),
571
('ReservesMaxPickUpDelay','7','','Define the Maximum delay to pick up an item on hold','Integer'),
571
('ReservesMaxPickUpDelay','7','','Define the Maximum delay to pick up an item on hold','Integer'),
572
('ReservesNeedReturns','1','','If ON, a hold placed on an item available in this library must be checked-in, otherwise, a hold on a specific item, that is in the library & available is considered available','YesNo'),
572
('ReservesNeedReturns','1','','If ON, a hold placed on an item available in this library must be checked-in, otherwise, a hold on a specific item, that is in the library & available is considered available','YesNo'),
573
('RESTBasicAuth','0',NULL,'If enabled, Basic authentication is enabled for the REST API.','YesNo'),
573
('RESTBasicAuth','0',NULL,'If enabled, Basic authentication is enabled for the REST API.','YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+1 lines)
Lines 721-726 Circulation: Link Here
721
            - pref: ReservesControlBranch
721
            - pref: ReservesControlBranch
722
              choices:
722
              choices:
723
                  ItemHomeLibrary: "item's home library"
723
                  ItemHomeLibrary: "item's home library"
724
                  ItemHoldingLibrary: "item's holding library"
724
                  PatronLibrary: "patron's home library"
725
                  PatronLibrary: "patron's home library"
725
            - to see if the patron can place a hold on the item.    
726
            - to see if the patron can place a hold on the item.    
726
        -
727
        -
(-)a/t/db_dependent/Reserves.t (-2 / +8 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 67;
20
use Test::More tests => 68;
21
use Test::MockModule;
21
use Test::MockModule;
22
use Test::Warn;
22
use Test::Warn;
23
23
Lines 139-144 ok( Link Here
139
        { branchcode => 'PatronHomeLib' }
139
        { branchcode => 'PatronHomeLib' }
140
    ), "GetReservesControlBranch returns item home branch when set to ItemHomeLibrary"
140
    ), "GetReservesControlBranch returns item home branch when set to ItemHomeLibrary"
141
);
141
);
142
t::lib::Mocks::mock_preference( 'ReservesControlBranch', 'ItemHoldingLibrary' );
143
ok(
144
    'ItemHoldingLib' eq GetReservesControlBranch(
145
        { holdingbranch => 'ItemHoldingLib' },
146
        { branchcode => 'PatronHomeLib' }
147
    ), "GetReservesControlBranch returns item holding branch when set to ItemHoldingLibrary"
148
);
142
t::lib::Mocks::mock_preference( 'ReservesControlBranch', 'PatronLibrary' );
149
t::lib::Mocks::mock_preference( 'ReservesControlBranch', 'PatronLibrary' );
143
ok(
150
ok(
144
    'PatronHomeLib' eq GetReservesControlBranch(
151
    'PatronHomeLib' eq GetReservesControlBranch(
145
- 

Return to bug 22562