Lines 151-158
$template->param( "add" => 1 ) if ( $op eq 'add' );
Link Here
|
151 |
$template->param( "quickadd" => 1 ) if ( $quickadd ); |
151 |
$template->param( "quickadd" => 1 ) if ( $quickadd ); |
152 |
$template->param( "duplicate" => 1 ) if ( $op eq 'duplicate' ); |
152 |
$template->param( "duplicate" => 1 ) if ( $op eq 'duplicate' ); |
153 |
$template->param( "checked" => 1 ) if ( defined($nodouble) && $nodouble eq 1 ); |
153 |
$template->param( "checked" => 1 ) if ( defined($nodouble) && $nodouble eq 1 ); |
|
|
154 |
my $patron; |
154 |
if ( $op eq 'modify' or $op eq 'save' or $op eq 'duplicate' ) { |
155 |
if ( $op eq 'modify' or $op eq 'save' or $op eq 'duplicate' ) { |
155 |
my $patron = Koha::Patrons->find( $borrowernumber ); |
156 |
|
|
|
157 |
$patron = Koha::Patrons->find( $borrowernumber ); |
156 |
unless ( $patron ) { |
158 |
unless ( $patron ) { |
157 |
print $input->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber"); |
159 |
print $input->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber"); |
158 |
exit; |
160 |
exit; |
Lines 160-165
if ( $op eq 'modify' or $op eq 'save' or $op eq 'duplicate' ) {
Link Here
|
160 |
|
162 |
|
161 |
$borrower_data = $patron->unblessed; |
163 |
$borrower_data = $patron->unblessed; |
162 |
$borrower_data->{category_type} = $patron->category->category_type; |
164 |
$borrower_data->{category_type} = $patron->category->category_type; |
|
|
165 |
} else { |
166 |
$patron = Koha::Patron->new; |
163 |
} |
167 |
} |
164 |
my $categorycode = $input->param('categorycode') || $borrower_data->{'categorycode'}; |
168 |
my $categorycode = $input->param('categorycode') || $borrower_data->{'categorycode'}; |
165 |
my $category_type = $input->param('category_type') || ''; |
169 |
my $category_type = $input->param('category_type') || ''; |
Lines 281-292
$newdata{'lang'} = $input->param('lang') if defined($input->param('lang'))
Link Here
|
281 |
if ( ( defined $newdata{'userid'} && $newdata{'userid'} eq '' ) || $check_BorrowerUnwantedField =~ /userid/ ) { |
285 |
if ( ( defined $newdata{'userid'} && $newdata{'userid'} eq '' ) || $check_BorrowerUnwantedField =~ /userid/ ) { |
282 |
if ( ( defined $newdata{'firstname'} ) && ( defined $newdata{'surname'} ) ) { |
286 |
if ( ( defined $newdata{'firstname'} ) && ( defined $newdata{'surname'} ) ) { |
283 |
# Full page edit, firstname and surname input zones are present |
287 |
# Full page edit, firstname and surname input zones are present |
284 |
$newdata{'userid'} = Generate_Userid( $borrowernumber, $newdata{'firstname'}, $newdata{'surname'} ); |
288 |
$patron->firstname($newdata{firstname}); |
|
|
289 |
$patron->surname($newdata{surname}); |
290 |
$newdata{'userid'} = $patron->generate_userid; |
285 |
} |
291 |
} |
286 |
elsif ( ( defined $data{'firstname'} ) && ( defined $data{'surname'} ) ) { |
292 |
elsif ( ( defined $data{'firstname'} ) && ( defined $data{'surname'} ) ) { |
287 |
# Partial page edit (access through "Details"/"Library details" tab), firstname and surname input zones are not used |
293 |
# Partial page edit (access through "Details"/"Library details" tab), firstname and surname input zones are not used |
288 |
# Still, if the userid field is erased, we can create a new userid with available firstname and surname |
294 |
# Still, if the userid field is erased, we can create a new userid with available firstname and surname |
289 |
$newdata{'userid'} = Generate_Userid( $borrowernumber, $data{'firstname'}, $data{'surname'} ); |
295 |
# FIXME clean thiscode newdata vs data is very confusing |
|
|
296 |
$patron->firstname($data{firstname}); |
297 |
$patron->surname($data{surname}); |
298 |
$newdata{'userid'} = $patron->generate_userid; |
290 |
} |
299 |
} |
291 |
else { |
300 |
else { |
292 |
$newdata{'userid'} = $data{'userid'}; |
301 |
$newdata{'userid'} = $data{'userid'}; |
293 |
- |
|
|