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

(-)a/C4/Reserves.pm (-9 / +5 lines)
Lines 476-486 sub CanItemBeReserved { Link Here
476
        return { status => 'cannotReserveFromOtherBranches' };
476
        return { status => 'cannotReserveFromOtherBranches' };
477
    }
477
    }
478
478
479
    my $branch_control = C4::Context->preference('HomeOrHoldingBranch');
479
    my $item_library = Koha::Libraries->find( {branchcode => $item->homebranch} );
480
    my $itembranchcode = $branch_control eq 'holdingbranch' ? $item->holdingbranch : $item->homebranch;
481
    my $item_library = Koha::Libraries->find( {branchcode => $itembranchcode} );
482
    if ( $branchitemrule->{holdallowed} == 3) {
480
    if ( $branchitemrule->{holdallowed} == 3) {
483
        if($borrower->{branchcode} ne $itembranchcode && !$item_library->validate_hold_sibling( {branchcode => $borrower->{branchcode}} )) {
481
        if($borrower->{branchcode} ne $item->homebranch && !$item_library->validate_hold_sibling( {branchcode => $borrower->{branchcode}} )) {
484
            return { status => 'branchNotInHoldGroup' };
482
            return { status => 'branchNotInHoldGroup' };
485
        }
483
        }
486
    }
484
    }
Lines 825-831 sub CheckReserves { Link Here
825
                    my $branchitemrule = C4::Circulation::GetBranchItemRule($branch,$item->effective_itemtype);
823
                    my $branchitemrule = C4::Circulation::GetBranchItemRule($branch,$item->effective_itemtype);
826
                    next if ($branchitemrule->{'holdallowed'} == 0);
824
                    next if ($branchitemrule->{'holdallowed'} == 0);
827
                    next if (($branchitemrule->{'holdallowed'} == 1) && ($branch ne $patron->branchcode));
825
                    next if (($branchitemrule->{'holdallowed'} == 1) && ($branch ne $patron->branchcode));
828
                    my $library = Koha::Libraries->find({branchcode=>$branch});
826
                    my $library = Koha::Libraries->find({branchcode=>$item->homebranch});
829
                    next if (($branchitemrule->{'holdallowed'} == 3) && (!$library->validate_hold_sibling({branchcode => $patron->branchcode}) ));
827
                    next if (($branchitemrule->{'holdallowed'} == 3) && (!$library->validate_hold_sibling({branchcode => $patron->branchcode}) ));
830
                    my $hold_fulfillment_policy = $branchitemrule->{hold_fulfillment_policy};
828
                    my $hold_fulfillment_policy = $branchitemrule->{hold_fulfillment_policy};
831
                    next if ( ($hold_fulfillment_policy eq 'holdgroup') && (!$library->validate_hold_sibling({branchcode => $res->{branchcode}})) );
829
                    next if ( ($hold_fulfillment_policy eq 'holdgroup') && (!$library->validate_hold_sibling({branchcode => $res->{branchcode}})) );
Lines 1243-1251 sub IsAvailableForItemLevelRequest { Link Here
1243
        foreach my $i (@items) {
1241
        foreach my $i (@items) {
1244
            my $reserves_control_branch = GetReservesControlBranch( $i->unblessed(), $patron->unblessed );
1242
            my $reserves_control_branch = GetReservesControlBranch( $i->unblessed(), $patron->unblessed );
1245
            my $branchitemrule = C4::Circulation::GetBranchItemRule( $reserves_control_branch, $i->itype );
1243
            my $branchitemrule = C4::Circulation::GetBranchItemRule( $reserves_control_branch, $i->itype );
1246
            my $branch_control = C4::Context->preference('HomeOrHoldingBranch');
1244
            my $item_library = Koha::Libraries->find( {branchcode => $i->homebranch} );
1247
            my $itembranchcode = $branch_control eq 'holdingbranch' ? $item->holdingbranch : $item->homebranch;
1248
            my $item_library = Koha::Libraries->find( {branchcode => $itembranchcode} );
1249
1245
1250
1246
1251
            $any_available = 1
1247
            $any_available = 1
Lines 1258-1264 sub IsAvailableForItemLevelRequest { Link Here
1258
                && !C4::Context->preference('AllowHoldsOnDamagedItems') )
1254
                && !C4::Context->preference('AllowHoldsOnDamagedItems') )
1259
              || Koha::ItemTypes->find( $i->effective_itemtype() )->notforloan
1255
              || Koha::ItemTypes->find( $i->effective_itemtype() )->notforloan
1260
              || $branchitemrule->{holdallowed} == 1 && $patron->branchcode ne $i->homebranch
1256
              || $branchitemrule->{holdallowed} == 1 && $patron->branchcode ne $i->homebranch
1261
              || $branchitemrule->{holdallowed} == 3 && !$item_library->validate_hold_sibling( {branchcode => $pickup_branchcode} );
1257
              || $branchitemrule->{holdallowed} == 3 && !$item_library->validate_hold_sibling( {branchcode => $patron->branchcode} );
1262
        }
1258
        }
1263
1259
1264
        return $any_available ? 0 : 1;
1260
        return $any_available ? 0 : 1;
(-)a/Koha/Biblio.pm (-1 / +1 lines)
Lines 185-191 sub pickup_locations { Link Here
185
    my $patron = $params->{patron};
185
    my $patron = $params->{patron};
186
186
187
    my @pickup_locations;
187
    my @pickup_locations;
188
    foreach my $item_of_bib ($self->items) {
188
    foreach my $item_of_bib ($self->items->as_list) {
189
        push @pickup_locations, $item_of_bib->pickup_locations( {patron => $patron} );
189
        push @pickup_locations, $item_of_bib->pickup_locations( {patron => $patron} );
190
    }
190
    }
191
191
(-)a/Koha/Item.pm (-2 lines)
Lines 316-323 sub pickup_locations { Link Here
316
    my $branch_control = C4::Context->preference('HomeOrHoldingBranch');
316
    my $branch_control = C4::Context->preference('HomeOrHoldingBranch');
317
    my $library = $branch_control eq 'holdingbranch' ? $self->holding_branch : $self->home_branch;
317
    my $library = $branch_control eq 'holdingbranch' ? $self->holding_branch : $self->home_branch;
318
318
319
    #warn $branch_control.' '.$branchitemrule->{holdallowed}.' '.$library->branchcode.' '.$patron->branchcode;
320
321
    my @libs;
319
    my @libs;
322
    if(defined $patron) {
320
    if(defined $patron) {
323
        return @libs if $branchitemrule->{holdallowed} == 3 && !$library->validate_hold_sibling( {branchcode => $patron->branchcode} );
321
        return @libs if $branchitemrule->{holdallowed} == 3 && !$library->validate_hold_sibling( {branchcode => $patron->branchcode} );
(-)a/installer/data/mysql/atomicupdate/bug_22284_add_ft_local_hold_group_to_library_groups.perl (-6 / +1 lines)
Lines 5-16 if( CheckVersion( $DBversion ) ) { Link Here
5
        $dbh->do( "ALTER TABLE library_groups ADD COLUMN ft_local_hold_group tinyint(1) NOT NULL DEFAULT 0 AFTER ft_search_groups_staff" );
5
        $dbh->do( "ALTER TABLE library_groups ADD COLUMN ft_local_hold_group tinyint(1) NOT NULL DEFAULT 0 AFTER ft_search_groups_staff" );
6
    }
6
    }
7
7
8
    $dbh->do("ALTER TABLE default_branch_circ_rules MODIFY hold_fulfillment_policy ENUM('any', 'holdgroup', 'homebranch', 'holdingbranch') NOT NULL DEFAULT 'any'");
9
    $dbh->do("ALTER TABLE default_circ_rules MODIFY hold_fulfillment_policy ENUM('any', 'holdgroup', 'homebranch', 'holdingbranch') NOT NULL DEFAULT 'any'");
10
    $dbh->do("ALTER TABLE default_branch_item_rules MODIFY hold_fulfillment_policy ENUM('any', 'holdgroup', 'homebranch', 'holdingbranch') NOT NULL DEFAULT 'any'");
11
    $dbh->do("ALTER TABLE branch_item_rules MODIFY hold_fulfillment_policy ENUM('any', 'holdgroup', 'homebranch', 'holdingbranch') NOT NULL DEFAULT 'any'");
12
13
    # Always end with this (adjust the bug info)
8
    # Always end with this (adjust the bug info)
14
    SetVersion( $DBversion );
9
    SetVersion( $DBversion );
15
    print "Upgrade to $DBversion done (Bug 22284 - Add ft_local_hold_group column to library_groups and alter hold_fulfillment_policy in rules tables)\n";
10
    print "Upgrade to $DBversion done (Bug 22284 - Add ft_local_hold_group column to library_groups)\n";
16
}
11
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (-3 / +3 lines)
Lines 443-449 Link Here
443
                                From any library
443
                                From any library
444
                            </option>
444
                            </option>
445
445
446
			    [% IF holdallowed == 3 %]
446
                            [% IF holdallowed == 3 %]
447
                            <option value="3" selected="selected">
447
                            <option value="3" selected="selected">
448
                            [% ELSE %]
448
                            [% ELSE %]
449
                            <option value="3">
449
                            <option value="3">
Lines 486-492 Link Here
486
                                </option>
486
                                </option>
487
                            [% END %]
487
                            [% END %]
488
488
489
			    [% IF hold_fulfillment_policy == 'holdgroup' %]
489
                            [% IF hold_fulfillment_policy == 'holdgroup' %]
490
                                <option value="holdgroup" selected="selected">
490
                                <option value="holdgroup" selected="selected">
491
                                    item's hold group
491
                                    item's hold group
492
                                </option>
492
                                </option>
Lines 759-765 Link Here
759
                            <td>
759
                            <td>
760
                                [% IF holdallowed == 2 %]
760
                                [% IF holdallowed == 2 %]
761
                                    <span>From any library</span>
761
                                    <span>From any library</span>
762
				[% ELSIF holdallowed == 3 %]
762
                                [% ELSIF holdallowed == 3 %]
763
                                    <span>From local hold group</span>
763
                                    <span>From local hold group</span>
764
                                [% ELSIF holdallowed == 1 %]
764
                                [% ELSIF holdallowed == 1 %]
765
                                    <span>From home library</span>
765
                                    <span>From home library</span>
(-)a/t/db_dependent/Holds.t (-92 / +173 lines)
Lines 7-13 use t::lib::TestBuilder; Link Here
7
7
8
use C4::Context;
8
use C4::Context;
9
9
10
use Test::More tests => 60;
10
use Test::More tests => 61;
11
use MARC::Record;
11
use MARC::Record;
12
12
13
use C4::Biblio;
13
use C4::Biblio;
Lines 244-256 is( $hold->priority, '6', "Test AlterPriority(), move to bottom" ); Link Here
244
my $foreign_biblio = $builder->build_sample_biblio({ itemtype => 'DUMMY' });
244
my $foreign_biblio = $builder->build_sample_biblio({ itemtype => 'DUMMY' });
245
my ($foreign_item_bibnum, $foreign_item_bibitemnum, $foreign_itemnumber)
245
my ($foreign_item_bibnum, $foreign_item_bibitemnum, $foreign_itemnumber)
246
  = AddItem({ homebranch => $branch_2, holdingbranch => $branch_2 } , $foreign_biblio->biblionumber);
246
  = AddItem({ homebranch => $branch_2, holdingbranch => $branch_2 } , $foreign_biblio->biblionumber);
247
$dbh->do('DELETE FROM issuingrules');
247
# Cleanup circulation rules
248
$dbh->do(
248
$dbh->do('DELETE FROM circulation_rules');
249
    q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed, holds_per_record)
249
# $dbh->do(
250
      VALUES (?, ?, ?, ?, ?)},
250
#     q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed, holds_per_record)
251
    {},
251
#       VALUES (?, ?, ?, ?, ?)},
252
    '*', '*', '*', 25, 99
252
#     {},
253
);
253
#     '*', '*', '*', 25, 99
254
# );
254
$dbh->do(
255
$dbh->do(
255
    q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed, holds_per_record)
256
    q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed, holds_per_record)
256
      VALUES (?, ?, ?, ?, ?)},
