https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36650 --- Comment #2 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 209870 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=209870&action=edit Bug 36650: (follow-up) Allow uninstall reasons to provide links This patch makes it possible for each reason returned by Koha::Plugins::Base->can_uninstall to provide its own link: - Reasons defined in Koha build their links in the template, which already maps message codes to translatable text, and can decide whether the link should be displayed (e.g. user permissions). To allow this, the payload for 'ill_requests_exist' now also contains the 'backend' name. - Reasons added by plugins overriding `can_uninstall` can provide optional 'text' and 'url' keys in their payload, as core templates cannot know about them. Previously the raw message code was displayed. This is documented in the method POD. The 'cannot_uninstall_reasons' template block now takes a 'with_links' parameter: plain text is still used for the lock badge tooltip, links are rendered in the 'Actions' menu and the alert. Each reason is displayed on its own line there. Test plan: 1. Apply patch 2. Set up the BackendClass plugin with an ILL request as in the previous patch test plan 3. Add this method to the installed copy of the plugin (/var/lib/koha/kohadev/plugins/Koha/Plugin/BackendClass.pm), before the trailing '1;': sub can_uninstall { my ($self) = @_; my $result = $self->SUPER::can_uninstall; $result->set_value(0)->add_message( { message => 'pending_things', payload => { text => 'There are pending things', url => '/cgi-bin/koha/plugins/plugins-home.pl?method=ill_backend', } } ); $result->add_message( { message => 'no_text_reason' } ); return $result; } 4. Restart services: $ ktd --shell k$ restart_all 5. Go to Administration > Manage plugins and hover the lock badge => SUCCESS: The tooltip lists the three reasons, as plain text 6. Open the 'Actions' menu for BackendClass => SUCCESS: Each reason is displayed on its own line => SUCCESS: 'There are pending things' is a link => SUCCESS: 'no_text_reason' is displayed as-is (no 'text' provided) 7. Point your browser to: /cgi-bin/koha/plugins/plugins-uninstall.pl?class=Koha::Plugin::BackendClass => SUCCESS: The alert displays the same reasons and link as step 6 8. Run: k$ prove t/db_dependent/Koha/Plugins/ILL/Backends.t => SUCCESS: Tests pass! 9. Sign off :-D Assisted-by: Opus 5.5 (Anthropic) -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.