From 1fff188d7bcbb5a417b178390cce078d53639ddd 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 --- 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 a08f65e..2100ca8 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.7.4