From 179d0924730c46c8b9e5a6148872ee270d8ce3af 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 --- C4/Members.pm | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index 6ea04d46d8..e47c350068 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -88,7 +88,6 @@ BEGIN { #Check data push @EXPORT, qw( &checkuserpassword - &Generate_Userid &fixup_cardnumber &checkcardnumber ); @@ -464,38 +463,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.11.0