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

(-)a/C4/Reserves.pm (-9 / +5 lines)
Lines 460-470 sub CanItemBeReserved { Link Here
460
        return { status => 'cannotReserveFromOtherBranches' };
460
        return { status => 'cannotReserveFromOtherBranches' };
461
    }
461
    }
462
462
463
    my $branch_control = C4::Context->preference('HomeOrHoldingBranch');
463
    my $item_library = Koha::Libraries->find( {branchcode => $item->homebranch} );
464
    my $itembranchcode = $branch_control eq 'holdingbranch' ? $item->holdingbranch : $item->homebranch;
465
    my $item_library = Koha::Libraries->find( {branchcode => $itembranchcode} );
466
    if ( $branchitemrule->{holdallowed} == 3) {
464
    if ( $branchitemrule->{holdallowed} == 3) {
467
        if($borrower->{branchcode} ne $itembranchcode && !$item_library->validate_hold_sibling( {branchcode => $borrower->{branchcode}} )) {
465
        if($borrower->{branchcode} ne $item->homebranch && !$item_library->validate_hold_sibling( {branchcode => $borrower->{branchcode}} )) {
468
            return { status => 'branchNotInHoldGroup' };
466
            return { status => 'branchNotInHoldGroup' };
469
        }
467
        }
470
    }
468
    }