257
      VALUES (?, ?, ?, ?, ?)},
Lines 565-570 subtest 'CanItemBeReserved / holds_per_day tests' => sub { Link Here
565
566
566
    Koha::Holds->search->delete;
567
    Koha::Holds->search->delete;
567
    $dbh->do('DELETE FROM issues');
568
    $dbh->do('DELETE FROM issues');
569
    $dbh->do('DELETE FROM issuingrules');
570
    $dbh->do('DELETE FROM circulation_rules');
568
    Koha::Items->search->delete;
571
    Koha::Items->search->delete;
569
    Koha::Biblios->search->delete;
572
    Koha::Biblios->search->delete;
570
573
Lines 705-714 subtest 'CanItemBeReserved / branch_not_in_hold_group' => sub { Link Here
705
        {},
708
        {},
706
        '*', '*', '*', 25
709
        '*', '*', '*', 25
707
    );
710
    );
708
    $dbh->do('DELETE FROM branch_item_rules');
711
    $dbh->do('DELETE FROM circulation_rules');
709
    $dbh->do('DELETE FROM default_branch_circ_rules');
710
    $dbh->do('DELETE FROM default_branch_item_rules');
711
    $dbh->do('DELETE FROM default_circ_rules');
712
712
713
    Koha::Items->search->delete;
713
    Koha::Items->search->delete;
714
    Koha::Biblios->search->delete;
714
    Koha::Biblios->search->delete;
Lines 762-772 subtest 'CanItemBeReserved / branch_not_in_hold_group' => sub { Link Here
762
    );
762
    );
763
763
764
    # Insert default circ rule of holds allowed only from local hold group for all libraries
764
    # Insert default circ rule of holds allowed only from local hold group for all libraries
765
    $dbh->do(
765
    Koha::CirculationRules->set_rules(
766
        q{INSERT INTO default_circ_rules (holdallowed, hold_fulfillment_policy, returnbranch)
766
        {
767
        VALUES (?,?,?)},
767
            branchcode => undef,
768
        {},
768
            itemtype   => undef,
769
        3, 'any', 'any'
769
            categorycode => undef,
770
            rules => {
771
                holdallowed => 3,
772
                hold_fulfillment_policy => 'any',
773
                returnbranch => 'any'
774
            }
775
        }
770
    );
776
    );
771
777
772
    # Test 2: Patron 1 can place hold
778
    # Test 2: Patron 1 can place hold
Lines 784-797 subtest 'CanItemBeReserved / branch_not_in_hold_group' => sub { Link Here
784
    );
790
    );
785
791
786
    # Cleanup default_cirt_rules
792
    # Cleanup default_cirt_rules
787
    $dbh->do('DELETE FROM default_circ_rules');
793
    $dbh->do('DELETE FROM circulation_rules');
788
794
789
    # Insert default circ rule to "any" for library 2
795
    # Insert default circ rule to "any" for library 2
790
    $dbh->do(
796
    Koha::CirculationRules->set_rules(
791
        q{INSERT INTO default_branch_circ_rules (branchcode, holdallowed, hold_fulfillment_policy, returnbranch)
797
        {
792
        VALUES (?,?,?,?)},
798
            branchcode => $library2->branchcode,
793
        {},
799
            itemtype   => undef,
794
        $library2->branchcode, 2, 'any', 'any'
800
            categorycode => undef,
801
            rules => {
802
                holdallowed => 2,
803
                hold_fulfillment_policy => 'any',
804
                returnbranch => 'any'
805
            }
806
        }
795
    );
807
    );
796
808
797
    # Test 4: Patron 3 can place hold
809
    # Test 4: Patron 3 can place hold
Lines 802-812 subtest 'CanItemBeReserved / branch_not_in_hold_group' => sub { Link Here
802
    );
814
    );
803
815
804
    # Update default circ rule to "hold group" for library 2
816
    # Update default circ rule to "hold group" for library 2
805
    $dbh->do(
817
    Koha::CirculationRules->set_rules(
806
        q{UPDATE default_branch_circ_rules set holdallowed = ?
818
        {
807
        WHERE branchcode = ?},
819
            branchcode => $library2->branchcode,
808
        {},
820
            itemtype   => undef,
809
        3, $library2->branchcode
821
            categorycode => undef,
822
            rules => {
823
                holdallowed => 3,
824
                hold_fulfillment_policy => 'any',
825
                returnbranch => 'any'
826
            }
827
        }
810
    );
828
    );
