Bugzilla – Attachment 69467 Details for
Bug 18626
Add ability to track cardnumber changes for patrons
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18626 - Add ability to track cardnumber changes for patrons
Bug-18626---Add-ability-to-track-cardnumber-change.patch (text/plain), 2.79 KB, created by
Josef Moravec
on 2017-12-03 09:26:14 UTC
(
hide
)
Description:
Bug 18626 - Add ability to track cardnumber changes for patrons
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2017-12-03 09:26:14 UTC
Size:
2.79 KB
patch
obsolete
>From fc98509ab10bbfa9258d53ceb93565d137d3a243 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Thu, 11 May 2017 00:44:12 +0000 >Subject: [PATCH] Bug 18626 - Add ability to track cardnumber changes for > patrons >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Some libraries want to keep a history of cardnumber changes for a >patron. This is a feature that another ILS has. > >Test Plan: >1) Apply this patch >2) Enable the BorrowersLog >3) Modify a patron, update his or her cardnumber >4) Notice the entry in the action log containing the old and new cardnumbers >5) Edit a patron, leave the cardnumber the same >6) Note there is no cardnumber change entry in the action logs >7) Disable BorrowersLog, modify a patron cardnumber >8) Note there is no cardnumber change entry in teh action logs > >Followed test plan, works as expected >Signed-off-by: Marc Véron <veron@veron.ch> > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > C4/Members.pm | 22 +++++++++++++++++++++- > 1 file changed, 21 insertions(+), 1 deletion(-) > >diff --git a/C4/Members.pm b/C4/Members.pm >index 2031485..492f9c1 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -26,6 +26,7 @@ use C4::Context; > use String::Random qw( random_string ); > use Scalar::Util qw( looks_like_number ); > use Date::Calc qw/Today check_date Date_to_Days/; >+use JSON qw(to_json); > use C4::Log; # logaction > use C4::Overdues; > use C4::Reserves; >@@ -330,6 +331,25 @@ sub ModMember { > > my $patron = Koha::Patrons->find( $new_borrower->{borrowernumber} ); > >+ my $borrowers_log = C4::Context->preference("BorrowersLog"); >+ if ( $borrowers_log && $patron->cardnumber ne $new_borrower->{cardnumber} ) >+ { >+ logaction( >+ "MEMBERS", >+ "MODIFY", >+ $data{'borrowernumber'}, >+ to_json( >+ { >+ cardnumber_replaced => { >+ previous_cardnumber => $patron->cardnumber, >+ new_cardnumber => $new_borrower->{cardnumber}, >+ } >+ }, >+ { utf8 => 1, pretty => 1 } >+ ) >+ ); >+ } >+ > delete $new_borrower->{userid} if exists $new_borrower->{userid} and not $new_borrower->{userid}; > > my $execute_success = $patron->store if $patron->set($new_borrower); >@@ -361,7 +381,7 @@ sub ModMember { > Koha::NorwegianPatronDB::NLSync({ 'borrowernumber' => $data{'borrowernumber'} }); > } > >- logaction("MEMBERS", "MODIFY", $data{'borrowernumber'}, "UPDATE (executed w/ arg: $data{'borrowernumber'})") if C4::Context->preference("BorrowersLog"); >+ logaction("MEMBERS", "MODIFY", $data{'borrowernumber'}, "UPDATE (executed w/ arg: $data{'borrowernumber'})") if $borrowers_log; > } > return $execute_success; > } >-- >2.1.4
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 18626
:
63532
|
63560
|
69467
|
72607
|
72608
|
72609