Lines 809-815 sub CheckReserves { Link Here
809
                    my $branchitemrule = C4::Circulation::GetBranchItemRule($branch,$item->effective_itemtype);
807
                    my $branchitemrule = C4::Circulation::GetBranchItemRule($branch,$item->effective_itemtype);
810
                    next if ($branchitemrule->{'holdallowed'} == 0);
808
                    next if ($branchitemrule->{'holdallowed'} == 0);
811
                    next if (($branchitemrule->{'holdallowed'} == 1) && ($branch ne $patron->branchcode));
809
                    next if (($branchitemrule->{'holdallowed'} == 1) && ($branch ne $patron->branchcode));
812
                    my $library = Koha::Libraries->find({branchcode=>$branch});
810
                    my $library = Koha::Libraries->find({branchcode=>$item->homebranch});
813
                    next if (($branchitemrule->{'holdallowed'} == 3) && (!$library->validate_hold_sibling({branchcode => $patron->branchcode}) ));
811
                    next if (($branchitemrule->{'holdallowed'} == 3) && (!$library->validate_hold_sibling({branchcode => $patron->branchcode}) ));
814
                    my $hold_fulfillment_policy = $branchitemrule->{hold_fulfillment_policy};
812
                    my $hold_fulfillment_policy = $branchitemrule->{hold_fulfillment_policy};
815
                    next if ( ($hold_fulfillment_policy eq 'holdgroup') && (!$library->validate_hold_sibling({branchcode => $res->{branchcode}})) );
813
                    next if ( ($hold_fulfillment_policy eq 'holdgroup') && (!$library->validate_hold_sibling({branchcode => $res->{branchcode}})) );
Lines 1221-1229 sub IsAvailableForItemLevelRequest { Link Here
1221
        foreach my $i (@items) {
1219
        foreach my $i (@items) {
1222
            my $reserves_control_branch = GetReservesControlBranch( $i->unblessed(), $patron->unblessed );
1220
            my $reserves_control_branch = GetReservesControlBranch( $i->unblessed(), $patron->unblessed );
1223
            my $branchitemrule = C4::Circulation::GetBranchItemRule( $reserves_control_branch, $i->itype );
1221
            my $branchitemrule = C4::Circulation::GetBranchItemRule( $reserves_control_branch, $i->itype );
1224
            my $branch_control = C4::Context->preference('HomeOrHoldingBranch');
1222
            my $item_library = Koha::Libraries->find( {branchcode => $i->homebranch} );
1225
            my $itembranchcode = $branch_control eq 'holdingbranch' ? $item->holdingbranch : $item->homebranch;
1226
            my $item_library = Koha::Libraries->find( {branchcode => $itembranchcode} );
1227
1223
1228
1224
1229
            $any_available = 1
1225
            $any_available = 1
Lines 1236-1242 sub IsAvailableForItemLevelRequest { Link Here
1236
                && !C4::Context->preference('AllowHoldsOnDamagedItems') )
1232
                && !C4::Context->preference('AllowHoldsOnDamagedItems') )
1237
              || Koha::ItemTypes->find( $i->effective_itemtype() )->notforloan
1233
              || Koha::ItemTypes->find( $i->effective_itemtype() )->notforloan
1238
              || $branchitemrule->{holdallowed} == 1 && $patron->branchcode ne $i->homebranch
1234
              || $branchitemrule->{holdallowed} == 1 && $patron->branchcode ne $i->homebranch
1239
              || $branchitemrule->{holdallowed} == 3 && !$item_library->validate_hold_sibling( {branchcode => $pickup_branchcode} );
1235
              || $branchitemrule->{holdallowed} == 3 && !$item_library->validate_hold_sibling( {branchcode => $patron->branchcode} );
1240
        }
1236
        }
1241
1237
1242
        return $any_available ? 0 : 1;
1238
        return $any_available ? 0 : 1;
(-)a/Koha/Biblio.pm (-1 / +1 lines)
Lines 184-190 sub pickup_locations { Link Here
184
    my $patron = $params->{patron};
184
    my $patron = $params->{patron};
185
185
186
    my @pickup_locations;
186
    my @pickup_locations;
187
    foreach my $item_of_bib ($self->items) {
187
    foreach my $item_of_bib ($self->items->as_list) {
188
        push @pickup_locations, $item_of_bib->pickup_locations( {patron => $patron} );
188
        push @pickup_locations, $item_of_bib->pickup_locations( {patron => $patron} );
189
    }
189
    }
190
190
(-)a/Koha/Item.pm (-2 lines)
Lines 319-326 sub pickup_locations { Link Here
319
    my $branch_control = C4::Context->preference('HomeOrHoldingBranch');
319
    my $branch_control = C4::Context->preference('HomeOrHoldingBranch');
320
    my $library = $branch_control eq 'holdingbranch' ? $self->holding_branch : $self->home_branch;
320
    my $library = $branch_control eq 'holdingbranch' ? $self->holding_branch : $self->home_branch;
321
321
322
    #warn $branch_control.' '.$branchitemrule->{holdallowed}.' '.$library->branchcode.' '.$patron->branchcode;
323
324
    my @libs;
322
    my @libs;
325
    if(defined $patron) {
323
    if(defined $patron) {
326
        return @libs if $branchitemrule->{holdallowed} == 3 && !$library->validate_hold_sibling( {branchcode => $patron->branchcode} );
324
        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 209-218 subtest 'pickup_locations' => sub { Link Here
209
        {},
209
        {},
210
        '*', '*', '*', 25
210
        '*', '*', '*', 25
211
    );
211
    );
212
    $dbh->do('DELETE FROM branch_item_rules');
212
    $dbh->do('DELETE FROM circulation_rules');
213
    $dbh->do('DELETE FROM default_branch_circ_rules');
214
    $dbh->do('DELETE FROM default_branch_item_rules');
215
    $dbh->do('DELETE FROM default_circ_rules');
216
213
217
    my $root1 = $builder->build_object( { class => 'Koha::Library::Groups', value => { ft_local_hold_group => 1 } } );
214
    my $root1 = $builder->build_object( { class => 'Koha::Library::Groups', value => { ft_local_hold_group => 1 } } );
218
    my $root2 = $builder->build_object( { class => 'Koha::Library::Groups', value => { ft_local_hold_group => 1 } } );
215
    my $root2 = $builder->build_object( { class => 'Koha::Library::Groups', value => { ft_local_hold_group => 1 } } );
Lines 290-300 subtest 'pickup_locations' => sub { Link Here
290
    t::lib::Mocks::mock_preference('HomeOrHoldingBranch', 'homebranch');
287
    t::lib::Mocks::mock_preference('HomeOrHoldingBranch', 'homebranch');
291
288
292
    #Case 1: holdallowed any, hold_fulfillment_policy any
289
    #Case 1: holdallowed any, hold_fulfillment_policy any
293
    $dbh->do(
290
    Koha::CirculationRules->set_rules(
294
        q{INSERT INTO default_circ_rules (holdallowed, hold_fulfillment_policy, returnbranch)
291
        {
295
        VALUES (?,?,?)},
292
            branchcode => undef,
296
        {},
293
            itemtype   => undef,
297
        2, 'any', 'any'
294
            categorycode => undef,
295
            rules => {
296
                holdallowed => 2,
297
                hold_fulfillment_policy => 'any',
298
                returnbranch => 'any'
299
            }
300
        }
298
    );
301
    );
299
302
300
    my @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
303
    my @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
Lines 306-315 subtest 'pickup_locations' => sub { Link Here
306
    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');
309
    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');
307
310
308
    #Case 2: holdallowed homebranch, hold_fulfillment_policy any, HomeOrHoldingBranch 'homebranch'
311
    #Case 2: holdallowed homebranch, hold_fulfillment_policy any, HomeOrHoldingBranch 'homebranch'
309
    $dbh->do(
312
    Koha::CirculationRules->set_rules(
310
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
313
        {
311
        {},
314
            branchcode => undef,
312
        1, 'any'
315
            itemtype   => undef,
316
            categorycode => undef,
317
            rules => {
318
                holdallowed => 1,
319
                hold_fulfillment_policy => 'any',
320
                returnbranch => 'any'
321
            }
322
        }
313
    );
323
    );
314
324
315
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
325
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
Lines 321-330 subtest 'pickup_locations' => sub { Link Here
321
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_2_1) == 0, 'Returns no pickup locations');
331
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_2_1) == 0, 'Returns no pickup locations');
322
332
323
    #Case 3: holdallowed holdgroup, hold_fulfillment_policy any
333
    #Case 3: holdallowed holdgroup, hold_fulfillment_policy any
324
    $dbh->do(
334
    Koha::CirculationRules->set_rules(
325
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
335
        {
326
        {},
336
            branchcode => undef,
327
        3, 'any'
337
            itemtype   => undef,
338
            categorycode => undef,
339
            rules => {
340
                holdallowed => 3,
341
                hold_fulfillment_policy => 'any',
342
                returnbranch => 'any'
343
            }
344
        }
328
    );
345
    );
329
346
330
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
347
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
Lines 335-344 subtest 'pickup_locations' => sub { Link Here
335
    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');
352
    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');
336
353
337
    #Case 4: holdallowed any, hold_fulfillment_policy holdgroup
354
    #Case 4: holdallowed any, hold_fulfillment_policy holdgroup
338
    $dbh->do(
355
    Koha::CirculationRules->set_rules(
339
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
356
        {
340
        {},
357
            branchcode => undef,
341
        2, 'holdgroup'
358
            itemtype   => undef,
359
            categorycode => undef,
360
            rules => {
361
                holdallowed => 2,
362
                hold_fulfillment_policy => 'holdgroup',
363
                returnbranch => 'any'
364
            }
365
        }
342
    );
366
    );
343
367
344
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
368
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
Lines 349-358 subtest 'pickup_locations' => sub { Link Here
349
    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');
373
    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');
350
374
351
    #Case 5: holdallowed homebranch, hold_fulfillment_policy holdgroup, HomeOrHoldingBranch 'homebranch'
375
    #Case 5: holdallowed homebranch, hold_fulfillment_policy holdgroup, HomeOrHoldingBranch 'homebranch'
352
    $dbh->do(
376
    Koha::CirculationRules->set_rules(
353
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
377
        {
354
        {},
378
            branchcode => undef,
355
        1, 'holdgroup'
379
            itemtype   => undef,
380
            categorycode => undef,
381
            rules => {
382
                holdallowed => 1,
383
                hold_fulfillment_policy => 'holdgroup',
384
                returnbranch => 'any'
385
            }
386
        }
356
    );
387
    );
357
388
358
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
389
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
Lines 364-373 subtest 'pickup_locations' => sub { Link Here
364
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_2_1) == 0, 'Returns no pickup locations');
395
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_2_1) == 0, 'Returns no pickup locations');
365
396
366
    #Case 6: holdallowed holdgroup, hold_fulfillment_policy holdgroup
397
    #Case 6: holdallowed holdgroup, hold_fulfillment_policy holdgroup
367
    $dbh->do(
398
    Koha::CirculationRules->set_rules(
368
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
399
        {
369
        {},
400
            branchcode => undef,
370
        3, 'holdgroup'
401
            itemtype   => undef,
402
            categorycode => undef,
403
            rules => {
404
                holdallowed => 3,
405
                hold_fulfillment_policy => 'holdgroup',
406
                returnbranch => 'any'
407
            }
408
        }
371
    );
409
    );
372
410
373
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
411
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
Lines 378-387 subtest 'pickup_locations' => sub { Link Here
378
    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');
416
    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');
379
417
380
    #Case 7: holdallowed any, hold_fulfillment_policy homebranch
418
    #Case 7: holdallowed any, hold_fulfillment_policy homebranch
381
    $dbh->do(
419
    Koha::CirculationRules->set_rules(
382
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
420
        {
383
        {},
421
            branchcode => undef,
384
        2, 'homebranch'
422
            itemtype   => undef,
423
            categorycode => undef,
424
            rules => {
425
                holdallowed => 2,
426
                hold_fulfillment_policy => 'homebranch',
427
                returnbranch => 'any'
428
            }
429
        }
385
    );
430
    );
386
431
387
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
432
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
Lines 392-401 subtest 'pickup_locations' => sub { Link Here
392
    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');
437
    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');
393
438
394
    #Case 8: holdallowed homebranch, hold_fulfillment_policy homebranch, HomeOrHoldingBranch 'homebranch'
439
    #Case 8: holdallowed homebranch, hold_fulfillment_policy homebranch, HomeOrHoldingBranch 'homebranch'
395
    $dbh->do(
440
    Koha::CirculationRules->set_rules(
396
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
441
        {
397
        {},
442
            branchcode => undef,
398
        1, 'homebranch'
443
            itemtype   => undef,
444
            categorycode => undef,
445
            rules => {
446
                holdallowed => 1,
447
                hold_fulfillment_policy => 'homebranch',
448
                returnbranch => 'any'
449
            }
450
        }
399
    );
451
    );
400
452
401
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
453
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
Lines 407-416 subtest 'pickup_locations' => sub { Link Here
407
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_2_1) == 0, 'No pickup locations returned');
459
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_2_1) == 0, 'No pickup locations returned');
408
460
409
    #Case 9: holdallowed holdgroup, hold_fulfillment_policy homebranch
461
    #Case 9: holdallowed holdgroup, hold_fulfillment_policy homebranch
410
    $dbh->do(
462
    Koha::CirculationRules->set_rules(
411
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
463
        {
412
        {},
464
            branchcode => undef,
413
        3, 'homebranch'
465
            itemtype   => undef,
466
            categorycode => undef,
467
            rules => {
468
                holdallowed => 3,
469
                hold_fulfillment_policy => 'homebranch',
470
                returnbranch => 'any'
471
            }
472
        }
414
    );
473
    );
415
474
416
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
475
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
Lines 422-431 subtest 'pickup_locations' => sub { Link Here
422
    ok(scalar(@pl_1_4) == 0, 'No pickup locations returned');
481
    ok(scalar(@pl_1_4) == 0, 'No pickup locations returned');
423
482
424
    #Case 10: holdallowed any, hold_fulfillment_policy holdingbranch
483
    #Case 10: holdallowed any, hold_fulfillment_policy holdingbranch
425
    $dbh->do(
484
    Koha::CirculationRules->set_rules(
426
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
485
        {
427
        {},
486
            branchcode => undef,
428
        2, 'holdingbranch'
487
            itemtype   => undef,
488
            categorycode => undef,
489
            rules => {
490
                holdallowed => 2,
491
                hold_fulfillment_policy => 'holdingbranch',
492
                returnbranch => 'any'
493
            }
494
        }
429
    );
495
    );
430
496
431
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
497
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
Lines 436-445 subtest 'pickup_locations' => sub { Link Here
436
    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');
502
    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');
437
503
438
    #Case 11: holdallowed homebranch, hold_fulfillment_policy holdingbranch, HomeOrHoldingBranch 'homebranch'
504
    #Case 11: holdallowed homebranch, hold_fulfillment_policy holdingbranch, HomeOrHoldingBranch 'homebranch'
439
    $dbh->do(
505
    Koha::CirculationRules->set_rules(
440
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
506
        {
441
        {},
507
            branchcode => undef,
442
        1, 'holdingbranch'
508
            itemtype   => undef,
509
            categorycode => undef,
510
            rules => {
511
                holdallowed => 1,
512
                hold_fulfillment_policy => 'holdingbranch',
513
                returnbranch => 'any'
514
            }
515
        }
443
    );
516
    );
444
517
445
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
518
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
Lines 451-460 subtest 'pickup_locations' => sub { Link Here
451
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_2_1) == 0, 'No pickup locations returned');
524
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_2_1) == 0, 'No pickup locations returned');
452
525
453
    #Case 12: holdallowed holdgroup, hold_fulfillment_policy holdingbranch