811
829
812
    # Test 5: Patron 3 cannot place hold
830
    # Test 5: Patron 3 cannot place hold
Lines 817-830 subtest 'CanItemBeReserved / branch_not_in_hold_group' => sub { Link Here
817
    );
835
    );
818
836
819
    # Cleanup default_branch_cirt_rules
837
    # Cleanup default_branch_cirt_rules
820
    $dbh->do('DELETE FROM default_branch_circ_rules');
838
    $dbh->do('DELETE FROM circulation_rules');
821
839
822
    # Insert default item rule to "any" for itemtype 2
840
    # Insert default item rule to "any" for itemtype 2
823
    $dbh->do(
841
    Koha::CirculationRules->set_rules(
824
        q{INSERT INTO default_branch_item_rules (itemtype, holdallowed, hold_fulfillment_policy, returnbranch)
842
        {
825
        VALUES (?,?,?,?)},
843
            branchcode => undef,
826
        {},
844
            itemtype   => $itemtype2->itemtype,
827
        $itemtype2->itemtype, 2, 'any', 'any'
845
            categorycode => undef,
846
            rules => {
847
                holdallowed => 2,
848
                hold_fulfillment_policy => 'any',
849
                returnbranch => 'any'
850
            }
851
        }
828
    );
852
    );
829
853
830
    # Test 6: Patron 3 can place hold
854
    # Test 6: Patron 3 can place hold
Lines 835-845 subtest 'CanItemBeReserved / branch_not_in_hold_group' => sub { Link Here
835
    );
859
    );
836
860
837
    # Update default item rule to "hold group" for itemtype 2
861
    # Update default item rule to "hold group" for itemtype 2
838
    $dbh->do(
862
    Koha::CirculationRules->set_rules(
839
        q{UPDATE default_branch_item_rules set holdallowed = ?
863
        {
840
        WHERE itemtype = ?},
864
            branchcode => undef,
841
        {},
865
            itemtype   => $itemtype2->itemtype,
842
        3, $itemtype2->itemtype
866
            categorycode => undef,
867
            rules => {
868
                holdallowed => 3,
869
                hold_fulfillment_policy => 'any',
870
                returnbranch => 'any'
871
            }
872
        }
843
    );
873
    );
844
874
845
    # Test 7: Patron 3 cannot place hold
875
    # Test 7: Patron 3 cannot place hold
Lines 850-863 subtest 'CanItemBeReserved / branch_not_in_hold_group' => sub { Link Here
850
    );
880
    );
851
881
852
    # Cleanup default_branch_item_rules
882
    # Cleanup default_branch_item_rules
853
    $dbh->do('DELETE FROM default_branch_item_rules');
883
    $dbh->do('DELETE FROM circulation_rules');
854
884
855
    # Insert branch item rule to "any" for itemtype 2 and library 2
885
    # Insert branch item rule to "any" for itemtype 2 and library 2
856
    $dbh->do(
886
    Koha::CirculationRules->set_rules(
857
        q{INSERT INTO branch_item_rules (branchcode, itemtype, holdallowed, hold_fulfillment_policy, returnbranch)
887
        {
858
        VALUES (?,?,?,?,?)},
888
            branchcode => $library2->branchcode,
859
        {},
889
            itemtype   => $itemtype2->itemtype,
860
        $library2->branchcode, $itemtype2->itemtype, 2, 'any', 'any'
890
            categorycode => undef,
891
            rules => {
892
                holdallowed => 2,
893
                hold_fulfillment_policy => 'any',
894
                returnbranch => 'any'
895
            }
896
        }
861
    );
897
    );
862
898
863
    # Test 8: Patron 3 can place hold
899
    # Test 8: Patron 3 can place hold
Lines 868-878 subtest 'CanItemBeReserved / branch_not_in_hold_group' => sub { Link Here
868
    );
904
    );
869
905
870
    # Update branch item rule to "hold group" for itemtype 2 and library 2
906
    # Update branch item rule to "hold group" for itemtype 2 and library 2
871
    $dbh->do(
907
    Koha::CirculationRules->set_rules(
872
        q{UPDATE branch_item_rules set holdallowed = ?
908
        {
873
        WHERE branchcode = ? and itemtype = ?},
909
            branchcode => $library2->branchcode,
874
        {},
910
            itemtype   => $itemtype2->itemtype,
875
        3, $library2->branchcode, $itemtype2->itemtype
911
            categorycode => undef,
912
            rules => {
913
                holdallowed => 3,
914
                hold_fulfillment_policy => 'any',
915
                returnbranch => 'any'
916
            }
917
        }
876
    );
918
    );
877
919
878
    # Test 9: Patron 3 cannot place hold
920
    # Test 9: Patron 3 cannot place hold
Lines 901-910 subtest 'CanItemBeReserved / pickup_not_in_hold_group' => sub { Link Here
901
        {},
943
        {},
902
        '*', '*', '*', 25
944
        '*', '*', '*', 25
903
    );
945
    );
904
    $dbh->do('DELETE FROM branch_item_rules');
946
    $dbh->do('DELETE FROM circulation_rules');
905
    $dbh->do('DELETE FROM default_branch_circ_rules');
906
    $dbh->do('DELETE FROM default_branch_item_rules');
907
    $dbh->do('DELETE FROM default_circ_rules');
908
947
909
    Koha::Items->search->delete;
948
    Koha::Items->search->delete;
910
    Koha::Biblios->search->delete;
949
    Koha::Biblios->search->delete;
Lines 958-968 subtest 'CanItemBeReserved / pickup_not_in_hold_group' => sub { Link Here
958
    );
997
    );
959
998
960
    # Insert default circ rule of holds allowed only from local hold group for all libraries
999
    # Insert default circ rule of holds allowed only from local hold group for all libraries
961
    $dbh->do(
1000
    Koha::CirculationRules->set_rules(
962
        q{INSERT INTO default_circ_rules (holdallowed, hold_fulfillment_policy, returnbranch)
1001
        {
963
        VALUES (?,?,?)},
1002
            branchcode => undef,
964
        {},
1003
            itemtype   => undef,
965
        2, 'holdgroup', 'any'
1004
            categorycode => undef,
1005
            rules => {
1006
                holdallowed => 2,
1007
                hold_fulfillment_policy => 'holdgroup',
1008
                returnbranch => 'any'
1009
            }
1010
        }
966
    );
1011
    );
967
1012
968
    # Test 2: Patron 1 can place hold
1013
    # Test 2: Patron 1 can place hold
Lines 980-993 subtest 'CanItemBeReserved / pickup_not_in_hold_group' => sub { Link Here
980
    );
1025
    );
981
1026
982
    # Cleanup default_cirt_rules
1027
    # Cleanup default_cirt_rules
983
    $dbh->do('DELETE FROM default_circ_rules');
1028
    $dbh->do('DELETE FROM circulation_rules');
984
1029
985
    # Insert default circ rule to "any" for library 2
1030
    # Insert default circ rule to "any" for library 2
986
    $dbh->do(
1031
    Koha::CirculationRules->set_rules(
987
        q{INSERT INTO default_branch_circ_rules (branchcode, holdallowed, hold_fulfillment_policy, returnbranch)
1032
        {
988
        VALUES (?,?,?,?)},
1033
            branchcode => $library2->branchcode,
989
        {},
1034
            itemtype   => undef,
990
        $library2->branchcode, 2, 'any', 'any'
1035
            categorycode => undef,
1036
            rules => {
1037
                holdallowed => 2,
1038
                hold_fulfillment_policy => 'any',
1039
                returnbranch => 'any'
1040
            }
1041
        }
991
    );
1042
    );
992
1043
993
    # Test 4: Patron 3 can place hold
1044
    # Test 4: Patron 3 can place hold
Lines 998-1008 subtest 'CanItemBeReserved / pickup_not_in_hold_group' => sub { Link Here
998
    );
1049
    );
999
1050
1000
    # Update default circ rule to "hold group" for library 2
1051
    # Update default circ rule to "hold group" for library 2
