Bug 21765

Summary: AutoUnsuspendReserves manually sets holds fields instead of calling ->resume
Product: Koha Reporter: George Williams (NEKLS) <george>
Component: Hold requestsAssignee: Tomás Cohen Arazi <tomascohen>
Status: CLOSED FIXED QA Contact: Josef Moravec <josef.moravec>
Severity: minor    
Priority: P5 - low CC: barton, fridolin.somers, gmcharlt, jesse, josef.moravec, martin.renvoize, nick, tomascohen
Version: master   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8864
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 21765: Regression tests
Bug 21765: Make AutoUnsuspendReserves call Koha::Hold->resume
Bug 21765: Regression tests
Bug 21765: Make AutoUnsuspendReserves call Koha::Hold->resume
Bug 21765: Regression tests
Bug 21765: Make AutoUnsuspendReserves call Koha::Hold->resume

Description George Williams (NEKLS) 2018-11-05 14:44:47 UTC
When HoldsLog is set to "Log," holds that are manually unsuspended by staff or patrons are logged in action_logs, but holds unsuspended by auto_unsuspend_holds.pl are not.
Comment 1 Tomás Cohen Arazi 2019-02-11 17:32:23 UTC
This has the side-effect of having holds resuming by the auto_unsuspend_holds.pl script not logging.
Comment 2 Tomás Cohen Arazi 2019-02-11 19:09:50 UTC
Created attachment 84999 [details] [review]
Bug 21765: Regression tests
Comment 3 Tomás Cohen Arazi 2019-02-11 19:10:03 UTC
Created attachment 85000 [details] [review]
Bug 21765: Make AutoUnsuspendReserves call Koha::Hold->resume

This patch makes the mentioned method use the biult-in method for
resuming a suspended hold, instead of manually setting the specific
attributes using the accessors.

The side effect for this is that HoldsLog is now honoured.

This patchset also refactors the tests a bit so they rely on the exposed
methods and thus don't rely on specific implementation details (like
suspended hold means a date in suspended_until plus suspended=1).

To test:
- Apply the regression tests patch
- Run:
  $ kshell
 k$ prove t/db_dependent/Reserves/AutoUnsuspendReserves.t
=> FAIL: It fails loudly because things are done manually
- Apply this patch
- Run:
 k$ prove t/db_dependent/Reserves/AutoUnsuspendReserves.t
=> SUCCESS: Tests pass!
Comment 4 Kyle M Hall 2019-02-11 20:04:28 UTC
Created attachment 85007 [details] [review]
Bug 21765: Regression tests

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 5 Kyle M Hall 2019-02-11 20:04:39 UTC
Created attachment 85008 [details] [review]
Bug 21765: Make AutoUnsuspendReserves call Koha::Hold->resume

This patch makes the mentioned method use the biult-in method for
resuming a suspended hold, instead of manually setting the specific
attributes using the accessors.

The side effect for this is that HoldsLog is now honoured.

This patchset also refactors the tests a bit so they rely on the exposed
methods and thus don't rely on specific implementation details (like
suspended hold means a date in suspended_until plus suspended=1).

To test:
- Apply the regression tests patch
- Run:
  $ kshell
 k$ prove t/db_dependent/Reserves/AutoUnsuspendReserves.t
=> FAIL: It fails loudly because things are done manually
- Apply this patch
- Run:
 k$ prove t/db_dependent/Reserves/AutoUnsuspendReserves.t
=> SUCCESS: Tests pass!

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 6 Josef Moravec 2019-02-20 16:43:14 UTC
Created attachment 85386 [details] [review]
Bug 21765: Regression tests

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 7 Josef Moravec 2019-02-20 16:43:18 UTC
Created attachment 85387 [details] [review]
Bug 21765: Make AutoUnsuspendReserves call Koha::Hold->resume

This patch makes the mentioned method use the biult-in method for
resuming a suspended hold, instead of manually setting the specific
attributes using the accessors.

The side effect for this is that HoldsLog is now honoured.

This patchset also refactors the tests a bit so they rely on the exposed
methods and thus don't rely on specific implementation details (like
suspended hold means a date in suspended_until plus suspended=1).

To test:
- Apply the regression tests patch
- Run:
  $ kshell
 k$ prove t/db_dependent/Reserves/AutoUnsuspendReserves.t
=> FAIL: It fails loudly because things are done manually
- Apply this patch
- Run:
 k$ prove t/db_dependent/Reserves/AutoUnsuspendReserves.t
=> SUCCESS: Tests pass!

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 8 Nick Clemens 2019-02-27 14:16:36 UTC
Awesome work all!

Pushed to master for 19.05
Comment 9 Martin Renvoize 2019-03-01 11:35:34 UTC
Pushed to 18.11.x for 18.11.04 - I considered the lack of an action log in this case a bug the overriding factor here and so switch back from 'enhancement' to 'bug'.
Comment 10 Jesse Maseto 2019-03-08 19:18:20 UTC
Pushed to 18.05.x for 18.05.11