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 158-163 if ( $op eq 'modify' or $op eq 'save' or $op eq 'duplicate' ) { Link Here
158
158
159
    $borrower_data = $patron->unblessed;
159
    $borrower_data = $patron->unblessed;
160
    $borrower_data->{category_type} = $patron->category->category_type;
160
    $borrower_data->{category_type} = $patron->category->category_type;
161
} else {
162
    $patron = Koha::Patron->new;
161
}
163
}
162
my $categorycode  = $input->param('categorycode') || $borrower_data->{'categorycode'};
164
my $categorycode  = $input->param('categorycode') || $borrower_data->{'categorycode'};
163
my $category_type = $input->param('category_type') || '';
165
my $category_type = $input->param('category_type') || '';
Lines 279-290 $newdata{'lang'} = $input->param('lang') if defined($input->param('lang')) Link Here
279
if ( ( defined $newdata{'userid'} && $newdata{'userid'} eq '' ) || $check_BorrowerUnwantedField =~ /userid/ && !defined $data{'userid'} ) {
281
if ( ( defined $newdata{'userid'} && $newdata{'userid'} eq '' ) || $check_BorrowerUnwantedField =~ /userid/ && !defined $data{'userid'} ) {
280
    if ( ( defined $newdata{'firstname'} ) && ( defined $newdata{'surname'} ) ) {
282
    if ( ( defined $newdata{'firstname'} ) && ( defined $newdata{'surname'} ) ) {
281
        # Full page edit, firstname and surname input zones are present
283
        # Full page edit, firstname and surname input zones are present
282
        $newdata{'userid'} = Generate_Userid( $borrowernumber, $newdata{'firstname'}, $newdata{'surname'} );
284
        $patron->firstname($newdata{firstname});
285
        $patron->surname($newdata{surname});
286
        $newdata{'userid'} = $patron->generate_userid;
283
    }
287
    }
284
    elsif ( ( defined $data{'firstname'} ) && ( defined $data{'surname'} ) ) {
288
    elsif ( ( defined $data{'firstname'} ) && ( defined $data{'surname'} ) ) {
285
        # Partial page edit (access through "Details"/"Library details" tab), firstname and surname input zones are not used
289
        # Partial page edit (access through "Details"/"Library details" tab), firstname and surname input zones are not used
286
        # Still, if the userid field is erased, we can create a new userid with available firstname and surname
290
        # Still, if the userid field is erased, we can create a new userid with available firstname and surname
287
        $newdata{'userid'} = Generate_Userid( $borrowernumber, $data{'firstname'}, $data{'surname'} );
291
        # FIXME clean thiscode newdata vs data is very confusing
292
        $patron->firstname($data{firstname});
293
        $patron->surname($data{surname});
294
        $newdata{'userid'} = $patron->generate_userid;
288
    }
295
    }
289
    else {
296
    else {
290
        $newdata{'userid'} = $data{'userid'};
297
        $newdata{'userid'} = $data{'userid'};
291
- 

Return to bug 19936