Lines 916-922
sub generate_userid {
Link Here
|
916 |
my ($self) = @_; |
916 |
my ($self) = @_; |
917 |
my $userid; |
917 |
my $userid; |
918 |
my $offset = 0; |
918 |
my $offset = 0; |
919 |
my $patron = Koha::Patron->new; |
919 |
my $existing_userid = $self->userid; |
920 |
my $firstname = $self->firstname // q{}; |
920 |
my $firstname = $self->firstname // q{}; |
921 |
my $surname = $self->surname // q{}; |
921 |
my $surname = $self->surname // q{}; |
922 |
#The script will "do" the following code and increment the $offset until the generated userid is unique |
922 |
#The script will "do" the following code and increment the $offset until the generated userid is unique |
Lines 926-934
sub generate_userid {
Link Here
|
926 |
$userid = lc(($firstname)? "$firstname.$surname" : $surname); |
926 |
$userid = lc(($firstname)? "$firstname.$surname" : $surname); |
927 |
$userid = unac_string('utf-8',$userid); |
927 |
$userid = unac_string('utf-8',$userid); |
928 |
$userid .= $offset unless $offset == 0; |
928 |
$userid .= $offset unless $offset == 0; |
929 |
$patron->userid( $userid ); |
929 |
$self->userid( $userid ); |
930 |
$offset++; |
930 |
$offset++; |
931 |
} while (! $patron->has_valid_userid ); |
931 |
} while (! $self->has_valid_userid ); |
|
|
932 |
|
933 |
# Resetting to the previous value as the callers do not expect |
934 |
# this method to modify the userid attribute |
935 |
# This will be done later (move of AddMember and ModMember) |
936 |
$self->userid( $existing_userid ); |
932 |
|
937 |
|
933 |
return $userid; |
938 |
return $userid; |
934 |
|
939 |
|