From ae685b9ba54ba9991dba692ae0ef03eb6bc87633 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Mon, 20 Mar 2017 08:43:32 +0100 Subject: [PATCH] Bug 17669: Small change to sub delete Instead of looping through _resultset here and wrapping the results, we should use a Koha::Objects instance. Since the method may be called as a class method, we create an instance if needed. Test plan: Run t/db_dependent/Upload.t Signed-off-by: Marcel de Rooy Signed-off-by: Mirko Tietgen --- Koha/UploadedFiles.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Koha/UploadedFiles.pm b/Koha/UploadedFiles.pm index 109593d..74211fa 100644 --- a/Koha/UploadedFiles.pm +++ b/Koha/UploadedFiles.pm @@ -63,11 +63,11 @@ Parameter keep_file may be used to delete records, but keep files. sub delete { my ( $self, $params ) = @_; + $self = Koha::UploadedFiles->new if !ref($self); # handle class call # We use the individual delete on each resultset record my $err = 0; - while( my $row = $self->_resultset->next ) { - my $kohaobj = Koha::UploadedFile->_new_from_dbic( $row ); - $err++ if !$kohaobj->delete( $params ); + while( my $row = $self->next ) { + $err++ if !$row->delete( $params ); } return $err==0; } -- 2.1.4