Bugzilla – Attachment 144293 Details for
Bug 30719
ILL should provide the ability to create batch requests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30719: Logging of batch operations
0001-Bug-30719-Logging-of-batch-operations.patch (text/plain), 3.33 KB, created by
Pedro Amorim
on 2022-11-28 16:27:29 UTC
(
hide
)
Description:
Bug 30719: Logging of batch operations
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2022-11-28 16:27:29 UTC
Size:
3.33 KB
patch
obsolete
>From 0712d8d27a558e79e0f7304807ef99d0f87d6b5b Mon Sep 17 00:00:00 2001 >From: Andrew Isherwood <andrew.isherwood@ptfs-europe.com> >Date: Mon, 13 Jun 2022 11:21:28 +0100 >Subject: [PATCH] Bug 30719: Logging of batch operations > >This commit adds logging of the following batch operations: > >- Batch creation >- Batch update (Updating of the batch itself, not its contents) >- Batch delete >--- > Koha/Illbatch.pm | 85 ++++++++++++++++++++++++++++++++++++++ > Koha/REST/V1/Illbatches.pm | 7 ++-- > 2 files changed, 88 insertions(+), 4 deletions(-) > >diff --git a/Koha/Illbatch.pm b/Koha/Illbatch.pm >index edb2feb029..c604661617 100644 >--- a/Koha/Illbatch.pm >+++ b/Koha/Illbatch.pm >@@ -19,6 +19,8 @@ package Koha::Illbatch; > > use Modern::Perl; > use Koha::Database; >+use Koha::Illrequest::Logger; >+use JSON qw( to_json ); > use base qw(Koha::Object); > > =head1 NAME >@@ -72,6 +74,89 @@ sub requests_count { > })->count; > } > >+=head3 create_and_log >+ >+ $batch->create_and_log; >+ >+Log batch creation following storage >+ >+=cut >+ >+sub create_and_log { >+ my ( $self ) = @_; >+ >+ $self->store; >+ >+ my $logger = Koha::Illrequest::Logger->new; >+ >+ $logger->log_something({ >+ modulename => 'ILL', >+ actionname => 'batch_create', >+ objectnumber => $self->id, >+ infos => to_json({}) >+ }); >+} >+ >+=head3 update_and_log >+ >+ $batch->update_and_log; >+ >+Log batch update following storage >+ >+=cut >+ >+sub update_and_log { >+ my ( $self, $params ) = @_; >+ >+ my $before = { >+ name => $self->name, >+ branchcode => $self->branchcode >+ }; >+ >+ $self->set( $params ); >+ my $update = $self->store; >+ >+ my $after = { >+ name => $self->name, >+ branchcode => $self->branchcode >+ }; >+ >+ my $logger = Koha::Illrequest::Logger->new; >+ >+ $logger->log_something({ >+ modulename => 'ILL', >+ actionname => 'batch_update', >+ objectnumber => $self->id, >+ infos => to_json({ >+ before => $before, >+ after => $after >+ }) >+ }); >+} >+ >+=head3 delete_and_log >+ >+ $batch->delete_and_log; >+ >+Log batch delete >+ >+=cut >+ >+sub delete_and_log { >+ my ( $self ) = @_; >+ >+ my $logger = Koha::Illrequest::Logger->new; >+ >+ $logger->log_something({ >+ modulename => 'ILL', >+ actionname => 'batch_delete', >+ objectnumber => $self->id, >+ infos => to_json({}) >+ }); >+ >+ $self->delete; >+} >+ > =head2 Internal methods > > =head3 _type >diff --git a/Koha/REST/V1/Illbatches.pm b/Koha/REST/V1/Illbatches.pm >index af21e762ae..e2b175e241 100644 >--- a/Koha/REST/V1/Illbatches.pm >+++ b/Koha/REST/V1/Illbatches.pm >@@ -129,7 +129,7 @@ sub add { > > return try { > my $batch = Koha::Illbatch->new( $body ); >- $batch->store; >+ $batch->create_and_log; > $c->res->headers->location( $c->req->url->to_string . '/' . $batch->id ); > > my $ret = { >@@ -171,8 +171,7 @@ sub update { > delete $params->{cardnumber}; > > return try { >- $batch->set( $params ); >- $batch->store(); >+ $batch->update_and_log( $params ); > > my $ret = { > %{$batch->unblessed}, >@@ -208,7 +207,7 @@ sub delete { > } > > return try { >- $batch->delete; >+ $batch->delete_and_log; > return $c->render( status => 204, openapi => ''); > } > catch { >-- >2.25.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 30719
:
144281
|
144285
|
144286
|
144287
|
144288
|
144289
|
144290
|
144291
|
144292
|
144293
|
144294
|
144295
|
144296
|
144297
|
144298
|
144299
|
144300
|
144301
|
144302
|
145760
|
145869
|
145870
|
145876
|
145934
|
146152
|
147658
|
147929
|
147930
|
147931
|
147932
|
147933
|
147934
|
147952
|
147953
|
147954
|
147955
|
147956
|
151152
|
151153
|
151154
|
151155
|
151156
|
151284
|
151285
|
151286
|
151287
|
151288
|
151303
|
151304
|
151305
|
151306
|
151307
|
151308
|
151309
|
151310
|
151311
|
151312
|
151513
|
151514
|
151515
|
151516
|
151517
|
151519
|
151520
|
151521
|
151522
|
151523
|
151571
|
151572
|
151573
|
151574
|
151575
|
151611
|
151612
|
151613
|
151614
|
151615
|
151804
|
151805
|
151806
|
151807
|
151808
|
151809
|
154046
|
154047
|
154048
|
154049
|
154050
|
154051
|
154052
|
155421
|
155422
|
155423
|
155424
|
155425
|
155426
|
155427
|
155428
|
155429
|
155430
|
155431
|
155432
|
155433
|
155434
|
155435
|
156556
|
156748
|
156749
|
156752
|
156783
|
156785
|
156811
|
156812
|
156827
|
156828