1001
    $dbh->do(
1052
    Koha::CirculationRules->set_rules(
1002
        q{UPDATE default_branch_circ_rules set hold_fulfillment_policy = ?
1053
        {
1003
        WHERE branchcode = ?},
1054
            branchcode => $library2->branchcode,
1004
        {},
1055
            itemtype   => undef,
1005
        'holdgroup', $library2->branchcode
1056
            categorycode => undef,
1057
            rules => {
1058
                holdallowed => 2,
1059
                hold_fulfillment_policy => 'holdgroup',
1060
                returnbranch => 'any'
1061
            }
1062
        }
1006
    );
1063
    );
1007
1064
1008
    # Test 5: Patron 3 cannot place hold
1065
    # Test 5: Patron 3 cannot place hold
Lines 1013-1026 subtest 'CanItemBeReserved / pickup_not_in_hold_group' => sub { Link Here
1013
    );
1070
    );
1014
1071
1015
    # Cleanup default_branch_cirt_rules
1072
    # Cleanup default_branch_cirt_rules
1016
    $dbh->do('DELETE FROM default_branch_circ_rules');
1073
    $dbh->do('DELETE FROM circulation_rules');
1017
1074
1018
    # Insert default item rule to "any" for itemtype 2
1075
    # Insert default item rule to "any" for itemtype 2
1019
    $dbh->do(
1076
    Koha::CirculationRules->set_rules(
1020
        q{INSERT INTO default_branch_item_rules (itemtype, holdallowed, hold_fulfillment_policy, returnbranch)
1077
        {
1021
        VALUES (?,?,?,?)},
1078
            branchcode => undef,
1022
        {},
1079
            itemtype   => $itemtype2->itemtype,
1023
        $itemtype2->itemtype, 2, 'any', 'any'
1080
            categorycode => undef,
1081
            rules => {
1082
                holdallowed => 2,
1083
                hold_fulfillment_policy => 'any',
1084
                returnbranch => 'any'
1085
            }
1086
        }
1024
    );
1087
    );
1025
1088
1026
    # Test 6: Patron 3 can place hold
1089
    # Test 6: Patron 3 can place hold
Lines 1031-1041 subtest 'CanItemBeReserved / pickup_not_in_hold_group' => sub { Link Here
1031
    );
1094
    );
1032
1095
1033
    # Update default item rule to "hold group" for itemtype 2
1096
    # Update default item rule to "hold group" for itemtype 2
1034
    $dbh->do(
1097
    Koha::CirculationRules->set_rules(
1035
        q{UPDATE default_branch_item_rules set hold_fulfillment_policy = ?
1098
        {
1036
        WHERE itemtype = ?},
1099
            branchcode => undef,
1037
        {},
1100
            itemtype   => $itemtype2->itemtype,
1038
        'holdgroup', $itemtype2->itemtype
1101
            categorycode => undef,
1102
            rules => {
1103
                holdallowed => 2,
1104
                hold_fulfillment_policy => 'holdgroup',
1105
                returnbranch => 'any'
1106
            }
1107
        }
1039
    );
1108
    );
1040
1109
1041
    # Test 7: Patron 3 cannot place hold
1110
    # Test 7: Patron 3 cannot place hold
Lines 1046-1059 subtest 'CanItemBeReserved / pickup_not_in_hold_group' => sub { Link Here
1046
    );
1115
    );
1047
1116
1048
    # Cleanup default_branch_item_rules
1117
    # Cleanup default_branch_item_rules
1049
    $dbh->do('DELETE FROM default_branch_item_rules');
1118
    $dbh->do('DELETE FROM circulation_rules');
1050
1119
1051
    # Insert branch item rule to "any" for itemtype 2 and library 2
1120
    # Insert branch item rule to "any" for itemtype 2 and library 2
1052
    $dbh->do(
1121
    Koha::CirculationRules->set_rules(
1053
        q{INSERT INTO branch_item_rules (branchcode, itemtype, holdallowed, hold_fulfillment_policy, returnbranch)
1122
        {
1054
        VALUES (?,?,?,?,?)},
1123
            branchcode => $library2->branchcode,
1055
        {},
1124
            itemtype   => $itemtype2->itemtype,
1056
        $library2->branchcode, $itemtype2->itemtype, 2, 'any', 'any'
1125
            categorycode => undef,
1126
            rules => {
1127
                holdallowed => 2,
1128
                hold_fulfillment_policy => 'any',
1129
                returnbranch => 'any'
1130
            }
1131
        }
1057
    );
1132
    );
1058
1133
1059
    # Test 8: Patron 3 can place hold
1134
    # Test 8: Patron 3 can place hold
Lines 1064-1074 subtest 'CanItemBeReserved / pickup_not_in_hold_group' => sub { Link Here
1064
    );
1139
    );
1065
1140
1066
    # Update branch item rule to "hold group" for itemtype 2 and library 2
1141
    # Update branch item rule to "hold group" for itemtype 2 and library 2
1067
    $dbh->do(
1142
    Koha::CirculationRules->set_rules(
1068
        q{UPDATE branch_item_rules set hold_fulfillment_policy = ?
1143
        {
1069
        WHERE branchcode = ? and itemtype = ?},
1144
            branchcode => $library2->branchcode,
1070
        {},
1145
            itemtype   => $itemtype2->itemtype,
1071
        'holdgroup', $library2->branchcode, $itemtype2->itemtype
1146
            categorycode => undef,
1147
            rules => {
1148
                holdallowed => 2,
1149
                hold_fulfillment_policy => 'holdgroup',
1150
                returnbranch => 'any'
1151
            }
1152
        }
1072
    );
1153
    );
1073
1154
1074
    # Test 9: Patron 3 cannot place hold
1155
    # Test 9: Patron 3 cannot place hold
(-)a/t/db_dependent/Koha/Biblios.t (-69 / +177 lines)
Lines 237-246 subtest 'pickup_locations' => sub { Link Here
237
        {},
237
        {},
238
        '*', '*', '*', 25
238
        '*', '*', '*', 25
239
    );
239
    );
240
    $dbh->do('DELETE FROM branch_item_rules');
240
    $dbh->do('DELETE FROM circulation_rules');
241
    $dbh->do('DELETE FROM default_branch_circ_rules');
242
    $dbh->do('DELETE FROM default_branch_item_rules');
243
    $dbh->do('DELETE FROM default_circ_rules');
244
241
245
    my $root1 = $builder->build_object( { class => 'Koha::Library::Groups', value => { ft_local_hold_group => 1 } } );
242
    my $root1 = $builder->build_object( { class => 'Koha::Library::Groups', value => { ft_local_hold_group => 1 } } );
246
    my $root2 = $builder->build_object( { class => 'Koha::Library::Groups', value => { ft_local_hold_group => 1 } } );
243
    my $root2 = $builder->build_object( { class => 'Koha::Library::Groups', value => { ft_local_hold_group => 1 } } );
Lines 318-328 subtest 'pickup_locations' => sub { Link Here
318
    t::lib::Mocks::mock_preference('HomeOrHoldingBranch', 'homebranch');
315
    t::lib::Mocks::mock_preference('HomeOrHoldingBranch', 'homebranch');
319
316
320
    #Case 1: holdallowed any, hold_fulfillment_policy any
317
    #Case 1: holdallowed any, hold_fulfillment_policy any
321
    $dbh->do(
318
    Koha::CirculationRules->set_rules(
322
        q{INSERT INTO default_circ_rules (holdallowed, hold_fulfillment_policy, returnbranch)
319
        {
323
        VALUES (?,?,?)},
320
            branchcode => undef,
324
        {},
321
            itemtype   => undef,
325
        2, 'any', 'any'
322
            categorycode => undef,
323
            rules => {
324
                holdallowed => 2,
325
                hold_fulfillment_policy => 'any',
326
                returnbranch => 'any'
327
            }
328
        }
326
    );
329
    );
327
330
328
    my @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
331
    my @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
Lines 334-343 subtest 'pickup_locations' => sub { Link Here
334
    ok(scalar(@pl_1_1) == 5 && scalar(@pl_1_4) == 5 && scalar(@pl_2_1) == 5 && scalar(@pl_2_4) == 5, 'Returns all libraries that are pickup locations');
337
    ok(scalar(@pl_1_1) == 5 && scalar(@pl_1_4) == 5 && scalar(@pl_2_1) == 5 && scalar(@pl_2_4) == 5, 'Returns all libraries that are pickup locations');
335
338
336
    #Case 2: holdallowed homebranch, hold_fulfillment_policy any, HomeOrHoldingBranch 'homebranch'
339
    #Case 2: holdallowed homebranch, hold_fulfillment_policy any, HomeOrHoldingBranch 'homebranch'
337
    $dbh->do(
340
    Koha::CirculationRules->set_rules(
338
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
341
        {
339
        {},
342
            branchcode => undef,
340
        1, 'any'
343
            itemtype   => undef,
344
            categorycode => undef,
345
            rules => {
346
                holdallowed => 1,
347
                hold_fulfillment_policy => 'any',
348
                returnbranch => 'any'
349
            }
350
        }
341
    );
351
    );
342
352
343
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
353
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
Lines 349-358 subtest 'pickup_locations' => sub { Link Here
349
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_2_1) == 0, 'Returns no pickup locations');
359
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_2_1) == 0, 'Returns no pickup locations');
350
360
351
    #Case 3: holdallowed holdgroup, hold_fulfillment_policy any
