ffzg/recall_notices.pl: added --interval and --dedup
[koha.git] / tools / modborrowers.pl
index e53e3a3..fb672a6 100755 (executable)
@@ -295,8 +295,8 @@ if ( $op eq 'do' ) {
         # 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} };
@@ -336,9 +336,7 @@ if ( $op eq 'do' ) {
     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;
@@ -360,7 +358,6 @@ if ( $op eq 'do' ) {
     $template->param( borrowers => \@borrowers );
     $template->param( attributes_header => \@attributes_header );
 
-    $template->param( borrowers => \@borrowers );
     $template->param( errors => \@errors );
 } else {