526
    #Case 12: holdallowed holdgroup, hold_fulfillment_policy holdingbranch
454
    $dbh->do(
527
    Koha::CirculationRules->set_rules(
455
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
528
        {
456
        {},
529
            branchcode => undef,
457
        3, 'holdingbranch'
530
            itemtype   => undef,
531
            categorycode => undef,
532
            rules => {
533
                holdallowed => 3,
534
                hold_fulfillment_policy => 'holdingbranch',
535
                returnbranch => 'any'
536
            }
537
        }
458
    );
538
    );
459
539
460
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
540
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
Lines 467-476 subtest 'pickup_locations' => sub { Link Here
467
    t::lib::Mocks::mock_preference('HomeOrHoldingBranch', 'holdingbranch');
547
    t::lib::Mocks::mock_preference('HomeOrHoldingBranch', 'holdingbranch');
468
548
469
    #Case 13: holdallowed homebranch, hold_fulfillment_policy any, HomeOrHoldingBranch 'holdingbranch'
549
    #Case 13: holdallowed homebranch, hold_fulfillment_policy any, HomeOrHoldingBranch 'holdingbranch'
470
    $dbh->do(
550
    Koha::CirculationRules->set_rules(
471
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
551
        {
472
        {},
552
            branchcode => undef,
473
        1, 'any'
553
            itemtype   => undef,
554
            categorycode => undef,
555
            rules => {
556
                holdallowed => 1,
557
                hold_fulfillment_policy => 'any',
558
                returnbranch => 'any'
559
            }
560
        }
474
    );
561
    );
475
562
476
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
563
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
Lines 482-491 subtest 'pickup_locations' => sub { Link Here
482
    ok(scalar(@pl_1_1) == 0, 'No pickup locations returned');
569
    ok(scalar(@pl_1_1) == 0, 'No pickup locations returned');
483
570
484
    #Case 14: holdallowed homebranch, hold_fulfillment_policy holdgroup, HomeOrHoldingBranch 'holdingbranch'
571
    #Case 14: holdallowed homebranch, hold_fulfillment_policy holdgroup, HomeOrHoldingBranch 'holdingbranch'
485
    $dbh->do(
572
    Koha::CirculationRules->set_rules(
486
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
573
        {
487
        {},
574
            branchcode => undef,
488
        1, 'holdgroup'
575
            itemtype   => undef,
576
            categorycode => undef,
577
            rules => {
578
                holdallowed => 1,
579
                hold_fulfillment_policy => 'holdgroup',
580
                returnbranch => 'any'
581
            }
582
        }
489
    );
583
    );
490
584
491
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
585
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
Lines 497-506 subtest 'pickup_locations' => sub { Link Here
497
    ok(scalar(@pl_1_1) == 0, 'No pickup locations returned');
591
    ok(scalar(@pl_1_1) == 0, 'No pickup locations returned');
498
592
499
    #Case 15: holdallowed homebranch, hold_fulfillment_policy homebranch, HomeOrHoldingBranch 'holdingbranch'
593
    #Case 15: holdallowed homebranch, hold_fulfillment_policy homebranch, HomeOrHoldingBranch 'holdingbranch'
500
    $dbh->do(
594
    Koha::CirculationRules->set_rules(
501
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
595
        {
502
        {},
596
            branchcode => undef,
503
        1, 'homebranch'
597
            itemtype   => undef,
598
            categorycode => undef,
599
            rules => {
600
                holdallowed => 1,
601
                hold_fulfillment_policy => 'homebranch',
602
                returnbranch => 'any'
603
            }
604
        }
504
    );
605
    );
505
606
506
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
607
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
Lines 513-522 subtest 'pickup_locations' => sub { Link Here
513
    ok(scalar(@pl_1_1) == 0 && scalar(@pl_1_4) == 0, 'No pickup locations returned');
614
    ok(scalar(@pl_1_1) == 0 && scalar(@pl_1_4) == 0, 'No pickup locations returned');
514
615
515
    #Case 16: holdallowed homebranch, hold_fulfillment_policy holdingbranch, HomeOrHoldingBranch 'holdingbranch'
616
    #Case 16: holdallowed homebranch, hold_fulfillment_policy holdingbranch, HomeOrHoldingBranch 'holdingbranch'
516
    $dbh->do(
617
    Koha::CirculationRules->set_rules(
517
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
618
        {
518
        {},
619
            branchcode => undef,
519
        1, 'holdingbranch'
620
            itemtype   => undef,
621
            categorycode => undef,
622
            rules => {
623
                holdallowed => 1,
624
                hold_fulfillment_policy => 'holdingbranch',
625
                returnbranch => 'any'
626
            }
627
        }
520
    );
628
    );
521
629
522
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
630
    @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } );
(-)a/t/db_dependent/Koha/Items.t (-69 / +177 lines)
Lines 205-214 subtest 'pickup_locations' => sub { Link Here
205
        {},
205
        {},
206
        '*', '*', '*', 25
206
        '*', '*', '*', 25
207
    );
207
    );
208
    $dbh->do('DELETE FROM branch_item_rules');
208
    $dbh->do('DELETE FROM circulation_rules');
209
    $dbh->do('DELETE FROM default_branch_circ_rules');
210
    $dbh->do('DELETE FROM default_branch_item_rules');
211
    $dbh->do('DELETE FROM default_circ_rules');
212
209
213
    my $root1 = $builder->build_object( { class => 'Koha::Library::Groups', value => { ft_local_hold_group => 1 } } );
210
    my $root1 = $builder->build_object( { class => 'Koha::Library::Groups', value => { ft_local_hold_group => 1 } } );
214
    my $root2 = $builder->build_object( { class => 'Koha::Library::Groups', value => { ft_local_hold_group => 1 } } );
211
    my $root2 = $builder->build_object( { class => 'Koha::Library::Groups', value => { ft_local_hold_group => 1 } } );
Lines 250-260 subtest 'pickup_locations' => sub { Link Here
250
    t::lib::Mocks::mock_preference('HomeOrHoldingBranch', 'homebranch');
247
    t::lib::Mocks::mock_preference('HomeOrHoldingBranch', 'homebranch');
251
248
252
    #Case 1: holdallowed any, hold_fulfillment_policy any
249
    #Case 1: holdallowed any, hold_fulfillment_policy any
253
    $dbh->do(
250
    Koha::CirculationRules->set_rules(
254
        q{INSERT INTO default_circ_rules (holdallowed, hold_fulfillment_policy, returnbranch)
251
        {
255
        VALUES (?,?,?)},
252
            branchcode => undef,
256
        {},
253
            itemtype   => undef,
257
        2, 'any', 'any'
254
            categorycode => undef,
255
            rules => {
256
                holdallowed => 2,
257
                hold_fulfillment_policy => 'any',
258
                returnbranch => 'any'
259
            }
260
        }
258
    );
261
    );
259
262
260
    my @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
263
    my @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
Lines 265-274 subtest 'pickup_locations' => sub { Link Here
265
    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');
268
    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');
266
269
267
    #Case 2: holdallowed homebranch, hold_fulfillment_policy any, HomeOrHoldingBranch 'homebranch'
270
    #Case 2: holdallowed homebranch, hold_fulfillment_policy any, HomeOrHoldingBranch 'homebranch'
268
    $dbh->do(
271
    Koha::CirculationRules->set_rules(
269
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
272
        {
270
        {},
273
            branchcode => undef,
271
        1, 'any'
274
            itemtype   => undef,
275
            categorycode => undef,
276
            rules => {
277
                holdallowed => 1,
278
                hold_fulfillment_policy => 'any',
279
                returnbranch => 'any'
280
            }
281
        }
272
    );
282
    );
273
283
274
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
284
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
Lines 280-289 subtest 'pickup_locations' => sub { Link Here
280
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_3_4) == 0, 'Any other combination renders no locations');
290
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_3_4) == 0, 'Any other combination renders no locations');
281
291
282
    #Case 3: holdallowed holdgroup, hold_fulfillment_policy any
