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 <m.de.rooy@rijksmuseum.nl> Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
fe9a8bf973
commit
686b7d6a82
1 changed files with 3 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue