|
Lines 20-25
use Modern::Perl;
Link Here
|
| 20 |
use CGI qw ( -utf8 ); |
20 |
use CGI qw ( -utf8 ); |
| 21 |
use Digest::MD5 qw( md5_base64 md5_hex ); |
21 |
use Digest::MD5 qw( md5_base64 md5_hex ); |
| 22 |
use Encode qw( encode ); |
22 |
use Encode qw( encode ); |
|
|
23 |
use JSON; |
| 23 |
use List::MoreUtils qw( each_array uniq ); |
24 |
use List::MoreUtils qw( each_array uniq ); |
| 24 |
use String::Random qw( random_string ); |
25 |
use String::Random qw( random_string ); |
| 25 |
|
26 |
|
|
Lines 261-266
elsif ( $action eq 'update' ) {
Link Here
|
| 261 |
); |
262 |
); |
| 262 |
|
263 |
|
| 263 |
$borrower_changes{borrowernumber} = $borrowernumber; |
264 |
$borrower_changes{borrowernumber} = $borrowernumber; |
|
|
265 |
$borrower_changes{extended_attributes} = to_json($attributes); |
| 264 |
|
266 |
|
| 265 |
# FIXME update the following with |
267 |
# FIXME update the following with |
| 266 |
# Koha::Patron::Modifications->search({ borrowernumber => $borrowernumber })->delete; |
268 |
# Koha::Patron::Modifications->search({ borrowernumber => $borrowernumber })->delete; |
|
Lines 307-313
elsif ( $action eq 'edit' ) { #Display logged in borrower's data
Link Here
|
| 307 |
$template->param( display_patron_image => 1 ) if $patron_image; |
309 |
$template->param( display_patron_image => 1 ) if $patron_image; |
| 308 |
} |
310 |
} |
| 309 |
|
311 |
|
| 310 |
$template->param( patron_attribute_classes => GeneratePatronAttributesForm( $borrower ) ); |
312 |
$template->param( patron_attribute_classes => GeneratePatronAttributesForm( $borrowernumber ) ); |
| 311 |
} else { |
313 |
} else { |
| 312 |
$template->param( patron_attribute_classes => GeneratePatronAttributesForm() ); |
314 |
$template->param( patron_attribute_classes => GeneratePatronAttributesForm() ); |
| 313 |
} |
315 |
} |
|
Lines 465-471
sub DelEmptyFields {
Link Here
|
| 465 |
} |
467 |
} |
| 466 |
|
468 |
|
| 467 |
sub GeneratePatronAttributesForm { |
469 |
sub GeneratePatronAttributesForm { |
| 468 |
my ( $borrower, $entered_attributes ) = @_; |
470 |
my ( $borrowernumber, $entered_attributes ) = @_; |
| 469 |
|
471 |
|
| 470 |
# Get all attribute types and the values for this patron (if applicable) |
472 |
# Get all attribute types and the values for this patron (if applicable) |
| 471 |
my @types = C4::Members::AttributeTypes::GetAttributeTypes(); |
473 |
my @types = C4::Members::AttributeTypes::GetAttributeTypes(); |
|
Lines 476-482
sub GeneratePatronAttributesForm {
Link Here
|
| 476 |
|
478 |
|
| 477 |
my %attr_values = (); |
479 |
my %attr_values = (); |
| 478 |
|
480 |
|
| 479 |
if ( $borrower ) { |
481 |
if ( $borrowernumber ) { |
| 480 |
my $attributes = C4::Members::Attributes::GetBorrowerAttributes($borrowernumber); |
482 |
my $attributes = C4::Members::Attributes::GetBorrowerAttributes($borrowernumber); |
| 481 |
|
483 |
|
| 482 |
# Remap the patron's attributes into a hash of arrayrefs per attribute (depends on |
484 |
# Remap the patron's attributes into a hash of arrayrefs per attribute (depends on |
| 483 |
- |
|
|