# If at least one field are filled, we want to modify the borrower
if ( defined $infos ) {
$infos->{borrowernumber} = $borrowernumber;
- my $success = ModMember(%$infos);
- if (!$success) {
+ eval { Koha::Patrons->find( $borrowernumber )->set($infos)->store; };
+ if ( $@ ) { # FIXME We could provide better error handling here
my $patron = Koha::Patrons->find( $borrowernumber );
$infos->{cardnumber} = $patron ? $patron->cardnumber || '' : '';
push @errors, { error => "can_not_update", borrowernumber => $infos->{borrowernumber}, cardnumber => $infos->{cardnumber} };
};
push @errors, { error => $@ } if $@;
} else {
- # Attribute's value is empty, we don't want to modify it
- ++$i and next if not $attribute->{attribute};
-
eval {
C4::Members::Attributes::UpdateBorrowerAttribute( $borrowernumber, $attribute );
};
for my $borrowernumber ( @borrowernumbers ) {
my $patron = Koha::Patrons->find( $borrowernumber );
if ( $patron ) {
- my $category_description = $patron->category->description;
$patron = $patron->unblessed;
- $patron->{category_description} = $category_description;
$patron->{patron_attributes} = C4::Members::Attributes::GetBorrowerAttributes( $patron->{borrowernumber} );
$max_nb_attr = scalar( @{ $patron->{patron_attributes} } )
if scalar( @{ $patron->{patron_attributes} } ) > $max_nb_attr;
$template->param( borrowers => \@borrowers );
$template->param( attributes_header => \@attributes_header );
- $template->param( borrowers => \@borrowers );
$template->param( errors => \@errors );
} else {