Lines 160-168
if ( $op eq 'modify' or $op eq 'save' or $op eq 'duplicate' ) {
Link Here
|
160 |
|
160 |
|
161 |
$borrower_data = $patron->unblessed; |
161 |
$borrower_data = $patron->unblessed; |
162 |
$borrower_data->{category_type} = $patron->category->category_type; |
162 |
$borrower_data->{category_type} = $patron->category->category_type; |
163 |
} else { |
|
|
164 |
$patron = Koha::Patron->new; |
165 |
} |
163 |
} |
|
|
164 |
|
166 |
my $categorycode = $input->param('categorycode') || $borrower_data->{'categorycode'}; |
165 |
my $categorycode = $input->param('categorycode') || $borrower_data->{'categorycode'}; |
167 |
my $category_type = $input->param('category_type') || ''; |
166 |
my $category_type = $input->param('category_type') || ''; |
168 |
unless ($category_type or !($categorycode)){ |
167 |
unless ($category_type or !($categorycode)){ |
Lines 285-305
$newdata{'lang'} = $input->param('lang') if defined($input->param('lang'))
Link Here
|
285 |
# builds default userid |
284 |
# builds default userid |
286 |
# userid input text may be empty or missing because of syspref BorrowerUnwantedField |
285 |
# userid input text may be empty or missing because of syspref BorrowerUnwantedField |
287 |
if ( ( defined $newdata{'userid'} && $newdata{'userid'} eq '' ) || $check_BorrowerUnwantedField =~ /userid/ && !defined $data{'userid'} ) { |
286 |
if ( ( defined $newdata{'userid'} && $newdata{'userid'} eq '' ) || $check_BorrowerUnwantedField =~ /userid/ && !defined $data{'userid'} ) { |
|
|
287 |
my $fake_patron = Koha::Patron->new; |
288 |
$fake_patron->userid($patron->userid) if $patron; # editing |
288 |
if ( ( defined $newdata{'firstname'} || $category_type eq 'I' ) && ( defined $newdata{'surname'} ) ) { |
289 |
if ( ( defined $newdata{'firstname'} || $category_type eq 'I' ) && ( defined $newdata{'surname'} ) ) { |
289 |
# Full page edit, firstname and surname input zones are present |
290 |
# Full page edit, firstname and surname input zones are present |
290 |
$patron->firstname($newdata{firstname}); |
291 |
$fake_patron->firstname($newdata{firstname}); |
291 |
$patron->surname($newdata{surname}); |
292 |
$fake_patron->surname($newdata{surname}); |
292 |
$patron->generate_userid; |
293 |
$fake_patron->generate_userid; |
293 |
$newdata{'userid'} = $patron->userid; |
294 |
$newdata{'userid'} = $fake_patron->userid; |
294 |
} |
295 |
} |
295 |
elsif ( ( defined $data{'firstname'} || $category_type eq 'I' ) && ( defined $data{'surname'} ) ) { |
296 |
elsif ( ( defined $data{'firstname'} || $category_type eq 'I' ) && ( defined $data{'surname'} ) ) { |
296 |
# Partial page edit (access through "Details"/"Library details" tab), firstname and surname input zones are not used |
297 |
# Partial page edit (access through "Details"/"Library details" tab), firstname and surname input zones are not used |
297 |
# Still, if the userid field is erased, we can create a new userid with available firstname and surname |
298 |
# Still, if the userid field is erased, we can create a new userid with available firstname and surname |
298 |
# FIXME clean thiscode newdata vs data is very confusing |
299 |
# FIXME clean thiscode newdata vs data is very confusing |
299 |
$patron->firstname($data{firstname}); |
300 |
$fake_patron->firstname($data{firstname}); |
300 |
$patron->surname($data{surname}); |
301 |
$fake_patron->surname($data{surname}); |
301 |
$patron->generate_userid; |
302 |
$fake_patron->generate_userid; |
302 |
$newdata{'userid'} = $patron->userid; |
303 |
$newdata{'userid'} = $fake_patron->userid; |
303 |
} |
304 |
} |
304 |
else { |
305 |
else { |
305 |
$newdata{'userid'} = $data{'userid'}; |
306 |
$newdata{'userid'} = $data{'userid'}; |
306 |
- |
|
|