};
}
+sub ArePluginsEnabled {
+ return C4::Context->config('enable_plugins');
+}
+
1;
+[% USE Koha %]
+
<div id="navmenu">
<div id="navmenulist">
<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>
</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>
[% 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 ) %]
<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>
<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>
<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 %]
<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 %]
use Modern::Perl;
-use Test::More tests => 3;
+use Test::More tests => 4;
use Test::MockModule;
+use t::lib::Mocks;
use String::Random;
};
+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");
+
+};