View | Details | Raw Unified | Return to bug 3674
Collapse All | Expand All

(-)a/C4/Members.pm (-4 / +5 lines)
Lines 800-807 Returns the borrowernumber Link Here
800
sub AddMember {
800
sub AddMember {
801
    my (%data) = @_;
801
    my (%data) = @_;
802
    my $dbh = C4::Context->dbh;
802
    my $dbh = C4::Context->dbh;
803
    $data{'userid'} = '' unless $data{'password'};
803
	# generate a proper login if none provided
804
    $data{'password'} = md5_base64( $data{'password'} ) if $data{'password'};
804
	$data{'userid'} = Generate_Userid($data{'borrowernumber'}, $data{'firstname'}, $data{'surname'}) if $data{'userid'} eq '';
805
	# create a disabled account if no password provided
806
	$data{'password'} = ($data{'password'})? md5_base64($data{'password'}) : '!';
805
	$data{'borrowernumber'}=InsertInTable("borrowers",\%data);	
807
	$data{'borrowernumber'}=InsertInTable("borrowers",\%data);	
806
    # mysql_insertid is probably bad.  not necessarily accurate and mysql-specific at best.
808
    # mysql_insertid is probably bad.  not necessarily accurate and mysql-specific at best.
807
    logaction("MEMBERS", "CREATE", $data{'borrowernumber'}, "") if C4::Context->preference("BorrowersLog");
809
    logaction("MEMBERS", "CREATE", $data{'borrowernumber'}, "") if C4::Context->preference("BorrowersLog");
Lines 842-848 sub Generate_Userid { Link Here
842
  do {
844
  do {
843
    $firstname =~ s/[[:digit:][:space:][:blank:][:punct:][:cntrl:]]//g;
845
    $firstname =~ s/[[:digit:][:space:][:blank:][:punct:][:cntrl:]]//g;
844
    $surname =~ s/[[:digit:][:space:][:blank:][:punct:][:cntrl:]]//g;
846
    $surname =~ s/[[:digit:][:space:][:blank:][:punct:][:cntrl:]]//g;
845
    $newuid = lc("$firstname.$surname");
847
	$newuid = lc(($firstname)? "$firstname.$surname" : $surname);
846
    $newuid .= $offset unless $offset == 0;
848
    $newuid .= $offset unless $offset == 0;
847
    $offset++;
849
    $offset++;
848
850
849
- 

Return to bug 3674