Bug 26582: Add Koha::Acquisition::Basket->close
commitddf8dfcad06f4ecc99495754299cea65e3be0ea2
authorTomas Cohen Arazi <tomascohen@theke.io>
Wed, 30 Sep 2020 17:40:54 +0000 (30 14:40 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 5 Nov 2020 14:24:20 +0000 (5 15:24 +0100)
tree0c261776aa0db6baa163b94ca71d368f104312ee
parentbea89005ca2e59dc3c082e872f2ba3c1872a2dd3
Bug 26582: Add Koha::Acquisition::Basket->close

This patch adds two methods to Koha::Acquisition::Basket:
- 'closed': that tells if the basket is closed
- 'close': that closes the basket

It inherits the behaviour from CloseBasket (as it actually makes sense).
It improves CloseBasket by wrapping the action inside a transaction. It
uses the $orders->update call with no_trigger as there's no trigger to
trigger and the update can be done on a single DB call.

A new exceptions file is added for basket-related exceptions. The only
specific exception that gets added is
Koha::Exceptions::Acquisition::Basket::AlreadyClosed

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

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Koha/Acquisition/Basket.pm
Koha/Exceptions/Acquisition/Basket.pm [new file with mode: 0644]