361
    #Case 3: holdallowed holdgroup, hold_fulfillment_policy any
352
    $dbh->do(
362
    Koha::CirculationRules->set_rules(
353
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
363
        {
354
        {},
364
            branchcode => undef,
355
        3, 'any'
365
            itemtype   => undef,
366
            categorycode => undef,
367
            rules => {
368
                holdallowed => 3,
369
                hold_fulfillment_policy => 'any',
370
                returnbranch => 'any'
371
            }
372
        }
356
    );
373
    );
357
374
358
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
375
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
Lines 363-372 subtest 'pickup_locations' => sub { Link Here
363
    ok(scalar(@pl_1_1) == 5 && scalar(@pl_2_4) == 5 && scalar(@pl_1_4) == 5 && scalar(@pl_2_1) == 5, 'Returns all libraries that are pickup_locations, when item\'s hombebranch is in patron\' holdgroup');
380
    ok(scalar(@pl_1_1) == 5 && scalar(@pl_2_4) == 5 && scalar(@pl_1_4) == 5 && scalar(@pl_2_1) == 5, 'Returns all libraries that are pickup_locations, when item\'s hombebranch is in patron\' holdgroup');
364
381
365
    #Case 4: holdallowed any, hold_fulfillment_policy holdgroup
382
    #Case 4: holdallowed any, hold_fulfillment_policy holdgroup
366
    $dbh->do(
383
    Koha::CirculationRules->set_rules(
367
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
384
        {
368
        {},
385
            branchcode => undef,
369
        2, 'holdgroup'
386
            itemtype   => undef,
387
            categorycode => undef,
388
            rules => {
389
                holdallowed => 2,
390
                hold_fulfillment_policy => 'holdgroup',
391
                returnbranch => 'any'
392
            }
393
        }
370
    );
394
    );
371
395
372
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
396
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
Lines 377-386 subtest 'pickup_locations' => sub { Link Here
377
    ok(scalar(@pl_1_1) == 3 && scalar(@pl_2_4) == 3 && scalar(@pl_1_4) == 3 && scalar(@pl_2_1) == 3, 'Returns libraries in item\'s holdgroup, and that are pickup_locations');
401
    ok(scalar(@pl_1_1) == 3 && scalar(@pl_2_4) == 3 && scalar(@pl_1_4) == 3 && scalar(@pl_2_1) == 3, 'Returns libraries in item\'s holdgroup, and that are pickup_locations');
378
402
379
    #Case 5: holdallowed homebranch, hold_fulfillment_policy holdgroup, HomeOrHoldingBranch 'homebranch'
403
    #Case 5: holdallowed homebranch, hold_fulfillment_policy holdgroup, HomeOrHoldingBranch 'homebranch'
380
    $dbh->do(
404
    Koha::CirculationRules->set_rules(
381
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
405
        {
382
        {},
406
            branchcode => undef,
383
        1, 'holdgroup'
407
            itemtype   => undef,
408
            categorycode => undef,
409
            rules => {
410
                holdallowed => 1,
411
                hold_fulfillment_policy => 'holdgroup',
412
                returnbranch => 'any'
413
            }
414
        }
384
    );
415
    );
385
416
386
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
417
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
Lines 392-401 subtest 'pickup_locations' => sub { Link Here
392
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_2_1) == 0, 'Returns no pickup locations');
423
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_2_1) == 0, 'Returns no pickup locations');
393
424
394
    #Case 6: holdallowed holdgroup, hold_fulfillment_policy holdgroup
425
    #Case 6: holdallowed holdgroup, hold_fulfillment_policy holdgroup
395
    $dbh->do(
426
    Koha::CirculationRules->set_rules(
396
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
427
        {
397
        {},
428
            branchcode => undef,
398
        3, 'holdgroup'
429
            itemtype   => undef,
430
            categorycode => undef,
431
            rules => {
432
                holdallowed => 3,
433
                hold_fulfillment_policy => 'holdgroup',
434
                returnbranch => 'any'
435
            }
436
        }
399
    );
437
    );
400
438
401
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
439
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
Lines 406-415 subtest 'pickup_locations' => sub { Link Here
406
    ok(scalar(@pl_1_1) == 2 && scalar(@pl_2_1) == 2 && scalar(@pl_2_4) == 1 && scalar(@pl_1_4) == 1, 'Returns libraries in item\'s holdgroup whose homebranch is included patron\'s holdgroup, and that are pickup_locations');
444
    ok(scalar(@pl_1_1) == 2 && scalar(@pl_2_1) == 2 && scalar(@pl_2_4) == 1 && scalar(@pl_1_4) == 1, 'Returns libraries in item\'s holdgroup whose homebranch is included patron\'s holdgroup, and that are pickup_locations');
407
445
408
    #Case 7: holdallowed any, hold_fulfillment_policy homebranch
446
    #Case 7: holdallowed any, hold_fulfillment_policy homebranch
409
    $dbh->do(
447
    Koha::CirculationRules->set_rules(
410
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
448
        {
411
        {},
449
            branchcode => undef,
412
        2, 'homebranch'
450
            itemtype   => undef,
451
            categorycode => undef,
452
            rules => {
453
                holdallowed => 2,
454
                hold_fulfillment_policy => 'homebranch',
455
                returnbranch => 'any'
456
            }
457
        }
413
    );
458
    );
414
459
415
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
460
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
Lines 420-429 subtest 'pickup_locations' => sub { Link Here
420
    ok(scalar(@pl_1_1) == 1 && scalar(@pl_1_4) == 1 && scalar(@pl_2_1) == 2 && scalar(@pl_2_4) == 2, 'Returns homebranch of items in biblio, that are pickup_locations');
465
    ok(scalar(@pl_1_1) == 1 && scalar(@pl_1_4) == 1 && scalar(@pl_2_1) == 2 && scalar(@pl_2_4) == 2, 'Returns homebranch of items in biblio, that are pickup_locations');
421
466
422
    #Case 8: holdallowed homebranch, hold_fulfillment_policy homebranch, HomeOrHoldingBranch 'homebranch'
467
    #Case 8: holdallowed homebranch, hold_fulfillment_policy homebranch, HomeOrHoldingBranch 'homebranch'
423
    $dbh->do(
468
    Koha::CirculationRules->set_rules(
424
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
469
        {
425
        {},
470
            branchcode => undef,
426
        1, 'homebranch'
471
            itemtype   => undef,
472
            categorycode => undef,
473
            rules => {
474
                holdallowed => 1,
475
                hold_fulfillment_policy => 'homebranch',
476
                returnbranch => 'any'
477
            }
478
        }
427
    );
479
    );
428
480
429
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
481
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
Lines 435-444 subtest 'pickup_locations' => sub { Link Here
435
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_2_1) == 0, 'No pickup locations returned');
487
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_2_1) == 0, 'No pickup locations returned');
436
488
437
    #Case 9: holdallowed holdgroup, hold_fulfillment_policy homebranch
489
    #Case 9: holdallowed holdgroup, hold_fulfillment_policy homebranch
438
    $dbh->do(
490
    Koha::CirculationRules->set_rules(
439
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
491
        {
440
        {},
492
            branchcode => undef,
441
        3, 'homebranch'
493
            itemtype   => undef,
494
            categorycode => undef,
495
            rules => {
496
                holdallowed => 3,
497
                hold_fulfillment_policy => 'homebranch',
498
                returnbranch => 'any'
499
            }
500
        }
442
    );
501
    );
