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

(-)a/Koha/Item.pm (+13 lines)
Lines 30-35 use C4::Reserves; Link Here
30
use C4::ClassSource qw( GetClassSort );
30
use C4::ClassSource qw( GetClassSort );
31
use C4::Log qw( logaction );
31
use C4::Log qw( logaction );
32
32
33
use Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue;
33
use Koha::Checkouts;
34
use Koha::Checkouts;
34
use Koha::CirculationRules;
35
use Koha::CirculationRules;
35
use Koha::CoverImages;
36
use Koha::CoverImages;
Lines 212-217 sub store { Link Here
212
        unless $params->{skip_record_index};
213
        unless $params->{skip_record_index};
213
    $self->get_from_storage->_after_item_action_hooks({ action => $action });
214
    $self->get_from_storage->_after_item_action_hooks({ action => $action });
214
215
216
    Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue(
217
        {
218
            biblio_ids => [ $self->biblionumber ]
219
        }
220
    );
221
215
    return $result;
222
    return $result;
216
}
223
}
217
224
Lines 237-242 sub delete { Link Here
237
    logaction( "CATALOGUING", "DELETE", $self->itemnumber, "item" )
244
    logaction( "CATALOGUING", "DELETE", $self->itemnumber, "item" )
238
      if C4::Context->preference("CataloguingLog");
245
      if C4::Context->preference("CataloguingLog");
239
246
247
    Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue(
248
        {
249
            biblio_ids => [ $self->biblionumber ]
250
        }
251
    );
252
240
    return $result;
253
    return $result;
241
}
254
}
242
255
(-)a/t/db_dependent/Koha/Item.t (-2 / +29 lines)
Lines 22-27 use utf8; Link Here
22
22
23
use Test::More tests => 15;
23
use Test::More tests => 15;
24
use Test::Exception;
24
use Test::Exception;
25
use Test::MockModule;
25
26
26
use C4::Biblio qw( GetMarcSubfieldStructure );
27
use C4::Biblio qw( GetMarcSubfieldStructure );
27
use C4::Circulation qw( AddIssue AddReturn );
28
use C4::Circulation qw( AddIssue AddReturn );
Lines 1170-1176 subtest 'columns_to_str' => sub { Link Here
1170
1171
1171
subtest 'store() tests' => sub {
1172
subtest 'store() tests' => sub {
1172
1173
1173
    plan tests => 1;
1174
    plan tests => 2;
1174
1175
1175
    subtest '_set_found_trigger() tests' => sub {
1176
    subtest '_set_found_trigger() tests' => sub {
1176
1177
Lines 1223-1228 subtest 'store() tests' => sub { Link Here
1223
1224
1224
        $schema->storage->txn_rollback;
1225
        $schema->storage->txn_rollback;
1225
    };
1226
    };
1227
1228
    subtest 'holds_queue update tests' => sub {
1229
1230
        plan tests => 2;
1231
1232
        $schema->storage->txn_begin;
1233
1234
        my $biblio = $builder->build_sample_biblio;
1235
1236
        my $mock = Test::MockModule->new('Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue');
1237
        $mock->mock( 'enqueue', sub {
1238
            my ( $self, $args ) = @_;
1239
            is_deeply(
1240
                $args->{biblio_ids},
1241
                [ $biblio->id ],
1242
                '->store triggers a holds queue update for the related biblio'
1243
            );
1244
        } );
1245
1246
        # new item
1247
        my $item = $builder->build_sample_item({ biblionumber => $biblio->id });
1248
1249
        # updated item
1250
        $item->set({ reserves => 1 })->store;
1251
1252
        $schema->storage->txn_rollback;
1253
    };
1226
};
1254
};
1227
1255
1228
subtest 'Recalls tests' => sub {
1256
subtest 'Recalls tests' => sub {
1229
- 

Return to bug 29346