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

(-)a/C4/Reserves.pm (+6 lines)
Lines 357-362 sub CanItemBeReserved { Link Here
357
        $branchfield = "items.homebranch";
357
        $branchfield = "items.homebranch";
358
        $branchcode  = $item->homebranch;
358
        $branchcode  = $item->homebranch;
359
    }
359
    }
360
    elsif ( $controlbranch eq "ItemHoldingLibrary" ) {
361
        $branchfield = "items.holdingbranch";
362
        $branchcode  = $item->{holdingbranch};
363
    }
360
    elsif ( $controlbranch eq "PatronLibrary" ) {
364
    elsif ( $controlbranch eq "PatronLibrary" ) {
361
        $branchfield = "borrowers.branchcode";
365
        $branchfield = "borrowers.branchcode";
362
        $branchcode  = $borrower->{branchcode};
366
        $branchcode  = $borrower->{branchcode};
Lines 2019-2024 sub GetReservesControlBranch { Link Here
2019
2023
2020
    my $branchcode =
2024
    my $branchcode =
2021
        ( $reserves_control eq 'ItemHomeLibrary' ) ? $item->{'homebranch'}
2025
        ( $reserves_control eq 'ItemHomeLibrary' ) ? $item->{'homebranch'}
2026
      : ( $reserves_control eq 'ItemHoldingLibrary' ) ? $item->{'holdingbranch'}
2022
      : ( $reserves_control eq 'PatronLibrary' )   ? $borrower->{'branchcode'}
2027
      : ( $reserves_control eq 'PatronLibrary' )   ? $borrower->{'branchcode'}
2023
      :                                              undef;
2028
      :                                              undef;
2024
2029
Lines 2123-2128 sub GetMaxPatronHoldsForRecord { Link Here
2123
        my $itemtype = $item->effective_itemtype();
2128
        my $itemtype = $item->effective_itemtype();
2124
2129
2125
        $branchcode = $item->homebranch if ( $controlbranch eq "ItemHomeLibrary" );
2130
        $branchcode = $item->homebranch if ( $controlbranch eq "ItemHomeLibrary" );
2131
        $branchcode = $item->holdingbranch if ( $controlbranch eq "ItemHoldingLibrary" );
2126
2132
2127
        my $rule = GetHoldRule( $categorycode, $itemtype, $branchcode );
2133
        my $rule = GetHoldRule( $categorycode, $itemtype, $branchcode );
2128
        my $holds_per_record = $rule ? $rule->{holds_per_record} : 0;
2134
        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 611-616 Circulation: Link Here
611
            - pref: ReservesControlBranch
611
            - pref: ReservesControlBranch
612
              choices:
612
              choices:
613
                  ItemHomeLibrary: "item's home library"
613
                  ItemHomeLibrary: "item's home library"
614
                  ItemHoldingLibrary: "item's holding library"
614
                  PatronLibrary: "patron's home library"
615
                  PatronLibrary: "patron's home library"
615
            - to see if the patron can place a hold on the item.    
616
            - to see if the patron can place a hold on the item.    
616
        -
617
        -
(-)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 => 59;
20
use Test::More tests => 60;
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