292
    #Case 3: holdallowed holdgroup, hold_fulfillment_policy any
283
    $dbh->do(
293
    Koha::CirculationRules->set_rules(
284
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
294
        {
285
        {},
295
            branchcode => undef,
286
        3, 'any'
296
            itemtype   => undef,
297
            categorycode => undef,
298
            rules => {
299
                holdallowed => 3,
300
                hold_fulfillment_policy => 'any',
301
                returnbranch => 'any'
302
            }
303
        }
287
    );
304
    );
288
305
289
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
306
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
Lines 296-305 subtest 'pickup_locations' => sub { Link Here
296
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0, 'Any other combination renders no locations');
313
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0, 'Any other combination renders no locations');
297
314
298
    #Case 4: holdallowed any, hold_fulfillment_policy holdgroup
315
    #Case 4: holdallowed any, hold_fulfillment_policy holdgroup
299
    $dbh->do(
316
    Koha::CirculationRules->set_rules(
300
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
317
        {
301
        {},
318
            branchcode => undef,
302
        2, 'holdgroup'
319
            itemtype   => undef,
320
            categorycode => undef,
321
            rules => {
322
                holdallowed => 2,
323
                hold_fulfillment_policy => 'holdgroup',
324
                returnbranch => 'any'
325
            }
326
        }
303
    );
327
    );
