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>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 7c3a5c78c1)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 7609009a73)

Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
This commit is contained in:
Tomas Cohen Arazi 2019-02-11 16:05:23 -03:00 committed by Jesse Maseto
parent 13a769c5a8
commit f7c5a910de
1 changed files with 1 additions and 1 deletions

View File

@ -806,7 +806,7 @@ sub AutoUnsuspendReserves {
my @holds = Koha::Holds->search( { suspend_until => { '<=' => $today->ymd() } } );
map { $_->suspend(0)->suspend_until(undef)->store() } @holds;
map { $_->resume() } @holds;
}
=head2 ModReserve