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

(-)a/Koha/Acquisition/Basket.pm (+10 lines)
Lines 25-30 use Koha::Acquisition::BasketGroups; Link Here
25
use Koha::Acquisition::Orders;
25
use Koha::Acquisition::Orders;
26
use Koha::Exceptions::Acquisition::Basket;
26
use Koha::Exceptions::Acquisition::Basket;
27
use Koha::Patrons;
27
use Koha::Patrons;
28
use C4::Log qw(logaction);
28
29
29
use base qw( Koha::Object Koha::Object::Mixin::AdditionalFields );
30
use base qw( Koha::Object Koha::Object::Mixin::AdditionalFields );
30
31
Lines 201-206 sub close { Link Here
201
        }
202
        }
202
    );
203
    );
203
204
205
    # Log the closure
206
    if (C4::Context->preference("AcqLog")) {
207
        logaction(
208
            'ACQUISITIONS',
209
            'CLOSE_BASKET',
210
            $self->id
211
        );
212
    }
213
204
    return $self;
214
    return $self;
205
}
215
}
206
216
(-)a/t/db_dependent/Acquisition.t (-6 / +1 lines)
Lines 901-907 subtest 'GetHistory - is_standing' => sub { Link Here
901
901
902
subtest 'Acquisition logging' => sub {
902
subtest 'Acquisition logging' => sub {
903
903
904
    plan tests => 6;
904
    plan tests => 5;
905
905
906
    t::lib::Mocks::mock_preference('AcqLog', 1);
906
    t::lib::Mocks::mock_preference('AcqLog', 1);
907
907
Lines 910-920 subtest 'Acquisition logging' => sub { Link Here
910
    my @create_logs = Koha::ActionLogs->search({ module =>'ACQUISITIONS', action => 'ADD_BASKET', object => $basketno });
910
    my @create_logs = Koha::ActionLogs->search({ module =>'ACQUISITIONS', action => 'ADD_BASKET', object => $basketno });
911
    is (scalar @create_logs, 1, 'Basket creation is logged');
911
    is (scalar @create_logs, 1, 'Basket creation is logged');
912
912
913
    Koha::ActionLogs->delete;
914
    C4::Acquisition::CloseBasket($basketno);
915
    my @close_logs = Koha::ActionLogs->search({ module =>'ACQUISITIONS', action => 'CLOSE_BASKET', object => $basketno });
916
    is (scalar @close_logs, 1, 'Basket closure is logged');
917
918
    Koha::ActionLogs->delete;
913
    Koha::ActionLogs->delete;
919
    C4::Acquisition::ReopenBasket($basketno);
914
    C4::Acquisition::ReopenBasket($basketno);
920
    my @reopen_logs = Koha::ActionLogs->search({ module =>'ACQUISITIONS', action => 'REOPEN_BASKET', object => $basketno });
915
    my @reopen_logs = Koha::ActionLogs->search({ module =>'ACQUISITIONS', action => 'REOPEN_BASKET', object => $basketno });
(-)a/t/db_dependent/Koha/Acquisition/Basket.t (-2 / +8 lines)
Lines 335-341 subtest 'is_closed() tests' => sub { Link Here
335
335
336
subtest 'close() tests' => sub {
336
subtest 'close() tests' => sub {
337
337
338
    plan tests => 3;
338
    plan tests => 4;
339
340
    # Turn on acquisitions logging and ensure the logs are empty
341
    t::lib::Mocks::mock_preference('AcqLog', 1);
342
    Koha::ActionLogs->delete;
339
343
340
    $schema->storage->txn_begin;
344
    $schema->storage->txn_begin;
341
345
Lines 372-376 subtest 'close() tests' => sub { Link Here
372
        'Koha::Exceptions::Acquisition::Basket::AlreadyClosed',
376
        'Koha::Exceptions::Acquisition::Basket::AlreadyClosed',
373
        'Trying to close an already closed basket throws an exception';
377
        'Trying to close an already closed basket throws an exception';
374
378
379
    my @close_logs = Koha::ActionLogs->search({ module =>'ACQUISITIONS', action => 'CLOSE_BASKET', object => $basket->id });
380
    is (scalar @close_logs, 1, 'Basket closure is logged');
381
375
    $schema->storage->txn_rollback;
382
    $schema->storage->txn_rollback;
376
};
383
};
377
- 

Return to bug 23971