443
502
444
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
503
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
Lines 450-459 subtest 'pickup_locations' => sub { Link Here
450
    ok(scalar(@pl_1_4) == 0, 'No pickup locations returned');
509
    ok(scalar(@pl_1_4) == 0, 'No pickup locations returned');
451
510
452
    #Case 10: holdallowed any, hold_fulfillment_policy holdingbranch
511
    #Case 10: holdallowed any, hold_fulfillment_policy holdingbranch
453
    $dbh->do(
512
    Koha::CirculationRules->set_rules(
454
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
513
        {
455
        {},
514
            branchcode => undef,
456
        2, 'holdingbranch'
515
            itemtype   => undef,
516
            categorycode => undef,
517
            rules => {
518
                holdallowed => 2,
519
                hold_fulfillment_policy => 'holdingbranch',
520
                returnbranch => 'any'
521
            }
522
        }
457
    );
523
    );
458
524
459
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
525
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
Lines 464-473 subtest 'pickup_locations' => sub { Link Here
464
    ok(scalar(@pl_1_1) == 2 && scalar(@pl_1_4) == 2 && scalar(@pl_2_1) == 2 && scalar(@pl_2_4) == 2, 'Returns holdingbranch of items in biblio, that are pickup_locations');
530
    ok(scalar(@pl_1_1) == 2 && scalar(@pl_1_4) == 2 && scalar(@pl_2_1) == 2 && scalar(@pl_2_4) == 2, 'Returns holdingbranch of items in biblio, that are pickup_locations');
465
531
466
    #Case 11: holdallowed homebranch, hold_fulfillment_policy holdingbranch, HomeOrHoldingBranch 'homebranch'
532
    #Case 11: holdallowed homebranch, hold_fulfillment_policy holdingbranch, HomeOrHoldingBranch 'homebranch'
467
    $dbh->do(
533
    Koha::CirculationRules->set_rules(
468
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
534
        {
469
        {},
535
            branchcode => undef,
470
        1, 'holdingbranch'
536
            itemtype   => undef,
537
            categorycode => undef,
538
            rules => {
539
                holdallowed => 1,
540
                hold_fulfillment_policy => 'holdingbranch',
541
                returnbranch => 'any'
542
            }
543
        }
471
    );
544
    );
472
545
473
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
546
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
Lines 479-488 subtest 'pickup_locations' => sub { Link Here
479
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_2_1) == 0, 'No pickup locations returned');
552
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_2_1) == 0, 'No pickup locations returned');
480
553
481
    #Case 12: holdallowed holdgroup, hold_fulfillment_policy holdingbranch
554
    #Case 12: holdallowed holdgroup, hold_fulfillment_policy holdingbranch
482
    $dbh->do(
555
    Koha::CirculationRules->set_rules(
483
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
556
        {
484
        {},
557
            branchcode => undef,
485
        3, 'holdingbranch'
558
            itemtype   => undef,
559
            categorycode => undef,
560
            rules => {
561
                holdallowed => 3,
562
                hold_fulfillment_policy => 'holdingbranch',
563
                returnbranch => 'any'
564
            }
565
        }
486
    );
566
    );
