Bug 26515: (QA follow-up) Preserve original behaviour
authorTomas Cohen Arazi <tomascohen@theke.io>
Thu, 15 Oct 2020 12:37:56 +0000 (09:37 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 15 Oct 2020 12:50:07 +0000 (14:50 +0200)
commit14820607c43b6e760ba2edadfb14436f2685a1fe
tree05f78e91a0e6b27c0406a3c11582d4ce64d4111c
parent6f940b5fe90518112db612d7e19aa1419a6ef84e
Bug 26515: (QA follow-up) Preserve original behaviour

This patch removes the use of $self->items->safe_delete, as we don't
want to change the current behaviour (i.e. delete what can be deleted)
As safe_delete would rollback entirely, there was a behaviour change.

Now items are deleted in a loop that catches any problem and reports it
using the new ->add_message mechanism. The $item object is added to the
message payload so it doesn't need to be queried by the caller for
providing UI feedback.

Tests are augmented accordingly,

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Acquisition/Order.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Koha/Acquisition/Order.pm
t/db_dependent/Koha/Acquisition/Order.t