Bugzilla – Attachment 162669 Details for
Bug 36159
Patron imports record a change for non-text columns that are not in the import file
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36159: Patron imports record a change for non-text columns that are not in the import file
Bug-36159-Patron-imports-record-a-change-for-non-t.patch (text/plain), 3.67 KB, created by
Kyle M Hall (khall)
on 2024-03-01 14:55:54 UTC
(
hide
)
Description:
Bug 36159: Patron imports record a change for non-text columns that are not in the import file
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2024-03-01 14:55:54 UTC
Size:
3.67 KB
patch
obsolete
>From 986e6c91fdb7a1abaa0d7d522a2617e15c2821d4 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 1 Mar 2024 09:50:07 -0500 >Subject: [PATCH] Bug 36159: Patron imports record a change for non-text > columns that are not in the import file > >When importing patrons we assume a default of '' for borrower columns not supplied in the file. > >When saving we compare the new object we built to the one form the database - for columns are that are not text type we get undef from the db and '' in the object we make. This means we see a difference and log into the BorrowersLog: > > "date_renewed" : { > "after" : "", > "before" : null > }, > "dateofbirth" : { > "after" : "", > "before" : null > }, > "debarred" : { > "after" : "", > "before" : null > }, > "flags" : { > "after" : "", > "before" : null > }, > "gonenoaddress" : { > "after" : "", > "before" : null > }, > "lost" : { > "after" : "", > "before" : null > }, > "password_expiration_date" : { > "after" : "", > "before" : null > }, > "sms_provider_id" : { > "after" : "", > "before" : null > } >} > >This can mean a lot of useless logging in sites that do automated imports > >Test Plan: >1) Enable 'BorrowersLog' system preference >2) Import the borrowers file attach do this bug report file, matchig on cardnuber, and overwriting > Contents of the borrowers file are : >surname,firstname,branchcode,categorycode,cardnumber,dateenrolled,patron_attributes,lastseen >Acosta,Ednb,CPL,PT,23529001000463,02/01/2013,, >3) Check the logs, note the modification of columns that have no date >4) Import the file again with the same settings >5) Note the new action log >6) Apply this patch >7) Restart all the things! >8) Import the file again with the same settings >9) Note no new action log was created! >--- > Koha/Patron.pm | 18 ++++++++++-------- > 1 file changed, 10 insertions(+), 8 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 5b0bd9ea7f5..ac8c5dd159e 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -375,17 +375,19 @@ sub store { > my $info; > my $from_storage = $self_from_storage->unblessed; > my $from_object = $self->unblessed; >+ >+ # Object's dateexpiry is a DateTime object which stringifies to iso8601 datetime, >+ # but the column in only a date so we need to convert the datetime to just a date >+ # to know if it has actually changed. >+ $from_object->{dateexpiry} = dt_from_string( $from_object->{dateexpiry} )->ymd >+ if $from_object->{dateexpiry}; >+ > my @skip_fields = (qw/lastseen updated_on/); > for my $key ( keys %{$from_storage} ) { > next if any { /$key/ } @skip_fields; >- if ( >- ( !defined( $from_storage->{$key} ) && defined( $from_object->{$key} ) ) >- || ( defined( $from_storage->{$key} ) >- && !defined( $from_object->{$key} ) ) >- || ( defined( $from_storage->{$key} ) >- && defined( $from_object->{$key} ) >- && ( $from_storage->{$key} ne $from_object->{$key} ) ) >- ) >+ if ( defined( $from_storage->{$key} ) >+ && defined( $from_object->{$key} ) >+ && ( $from_storage->{$key} ne $from_object->{$key} ) ) > { > $info->{$key} = { > before => $from_storage->{$key}, >-- >2.30.2
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 36159
:
162392
|
162669
|
162672
|
162689
|
164038
|
164039
|
164040
|
164113
|
164114
|
164115
|
164124