Bugzilla – Attachment 165246 Details for
Bug 25996
Changes to restrictions should be logged
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25996: Add logging to restrictions actions
Bug-25996-Add-logging-to-restrictions-actions.patch (text/plain), 2.14 KB, created by
Tomás Cohen Arazi (tcohen)
on 2024-04-22 04:23:35 UTC
(
hide
)
Description:
Bug 25996: Add logging to restrictions actions
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2024-04-22 04:23:35 UTC
Size:
2.14 KB
patch
obsolete
>From e084c02d3a1e061cff4e6179192f72c4c1a3b76d Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 22 Apr 2024 01:04:31 -0300 >Subject: [PATCH] Bug 25996: Add logging to restrictions actions > >This patch adds logging for the following actions: > >* CREATE_RESTRICITON >* MODIFY_RESTRICTION >* DELETE_RESTRICTION > >To test: >1. Apply the unit tests >2. Run: > $ ktd --shell > k$ prove t/db_dependent/Patron/Borrower_Debarments.t >=> FAIL: The feature is not implemented! Nothing is logged! >3. Apply this patch >4. Repeat 2 >=> SUCCESS: Tests pass! >5. Sign off :-D > >Sponsored-by: Karlsruhe Institute of Technology (KIT) >--- > Koha/Patron/Debarments.pm | 15 ++++++++++++++- > 1 file changed, 14 insertions(+), 1 deletion(-) > >diff --git a/Koha/Patron/Debarments.pm b/Koha/Patron/Debarments.pm >index 2ac587307f3..8890fedf4f2 100644 >--- a/Koha/Patron/Debarments.pm >+++ b/Koha/Patron/Debarments.pm >@@ -20,6 +20,7 @@ package Koha::Patron::Debarments; > use Modern::Perl; > > use C4::Context; >+use C4::Log qw( logaction ); > > use Koha::Patron::Restriction::Types; > use Koha::Patron::Restrictions; >@@ -86,6 +87,9 @@ sub AddDebarment { > > UpdateBorrowerDebarmentFlags($borrowernumber); > >+ logaction( "MEMBERS", "CREATE_RESTRICTION", $borrowernumber, $restriction ) >+ if C4::Context->preference("BorrowersLog"); >+ > return $restriction ? 1 : 0; > } > >@@ -108,6 +112,9 @@ sub DelDebarment { > > UpdateBorrowerDebarmentFlags($borrowernumber); > >+ logaction( "MEMBERS", "DELETE_RESTRICTION", $borrowernumber, q{} ) >+ if C4::Context->preference("BorrowersLog"); >+ > return $r; > } > >@@ -149,7 +156,13 @@ sub ModDebarment { > > my $r = C4::Context->dbh->do( $sql, {}, ( @values, $borrower_debarment_id ) ); > >- UpdateBorrowerDebarmentFlags( _GetBorrowernumberByDebarmentId($borrower_debarment_id) ); >+ my $borrowernumber = _GetBorrowernumberByDebarmentId($borrower_debarment_id); >+ UpdateBorrowerDebarmentFlags($borrowernumber); >+ >+ logaction( >+ "MEMBERS", "MODIFY_RESTRICTION", $borrowernumber, >+ Koha::Patron::Restrictions->find($borrower_debarment_id) >+ ) if C4::Context->preference("BorrowersLog"); > > return $r; > } >-- >2.44.0
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 25996
:
165244
|
165245
|
165246
|
165247
|
165267
|
165281
|
165282
|
165283
|
165284
|
165285
|
166056
|
166057
|
166058
|
166059
|
166060