Bug 20443: (follow-up) Move GetBorrowerAttributes to Koha::Patron - ILSDI

Either we display everything, or only the info from the attribute itself
(i.e. not its type)

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Jonathan Druart 2018-08-09 19:46:35 -03:00 committed by Martin Renvoize
parent e37bfe3e4b
commit e3cc65156e
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
2 changed files with 16 additions and 8 deletions

View File

@ -506,8 +506,18 @@ sub GetPatronInfo {
if ( $show_attributes && $show_attributes eq "1" ) {
# FIXME Regression expected here, we do not retrieve the same field as previously
# Waiting for answer on bug 14257 comment 15
my $attrs = $patron->extended_attributes->search({ opac_display => 1 })->unblessed;
$borrower->{'attributes'} = $attrs;
$borrower->{'attributes'} = [
map {
$_->type->opac_display
? {
%{ $_->unblessed },
%{ $_->type->unblessed },
value => $_->attribute, # Backward compatibility
value_description => $_->description, # Awkward retro-compability...
}
: ()
} $patron->extended_attributes->search
];
}
# Add is expired information

View File

@ -217,13 +217,11 @@ subtest 'GetPatronInfo/GetBorrowerAttributes test for extended patron attributes
# Build a structure for comparison:
my $cmp = {
category_code => $attr_type_visible->{'category_code'},
class => $attr_type_visible->{'class'},
code => $attr_shown->{'code'},
description => $attr_type_visible->{'description'},
display_checkout => $attr_type_visible->{'display_checkout'},
borrowernumber => $brwr->{borrowernumber},
value => $attr_shown->{'attribute'},
value_description => undef,
value_description => $attr_shown->{'attribute'},
%$attr_type_visible,
%$attr_shown,
};
is( $reply->{'charges'}, '10.00',