304
328
305
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
329
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
Lines 311-320 subtest 'pickup_locations' => sub { Link Here
311
    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');
335
    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');
312
336
313
    #Case 5: holdallowed homebranch, hold_fulfillment_policy holdgroup, HomeOrHoldingBranch 'homebranch'
337
    #Case 5: holdallowed homebranch, hold_fulfillment_policy holdgroup, HomeOrHoldingBranch 'homebranch'
314
    $dbh->do(
338
    Koha::CirculationRules->set_rules(
315
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
339
        {
316
        {},
340
            branchcode => undef,
317
        1, 'holdgroup'
341
            itemtype   => undef,
342
            categorycode => undef,
343
            rules => {
344
                holdallowed => 1,
345
                hold_fulfillment_policy => 'holdgroup',
346
                returnbranch => 'any'
347
            }
348
        }
318
    );
349
    );
319
350
320
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
351
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
Lines 326-335 subtest 'pickup_locations' => sub { Link Here
326
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_3_4) == 0, 'Any other combination renders no locations');
357
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_3_4) == 0, 'Any other combination renders no locations');
327
358
328
    #Case 6: holdallowed holdgroup, hold_fulfillment_policy holdgroup
359
    #Case 6: holdallowed holdgroup, hold_fulfillment_policy holdgroup
