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>
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;
}