487
567
488
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
568
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
Lines 495-504 subtest 'pickup_locations' => sub { Link Here
495
    t::lib::Mocks::mock_preference('HomeOrHoldingBranch', 'holdingbranch');
575
    t::lib::Mocks::mock_preference('HomeOrHoldingBranch', 'holdingbranch');
496
576
497
    #Case 13: holdallowed homebranch, hold_fulfillment_policy any, HomeOrHoldingBranch 'holdingbranch'
577
    #Case 13: holdallowed homebranch, hold_fulfillment_policy any, HomeOrHoldingBranch 'holdingbranch'
498
    $dbh->do(
578
    Koha::CirculationRules->set_rules(
499
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
579
        {
500
        {},
580
            branchcode => undef,
501
        1, 'any'
581
            itemtype   => undef,
582
            categorycode => undef,
583
            rules => {
584
                holdallowed => 1,
585
                hold_fulfillment_policy => 'any',
586
                returnbranch => 'any'
587
            }
588
        }
502
    );
589
    );
503
590
504
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
591
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
Lines 510-519 subtest 'pickup_locations' => sub { Link Here
510
    ok(scalar(@pl_1_1) == 0, 'No pickup locations returned');
597
    ok(scalar(@pl_1_1) == 0, 'No pickup locations returned');
511
598
512
    #Case 14: holdallowed homebranch, hold_fulfillment_policy holdgroup, HomeOrHoldingBranch 'holdingbranch'
599
    #Case 14: holdallowed homebranch, hold_fulfillment_policy holdgroup, HomeOrHoldingBranch 'holdingbranch'
513
    $dbh->do(
600
    Koha::CirculationRules->set_rules(
514
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
601
        {
515
        {},
602
            branchcode => undef,
516
        1, 'holdgroup'
603
            itemtype   => undef,
604
            categorycode => undef,
605
            rules => {
606
                holdallowed => 1,
607
                hold_fulfillment_policy => 'holdgroup',
608
                returnbranch => 'any'
609
            }
610
        }
517
    );
611
    );
518
612
519
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
613
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
Lines 525-534 subtest 'pickup_locations' => sub { Link Here
525
    ok(scalar(@pl_1_1) == 0, 'No pickup locations returned');
619
    ok(scalar(@pl_1_1) == 0, 'No pickup locations returned');
526
620
527
    #Case 15: holdallowed homebranch, hold_fulfillment_policy homebranch, HomeOrHoldingBranch 'holdingbranch'
621
    #Case 15: holdallowed homebranch, hold_fulfillment_policy homebranch, HomeOrHoldingBranch 'holdingbranch'
528
    $dbh->do(
622
    Koha::CirculationRules->set_rules(
529
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
623
        {
530
        {},
624
            branchcode => undef,
531
        1, 'homebranch'
625
            itemtype   => undef,
626
            categorycode => undef,
627
            rules => {
628
                holdallowed => 1,
629
                hold_fulfillment_policy => 'homebranch',
630
                returnbranch => 'any'
631
            }
632
        }
532
    );
633
    );
533
634
534
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
635
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
Lines 541-550 subtest 'pickup_locations' => sub { Link Here
541
    ok(scalar(@pl_1_1) == 0 && scalar(@pl_1_4) == 0, 'No pickup locations returned');
642
    ok(scalar(@pl_1_1) == 0 && scalar(@pl_1_4) == 0, 'No pickup locations returned');
542
643
543
    #Case 16: holdallowed homebranch, hold_fulfillment_policy holdingbranch, HomeOrHoldingBranch 'holdingbranch'
644
    #Case 16: holdallowed homebranch, hold_fulfillment_policy holdingbranch, HomeOrHoldingBranch 'holdingbranch'
544
    $dbh->do(
645
    Koha::CirculationRules->set_rules(
545
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
646
        {
546
        {},
647
            branchcode => undef,
547
        1, 'holdingbranch'
648
            itemtype   => undef,
649
            categorycode => undef,
650
            rules => {
651
                holdallowed => 1,
652
                hold_fulfillment_policy => 'holdingbranch',
653
                returnbranch => 'any'
654
            }
655
        }
548
    );
656
    );
549
657
550
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
658
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
(-)a/t/db_dependent/Koha/Items.t (-69 / +177 lines)
Lines 196-205 subtest 'pickup_locations' => sub { Link Here
196
        {},
196
        {},
197
        '*', '*', '*', 25
197
        '*', '*', '*', 25
198
    );
198
    );
199
    $dbh->do('DELETE FROM branch_item_rules');
199
    $dbh->do('DELETE FROM circulation_rules');
200
    $dbh->do('DELETE FROM default_branch_circ_rules');
201
    $dbh->do('DELETE FROM default_branch_item_rules');
202
    $dbh->do('DELETE FROM default_circ_rules');
203
200
204
    my $root1 = $builder->build_object( { class => 'Koha::Library::Groups', value => { ft_local_hold_group => 1 } } );
201
    my $root1 = $builder->build_object( { class => 'Koha::Library::Groups', value => { ft_local_hold_group => 1 } } );
205
    my $root2 = $builder->build_object( { class => 'Koha::Library::Groups', value => { ft_local_hold_group => 1 } } );
202
    my $root2 = $builder->build_object( { class => 'Koha::Library::Groups', value => { ft_local_hold_group => 1 } } );
Lines 241-251 subtest 'pickup_locations' => sub { Link Here
241
    t::lib::Mocks::mock_preference('HomeOrHoldingBranch', 'homebranch');
238
    t::lib::Mocks::mock_preference('HomeOrHoldingBranch', 'homebranch');
242
239
243
    #Case 1: holdallowed any, hold_fulfillment_policy any
240
    #Case 1: holdallowed any, hold_fulfillment_policy any
244
    $dbh->do(
241
    Koha::CirculationRules->set_rules(
245
        q{INSERT INTO default_circ_rules (holdallowed, hold_fulfillment_policy, returnbranch)
242
        {
246
        VALUES (?,?,?)},
243
            branchcode => undef,
247
        {},
244
            itemtype   => undef,
248
        2, 'any', 'any'
245
            categorycode => undef,
246
            rules => {
247
                holdallowed => 2,
248
                hold_fulfillment_policy => 'any',
249
                returnbranch => 'any'
250
            }
251
        }
249
    );
252
    );
250
253
251
    my @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
254
    my @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
Lines 256-265 subtest 'pickup_locations' => sub { Link Here
256
    ok(scalar(@pl_1_1) == scalar(@pl_1_4) && scalar(@pl_1_1) == scalar(@pl_3_1) && scalar(@pl_1_1) == scalar(@pl_3_4), 'All combinations of patron/item renders the same number of locations');
259
    ok(scalar(@pl_1_1) == scalar(@pl_1_4) && scalar(@pl_1_1) == scalar(@pl_3_1) && scalar(@pl_1_1) == scalar(@pl_3_4), 'All combinations of patron/item renders the same number of locations');
257
260
258
    #Case 2: holdallowed homebranch, hold_fulfillment_policy any, HomeOrHoldingBranch 'homebranch'
261
    #Case 2: holdallowed homebranch, hold_fulfillment_policy any, HomeOrHoldingBranch 'homebranch'
259
    $dbh->do(
262
    Koha::CirculationRules->set_rules(
260
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
263
        {
261
        {},
264
            branchcode => undef,
262
        1, 'any'
265
            itemtype   => undef,
266
            categorycode => undef,
267
            rules => {
268
                holdallowed => 1,
269
                hold_fulfillment_policy => 'any',
270
                returnbranch => 'any'
271
            }
272
        }
263
    );
273
    );
264
274
265
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
275
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
Lines 271-280 subtest 'pickup_locations' => sub { Link Here
271
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_3_4) == 0, 'Any other combination renders no locations');
281
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_3_4) == 0, 'Any other combination renders no locations');
272
282
273
    #Case 3: holdallowed holdgroup, hold_fulfillment_policy any
283
    #Case 3: holdallowed holdgroup, hold_fulfillment_policy any
274
    $dbh->do(
284
    Koha::CirculationRules->set_rules(
275
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
285
        {
276
        {},
286
            branchcode => undef,
277
        3, 'any'
287
            itemtype   => undef,
288
            categorycode => undef,
289
            rules => {
290
                holdallowed => 3,
291
                hold_fulfillment_policy => 'any',
292
                returnbranch => 'any'
293
            }
294
        }
278
    );
295
    );
279
296
280
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
297
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
Lines 287-296 subtest 'pickup_locations' => sub { Link Here
287
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0, 'Any other combination renders no locations');
304
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0, 'Any other combination renders no locations');
288
305
289
    #Case 4: holdallowed any, hold_fulfillment_policy holdgroup
306
    #Case 4: holdallowed any, hold_fulfillment_policy holdgroup
290
    $dbh->do(
307
    Koha::CirculationRules->set_rules(
291
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
308
        {
292
        {},
309
            branchcode => undef,
293
        2, 'holdgroup'
310
            itemtype   => undef,
311
            categorycode => undef,
312
            rules => {
313
                holdallowed => 2,
314
                hold_fulfillment_policy => 'holdgroup',
315
                returnbranch => 'any'
316
            }
317
        }
294
    );
318
    );
295
319
296
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
320
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
Lines 302-311 subtest 'pickup_locations' => sub { Link Here
302
    ok(scalar(@pl_3_1) == 1 && scalar(@pl_3_4) == 1, 'Pickup locations for item 3 renders all libraries in items\'s holdgroup that are pickup_locations');
326
    ok(scalar(@pl_3_1) == 1 && scalar(@pl_3_4) == 1, 'Pickup locations for item 3 renders all libraries in items\'s holdgroup that are pickup_locations');
303
327
304
    #Case 5: holdallowed homebranch, hold_fulfillment_policy holdgroup, HomeOrHoldingBranch 'homebranch'
328
    #Case 5: holdallowed homebranch, hold_fulfillment_policy holdgroup, HomeOrHoldingBranch 'homebranch'
305
    $dbh->do(
329
    Koha::CirculationRules->set_rules(
306
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
330
        {
307
        {},
331
            branchcode => undef,
308
        1, 'holdgroup'
332
            itemtype   => undef,
333
            categorycode => undef,
334
            rules => {
335
                holdallowed => 1,
336
                hold_fulfillment_policy => 'holdgroup',
337
                returnbranch => 'any'
338
            }
339
        }
309
    );
340
    );
310
341
311
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
342
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
Lines 317-326 subtest 'pickup_locations' => sub { Link Here
317
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_3_4) == 0, 'Any other combination renders no locations');
348
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_3_4) == 0, 'Any other combination renders no locations');
318
349
319
    #Case 6: holdallowed holdgroup, hold_fulfillment_policy holdgroup
350
    #Case 6: holdallowed holdgroup, hold_fulfillment_policy holdgroup
320
    $dbh->do(
351
    Koha::CirculationRules->set_rules(
321
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
352
        {
322
        {},
353
            branchcode => undef,
323
        3, 'holdgroup'
354
            itemtype   => undef,
355
            categorycode => undef,
356
            rules => {
357
                holdallowed => 3,
358
                hold_fulfillment_policy => 'holdgroup',
359
                returnbranch => 'any'
360
            }
361
        }
324
    );
362
    );
325
363
326
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
364
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
Lines 333-342 subtest 'pickup_locations' => sub { Link Here
333
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0, 'Any other combination renders no locations');
371
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0, 'Any other combination renders no locations');
334
372
335
    #Case 7: holdallowed any, hold_fulfillment_policy homebranch
373
    #Case 7: holdallowed any, hold_fulfillment_policy homebranch
336
    $dbh->do(
374
    Koha::CirculationRules->set_rules(
337
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
375
        {
338
        {},
376
            branchcode => undef,
339
        2, 'homebranch'
377
            itemtype   => undef,
378
            categorycode => undef,
379
            rules => {
380
                holdallowed => 2,
381
                hold_fulfillment_policy => 'homebranch',
382
                returnbranch => 'any'
383
            }
384
        }
340
    );
385
    );
341
386
342
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
387
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
Lines 348-357 subtest 'pickup_locations' => sub { Link Here
348
    ok(scalar(@pl_3_1) == 0 && scalar(@pl_3_4) == 0, 'Any other combination renders no locations, because library3 is not pickup_location');
393
    ok(scalar(@pl_3_1) == 0 && scalar(@pl_3_4) == 0, 'Any other combination renders no locations, because library3 is not pickup_location');
349
394
350
    #Case 8: holdallowed homebranch, hold_fulfillment_policy homebranch, HomeOrHoldingBranch 'homebranch'
395
    #Case 8: holdallowed homebranch, hold_fulfillment_policy homebranch, HomeOrHoldingBranch 'homebranch'
351
    $dbh->do(
396
    Koha::CirculationRules->set_rules(
352
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
397
        {
353
        {},
398
            branchcode => undef,
354
        1, 'homebranch'
399
            itemtype   => undef,
400
            categorycode => undef,
401
            rules => {
402
                holdallowed => 1,
403
                hold_fulfillment_policy => 'homebranch',
404
                returnbranch => 'any'
405
            }
406
        }
355
    );
407
    );
356
408
357
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
409
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
Lines 363-372 subtest 'pickup_locations' => sub { Link Here
363
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_3_4) == 0, 'Any other combination renders no locations');
415
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_3_4) == 0, 'Any other combination renders no locations');
364
416
365
    #Case 9: holdallowed holdgroup, hold_fulfillment_policy homebranch
