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

(-)a/C4/Members.pm (-2 / +2 lines)
Lines 414-422 sub AddMember { Link Here
414
        }
414
        }
415
    }
415
    }
416
416
417
    my $p = Koha::Patron->new( { userid => $data{userid} } );
417
    my $p = Koha::Patron->new( { userid => $data{userid}, firstname => $data{firstname}, surname => $data{surname} } );
418
    # generate a proper login if none provided
418
    # generate a proper login if none provided
419
    $data{'userid'} = Generate_Userid( $data{'borrowernumber'}, $data{'firstname'}, $data{'surname'} )
419
    $data{'userid'} = $p->generate_userid
420
      if ( $data{'userid'} eq '' || ! $p->has_valid_userid );
420
      if ( $data{'userid'} eq '' || ! $p->has_valid_userid );
421
421
422
    # add expiration date if it isn't already there
422
    # add expiration date if it isn't already there
(-)a/members/memberentry.pl (-3 / +9 lines)
Lines 159-164 if ( $op eq 'modify' or $op eq 'save' or $op eq 'duplicate' ) { Link Here
159
159
160
    $borrower_data = $patron->unblessed;
160
    $borrower_data = $patron->unblessed;
161
    $borrower_data->{category_type} = $patron->category->category_type;
161
    $borrower_data->{category_type} = $patron->category->category_type;
162
} else {
163
    $patron = Koha::Patron->new;
162
}
164
}
163
my $categorycode  = $input->param('categorycode') || $borrower_data->{'categorycode'};
165
my $categorycode  = $input->param('categorycode') || $borrower_data->{'categorycode'};
164
my $category_type = $input->param('category_type') || '';
166
my $category_type = $input->param('category_type') || '';
Lines 280-291 $newdata{'lang'} = $input->param('lang') if defined($input->param('lang')) Link Here
280
if ( ( defined $newdata{'userid'} && $newdata{'userid'} eq '' ) || $check_BorrowerUnwantedField =~ /userid/ && !defined $data{'userid'} ) {
282
if ( ( defined $newdata{'userid'} && $newdata{'userid'} eq '' ) || $check_BorrowerUnwantedField =~ /userid/ && !defined $data{'userid'} ) {
281
    if ( ( defined $newdata{'firstname'} ) && ( defined $newdata{'surname'} ) ) {
283
    if ( ( defined $newdata{'firstname'} ) && ( defined $newdata{'surname'} ) ) {
282
        # Full page edit, firstname and surname input zones are present
284
        # Full page edit, firstname and surname input zones are present
283
        $newdata{'userid'} = Generate_Userid( $borrowernumber, $newdata{'firstname'}, $newdata{'surname'} );
285
        $patron->firstname($newdata{firstname});
286
        $patron->surname($newdata{surname});
287
        $newdata{'userid'} = $patron->generate_userid;
284
    }
288
    }
285
    elsif ( ( defined $data{'firstname'} ) && ( defined $data{'surname'} ) ) {
289
    elsif ( ( defined $data{'firstname'} ) && ( defined $data{'surname'} ) ) {
286
        # Partial page edit (access through "Details"/"Library details" tab), firstname and surname input zones are not used
290
        # Partial page edit (access through "Details"/"Library details" tab), firstname and surname input zones are not used
287
        # Still, if the userid field is erased, we can create a new userid with available firstname and surname
291
        # Still, if the userid field is erased, we can create a new userid with available firstname and surname
288
        $newdata{'userid'} = Generate_Userid( $borrowernumber, $data{'firstname'}, $data{'surname'} );
292
        # FIXME clean thiscode newdata vs data is very confusing
293
        $patron->firstname($data{firstname});
294
        $patron->surname($data{surname});
295
        $newdata{'userid'} = $patron->generate_userid;
289
    }
296
    }
290
    else {
297
    else {
291
        $newdata{'userid'} = $data{'userid'};
298
        $newdata{'userid'} = $data{'userid'};
292
- 

Return to bug 19936