Bug 6218: patron gets dot added if no first name
authorconan (aka Fernando Canizo) <conan@lugmen.org.ar>
Wed, 20 Apr 2011 20:04:37 +0000 (17:04 -0300)
committerChris Cormack <chrisc@catalyst.net.nz>
Sat, 14 May 2011 07:19:08 +0000 (19:19 +1200)
Trivial fix, now it choose surname if firstname is empty and behaves
like before (firstname.surname) if both are provided.

Signed-off-by: Frederic Demians <frederic@tamil.fr>
Signed-off-by: Ian Walls <ian.walls@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
C4/Members.pm

index a151e03..e03b40b 100644 (file)
@@ -842,7 +842,7 @@ sub Generate_Userid {
   do {
     $firstname =~ s/[[:digit:][:space:][:blank:][:punct:][:cntrl:]]//g;
     $surname =~ s/[[:digit:][:space:][:blank:][:punct:][:cntrl:]]//g;
-    $newuid = lc("$firstname.$surname");
+    $newuid = lc(($firstname)? "$firstname.$surname" : $surname);
     $newuid .= $offset unless $offset == 0;
     $offset++;