View | Details | Raw Unified | Return to bug 21337
Collapse All | Expand All

(-)a/Koha/Exceptions/Patron.pm (-1 / +1 lines)
Lines 6-12 use Exception::Class ( Link Here
6
    'Koha::Exceptions::Patron' => {
6
    'Koha::Exceptions::Patron' => {
7
        description => "Something went wrong!"
7
        description => "Something went wrong!"
8
    },
8
    },
9
    'Koha::Exceptions::Patron::Delete' => {
9
    'Koha::Exceptions::Patron::FailedDelete' => {
10
        description => "Deleting patron failed"
10
        description => "Deleting patron failed"
11
    },
11
    },
12
);
12
);
(-)a/Koha/Patrons.pm (-1 / +1 lines)
Lines 229-235 sub delete { Link Here
229
        my ( $set, $params ) = @_;
229
        my ( $set, $params ) = @_;
230
        while( my $patron = $set->next ) {
230
        while( my $patron = $set->next ) {
231
            $patron->move_to_deleted if $params->{move};
231
            $patron->move_to_deleted if $params->{move};
232
            $patron->delete == 1 || Koha::Exceptions::Patron::Delete->throw;
232
            $patron->delete == 1 || Koha::Exceptions::Patron::FailedDelete->throw;
233
            $patrons_deleted++;
233
            $patrons_deleted++;
234
        }
234
        }
235
    }, $self, $params );
235
    }, $self, $params );
(-)a/t/db_dependent/Koha/Patrons.t (-2 / +1 lines)
Lines 443-449 subtest 'Koha::Patrons->delete' => sub { Link Here
443
    $patron1 = $builder->build_object({ class => 'Koha::Patrons' });
443
    $patron1 = $builder->build_object({ class => 'Koha::Patrons' });
444
    $id1 = $patron1->borrowernumber;
444
    $id1 = $patron1->borrowernumber;
445
    $set = Koha::Patrons->search({ borrowernumber => { '>=' => $id1 }});
445
    $set = Koha::Patrons->search({ borrowernumber => { '>=' => $id1 }});
446
    throws_ok { $set->delete } 'Koha::Exceptions::Patron::Delete',
446
    throws_ok { $set->delete } 'Koha::Exceptions::Patron::FailedDelete',
447
        'Exception raised for deleting patron';
447
        'Exception raised for deleting patron';
448
};
448
};
449
449
450
- 

Return to bug 21337