Bugzilla – Attachment 101717 Details for
Bug 20415
Remove UseKohaPlugins system preference
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20415: add Koha.ArePluginsEnabled Template Toolkit method
Bug-20415-add-KohaArePluginsEnabled-Template-Toolk.patch (text/plain), 7.09 KB, created by
Kyle M Hall (khall)
on 2020-03-25 14:29:42 UTC
(
hide
)
Description:
Bug 20415: add Koha.ArePluginsEnabled Template Toolkit method
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2020-03-25 14:29:42 UTC
Size:
7.09 KB
patch
obsolete
>From 36f552678601a21e5c210fac7a5d1ab9d1b3d8a3 Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Thu, 19 Mar 2020 17:01:13 +0300 >Subject: [PATCH] Bug 20415: add Koha.ArePluginsEnabled Template Toolkit method > >In order to remove UseKohaPlugins syspref, adds to Koha Template Toolkit >plugin a method ArePluginsEnabled(). > >Test plan: >1) Set syspref UseKohaPlugins enabled >2) Set config enable_plugins=1 >3) Check you see "Tool plugins" in "Tools" home page and menu >4) Check you see "Manage plugins" in "Koha administration" home page >5) Check you see "Report plugins" in "Reports" home page and menu >6) Set config enable_plugins=0 >7) Check you don't see in 3) 4) 5) >8) Run prove t/Koha_Template_Plugin_Koha.t > >Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> >Work as described, no errors. > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/Template/Plugin/Koha.pm | 4 ++++ > .../prog/en/includes/reports-menu.inc | 4 +++- > .../intranet-tmpl/prog/en/includes/tools-menu.inc | 4 ++-- > .../prog/en/modules/plugins/plugins-disabled.tt | 2 +- > .../prog/en/modules/reports/reports-home.tt | 2 +- > .../prog/en/modules/tools/tools-home.tt | 4 ++-- > t/Koha_Template_Plugin_Koha.t | 14 +++++++++++++- > 7 files changed, 26 insertions(+), 8 deletions(-) > >diff --git a/Koha/Template/Plugin/Koha.pm b/Koha/Template/Plugin/Koha.pm >index 0532a0479a..87b6f5f9ef 100644 >--- a/Koha/Template/Plugin/Koha.pm >+++ b/Koha/Template/Plugin/Koha.pm >@@ -58,4 +58,8 @@ sub Version { > }; > } > >+sub ArePluginsEnabled { >+ return C4::Context->config('enable_plugins'); >+} >+ > 1; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/reports-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/reports-menu.inc >index e79f2db105..d63b3e923d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/reports-menu.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/reports-menu.inc >@@ -1,3 +1,5 @@ >+[% USE Koha %] >+ > <div id="navmenu"> > <div id="navmenulist"> > >@@ -26,7 +28,7 @@ > <li><a href="/cgi-bin/koha/reports/reserves_stats.pl">Holds</a></li> > </ul> > >- [% IF UseKohaPlugins %] >+ [% IF Koha.ArePluginsEnabled() %] > <h5>Report plugins</h5> > <ul> > <li><a href="/cgi-bin/koha/plugins/plugins-home.pl?method=report">Report plugins</a></li> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc >index 877e68fd84..3df04097f7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc >@@ -102,7 +102,7 @@ > </ul> > [% END %] > [% IF ( CAN_user_tools_edit_calendar || CAN_user_tools_manage_csv_profiles || CAN_user_tools_view_system_logs || CAN_user_tools_edit_news >- || CAN_user_tools_schedule_tasks || CAN_user_tools_edit_quotes || ( UseKohaPlugins && CAN_user_plugins_tool ) >+ || CAN_user_tools_schedule_tasks || CAN_user_tools_edit_quotes || ( Koha.ArePluginsEnabled() && CAN_user_plugins_tool ) > || CAN_user_tools_upload_general_files || CAN_user_tools_access_files ) %] > <h5>Additional tools</h5> > <ul> >@@ -124,7 +124,7 @@ > [% IF ( CAN_user_tools_edit_quotes ) %] > <li><a href="/cgi-bin/koha/tools/quotes.pl">Quote editor</a></li> > [% END %] >- [% IF ( UseKohaPlugins && CAN_user_plugins_tool ) %] >+ [% IF ( Koha.ArePluginsEnabled() && CAN_user_plugins_tool ) %] > <li><a href="/cgi-bin/koha/plugins/plugins-home.pl?method=tool">Tool plugins</a></li> > [% END %] > [% IF ( CAN_user_tools_upload_general_files ) %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-disabled.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-disabled.tt >index 3b2a3fe559..b17d140b82 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-disabled.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-disabled.tt >@@ -19,7 +19,7 @@ > <div class="col-sm-6 col-sm-offset-3 col-md-6 col-md-offset-3"> > <h1>Plugins disabled!</h1> > >- <p>To enable Koha plugins, the system preference UseKohaPlugins must be enabled, and the flag enable_plugins must be set in the Koha configuration file</p> >+ <p>To enable Koha plugins, the flag enable_plugins must be set in the Koha configuration file</p> > </div> > </div> > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reports-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reports-home.tt >index e4901bbd62..e7edc4ee5f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reports-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reports-home.tt >@@ -55,7 +55,7 @@ > <li><a href="/cgi-bin/koha/reports/reserves_stats.pl">Holds</a></li> > </ul> > >- [% IF UseKohaPlugins %] >+ [% IF Koha.ArePluginsEnabled() %] > <h2>Report plugins</h2> > <ul> > <li><a href="/cgi-bin/koha/plugins/plugins-home.pl?method=report">Report plugins</a></li> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt >index 7b1bf98c3b..b4e7816746 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt >@@ -84,7 +84,7 @@ > > <div class="col-sm-4 col-sm-push-4"> > [% IF ( CAN_user_tools_edit_calendar || CAN_user_tools_manage_csv_profiles || CAN_user_tools_view_system_logs || CAN_user_tools_edit_news >- || CAN_user_tools_schedule_tasks || CAN_user_tools_edit_quotes || ( UseKohaPlugins && CAN_user_plugins_tool ) >+ || CAN_user_tools_schedule_tasks || CAN_user_tools_edit_quotes || ( Koha.ArePluginsEnabled() && CAN_user_plugins_tool ) > || CAN_user_tools_upload_general_files || CAN_user_tools_access_files ) %] > <h3>Additional tools</h3> > [% END %] >@@ -119,7 +119,7 @@ > <dd>Quote editor for Quote-of-the-day feature in OPAC</dd> > [% END %] > >- [% IF ( UseKohaPlugins && CAN_user_plugins_tool ) %] >+ [% IF ( Koha.ArePluginsEnabled() && CAN_user_plugins_tool ) %] > <dt><a href="/cgi-bin/koha/plugins/plugins-home.pl?method=tool">Tool plugins</a></dt> > <dd>Use tool plugins</dd> > [% END %] >diff --git a/t/Koha_Template_Plugin_Koha.t b/t/Koha_Template_Plugin_Koha.t >index e0e5ed2ea4..5cba73b22c 100644 >--- a/t/Koha_Template_Plugin_Koha.t >+++ b/t/Koha_Template_Plugin_Koha.t >@@ -17,8 +17,9 @@ > > use Modern::Perl; > >-use Test::More tests => 3; >+use Test::More tests => 4; > use Test::MockModule; >+use t::lib::Mocks; > > use String::Random; > >@@ -76,3 +77,14 @@ subtest "Koha::Template::Plugin::Koha::Version tests" => sub { > > }; > >+subtest "Koha::Template::Plugin::Koha::ArePluginsEnabled tests" => sub { >+ >+ plan tests => 2; >+ >+ t::lib::Mocks::mock_config( 'enable_plugins', 1 ); >+ is(Koha::Template::Plugin::Koha::ArePluginsEnabled(), 1, "Correct ArePluginsEnabled is yes"); >+ >+ t::lib::Mocks::mock_config( 'enable_plugins', 0 ); >+ is(Koha::Template::Plugin::Koha::ArePluginsEnabled(), 0, "Correct ArePluginsEnabled is no"); >+ >+}; >-- >2.21.1 (Apple Git-122.3)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 20415
:
101021
|
101022
|
101060
|
101061
|
101433
|
101434
|
101663
|
101664
| 101717 |
101718
|
101719
|
101928