Bug 7411: Remove diacritics from generated userid
authorKatrin Fischer <Katrin.Fischer.83@web.de>
Sat, 9 Jun 2012 17:09:32 +0000 (18:09 +0100)
committerPaul Poulain <paul.poulain@biblibre.com>
Mon, 11 Jun 2012 14:43:39 +0000 (16:43 +0200)
Patch introduces a new module Text::Unaccent.

To test:
1) Add a new patron with diacritics in surname and first name, leave userid empty.
2) Save user and check the created userid has only the base characters and
diacritics have been removed correctly.
3) Create another user with the same surname and first name, check userid
is generated correctly.

Signed-off-by: Dobrica Pavlinusic <dpavlin@rot13.org>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
C4/Members.pm
debian/control
install_misc/debian.packages

index ce54952..fd25844 100644 (file)
@@ -38,6 +38,7 @@ use C4::NewsChannels; #get slip news
 use DateTime;
 use DateTime::Format::DateParse;
 use Koha::DateUtils;
+use Text::Unaccent qw( unac_string );
 
 our ($VERSION,@ISA,@EXPORT,@EXPORT_OK,$debug);
 
@@ -800,6 +801,7 @@ sub Generate_Userid {
     $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;
     $offset++;
 
index bf4d3e0..588c641 100644 (file)
@@ -72,6 +72,7 @@ Build-Depends: libcgi-session-driver-memcached-perl,
  libtext-csv-perl,
  libtext-csv-xs-perl,
  libtext-iconv-perl,
+ libtext-unaccent-perl,
  libuniversal-require-perl,
  liburi-perl,
  libwww-perl,
index 4406e3d..153bcb7 100644 (file)
@@ -83,6 +83,7 @@ libtext-charwidth-perl        install
 libtext-csv-encoded-perl install
 libtext-csv-perl       install
 libtext-iconv-perl     install
+libtext-unaccent-perl  install
 libtext-wrapi18n-perl  install
 libtimedate-perl       install
 libtime-duration-perl  install