From bebf7d17c9e6b12c5d0abe7253cea26f046311bb Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 9 Jan 2018 10:27:34 -0300 Subject: [PATCH] Bug 19936: Remove the subroutine Generate_Userid Signed-off-by: Josef Moravec Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart --- C4/Members.pm | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index ade8b11710..f4fd79e1dc 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -86,7 +86,6 @@ BEGIN { #Check data push @EXPORT, qw( &checkuserpassword - &Generate_Userid &fixup_cardnumber &checkcardnumber ); @@ -482,38 +481,6 @@ sub AddMember { return $data{borrowernumber}; } -=head2 Generate_Userid - - my $newuid = Generate_Userid($borrowernumber, $firstname, $surname); - - Generate a userid using the $surname and the $firstname (if there is a value in $firstname). - - $borrowernumber is optional (i.e. it can contain a blank value). A value is passed when generating a new userid for an existing borrower. When a new userid is created for a new borrower, a blank value is passed to this sub. - - return : - new userid ($firstname.$surname if there is a $firstname, or $surname if there is no value in $firstname) plus offset (0 if the $newuid is unique, or a higher numeric value if not unique). - -=cut - -sub Generate_Userid { - my ($borrowernumber, $firstname, $surname) = @_; - my $newuid; - my $offset = 0; - my $patron = Koha::Patron->new; - #The script will "do" the following code and increment the $offset until the generated userid is unique - do { - $firstname =~ s/[[:digit:][:space:][:blank:][:punct:][:cntrl:]]//g; - $surname =~ s/[[:digit:][:space:][:blank:][:punct:][:cntrl:]]//g; - $newuid = lc(($firstname)? "$firstname.$surname" : $surname); - $newuid = unac_string('utf-8',$newuid); - $newuid .= $offset unless $offset == 0; - $patron->userid( $newuid ); - $offset++; - } while (! $patron->has_valid_userid ); - - return $newuid; -} - =head2 fixup_cardnumber Warning: The caller is responsible for locking the members table in write -- 2.39.5