From 01506e0195266a0e6b6005c43b9763bf4a09dd78 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 19 Dec 2016 12:51:04 -0300 Subject: [PATCH] Bug 13757: Add extended attributes to the patron modification Signed-off-by: Tomas Cohen Arazi Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- opac/opac-memberentry.pl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl index a08f65e0fc..2100ca827a 100755 --- a/opac/opac-memberentry.pl +++ b/opac/opac-memberentry.pl @@ -20,6 +20,7 @@ use Modern::Perl; use CGI qw ( -utf8 ); use Digest::MD5 qw( md5_base64 md5_hex ); use Encode qw( encode ); +use JSON; use List::MoreUtils qw( each_array uniq ); use String::Random qw( random_string ); @@ -261,6 +262,7 @@ elsif ( $action eq 'update' ) { ); $borrower_changes{borrowernumber} = $borrowernumber; + $borrower_changes{extended_attributes} = to_json($attributes); # FIXME update the following with # Koha::Patron::Modifications->search({ borrowernumber => $borrowernumber })->delete; @@ -307,7 +309,7 @@ elsif ( $action eq 'edit' ) { #Display logged in borrower's data $template->param( display_patron_image => 1 ) if $patron_image; } - $template->param( patron_attribute_classes => GeneratePatronAttributesForm( $borrower ) ); + $template->param( patron_attribute_classes => GeneratePatronAttributesForm( $borrowernumber ) ); } else { $template->param( patron_attribute_classes => GeneratePatronAttributesForm() ); } @@ -465,7 +467,7 @@ sub DelEmptyFields { } sub GeneratePatronAttributesForm { - my ( $borrower, $entered_attributes ) = @_; + my ( $borrowernumber, $entered_attributes ) = @_; # Get all attribute types and the values for this patron (if applicable) my @types = C4::Members::AttributeTypes::GetAttributeTypes(); @@ -476,7 +478,7 @@ sub GeneratePatronAttributesForm { my %attr_values = (); - if ( $borrower ) { + if ( $borrowernumber ) { my $attributes = C4::Members::Attributes::GetBorrowerAttributes($borrowernumber); # Remap the patron's attributes into a hash of arrayrefs per attribute (depends on -- 2.39.5