Bugzilla – Attachment 114864 Details for
Bug 23971
Add logging for basket related actions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23971: (follow-up) Make changes for 26582
Bug-23971-follow-up-Make-changes-for-26582.patch (text/plain), 3.50 KB, created by
Andrew Isherwood
on 2021-01-05 11:41:54 UTC
(
hide
)
Description:
Bug 23971: (follow-up) Make changes for 26582
Filename:
MIME Type:
Creator:
Andrew Isherwood
Created:
2021-01-05 11:41:54 UTC
Size:
3.50 KB
patch
obsolete
>From 9c5d01536e2b86db88d90f451e039bd2b36e2f92 Mon Sep 17 00:00:00 2001 >From: Andrew Isherwood <andrew.isherwood@ptfs-europe.com> >Date: Fri, 23 Oct 2020 15:44:32 +0100 >Subject: [PATCH] Bug 23971: (follow-up) Make changes for 26582 > >This commit makes changes necessary to allow this bug to be dependent on >Bug 23562: > >- Move basket closure logging from C4::Acquisision::CloseBasket to Koha::Acquisition::Basket::close >- Move basket closure unit test from t/db_dependent/Acquisition.t to >t/db_dependent/Koha/Acquisition/Basket.t > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/Acquisition/Basket.pm | 10 ++++++++++ > t/db_dependent/Acquisition.t | 7 +------ > t/db_dependent/Koha/Acquisition/Basket.t | 9 ++++++++- > 3 files changed, 19 insertions(+), 7 deletions(-) > >diff --git a/Koha/Acquisition/Basket.pm b/Koha/Acquisition/Basket.pm >index 35255bee4b..b2e038a846 100644 >--- a/Koha/Acquisition/Basket.pm >+++ b/Koha/Acquisition/Basket.pm >@@ -25,6 +25,7 @@ use Koha::Acquisition::BasketGroups; > use Koha::Acquisition::Orders; > use Koha::Exceptions::Acquisition::Basket; > use Koha::Patrons; >+use C4::Log qw(logaction); > > use base qw( Koha::Object Koha::Object::Mixin::AdditionalFields ); > >@@ -201,6 +202,15 @@ sub close { > } > ); > >+ # Log the closure >+ if (C4::Context->preference("AcqLog")) { >+ logaction( >+ 'ACQUISITIONS', >+ 'CLOSE_BASKET', >+ $self->id >+ ); >+ } >+ > return $self; > } > >diff --git a/t/db_dependent/Acquisition.t b/t/db_dependent/Acquisition.t >index 8237996c0a..d39d70334e 100755 >--- a/t/db_dependent/Acquisition.t >+++ b/t/db_dependent/Acquisition.t >@@ -901,7 +901,7 @@ subtest 'GetHistory - is_standing' => sub { > > subtest 'Acquisition logging' => sub { > >- plan tests => 6; >+ plan tests => 5; > > t::lib::Mocks::mock_preference('AcqLog', 1); > >@@ -910,11 +910,6 @@ subtest 'Acquisition logging' => sub { > my @create_logs = Koha::ActionLogs->search({ module =>'ACQUISITIONS', action => 'ADD_BASKET', object => $basketno }); > is (scalar @create_logs, 1, 'Basket creation is logged'); > >- Koha::ActionLogs->delete; >- C4::Acquisition::CloseBasket($basketno); >- my @close_logs = Koha::ActionLogs->search({ module =>'ACQUISITIONS', action => 'CLOSE_BASKET', object => $basketno }); >- is (scalar @close_logs, 1, 'Basket closure is logged'); >- > Koha::ActionLogs->delete; > C4::Acquisition::ReopenBasket($basketno); > my @reopen_logs = Koha::ActionLogs->search({ module =>'ACQUISITIONS', action => 'REOPEN_BASKET', object => $basketno }); >diff --git a/t/db_dependent/Koha/Acquisition/Basket.t b/t/db_dependent/Koha/Acquisition/Basket.t >index c8819457a9..ca25462e13 100755 >--- a/t/db_dependent/Koha/Acquisition/Basket.t >+++ b/t/db_dependent/Koha/Acquisition/Basket.t >@@ -335,7 +335,11 @@ subtest 'is_closed() tests' => sub { > > subtest 'close() tests' => sub { > >- plan tests => 3; >+ plan tests => 4; >+ >+ # Turn on acquisitions logging and ensure the logs are empty >+ t::lib::Mocks::mock_preference('AcqLog', 1); >+ Koha::ActionLogs->delete; > > $schema->storage->txn_begin; > >@@ -372,5 +376,8 @@ subtest 'close() tests' => sub { > 'Koha::Exceptions::Acquisition::Basket::AlreadyClosed', > 'Trying to close an already closed basket throws an exception'; > >+ my @close_logs = Koha::ActionLogs->search({ module =>'ACQUISITIONS', action => 'CLOSE_BASKET', object => $basket->id }); >+ is (scalar @close_logs, 1, 'Basket closure is logged'); >+ > $schema->storage->txn_rollback; > }; >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23971
:
95285
|
95286
|
95885
|
95888
|
96063
|
96064
|
100239
|
100240
|
100241
|
103911
|
103912
|
103913
|
103945
|
108962
|
111300
|
111301
|
111302
|
111303
|
111304
|
111955
|
111956
|
111957
|
111958
|
111959
|
111960
|
112277
|
112278
|
112279
|
112280
|
112281
|
112282
|
112283
|
112284
|
112285
|
112286
|
112287
|
112288
|
112289
|
112290
|
112291
|
112298
|
112299
|
112300
|
112301
|
112302
|
112303
|
112304
|
112305
|
112306
|
112307
|
113384
|
113385
|
113386
|
113387
|
113388
|
113389
|
113390
|
113391
|
113392
|
113393
|
114857
|
114858
|
114859
|
114860
|
114861
|
114862
|
114863
|
114864
|
114865
|
114866
|
114867
|
114905
|
114906
|
114907
|
114908
|
114909
|
114910
|
114911
|
114912
|
114913
|
114914
|
114915
|
114916
|
115976
|
115977
|
115978
|
115979
|
115980
|
115981
|
115982
|
115983
|
115984
|
115985
|
115986
|
119401
|
119402
|
119403
|
119404
|
119405
|
119406
|
119407
|
119408
|
119409
|
119410
|
119411
|
119412
|
119944
|
119946
|
120048