417
    #Case 9: holdallowed holdgroup, hold_fulfillment_policy homebranch
366
    $dbh->do(
418
    Koha::CirculationRules->set_rules(
367
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
419
        {
368
        {},
420
            branchcode => undef,
369
        3, 'homebranch'
421
            itemtype   => undef,
422
            categorycode => undef,
423
            rules => {
424
                holdallowed => 3,
425
                hold_fulfillment_policy => 'homebranch',
426
                returnbranch => 'any'
427
            }
428
        }
370
    );
429
    );
371
430
372
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
431
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
Lines 378-387 subtest 'pickup_locations' => sub { Link Here
378
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_3_4) == 0, 'Any other combination renders no locations');
437
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_3_4) == 0, 'Any other combination renders no locations');
379
438
380
    #Case 10: holdallowed any, hold_fulfillment_policy holdingbranch
439
    #Case 10: holdallowed any, hold_fulfillment_policy holdingbranch
381
    $dbh->do(
440
    Koha::CirculationRules->set_rules(
382
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
441
        {
383
        {},
442
            branchcode => undef,
384
        2, 'holdingbranch'
443
            itemtype   => undef,
444
            categorycode => undef,
445
            rules => {
446
                holdallowed => 2,
447
                hold_fulfillment_policy => 'holdingbranch',
448
                returnbranch => 'any'
449
            }
450
        }
385
    );
451
    );
386
452
387
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
453
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
Lines 394-403 subtest 'pickup_locations' => sub { Link Here
394
460
395
461
396
    #Case 11: holdallowed homebranch, hold_fulfillment_policy holdingbranch, HomeOrHoldingBranch 'homebranch'
462
    #Case 11: holdallowed homebranch, hold_fulfillment_policy holdingbranch, HomeOrHoldingBranch 'homebranch'
397
    $dbh->do(
463
    Koha::CirculationRules->set_rules(
398
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
464
        {
399
        {},
465
            branchcode => undef,
400
        1, 'holdingbranch'
466
            itemtype   => undef,
467
            categorycode => undef,
468
            rules => {
469
                holdallowed => 1,
470
                hold_fulfillment_policy => 'holdingbranch',
471
                returnbranch => 'any'
472
            }
473
        }
401
    );
474
    );
402
475
403
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
476
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
Lines 409-418 subtest 'pickup_locations' => sub { Link Here
409
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_3_4) == 0, 'Any other combination renders no locations');
482
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_3_4) == 0, 'Any other combination renders no locations');
410
483
411
    #Case 12: holdallowed holdgroup, hold_fulfillment_policy holdingbranch
484
    #Case 12: holdallowed holdgroup, hold_fulfillment_policy holdingbranch
412
    $dbh->do(
485
    Koha::CirculationRules->set_rules(
413
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
486
        {
414
        {},
487
            branchcode => undef,
415
        3, 'holdingbranch'
488
            itemtype   => undef,
489
            categorycode => undef,
490
            rules => {
491
                holdallowed => 3,
492
                hold_fulfillment_policy => 'holdingbranch',
493
                returnbranch => 'any'
494
            }
495
        }
416
    );
496
    );
417
497
418
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
498
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
Lines 427-436 subtest 'pickup_locations' => sub { Link Here
427
    t::lib::Mocks::mock_preference('HomeOrHoldingBranch', 'holdingbranch');
507
    t::lib::Mocks::mock_preference('HomeOrHoldingBranch', 'holdingbranch');
428
508
429
    #Case 13: holdallowed homebranch, hold_fulfillment_policy any, HomeOrHoldingBranch 'holdingbranch'
509
    #Case 13: holdallowed homebranch, hold_fulfillment_policy any, HomeOrHoldingBranch 'holdingbranch'
430
    $dbh->do(
510
    Koha::CirculationRules->set_rules(
431
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
511
        {
432
        {},
512
            branchcode => undef,
433
        1, 'any'
513
            itemtype   => undef,
514
            categorycode => undef,
515
            rules => {
516
                holdallowed => 1,
517
                hold_fulfillment_policy => 'any',
518
                returnbranch => 'any'
519
            }
520
        }
434
    );
521
    );
435
522
436
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
523
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
Lines 442-451 subtest 'pickup_locations' => sub { Link Here
442
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_1_1) == 0, 'Any other combination renders no locations');
529
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_1_1) == 0, 'Any other combination renders no locations');
443
530
444
    #Case 14: holdallowed homebranch, hold_fulfillment_policy holdgroup, HomeOrHoldingBranch 'holdingbranch'
531
    #Case 14: holdallowed homebranch, hold_fulfillment_policy holdgroup, HomeOrHoldingBranch 'holdingbranch'
445
    $dbh->do(
532
    Koha::CirculationRules->set_rules(
446
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
533
        {
447
        {},
534
            branchcode => undef,
448
        1, 'holdgroup'
535
            itemtype   => undef,
536
            categorycode => undef,
537
            rules => {
538
                holdallowed => 1,
539
                hold_fulfillment_policy => 'holdgroup',
540
                returnbranch => 'any'
541
            }
542
        }
449
    );
543
    );
450
544
451
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
545
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
Lines 457-466 subtest 'pickup_locations' => sub { Link Here
457
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_1_1) == 0, 'Any other combination renders no locations');
551
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_1_1) == 0, 'Any other combination renders no locations');
458
552
459
    #Case 15: holdallowed homebranch, hold_fulfillment_policy homebranch, HomeOrHoldingBranch 'holdingbranch'
553
    #Case 15: holdallowed homebranch, hold_fulfillment_policy homebranch, HomeOrHoldingBranch 'holdingbranch'
460
    $dbh->do(
554
    Koha::CirculationRules->set_rules(
461
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
555
        {
462
        {},
556
            branchcode => undef,
463
        1, 'homebranch'
557
            itemtype   => undef,
558
            categorycode => undef,
559
            rules => {
560
                holdallowed => 1,
561
                hold_fulfillment_policy => 'homebranch',
562
                returnbranch => 'any'
563
            }
564
        }
464
    );
565
    );
465
566
466
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
567
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
Lines 472-481 subtest 'pickup_locations' => sub { Link Here
472
    ok(scalar(@pl_3_4) == 0 && scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_1_1) == 0, 'Any combination of patron/item renders no locations');
573
    ok(scalar(@pl_3_4) == 0 && scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_1_1) == 0, 'Any combination of patron/item renders no locations');
473
574
474
    #Case 16: holdallowed homebranch, hold_fulfillment_policy holdingbranch, HomeOrHoldingBranch 'holdingbranch'
575
    #Case 16: holdallowed homebranch, hold_fulfillment_policy holdingbranch, HomeOrHoldingBranch 'holdingbranch'
475
    $dbh->do(
576
    Koha::CirculationRules->set_rules(
476
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
577
        {
477
        {},
578
            branchcode => undef,
478
        1, 'holdingbranch'
579
            itemtype   => undef,
580
            categorycode => undef,
581
            rules => {
582
                holdallowed => 1,
583
                hold_fulfillment_policy => 'holdingbranch',
584
                returnbranch => 'any'
585
            }
586
        }
479
    );
587
    );
480
588
481
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
589
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
(-)a/t/db_dependent/Koha/Libraries.t (-1 / +4 lines)
Lines 38-43 use t::lib::TestBuilder; Link Here
38
my $schema = Koha::Database->new->schema;
38
my $schema = Koha::Database->new->schema;
39
$schema->storage->txn_begin;
39
$schema->storage->txn_begin;
40
40
41
# Cleanup default_branch_item_rules
42
my $dbh     = C4::Context->dbh;
43
$dbh->do('DELETE FROM circulation_rules');
44
41
my $builder = t::lib::TestBuilder->new;
45
my $builder = t::lib::TestBuilder->new;
42
my $nb_of_libraries = Koha::Libraries->search->count;
46
my $nb_of_libraries = Koha::Libraries->search->count;
43
my $new_library_1 = Koha::Library->new({
47
my $new_library_1 = Koha::Library->new({
44
- 

Return to bug 22284