The original method -RevertWaitingStatus- was actually used to revert any `found` status, not just waiting. The `Koha::Hold->revert_waiting()` method implemented on bug 40058 throws an exception if the hold is not waiting. This causes errors in a couple places (reverting in transit holds, reverting in processing holds, etc). We need to document things better and cover all the use cases with tests to avoid this. Will do my best.
Created attachment 185541 [details] [review] Bug 40671: Refactor Koha::Hold->revert_waiting into revert_found This patch refactors the revert_waiting method to handle all found statuses instead of just waiting holds, making it more versatile and consistent. Changes: * Renamed method from revert_waiting() to revert_found() * Expanded functionality to handle all found statuses (W, T, P) * Updated exception logic to check is_found instead of is_waiting * Changed exception message from hold_not_waiting to hold_not_found * Added comprehensive tests for all found statuses * Updated POD documentation to reflect new behavior The method now reverts any hold with a found status back to a regular hold with priority 1, regardless of whether it was waiting, in transit, or in processing. To test: 1. Apply the patches 2. Run tests: $ ktd --shell k$ cd /kohadevbox/koha k$ prove t/db_dependent/Koha/Hold.t => SUCCESS: All tests pass including new subtests for T and P statuses 3. Verify all hold test suites pass: k$ prove t/db_dependent/Koha/Hold*.t => SUCCESS: All hold-related tests pass 4. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 185542 [details] [review] Bug 40671: Update method calls from revert_waiting to revert_found This patch updates all existing calls to the renamed method throughout the codebase to maintain compatibility. Changes: * Updated C4::Circulation calls to use revert_found() * Updated C4::Reserves calls to use revert_found() * Updated test files to use revert_found() * Maintained all existing functionality and behavior All existing functionality is preserved - this is purely a method name change to reflect the expanded capability. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 185562 [details] [review] Bug 40671: Refactor Koha::Hold->revert_waiting into revert_found This patch refactors the revert_waiting method to handle all found statuses instead of just waiting holds, making it more versatile and consistent. Changes: * Renamed method from revert_waiting() to revert_found() * Expanded functionality to handle all found statuses (W, T, P) * Updated exception logic to check is_found instead of is_waiting * Changed exception message from hold_not_waiting to hold_not_found * Added comprehensive tests for all found statuses * Updated POD documentation to reflect new behavior The method now reverts any hold with a found status back to a regular hold with priority 1, regardless of whether it was waiting, in transit, or in processing. To test: 1. Apply the patches 2. Run tests: $ ktd --shell k$ cd /kohadevbox/koha k$ prove t/db_dependent/Koha/Hold.t => SUCCESS: All tests pass including new subtests for T and P statuses 3. Verify all hold test suites pass: k$ prove t/db_dependent/Koha/Hold*.t => SUCCESS: All hold-related tests pass 4. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Created attachment 185563 [details] [review] Bug 40671: Update method calls from revert_waiting to revert_found This patch updates all existing calls to the renamed method throughout the codebase to maintain compatibility. Changes: * Updated C4::Circulation calls to use revert_found() * Updated C4::Reserves calls to use revert_found() * Updated test files to use revert_found() * Maintained all existing functionality and behavior All existing functionality is preserved - this is purely a method name change to reflect the expanded capability. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>