From a847067d7ef5350f9572c92407971baa7af76216 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Tue, 30 Dec 2014 15:37:39 +1300 Subject: [PATCH] Bug 1861: There is a problem introduced with an earlier patch, on this patchset - $data{'userid'} = Generate_Userid($data{'borrowernumber'}, $data{'firstname'}, $data{'surname'}) if $data{'userid'} eq ''; + $data{'userid'} = Generate_Userid( $data{'borrowernumber'}, $data{'firstname'}, $data{'surname'} ) + if ( $data{'userid'} eq '' || Check_Userid( $data{'userid'} ) ); Check_Userid returns 1 if it is unique. So this means unique userids will always be discarded and new ones created. This is why all the tests depending on a userid are now failing To test 1/ run perl t/db_dependent/Serials_2.t 2/ Notice lots of tests fail 3/ OR Add a borrower with a userid set, notice the userid is ignored and one is generated instead 4/ Apply patch 5/ Add a new borrower, notice the userid sticks (if it is unique) 6/ Run perl t/db_dependent/Serials_2.t notice tests pass 7/ Run perl t/db_dependent/Members.t notice tests still pass Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart Signed-off-by: Tomas Cohen Arazi --- C4/Members.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/C4/Members.pm b/C4/Members.pm index 161199178d..e1449df941 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -856,7 +856,7 @@ sub AddMember { # generate a proper login if none provided $data{'userid'} = Generate_Userid( $data{'borrowernumber'}, $data{'firstname'}, $data{'surname'} ) - if ( $data{'userid'} eq '' || Check_Userid( $data{'userid'} ) ); + if ( $data{'userid'} eq '' || !Check_Userid( $data{'userid'} ) ); # add expiration date if it isn't already there unless ( $data{'dateexpiry'} ) { -- 2.39.5