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

(-)a/t/db_dependent/Circulation.t (-2 / +60 lines)
Lines 18-24 Link Here
18
use Modern::Perl;
18
use Modern::Perl;
19
use utf8;
19
use utf8;
20
20
21
use Test::More tests => 67;
21
use Test::More tests => 68;
22
use Test::Exception;
22
use Test::Exception;
23
use Test::MockModule;
23
use Test::MockModule;
24
use Test::Deep qw( cmp_deeply );
24
use Test::Deep qw( cmp_deeply );
Lines 6133-6138 subtest 'Tests for RecordLocalUseOnReturn' => sub { Link Here
6133
        [ 0, { NotIssued => $item->barcode, withdrawn => 1, LocalUse => 1  }, undef, {} ], "Local use is recorded");
6133
        [ 0, { NotIssued => $item->barcode, withdrawn => 1, LocalUse => 1  }, undef, {} ], "Local use is recorded");
6134
};
6134
};
6135
6135
6136
subtest 'Test CanBookBeIssued param ignore_reserves (Bug 35322)' => sub {
6137
    plan tests => 4;
6138
6139
    my $homebranch    = $builder->build( { source => 'Branch' } );
6140
    my $holdingbranch = $builder->build( { source => 'Branch' } );
6141
    my $patron_1      = $builder->build_object( { class => 'Koha::Patrons', value => { categorycode => $patron_category->{categorycode} } } );
6142
    my $patron_2      = $builder->build_object( { class => 'Koha::Patrons', value => { categorycode => $patron_category->{categorycode} } } );
6143
6144
    my $item = $builder->build_sample_item(
6145
        {
6146
            homebranch    => $homebranch->{branchcode},
6147
            holdingbranch => $holdingbranch->{branchcode},
6148
        }
6149
    );
6150
6151
    Koha::CirculationRules->search()->delete();
6152
    Koha::CirculationRules->set_rules(
6153
        {
6154
            categorycode => undef,
6155
            itemtype     => undef,
6156
            branchcode   => undef,
6157
            rules        => {
6158
                reservesallowed => 25,
6159
                issuelength     => 14,
6160
                lengthunit      => 'days',
6161
                renewalsallowed => 1,
6162
                renewalperiod   => 7,
6163
                chargeperiod    => 1,
6164
                maxissueqty     => 20,
6165
            }
6166
        }
6167
    );
6168
6169
    my $reserve_id = AddReserve(
6170
        {
6171
            branchcode       => $homebranch,
6172
            borrowernumber   => $patron_1->id,
6173
            biblionumber     => $item->biblionumber,
6174
            priority         => 1,
6175
            reservation_date => dt_from_string,
6176
            expiration_date  => dt_from_string,
6177
            itemnumber       => $item->id,
6178
            found            => 'W',
6179
        }
6180
    );
6181
6182
    set_userenv($holdingbranch);
6183
6184
    my ( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, 0 );
6185
    is( keys(%$error) + keys(%$alerts), 0, 'There should not be any errors or alerts (impossible)' . str($error, $question, $alerts) );
6186
    is( exists $question->{RESERVE_WAITING}, 1, 'RESERVE_WAITING is set' );
6187
6188
    ( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, 1 );
6189
    is( keys(%$error) + keys(%$alerts), 0, 'There should not be any errors or alerts (impossible)' . str($error, $question, $alerts) );
6190
    isnt( exists $question->{RESERVE_WAITING}, 1, 'RESERVE_WAITING is not set' );
6191
6192
};
6193
6194
6136
$schema->storage->txn_rollback;
6195
$schema->storage->txn_rollback;
6137
C4::Context->clear_syspref_cache();
6196
C4::Context->clear_syspref_cache();
6138
$branches = Koha::Libraries->search();
6197
$branches = Koha::Libraries->search();
6139
- 

Return to bug 35322