Bug 26582 - Add Koha::Acquisition::Basket->close
Summary: Add Koha::Acquisition::Basket->close
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Tomás Cohen Arazi
QA Contact: Testopia
URL:
Keywords:
Depends on: 26515
Blocks: 23971 26584
  Show dependency treegraph
 
Reported: 2020-09-30 17:39 UTC by Tomás Cohen Arazi
Modified: 2021-06-14 21:33 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.11.00


Attachments
Bug 26582: Unit tests (2.60 KB, patch)
2020-09-30 17:48 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 26582: Add Koha::Acquisition::Basket->close (4.35 KB, patch)
2020-09-30 17:48 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 26582: Unit tests (2.66 KB, patch)
2020-10-01 11:26 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 26582: Add Koha::Acquisition::Basket->close (4.41 KB, patch)
2020-10-01 11:26 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 26582: Unit tests (2.73 KB, patch)
2020-10-13 11:18 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 26582: Add Koha::Acquisition::Basket->close (4.49 KB, patch)
2020-10-13 11:18 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 26582: (QA follow-up) Rename closed => is_closed (2.37 KB, patch)
2020-10-15 14:33 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi 2020-09-30 17:39:10 UTC
This method should implement the current behaviour:
- Mark all open orders as 'requested'
- Mark the basket as closed
Comment 1 Tomás Cohen Arazi 2020-09-30 17:48:45 UTC
Created attachment 111003 [details] [review]
Bug 26582: Unit tests
Comment 2 Tomás Cohen Arazi 2020-09-30 17:48:50 UTC
Created attachment 111004 [details] [review]
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
Comment 3 Martin Renvoize 2020-10-01 11:26:01 UTC
Created attachment 111032 [details] [review]
Bug 26582: Unit tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 4 Martin Renvoize 2020-10-01 11:26:08 UTC
Created attachment 111033 [details] [review]
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>
Comment 5 Martin Renvoize 2020-10-01 11:26:45 UTC
Works as expected, tests pass..  QA Script throws a false failure (POD).

Signing off
Comment 6 Katrin Fischer 2020-10-13 11:18:40 UTC
Created attachment 111528 [details] [review]
Bug 26582: Unit tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 7 Katrin Fischer 2020-10-13 11:18:46 UTC
Created attachment 111529 [details] [review]
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>
Comment 8 Jonathan Druart 2020-10-15 14:28:13 UTC
"closed" should be "is_closed" (and we need a guideline for this).
Comment 9 Tomás Cohen Arazi 2020-10-15 14:33:50 UTC
Created attachment 111748 [details] [review]
Bug 26582: (QA follow-up) Rename closed => is_closed

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 10 Jonathan Druart 2020-11-05 14:25:30 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 11 Lucas Gass 2020-11-16 21:58:54 UTC
enhancement will not be backported to 20.05.x