Bug 21684: Fix UploadedFile[s]->delete
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 7 Jan 2020 11:10:05 +0000 (12:10 +0100)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 7 Jan 2020 16:32:53 +0000 (16:32 +0000)
commitc66637670b4fa084438925d3e9a4bfa8e0275ef2
tree4109246611c9933c15f0d42f63cedb61cea7981a
parent7514ecb6c99851e9334875973a8085b6447fb2b9
Bug 21684: Fix UploadedFile[s]->delete

Tests were failing with:
 #   Failed test 'Test delete via UploadedFile as well as UploadedFiles'
 #   at t/db_dependent/Upload.t line 193.
 DBIx::Class::Row::delete(): Not in database at /kohadevbox/koha/Koha/Object.pm line 219

I am not sure this patch is perfect, a set of uploaded files should be
deleted in a transaction, which would be rollback if something is wrong.
But it will be tricky to restore the files after they have been deleted.
It seems that we should deal with that with a more complicated process
and should be part of a separate bug.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Koha/UploadedFile.pm
Koha/UploadedFiles.pm
t/db_dependent/Upload.t