Bugzilla – Attachment 119411 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) Log entire objects
Bug-23971-follow-up-Log-entire-objects.patch (text/plain), 4.51 KB, created by
Kyle M Hall (khall)
on 2021-04-09 15:53:26 UTC
(
hide
)
Description:
Bug 23971: (follow-up) Log entire objects
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2021-04-09 15:53:26 UTC
Size:
4.51 KB
patch
obsolete
>From 67f3172eca85d726e6dcc7c80dda483b18ccd30d Mon Sep 17 00:00:00 2001 >From: Andrew Isherwood <andrew.isherwood@ptfs-europe.com> >Date: Tue, 10 Nov 2020 11:31:30 +0000 >Subject: [PATCH] Bug 23971: (follow-up) Log entire objects >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >As requested by Tomás and Jonathan, we now log the entire basket object >when logging an action. > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/Acquisition.pm | 31 ++++++++++++++++++++++++++----- > Koha/EDI.pm | 11 +++++++++++ > acqui/addorder.pl | 6 +++++- > 3 files changed, 42 insertions(+), 6 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index 920fd5b239..5652f2b2f1 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -45,6 +45,7 @@ use C4::Koha; > > use MARC::Field; > use MARC::Record; >+use JSON qw(to_json); > > use Time::localtime; > >@@ -207,7 +208,13 @@ sub NewBasket { > > # Log the basket creation > if (C4::Context->preference("AcqLog")) { >- logaction('ACQUISITIONS', 'ADD_BASKET', $basket); >+ my $created = Koha::Acquisition::Baskets->find( $basket ); >+ logaction( >+ 'ACQUISITIONS', >+ 'ADD_BASKET', >+ $basket, >+ to_json($created->unblessed) >+ ); > } > > return $basket; >@@ -235,10 +242,12 @@ sub ReopenBasket { > > # Log the basket reopening > if (C4::Context->preference("AcqLog")) { >+ my $reopened = Koha::Acquisition::Baskets->find( $basketno ); > logaction( > 'ACQUISITIONS', > 'REOPEN_BASKET', >- $basketno >+ $basketno, >+ to_json($reopened->unblessed) > ); > } > return; >@@ -518,10 +527,14 @@ sub ModBasket { > > # Log the basket update > if (C4::Context->preference("AcqLog")) { >+ my $modified = Koha::Acquisition::Baskets->find( >+ $basketinfo->{basketno} >+ ); > logaction( > 'ACQUISITIONS', > 'MODIFY_BASKET', >- $basketinfo->{'basketno'} >+ $basketinfo->{basketno}, >+ to_json($modified->unblessed) > ); > } > >@@ -585,10 +598,14 @@ sub ModBasketHeader { > > # Log the basket update > if (C4::Context->preference("AcqLog")) { >+ my $modified = Koha::Acquisition::Baskets->find( >+ $basketno >+ ); > logaction( > 'ACQUISITIONS', > 'MODIFY_BASKET_HEADER', >- $basketno >+ $basketno, >+ to_json($modified->unblessed) > ); > } > >@@ -778,7 +795,11 @@ sub ModBasketUsers { > logaction( > 'ACQUISITIONS', > 'MODIFY_BASKET_USERS', >- $basketno >+ $basketno, >+ to_json({ >+ basketno => $basketno, >+ basketusers => @basketusers_ids >+ }) > ); > } > >diff --git a/Koha/EDI.pm b/Koha/EDI.pm >index 6e90675aba..14f61c79ac 100644 >--- a/Koha/EDI.pm >+++ b/Koha/EDI.pm >@@ -622,9 +622,20 @@ sub process_quote { > } > ); > Koha::Acquisition::Baskets->find($b)->close; >+ # Log the approval >+ if (C4::Context->preference("AcqLog")) { >+ my $approved = Koha::Acquisition::Baskets->find( $b ); >+ logaction( >+ 'ACQUISITIONS', >+ 'APPROVE_BASKET', >+ $b, >+ to_json($approved->unblessed) >+ ); >+ } > } > } > >+ > return; > } > >diff --git a/acqui/addorder.pl b/acqui/addorder.pl >index cd69a4d251..74da873128 100755 >--- a/acqui/addorder.pl >+++ b/acqui/addorder.pl >@@ -119,6 +119,7 @@ if it is an order from an existing suggestion : the id of this suggestion. > > use Modern::Perl; > use CGI qw ( -utf8 ); >+use JSON qw ( to_json ); > use C4::Auth; # get_template_and_user > use C4::Acquisition; # ModOrder > use C4::Suggestions; # ModStatus >@@ -129,6 +130,7 @@ use C4::Output; > use C4::Log qw(logaction); > use Koha::Acquisition::Currencies; > use Koha::Acquisition::Orders; >+use Koha::Acquisition::Baskets; > use C4::Barcodes; > > ### "-------------------- addorder.pl ----------" >@@ -362,10 +364,12 @@ if ( $basket->{is_standing} || $orderinfo->{quantity} ne '0' ) { > } > > if (C4::Context->preference("AcqLog") && $basketno) { >+ my $modified = Koha::Acquisition::Baskets->find( $basketno ); > logaction( > 'ACQUISITIONS', > 'MODIFY_BASKET', >- $basketno >+ $basketno, >+ to_json($modified->unblessed) > ); > } > >-- >2.24.3 (Apple Git-128)
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