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

(-)a/C4/Reserves.pm (+6 lines)
Lines 392-397 sub CanItemBeReserved { Link Here
392
        $branchfield = "items.homebranch";
392
        $branchfield = "items.homebranch";
393
        $branchcode  = $item->homebranch;
393
        $branchcode  = $item->homebranch;
394
    }
394
    }
395
    elsif ( $controlbranch eq "ItemHoldingLibrary" ) {
396
        $branchfield = "items.holdingbranch";
397
        $branchcode  = $item->holdingbranch;
398
    }
395
    elsif ( $controlbranch eq "PatronLibrary" ) {
399
    elsif ( $controlbranch eq "PatronLibrary" ) {
396
        $branchfield = "borrowers.branchcode";
400
        $branchfield = "borrowers.branchcode";
397
        $branchcode  = $borrower->{branchcode};
401
        $branchcode  = $borrower->{branchcode};
Lines 2098-2103 sub GetReservesControlBranch { Link Here
2098
2102
2099
    my $branchcode =
2103
    my $branchcode =
2100
        ( $reserves_control eq 'ItemHomeLibrary' ) ? $item->{'homebranch'}
2104
        ( $reserves_control eq 'ItemHomeLibrary' ) ? $item->{'homebranch'}
2105
      : ( $reserves_control eq 'ItemHoldingLibrary' ) ? $item->{'holdingbranch'}
2101
      : ( $reserves_control eq 'PatronLibrary' )   ? $borrower->{'branchcode'}
2106
      : ( $reserves_control eq 'PatronLibrary' )   ? $borrower->{'branchcode'}
2102
      :                                              undef;
2107
      :                                              undef;
2103
2108
Lines 2202-2207 sub GetMaxPatronHoldsForRecord { Link Here
2202
        my $itemtype = $item->effective_itemtype();
2207
        my $itemtype = $item->effective_itemtype();
2203
2208
2204
        $branchcode = $item->homebranch if ( $controlbranch eq "ItemHomeLibrary" );
2209
        $branchcode = $item->homebranch if ( $controlbranch eq "ItemHomeLibrary" );
2210
        $branchcode = $item->holdingbranch if ( $controlbranch eq "ItemHoldingLibrary" );
2205
2211
2206
        my $rule = GetHoldRule( $categorycode, $itemtype, $branchcode );
2212
        my $rule = GetHoldRule( $categorycode, $itemtype, $branchcode );
2207
        my $holds_per_record = $rule ? $rule->{holds_per_record} : 0;
2213
        my $holds_per_record = $rule ? $rule->{holds_per_record} : 0;
(-)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/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+1 lines)
Lines 642-647 Circulation: Link Here
642
            - pref: ReservesControlBranch
642
            - pref: ReservesControlBranch
643
              choices:
643
              choices:
644
                  ItemHomeLibrary: "item's home library"
644
                  ItemHomeLibrary: "item's home library"
645
                  ItemHoldingLibrary: "item's holding library"
645
                  PatronLibrary: "patron's home library"
646
                  PatronLibrary: "patron's home library"
646
            - to see if the patron can place a hold on the item.    
647
            - to see if the patron can place a hold on the item.    
647
        -
648
        -
(-)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 => 62;
20
use Test::More tests => 63;
21
use Test::MockModule;
21
use Test::MockModule;
22
use Test::Warn;
22
use Test::Warn;
23
23
Lines 147-152 ok( Link Here
147
        { branchcode => 'PatronHomeLib' }
147
        { branchcode => 'PatronHomeLib' }
148
    ), "GetReservesControlBranch returns item home branch when set to ItemHomeLibrary"
148
    ), "GetReservesControlBranch returns item home branch when set to ItemHomeLibrary"
149
);
149
);
150
t::lib::Mocks::mock_preference( 'ReservesControlBranch', 'ItemHoldingLibrary' );
151
ok(
152
    'ItemHoldingLib' eq GetReservesControlBranch(
153
        { holdingbranch => 'ItemHoldingLib' },
154
        { branchcode => 'PatronHomeLib' }
155
    ), "GetReservesControlBranch returns item holding branch when set to ItemHoldingLibrary"
156
);
150
t::lib::Mocks::mock_preference( 'ReservesControlBranch', 'PatronLibrary' );
157
t::lib::Mocks::mock_preference( 'ReservesControlBranch', 'PatronLibrary' );
151
ok(
158
ok(
152
    'PatronHomeLib' eq GetReservesControlBranch(
159
    'PatronHomeLib' eq GetReservesControlBranch(
153
- 

Return to bug 22562