Lines 885-891
sub generate_userid {
Link Here
|
885 |
my ($self) = @_; |
885 |
my ($self) = @_; |
886 |
my $userid; |
886 |
my $userid; |
887 |
my $offset = 0; |
887 |
my $offset = 0; |
888 |
my $patron = Koha::Patron->new; |
888 |
my $existing_userid = $self->userid; |
889 |
my $firstname = $self->firstname // q{}; |
889 |
my $firstname = $self->firstname // q{}; |
890 |
my $surname = $self->surname // q{}; |
890 |
my $surname = $self->surname // q{}; |
891 |
#The script will "do" the following code and increment the $offset until the generated userid is unique |
891 |
#The script will "do" the following code and increment the $offset until the generated userid is unique |
Lines 895-903
sub generate_userid {
Link Here
|
895 |
$userid = lc(($firstname)? "$firstname.$surname" : $surname); |
895 |
$userid = lc(($firstname)? "$firstname.$surname" : $surname); |
896 |
$userid = unac_string('utf-8',$userid); |
896 |
$userid = unac_string('utf-8',$userid); |
897 |
$userid .= $offset unless $offset == 0; |
897 |
$userid .= $offset unless $offset == 0; |
898 |
$patron->userid( $userid ); |
898 |
$self->userid( $userid ); |
899 |
$offset++; |
899 |
$offset++; |
900 |
} while (! $patron->has_valid_userid ); |
900 |
} while (! $self->has_valid_userid ); |
|
|
901 |
|
902 |
# Resetting to the previous value as the callers do not expect |
903 |
# this method to modify the userid attribute |
904 |
# This will be done later (move of AddMember and ModMember) |
905 |
$self->userid( $existing_userid ); |
901 |
|
906 |
|
902 |
return $userid; |
907 |
return $userid; |
903 |
|
908 |
|