329
    $dbh->do(
360
    Koha::CirculationRules->set_rules(
330
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
361
        {
331
        {},
362
            branchcode => undef,
332
        3, 'holdgroup'
363
            itemtype   => undef,
364
            categorycode => undef,
365
            rules => {
366
                holdallowed => 3,
367
                hold_fulfillment_policy => 'holdgroup',
368
                returnbranch => 'any'
369
            }
370
        }
333
    );
371
    );
334
372
335
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
373
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
Lines 342-351 subtest 'pickup_locations' => sub { Link Here
342
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0, 'Any other combination renders no locations');
380
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0, 'Any other combination renders no locations');
343
381
344
    #Case 7: holdallowed any, hold_fulfillment_policy homebranch
382
    #Case 7: holdallowed any, hold_fulfillment_policy homebranch
345
    $dbh->do(
383
    Koha::CirculationRules->set_rules(
346
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
384
        {
347
        {},
385
            branchcode => undef,
348
        2, 'homebranch'
386
            itemtype   => undef,
387
            categorycode => undef,
388
            rules => {
389
                holdallowed => 2,
390
                hold_fulfillment_policy => 'homebranch',
391
                returnbranch => 'any'
392
            }
393
        }
349
    );
394
    );
350
395
351
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
396
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
Lines 357-366 subtest 'pickup_locations' => sub { Link Here
357
    ok(scalar(@pl_3_1) == 0 && scalar(@pl_3_4) == 0, 'Any other combination renders no locations, because library3 is not pickup_location');
402
    ok(scalar(@pl_3_1) == 0 && scalar(@pl_3_4) == 0, 'Any other combination renders no locations, because library3 is not pickup_location');
358
403
359
    #Case 8: holdallowed homebranch, hold_fulfillment_policy homebranch, HomeOrHoldingBranch 'homebranch'
404
    #Case 8: holdallowed homebranch, hold_fulfillment_policy homebranch, HomeOrHoldingBranch 'homebranch'
360
    $dbh->do(
405
    Koha::CirculationRules->set_rules(
361
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
406
        {
362
        {},
407
            branchcode => undef,
363
        1, 'homebranch'
408
            itemtype   => undef,
409
            categorycode => undef,
410
            rules => {
411
                holdallowed => 1,
412
                hold_fulfillment_policy => 'homebranch',
413
                returnbranch => 'any'
414
            }
415
        }
364
    );
416
    );
365
417
366
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
418
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
Lines 372-381 subtest 'pickup_locations' => sub { Link Here
372
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_3_4) == 0, 'Any other combination renders no locations');
424
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_3_4) == 0, 'Any other combination renders no locations');
373
425
374
    #Case 9: holdallowed holdgroup, hold_fulfillment_policy homebranch
