Bug 6218 - patron login gets an initial dot added when no first name
Summary: patron login gets an initial dot added when no first name
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: 3.4
Hardware: All All
: PATCH-Sent (DO NOT USE) minor
Assignee: Fernando L. Canizo
QA Contact: Bugs List
URL:
Keywords:
Depends on:
Blocks: 3674
  Show dependency treegraph
 
Reported: 2011-04-20 15:15 UTC by Fernando L. Canizo
Modified: 2013-12-05 20:01 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
fix Member.pm (970 bytes, patch)
2011-04-20 21:17 UTC, Fernando L. Canizo
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Fernando L. Canizo 2011-04-20 15:15:26 UTC
If you create a patron with an empty opac login and an empty first name, save and then edit him/her, script will add a dot before login on OPAC Login box, for example if
your surname is 'mongo' box gets pre-filled with '.mongo'.

This is because script joins 'first name'.'surname' and with an empty first name, hence the initial dot.

It would be desirable to have 'surname' as login (without dot) when there's no first name entered.
Comment 1 Owen Leonard 2011-04-20 15:31:13 UTC
In Members.pm:

sub Generate_Userid {
  my ($borrowernumber, $firstname, $surname) = @_;
  my $newuid;
  my $offset = 0;
  do {
    $firstname =~ s/[[:digit:][:space:][:blank:][:punct:][:cntrl:]]//g;
    $surname =~ s/[[:digit:][:space:][:blank:][:punct:][:cntrl:]]//g;
    $newuid = lc("$firstname.$surname");
    $newuid .= $offset unless $offset == 0;
    $offset++;

   } while (!Check_Userid($newuid,$borrowernumber));

   return $newuid;
}
Comment 2 Fernando L. Canizo 2011-04-20 21:17:50 UTC
Created attachment 3960 [details] [review]
fix Member.pm

Now it chooses surname if firstname is blank, no dots added. It behaves the same if both are provided.
Comment 3 Ian Walls 2011-05-13 13:58:24 UTC
This patch can be verified by reading the code.  Marking as Passed QA.
Comment 4 Chris Cormack 2011-05-14 07:22:45 UTC
Merged to master please test