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

(-)a/C4/Reserves.pm (-1 / +1 lines)
Lines 894-900 sub CheckReserves { Link Here
894
                    my $branch = GetReservesControlBranch( $item->unblessed, $patron->unblessed );
894
                    my $branch = GetReservesControlBranch( $item->unblessed, $patron->unblessed );
895
                    my $branchitemrule = C4::Circulation::GetBranchItemRule($branch,$item->effective_itemtype);
895
                    my $branchitemrule = C4::Circulation::GetBranchItemRule($branch,$item->effective_itemtype);
896
                    next if ($branchitemrule->{'holdallowed'} == 0);
896
                    next if ($branchitemrule->{'holdallowed'} == 0);
897
                    next if (($branchitemrule->{'holdallowed'} == 1) && ($branch ne $patron->branchcode));
897
                    next if (($branchitemrule->{'holdallowed'} == 1) && ($item->homebranch ne $patron->branchcode));
898
                    my $library = Koha::Libraries->find({branchcode=>$item->homebranch});
898
                    my $library = Koha::Libraries->find({branchcode=>$item->homebranch});
899
                    next if (($branchitemrule->{'holdallowed'} == 3) && (!$library->validate_hold_sibling({branchcode => $patron->branchcode}) ));
899
                    next if (($branchitemrule->{'holdallowed'} == 3) && (!$library->validate_hold_sibling({branchcode => $patron->branchcode}) ));
900
                    my $hold_fulfillment_policy = $branchitemrule->{hold_fulfillment_policy};
900
                    my $hold_fulfillment_policy = $branchitemrule->{hold_fulfillment_policy};
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (-1 / +1 lines)
Lines 716-722 Circulation: Link Here
716
              class: integer
716
              class: integer
717
            - days from now) at checkin time. Note that this number of days will be used too in calculating the default end date for the Holds to pull-report. But it does not interfere with issuing, renewing or transferring items.
717
            - days from now) at checkin time. Note that this number of days will be used too in calculating the default end date for the Holds to pull-report. But it does not interfere with issuing, renewing or transferring items.
718
        -
718
        -
719
            - Check the
719
            - Check the rule from the
720
            - pref: ReservesControlBranch
720
            - pref: ReservesControlBranch
721
              choices:
721
              choices:
722
                  ItemHomeLibrary: "item's home library"
722
                  ItemHomeLibrary: "item's home library"
(-)a/misc/cronjobs/update_patrons_category.pl (+1 lines)
Lines 47-52 update_patrons_category.pl -f=categorycode -t=categorycode Link Here
47
update_patrons_category.pl --help | --man
47
update_patrons_category.pl --help | --man
48
48
49
Options:
49
Options:
50
50
   --help                   brief help message
51
   --help                   brief help message
51
   --man                    full documentation
52
   --man                    full documentation
52
   -too_old                 update if over  maximum age for current category
53
   -too_old                 update if over  maximum age for current category
(-)a/t/db_dependent/Circulation.t (-1 / +1 lines)
Lines 291-297 subtest "CanBookBeRenewed AllowRenewalIfOtherItemsAvailable multiple borrowers a Link Here
291
            branchcode   => undef,
291
            branchcode   => undef,
292
            itemtype     => undef,
292
            itemtype     => undef,
293
            rule_name    => 'holdallowed',
293
            rule_name    => 'holdallowed',
294
            rule_value   => 1
294
            rule_value   => 2
295
        }
295
        }
296
    );
296
    );
