Bug 12598: Allow matched patron to be updated
authorColin Campbell <colin.campbell@ptfs-europe.com>
Thu, 10 Aug 2017 12:56:24 +0000 (13:56 +0100)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 16 Feb 2018 17:05:14 +0000 (14:05 -0300)
When a test was introduced to not add duplicate userids
it overlooked that if you were matching on userid you
do not want the update to be rejected.

Add a test to overcome this logical flaw if updating
by matching userid

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Koha/Patrons/Import.pm

index db6beb0..c785604 100644 (file)
@@ -199,7 +199,7 @@ sub import_patrons {
         }
 
         # Check if the userid provided does not exist yet
-        if (  exists $borrower{userid}
+        if (  $matchpoint ne 'userid' and exists $borrower{userid}
                  and $borrower{userid}
              and not Check_Userid( $borrower{userid}, $borrower{borrowernumber} ) ) {
              push @errors, { duplicate_userid => 1, userid => $borrower{userid} };