This patch introduces a standardized result class for availability checks, providing a clean API with proper methods instead of raw hashrefs. The Koha::Availability::Result class provides: - add_blocker() - Add conditions that prevent the action - add_confirmation() - Add conditions requiring user confirmation - add_warning() - Add informational messages - set_context() - Store related objects (item, checkout, patron, etc.) - available() - Check if action can proceed (no blockers) - needs_confirmation() - Check if confirmations are required - Accessor methods for all categories - to_hashref() for backward compatibility This design: - Provides a consistent interface across all availability checks - Makes the API more discoverable and self-documenting - Enables future enhancements without breaking changes - Follows OO principles with proper encapsulation - Can be used as base for checkout, hold, renewal availability Test plan: 1. Apply patch 2. Run: $ ktd --shell k$ prove t/Koha/Availability/Result.t => SUCCESS: Tests pass! 3. Verify all methods work correctly 4. Sign off :-D Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk> |
||
|---|---|---|
| .. | ||
| Auth | ||
| Authority | ||
| Availability | ||
| Database | ||
| DateTime/Format | ||
| I18N/po/xx_XX/LC_MESSAGES | ||
| Installer | ||
| Middleware | ||
| Object | ||
| Plugins | ||
| REST/Plugin | ||
| Regex | ||
| Result | ||
| SearchEngine | ||
| Util | ||
| CSV.t | ||
| Config.t | ||
| ContentSecurityPolicy.t | ||
| Email.t | ||
| Exceptions.t | ||
| I18N.t | ||
| ItemType.t | ||
| Manual.t | ||
| Script.t | ||
| Script_cron.t | ||
| Script_scrub_argv.t | ||
| Status.t | ||
| Z3950responder.t | ||
| sleep.pl | ||
| wait.pl | ||