Bug 19077

Summary: When loading patrons matching on userid updates to matched patrons are rejected
Product: Koha Reporter: Colin Campbell <colin.campbell>
Component: PatronsAssignee: Colin Campbell <colin.campbell>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: gmcharlt, jonathan.druart, katrin.fischer, kyle.m.hall
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Add test to not reject update if matching on userid

Description Colin Campbell 2017-08-10 15:14:47 UTC
A while back the import_borrowers script was altered to allow matching by userid, to allow updating borrowers by the id, unfortunately in parallel was  a change to ensure duplicate userids were not added. Both changes were applied but the latter had the side effect of rendering the first useless. This patch adds a test that we are not matching on userid to the check userid for uniqueness

To test
Without the patch a import record matching on userid will be rejected
With the patch it will update the db record
when matching on another key non-unique userids will still be rejected

a version of the patch has been submitted for inclusion in the enhanced version of patron load in bug 12598
Comment 1 Colin Campbell 2017-08-10 15:23:28 UTC
Created attachment 65828 [details] [review]
Add test to not reject update if matching on userid

test by confirming that if matching by userid a matched record is updated, howver if matching by another criteria a record with a duplicate userid should still be rejected
Comment 2 Katrin Fischer 2017-08-15 21:24:07 UTC
Hi Colin, with and without the patch I receive an internal server error when I try to match on username/uderid:

Use of uninitialized value $uploadborrowers in concatenation (.) or string at /home/vagrant/kohaclone/tools/import_borrowers.pl line 113.
Use of uninitialized value $uploadborrowers in concatenation (.) or string at /home/vagrant/kohaclone/tools/import_borrowers.pl line 113.
Can't call method "unblessed" on unblessed reference at /home/vagrant/kohaclone/tools/import_borrowers.pl line 255, <$fh> line 2.

Can you help?
Comment 3 Jonathan Druart 2017-08-22 16:46:04 UTC
(In reply to Katrin Fischer from comment #2)
> Hi Colin, with and without the patch I receive an internal server error when
> I try to match on username/uderid:
> 
> Use of uninitialized value $uploadborrowers in concatenation (.) or string
> at /home/vagrant/kohaclone/tools/import_borrowers.pl line 113.
> Use of uninitialized value $uploadborrowers in concatenation (.) or string
> at /home/vagrant/kohaclone/tools/import_borrowers.pl line 113.
> Can't call method "unblessed" on unblessed reference at
> /home/vagrant/kohaclone/tools/import_borrowers.pl line 255, <$fh> line 2.
> 
> Can you help?

Should be fixed by
  commit 6f595e4c95c22ba444f49c61c9d101483309871f
    Bug 17829: (follow-up) Fix import patron
Comment 4 Katrin Fischer 2017-08-22 21:09:32 UTC
Hi Colin, after Jonathan's fix the update using userid for matching works for me without the patch. Can you verify?
Comment 5 Jonathan Druart 2017-09-04 15:26:05 UTC
Closing, reopen if it is still needed.