Bug 32528: Make safe_to_delete exit earlier on error conditions
authorTomas Cohen Arazi <tomascohen@theke.io>
Mon, 26 Dec 2022 18:43:16 +0000 (15:43 -0300)
committerJacob O'Mara <jacob.omara@ptfs-europe.com>
Fri, 13 Jan 2023 16:18:43 +0000 (16:18 +0000)
commit2b92f43cc315968da3d17088c183df619f0a33cc
treec89acadce67c1de8c51727cee765c5d55fc8bfbc
parent6238ce057e2b2784d6c4a178728cb92d515ac454
Bug 32528: Make safe_to_delete exit earlier on error conditions

This patch makes the `Koha::Item->safe_to_delete` method return right
after one of the checked conditions is met. This way we avoid further DB
queries and processing.

No behavior change is expected

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

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Bug 32528: Change return logic

Back to 1 return statement
Prevent the Koha::Result::Boolean instanciation duplication

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit cc58ca2a3cc71d2af6b2342979ec310e89fec3a6)
Signed-off-by: Jacob O'Mara <jacob.omara@ptfs-europe.com>
Koha/Item.pm