297
    Koha::CirculationRules->set_rule(
297
    Koha::CirculationRules->set_rule(
(-)a/t/db_dependent/Reserves.t (-5 / +70 lines)
Lines 1076-1084 subtest 'RevertWaitingStatus' => sub { Link Here
1076
    );
1076
    );
1077
};
1077
};
1078
1078
1079
subtest 'CheckReserves additional test' => sub {
1079
subtest 'CheckReserves additional tests' => sub {
1080
1080
1081
    plan tests => 3;
1081
    plan tests => 8;
1082
1082
1083
    my $item = $builder->build_sample_item;
1083
    my $item = $builder->build_sample_item;
1084
    my $reserve1 = $builder->build_object(
1084
    my $reserve1 = $builder->build_object(
Lines 1151-1156 subtest 'CheckReserves additional test' => sub { Link Here
1151
    is( $matched_reserve->{reserve_id},
1151
    is( $matched_reserve->{reserve_id},
1152
        $reserve1->reserve_id, "We got the Transit reserve" );
1152
        $reserve1->reserve_id, "We got the Transit reserve" );
1153
    is( scalar @$possible_reserves, 2, 'We do get both reserves' );
1153
    is( scalar @$possible_reserves, 2, 'We do get both reserves' );
1154
1155
    my $patron_B = $builder->build_object({ class => "Koha::Patrons" });
1156
    my $item_A = $builder->build_sample_item;
1157
    my $item_B = $builder->build_sample_item({
1158
        homebranch => $patron_B->branchcode,
1159
        biblionumber => $item_A->biblionumber,
1160
        itype => $item_A->itype
1161
    });
1162
    Koha::CirculationRules->set_rules(
1163
        {
1164
            branchcode   => undef,
1165
            categorycode => undef,
1166
            itemtype     => $item_A->itype,
1167
            rules        => {
1168
                reservesallowed => 25,
1169
                holds_per_record => 1,
1170
            }
1171
        }
1172
    );
1173
    Koha::CirculationRules->set_rule({
1174
        branchcode => undef,
1175
        itemtype   => $item_A->itype,
1176
        rule_name  => 'holdallowed',
1177
        rule_value => 1
1178
    });
1179
    my $reserve_id = AddReserve(
1180
        {
1181
            branchcode     => $patron_B->branchcode,
1182
            borrowernumber => $patron_B->borrowernumber,
1183
            biblionumber   => $item_A->biblionumber,
1184
            priority       => 1,
1185
            itemnumber     => undef,
1186
        }
1187
    );
1188
1189
    ok( $reserve_id, "We can place a record level hold because one item is owned by patron's home library");
1190
    t::lib::Mocks::mock_preference('ReservesControlBranch', 'ItemHomeLibrary');
1191
    ( $status, $matched_reserve, $possible_reserves ) = CheckReserves( $item_A->itemnumber );
1192
    is( $status, "", "We do not fill the hold with item A because it is not from the patron's homebranch");
1193
    Koha::CirculationRules->set_rule({
1194
        branchcode => $item_A->homebranch,
1195
        itemtype   => $item_A->itype,
1196
        rule_name  => 'holdallowed',
1197
        rule_value => 2
1198
    });
1199
    ( $status, $matched_reserve, $possible_reserves ) = CheckReserves( $item_A->itemnumber );
1200
    is( $status, "Reserved", "We fill the hold with item A because item's branch rule says allow any");
1201
1202
1203
    # Changing the control branch should change only the rule we get
1204
    t::lib::Mocks::mock_preference('ReservesControlBranch', 'PatronLibrary');
1205
    ( $status, $matched_reserve, $possible_reserves ) = CheckReserves( $item_A->itemnumber );
1206
    is( $status, "", "We do not fill the hold with item A because it is not from the patron's homebranch");
1207
    Koha::CirculationRules->set_rule({
1208
        branchcode   => $patron_B->branchcode,
1209
        itemtype   => $item_A->itype,
1210
        rule_name  => 'holdallowed',
1211
        rule_value => 2
1212
    });
1213
    ( $status, $matched_reserve, $possible_reserves ) = CheckReserves( $item_A->itemnumber );
1214
    is( $status, "Reserved", "We fill the hold with item A because patron's branch rule says allow any");
1215
1154
};
1216
};
1155
1217
1156
subtest 'AllowHoldOnPatronPossession test' => sub {
1218
subtest 'AllowHoldOnPatronPossession test' => sub {
Lines 1250-1260 subtest 'ModReserveAffect logging' => sub { Link Here
1250
    $hold = Koha::Holds->find($reserve_id);
1312
    $hold = Koha::Holds->find($reserve_id);
1251
    is( $hold->timestamp, $previous_timestamp, 'Make sure the previous timestamp has been used' );
1313
    is( $hold->timestamp, $previous_timestamp, 'Make sure the previous timestamp has been used' );
1252
1314
1315
    # Avoid warnings
1316
    my $reserve_mock = Test::MockModule->new('C4::Reserves');
1317
    $reserve_mock->mock( '_koha_notify_reserve', undef );
1318
1253
    # Mark it waiting
1319
    # Mark it waiting
1254
    ModReserveAffect( $item->itemnumber, $patron->borrowernumber );
1320
    ModReserveAffect( $item->itemnumber, $patron->borrowernumber );
1255
1321
1256
    $hold = Koha::Holds->find($reserve_id);
1322
    $hold->discard_changes;
1257
    is( $hold->found, 'W', 'Hold has been set waiting' );
1323
    ok( $hold->is_waiting, 'Hold has been set waiting' );
1258
    isnt( $hold->timestamp, $previous_timestamp, 'The timestamp has been modified' );
1324
    isnt( $hold->timestamp, $previous_timestamp, 'The timestamp has been modified' );
1259
1325
1260
    my $log = Koha::ActionLogs->search({ module => 'HOLDS', action => 'MODIFY', object => $hold->reserve_id })->next;
1326
    my $log = Koha::ActionLogs->search({ module => 'HOLDS', action => 'MODIFY', object => $hold->reserve_id })->next;
1261
- 

Return to bug 28503