Bug 36159: Patron imports record a change for non-text columns that are not in the...
authorKyle M Hall <kyle@bywatersolutions.com>
Fri, 1 Mar 2024 14:50:07 +0000 (09:50 -0500)
committerFridolin Somers <fridolin.somers@biblibre.com>
Wed, 17 Apr 2024 15:12:01 +0000 (17:12 +0200)
commit104761e917a38b126cdbce392cbd5969484c9c20
tree314d7f304a38880771c6b619a20c5358ca603b76
parentbadf7521baee89bbee8e7d23bf2e1ba65c49907a
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!

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 67680d5d6a782ff81ba21b6910318e6d5d32afd0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Koha/Patron.pm