426
    #Case 9: holdallowed holdgroup, hold_fulfillment_policy homebranch
375
    $dbh->do(
427
    Koha::CirculationRules->set_rules(
376
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
428
        {
377
        {},
429
            branchcode => undef,
378
        3, 'homebranch'
430
            itemtype   => undef,
431
            categorycode => undef,
432
            rules => {
433
                holdallowed => 3,
434
                hold_fulfillment_policy => 'homebranch',
435
                returnbranch => 'any'
436
            }
437
        }
379
    );
438
    );
380
439
381
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
440
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
Lines 387-396 subtest 'pickup_locations' => sub { Link Here
387
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_3_4) == 0, 'Any other combination renders no locations');
446
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_3_4) == 0, 'Any other combination renders no locations');
388
447
389
    #Case 10: holdallowed any, hold_fulfillment_policy holdingbranch
448
    #Case 10: holdallowed any, hold_fulfillment_policy holdingbranch
390
    $dbh->do(
449
    Koha::CirculationRules->set_rules(
391
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
450
        {
392
        {},
451
            branchcode => undef,
393
        2, 'holdingbranch'
452
            itemtype   => undef,
453
            categorycode => undef,
454
            rules => {
455
                holdallowed => 2,
456
                hold_fulfillment_policy => 'holdingbranch',
457
                returnbranch => 'any'
458
            }
459
        }
394
    );
460
    );
395
461
396
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
462
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
Lines 403-412 subtest 'pickup_locations' => sub { Link Here
403
469
404
470
405
    #Case 11: holdallowed homebranch, hold_fulfillment_policy holdingbranch, HomeOrHoldingBranch 'homebranch'
471
    #Case 11: holdallowed homebranch, hold_fulfillment_policy holdingbranch, HomeOrHoldingBranch 'homebranch'
406
    $dbh->do(
472
    Koha::CirculationRules->set_rules(
407
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
473
        {
408
        {},
474
            branchcode => undef,
409
        1, 'holdingbranch'
475
            itemtype   => undef,
476
            categorycode => undef,
477
            rules => {
478
                holdallowed => 1,
479
                hold_fulfillment_policy => 'holdingbranch',
480
                returnbranch => 'any'
481
            }
482
        }
410
    );
483
    );
411
484
412
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
485
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
Lines 418-427 subtest 'pickup_locations' => sub { Link Here
418
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_3_4) == 0, 'Any other combination renders no locations');
491
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_3_4) == 0, 'Any other combination renders no locations');
419
492
420
    #Case 12: holdallowed holdgroup, hold_fulfillment_policy holdingbranch
