]> git.koha-community.org Git - koha.git/commit
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)
committerTomas Cohen Arazi <tomascohen@theke.io>
Wed, 11 Jan 2023 23:47:09 +0000 (20:47 -0300)
commitcc58ca2a3cc71d2af6b2342979ec310e89fec3a6
tree9eb08d6b24b59d67a6f3cc14aeb4219f329e470d
parentcd89c383219eb9355b225b51219007a08b5e339e
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>
Koha/Item.pm