493
    #Case 12: holdallowed holdgroup, hold_fulfillment_policy holdingbranch
421
    $dbh->do(
494
    Koha::CirculationRules->set_rules(
422
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
495
        {
423
        {},
496
            branchcode => undef,
424
        3, 'holdingbranch'
497
            itemtype   => undef,
498
            categorycode => undef,
499
            rules => {
500
                holdallowed => 3,
501
                hold_fulfillment_policy => 'holdingbranch',
502
                returnbranch => 'any'
503
            }
504
        }
425
    );
505
    );
426
506
427
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
507
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
Lines 436-445 subtest 'pickup_locations' => sub { Link Here
436
    t::lib::Mocks::mock_preference('HomeOrHoldingBranch', 'holdingbranch');
516
    t::lib::Mocks::mock_preference('HomeOrHoldingBranch', 'holdingbranch');
437
517
438
    #Case 13: holdallowed homebranch, hold_fulfillment_policy any, HomeOrHoldingBranch 'holdingbranch'
518
    #Case 13: holdallowed homebranch, hold_fulfillment_policy any, HomeOrHoldingBranch 'holdingbranch'
439
    $dbh->do(
519
    Koha::CirculationRules->set_rules(
440
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
520
        {
441
        {},
521
            branchcode => undef,
442
        1, 'any'
522
            itemtype   => undef,
523
            categorycode => undef,
524
            rules => {
525
                holdallowed => 1,
526
                hold_fulfillment_policy => 'any',
527
                returnbranch => 'any'
528
            }
529
        }
443
    );
530
    );
444
531
445
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
532
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
Lines 451-460 subtest 'pickup_locations' => sub { Link Here
451
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_1_1) == 0, 'Any other combination renders no locations');
538
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_1_1) == 0, 'Any other combination renders no locations');
452
539
453
    #Case 14: holdallowed homebranch, hold_fulfillment_policy holdgroup, HomeOrHoldingBranch 'holdingbranch'
540
    #Case 14: holdallowed homebranch, hold_fulfillment_policy holdgroup, HomeOrHoldingBranch 'holdingbranch'
454
    $dbh->do(
541
    Koha::CirculationRules->set_rules(
455
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
542
        {
456
        {},
543
            branchcode => undef,
457
        1, 'holdgroup'
544
            itemtype   => undef,
545
            categorycode => undef,
546
            rules => {
547
                holdallowed => 1,
548
                hold_fulfillment_policy => 'holdgroup',
549
                returnbranch => 'any'
550
            }
551
        }
458
    );
552
    );
459
553
460
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
554
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
Lines 466-475 subtest 'pickup_locations' => sub { Link Here
466
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_1_1) == 0, 'Any other combination renders no locations');
560
    ok(scalar(@pl_1_4) == 0 && scalar(@pl_3_1) == 0 && scalar(@pl_1_1) == 0, 'Any other combination renders no locations');
467
561
468
    #Case 15: holdallowed homebranch, hold_fulfillment_policy homebranch, HomeOrHoldingBranch 'holdingbranch'
562
    #Case 15: holdallowed homebranch, hold_fulfillment_policy homebranch, HomeOrHoldingBranch 'holdingbranch'
469
    $dbh->do(
563
    Koha::CirculationRules->set_rules(
470
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
564
        {
471
        {},
565
            branchcode => undef,
472
        1, 'homebranch'
566
            itemtype   => undef,
567
            categorycode => undef,
568
            rules => {
569
                holdallowed => 1,
570
                hold_fulfillment_policy => 'homebranch',
571
                returnbranch => 'any'
572
            }
573
        }
473
    );
574
    );
474
575
475
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
576
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
Lines 481-490 subtest 'pickup_locations' => sub { Link Here
481
    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');
582
    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');
482
583
483
    #Case 16: holdallowed homebranch, hold_fulfillment_policy holdingbranch, HomeOrHoldingBranch 'holdingbranch'
584
    #Case 16: holdallowed homebranch, hold_fulfillment_policy holdingbranch, HomeOrHoldingBranch 'holdingbranch'
484
    $dbh->do(
585
    Koha::CirculationRules->set_rules(
485
        q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?},
586
        {
486
        {},
587
            branchcode => undef,
487
        1, 'holdingbranch'
588
            itemtype   => undef,
589
            categorycode => undef,
590
            rules => {
591
                holdallowed => 1,
592
                hold_fulfillment_policy => 'holdingbranch',
593
                returnbranch => 'any'
594
            }
595
        }
488
    );
596
    );
489
597
490
    @pl_1_1 = $item1->pickup_locations( { patron => $patron1 } );
598
    @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