View | Details | Raw Unified | Return to bug 20415
Collapse All | Expand All

(-)a/C4/Auth.pm (-1 lines)
Lines 506-512 sub get_template_and_user { Link Here
506
            OPACLocalCoverImages                                                       => C4::Context->preference('OPACLocalCoverImages'),
506
            OPACLocalCoverImages                                                       => C4::Context->preference('OPACLocalCoverImages'),
507
            AllowMultipleCovers                                                        => C4::Context->preference('AllowMultipleCovers'),
507
            AllowMultipleCovers                                                        => C4::Context->preference('AllowMultipleCovers'),
508
            EnableBorrowerFiles                                                        => C4::Context->preference('EnableBorrowerFiles'),
508
            EnableBorrowerFiles                                                        => C4::Context->preference('EnableBorrowerFiles'),
509
            UseKohaPlugins                                                             => C4::Context->preference('UseKohaPlugins'),
510
            UseCourseReserves                                                          => C4::Context->preference("UseCourseReserves"),
509
            UseCourseReserves                                                          => C4::Context->preference("UseCourseReserves"),
511
            useDischarge                                                               => C4::Context->preference('useDischarge'),
510
            useDischarge                                                               => C4::Context->preference('useDischarge'),
512
            pending_checkout_notes                                                     => scalar Koha::Checkouts->search({ noteseen => 0 }),
511
            pending_checkout_notes                                                     => scalar Koha::Checkouts->search({ noteseen => 0 }),
(-)a/C4/Biblio.pm (-1 / +1 lines)
Lines 3448-3454 sub _after_biblio_action_hooks { Link Here
3448
    my $biblio_id = $args->{biblio_id};
3448
    my $biblio_id = $args->{biblio_id};
3449
    my $action    = $args->{action};
3449
    my $action    = $args->{action};
3450
3450
3451
    if ( C4::Context->preference('UseKohaPlugins') && C4::Context->config("enable_plugins") ) {
3451
    if ( C4::Context->config("enable_plugins") ) {
3452
3452
3453
        my @plugins = Koha::Plugins->new->GetPlugins({
3453
        my @plugins = Koha::Plugins->new->GetPlugins({
3454
            method => 'after_biblio_action',
3454
            method => 'after_biblio_action',
(-)a/C4/UsageStats.pm (-1 lines)
Lines 213-219 sub BuildReport { Link Here
213
        NovelistSelectEnabled
213
        NovelistSelectEnabled
214
        OpenLibraryCovers
214
        OpenLibraryCovers
215
        OpenLibrarySearch
215
        OpenLibrarySearch
216
        UseKohaPlugins
217
        SyndeticsEnabled
216
        SyndeticsEnabled
218
        TagsEnabled
217
        TagsEnabled
219
        CalendarFirstDayOfWeek
218
        CalendarFirstDayOfWeek
(-)a/Koha/Item.pm (-1 / +1 lines)
Lines 807-813 sub _after_item_action_hooks { Link Here
807
807
808
    my $action = $params->{action};
808
    my $action = $params->{action};
809
809
810
    if ( C4::Context->preference('UseKohaPlugins') && C4::Context->config("enable_plugins") ) {
810
    if ( C4::Context->config("enable_plugins") ) {
811
811
812
        my @plugins = Koha::Plugins->new->GetPlugins({
812
        my @plugins = Koha::Plugins->new->GetPlugins({
813
            method => 'after_item_action',
813
            method => 'after_item_action',
(-)a/Koha/Patron.pm (-5 / +2 lines)
Lines 230-239 sub store { Link Here
230
                $self->privacy($default_privacy);
230
                $self->privacy($default_privacy);
231
231
232
                # Call any check_password plugins if password is passed
232
                # Call any check_password plugins if password is passed
233
                if (   C4::Context->preference('UseKohaPlugins')
233
                if ( C4::Context->config("enable_plugins") && $self->password ) {
234
                    && C4::Context->config("enable_plugins")
235
                    && $self->password )
236
                {
237
                    my @plugins = Koha::Plugins->new()->GetPlugins({
234
                    my @plugins = Koha::Plugins->new()->GetPlugins({
238
                        method => 'check_password',
235
                        method => 'check_password',
239
                    });
236
                    });
Lines 749-755 sub set_password { Link Here
749
        }
746
        }
750
    }
747
    }
751
748
752
    if ( C4::Context->preference('UseKohaPlugins') && C4::Context->config("enable_plugins") ) {
749
    if ( C4::Context->config("enable_plugins") ) {
753
        # Call any check_password plugins
750
        # Call any check_password plugins
754
        my @plugins = Koha::Plugins->new()->GetPlugins({
751
        my @plugins = Koha::Plugins->new()->GetPlugins({
755
            method => 'check_password',
752
            method => 'check_password',
(-)a/Koha/REST/Plugin/PluginRoutes.pm (-2 / +1 lines)
Lines 45-52 sub register { Link Here
45
45
46
    my @plugins;
46
    my @plugins;
47
47
48
    if (   C4::Context->preference('UseKohaPlugins')
48
    if ( C4::Context->config("enable_plugins") )
49
        && C4::Context->config("enable_plugins") )
50
    {
49
    {
51
        # plugin needs to define a namespace
50
        # plugin needs to define a namespace
52
        @plugins = Koha::Plugins->new()->GetPlugins(
51
        @plugins = Koha::Plugins->new()->GetPlugins(
(-)a/Koha/REST/V1/Static.pm (-2 / +1 lines)
Lines 35-42 sub get { Link Here
35
    my $self = shift;
35
    my $self = shift;
36
    my $c = $self->openapi->valid_input or return;
36
    my $c = $self->openapi->valid_input or return;
37
37
38
    if (   C4::Context->preference('UseKohaPlugins')
38
    if ( C4::Context->config("enable_plugins") )
39
        && C4::Context->config("enable_plugins") )
40
    {
39
    {
41
        my $path = $c->req->url->path->leading_slash(1);
40
        my $path = $c->req->url->path->leading_slash(1);
42
41
(-)a/Koha/Template/Plugin/KohaPlugins.pm (-8 / +4 lines)
Lines 47-54 to output to the head section of opac pages. Link Here
47
=cut
47
=cut
48
48
49
sub get_plugins_opac_head {
49
sub get_plugins_opac_head {
50
    return q{}
50
    return q{} unless C4::Context->config("enable_plugins");
51
      unless C4::Context->preference('UseKohaPlugins');
52
51
53
    my $p = Koha::Plugins->new();
52
    my $p = Koha::Plugins->new();
54
53
Lines 75-82 to output to the javascript section of at the bottom of opac pages. Link Here
75
=cut
74
=cut
76
75
77
sub get_plugins_opac_js {
76
sub get_plugins_opac_js {
78
    return q{}
77
    return q{} unless C4::Context->config("enable_plugins");
79
      unless C4::Context->preference('UseKohaPlugins');
80
78
81
    my $p = Koha::Plugins->new();
79
    my $p = Koha::Plugins->new();
82
80
Lines 103-110 to output to the head section of intranet pages. Link Here
103
=cut
101
=cut
104
102
105
sub get_plugins_intranet_head {
103
sub get_plugins_intranet_head {
106
    return q{}
104
    return q{} unless C4::Context->config("enable_plugins");
107
      unless C4::Context->preference('UseKohaPlugins');
108
105
109
    my $p = Koha::Plugins->new();
106
    my $p = Koha::Plugins->new();
110
107
Lines 131-138 to output to the javascript section of at the bottom of intranet pages. Link Here
131
=cut
128
=cut
132
129
133
sub get_plugins_intranet_js {
130
sub get_plugins_intranet_js {
134
    return q{}
131
    return q{} unless C4::Context->config("enable_plugins");
135
      unless C4::Context->preference('UseKohaPlugins');
136
132
137
    my $p = Koha::Plugins->new();
133
    my $p = Koha::Plugins->new();
138
134
(-)a/admin/admin-home.pl (-1 / +1 lines)
Lines 24-30 use Koha::Plugins; Link Here
24
24
25
my $query = new CGI;
25
my $query = new CGI;
26
26
27
my $plugins_enabled = C4::Context->preference('UseKohaPlugins') && C4::Context->config("enable_plugins");
27
my $plugins_enabled = C4::Context->config("enable_plugins");
28
my $mana_url        = C4::Context->config('mana_config');
28
my $mana_url        = C4::Context->config('mana_config');
29
29
30
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
30
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
(-)a/admin/edi_accounts.pl (-4 / +1 lines)
Lines 52-61 if ( $op eq 'acct_form' ) { Link Here
52
    );
52
    );
53
    $template->param( vendors => \@vendors );
53
    $template->param( vendors => \@vendors );
54
54
55
    my $plugins_enabled = C4::Context->preference('UseKohaPlugins') && C4::Context->config("enable_plugins");
55
    if ( C4::Context->config("enable_plugins") ) {
56
    $template->param( plugins_enabled => $plugins_enabled );
57
58
    if ( $plugins_enabled ) {
59
        my @plugins = Koha::Plugins->new()->GetPlugins({
56
        my @plugins = Koha::Plugins->new()->GetPlugins({
60
            method => 'edifact',
57
            method => 'edifact',
61
        });
58
        });
(-)a/catalogue/detail.pl (-2 / +1 lines)
Lines 64-71 my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user( Link Here
64
);
64
);
65
65
66
# Determine if we should be offering any enhancement plugin buttons
66
# Determine if we should be offering any enhancement plugin buttons
67
if ( C4::Context->preference('UseKohaPlugins') &&
67
if ( C4::Context->config('enable_plugins') ) {
68
     C4::Context->config('enable_plugins') ) {
69
    # Only pass plugins that can offer a toolbar button
68
    # Only pass plugins that can offer a toolbar button
70
    my @plugins = Koha::Plugins->new()->GetPlugins({
69
    my @plugins = Koha::Plugins->new()->GetPlugins({
71
        method => 'intranet_catalog_biblio_enhancements_toolbar_button'
70
        method => 'intranet_catalog_biblio_enhancements_toolbar_button'
(-)a/installer/data/mysql/atomicupdate/bug_20415.sql (+1 lines)
Line 0 Link Here
1
DELETE FROM systempreferences WHERE variable='UseKohaPlugins';
(-)a/installer/data/mysql/sysprefs.sql (-1 lines)
Lines 674-680 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
674
('useDischarge','','','Allows librarians to discharge borrowers and borrowers to request a discharge','YesNo'),
674
('useDischarge','','','Allows librarians to discharge borrowers and borrowers to request a discharge','YesNo'),
675
('UseEmailReceipts','0','','Send email receipts for payments and write-offs','YesNo'),
675
('UseEmailReceipts','0','','Send email receipts for payments and write-offs','YesNo'),
676
('UseICU','0','1','Tell Koha if ICU indexing is in use for Zebra or not.','YesNo'),
676
('UseICU','0','1','Tell Koha if ICU indexing is in use for Zebra or not.','YesNo'),
677
('UseKohaPlugins','0','','Enable or disable the ability to use Koha Plugins.','YesNo'),
678
('UseTransportCostMatrix','0','','Use Transport Cost Matrix when filling holds','YesNo'),
677
('UseTransportCostMatrix','0','','Use Transport Cost Matrix when filling holds','YesNo'),
679
('UseWYSIWYGinSystemPreferences','0','','Show WYSIWYG editor when editing certain HTML system preferences.','YesNo'),
678
('UseWYSIWYGinSystemPreferences','0','','Show WYSIWYG editor when editing certain HTML system preferences.','YesNo'),
680
('viewISBD','1','','Allow display of ISBD view of bibiographic records','YesNo'),
679
('viewISBD','1','','Allow display of ISBD view of bibiographic records','YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref (-7 lines)
Lines 349-361 Enhanced Content: Link Here
349
                  yes: "Embed"
349
                  yes: "Embed"
350
                  no: "Don't embed"
350
                  no: "Don't embed"
351
            - YouTube links as videos.
351
            - YouTube links as videos.
352
    Plugins:
353
        -
354
            - pref: UseKohaPlugins
355
              choices:
356
                  yes: Enable
357
                  no: "Don't enable"
358
            - the ability to use Koha Plugins. Note, the plugin system must also be enabled in the Koha configuration file to be fully enabled.
359
    OverDrive:
352
    OverDrive:
360
        -
353
        -
361
            - Include OverDrive availability information with the client key
354
            - Include OverDrive availability information with the client key
(-)a/misc/devel/install_plugins.pl (-3 / +1 lines)
Lines 31-39 GetOptions( 'help|?' => \$help ); Link Here
31
31
32
pod2usage(1) if $help;
32
pod2usage(1) if $help;
33
33
34
my $plugins_enabled = C4::Context->preference('UseKohaPlugins')
34
unless ( C4::Context->config("enable_plugins") ) {
35
  && C4::Context->config("enable_plugins");
36
unless ($plugins_enabled) {
37
    print
35
    print
38
"The plugin system must be enabled for one to be able to install plugins\n";
36
"The plugin system must be enabled for one to be able to install plugins\n";
39
    exit 1;
37
    exit 1;
(-)a/opac/opac-account.pl (-2 / +1 lines)
Lines 84-91 $template->param( Link Here
84
    payment_error       => scalar $query->param('payment-error') || q{},
84
    payment_error       => scalar $query->param('payment-error') || q{},
85
);
85
);
86
86
87
my $plugins_enabled = C4::Context->preference('UseKohaPlugins') && C4::Context->config("enable_plugins");
87
if ( C4::Context->config("enable_plugins") ) {
88
if ( $plugins_enabled ) {
89
    my @plugins = Koha::Plugins->new()->GetPlugins({
88
    my @plugins = Koha::Plugins->new()->GetPlugins({
90
        method => 'opac_online_payment',
89
        method => 'opac_online_payment',
91
    });
90
    });
(-)a/plugins/plugins-enable.pl (-2 / +1 lines)
Lines 23-30 use C4::Context; Link Here
23
use C4::Auth qw(check_cookie_auth);
23
use C4::Auth qw(check_cookie_auth);
24
use Koha::Plugins::Handler;
24
use Koha::Plugins::Handler;
25
25
26
die("Koha plugins are disabled!")
26
die("Koha plugins are disabled!") unless C4::Context->config("enable_plugins");
27
  unless C4::Context->preference('UseKohaPlugins');
28
27
29
my $input = new CGI;
28
my $input = new CGI;
30
29
(-)a/plugins/plugins-home.pl (-1 / +1 lines)
Lines 30-36 use C4::Output; Link Here
30
use C4::Debug;
30
use C4::Debug;
31
use C4::Context;
31
use C4::Context;
32
32
33
my $plugins_enabled = C4::Context->preference('UseKohaPlugins') && C4::Context->config("enable_plugins");
33
my $plugins_enabled = C4::Context->config("enable_plugins");
34
34
35
my $input  = new CGI;
35
my $input  = new CGI;
36
my $method = $input->param('method');
36
my $method = $input->param('method');
(-)a/plugins/plugins-uninstall.pl (-2 / +1 lines)
Lines 29-36 use C4::Members; Link Here
29
use C4::Debug;
29
use C4::Debug;
30
use Koha::Plugins::Handler;
30
use Koha::Plugins::Handler;
31
31
32
die("Koha plugins are disabled!")
32
die("Koha plugins are disabled!") unless C4::Context->config("enable_plugins");
33
  unless C4::Context->preference('UseKohaPlugins');
34
33
35
my $input = new CGI;
34
my $input = new CGI;
36
35
(-)a/plugins/plugins-upload.pl (-1 / +1 lines)
Lines 31-37 use C4::Members; Link Here
31
use C4::Debug;
31
use C4::Debug;
32
use Koha::Plugins;
32
use Koha::Plugins;
33
33
34
my $plugins_enabled = C4::Context->preference('UseKohaPlugins') && C4::Context->config("enable_plugins");
34
my $plugins_enabled = C4::Context->config("enable_plugins");
35
35
36
my $input = new CGI;
36
my $input = new CGI;
37
37
(-)a/plugins/run.pl (-1 / +1 lines)
Lines 27-33 use C4::Output; Link Here
27
use C4::Debug;
27
use C4::Debug;
28
use C4::Context;
28
use C4::Context;
29
29
30
my $plugins_enabled = C4::Context->preference('UseKohaPlugins') && C4::Context->config("enable_plugins");
30
my $plugins_enabled = C4::Context->config("enable_plugins");
31
31
32
my $cgi = new CGI;
32
my $cgi = new CGI;
33
33
(-)a/t/db_dependent/ImportBatch.t (-1 lines)
Lines 190-196 subtest "RecordsFromMarcPlugin" => sub { Link Here
190
    close $fh;
190
    close $fh;
191
191
192
    t::lib::Mocks::mock_config( 'enable_plugins', 1 );
192
    t::lib::Mocks::mock_config( 'enable_plugins', 1 );
193
    t::lib::Mocks::mock_preference( 'UseKohaPlugins', 1 );
194
193
195
    my $plugins = Koha::Plugins->new;
194
    my $plugins = Koha::Plugins->new;
196
    $plugins->InstallPlugins;
195
    $plugins->InstallPlugins;
(-)a/t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t (-1 lines)
Lines 39-45 BEGIN { Link Here
39
my $schema  = Koha::Database->new->schema;
39
my $schema  = Koha::Database->new->schema;
40
my $builder = t::lib::TestBuilder->new;
40
my $builder = t::lib::TestBuilder->new;
41
41
42
t::lib::Mocks::mock_preference( 'UseKohaPlugins', 1 );
43
t::lib::Mocks::mock_config( 'enable_plugins', 1 );
42
t::lib::Mocks::mock_config( 'enable_plugins', 1 );
44
43
45
subtest 'after_biblio_action() and after_item_action() hooks tests' => sub {
44
subtest 'after_biblio_action() and after_item_action() hooks tests' => sub {
(-)a/t/db_dependent/Koha/Plugins/Patron.t (-1 lines)
Lines 40-46 BEGIN { Link Here
40
my $schema  = Koha::Database->new->schema;
40
my $schema  = Koha::Database->new->schema;
41
my $builder = t::lib::TestBuilder->new;
41
my $builder = t::lib::TestBuilder->new;
42
42
43
t::lib::Mocks::mock_preference( 'UseKohaPlugins', 1 );
44
t::lib::Mocks::mock_config( 'enable_plugins', 1 );
43
t::lib::Mocks::mock_config( 'enable_plugins', 1 );
45
44
46
subtest 'check_password hook tests' => sub {
45
subtest 'check_password hook tests' => sub {
(-)a/t/db_dependent/Koha/REST/Plugin/PluginRoutes.t (-2 lines)
Lines 48-54 subtest 'Bad plugins tests' => sub { Link Here
48
48
49
    # enable plugins
49
    # enable plugins
50
    t::lib::Mocks::mock_config( 'enable_plugins', 1 );
50
    t::lib::Mocks::mock_config( 'enable_plugins', 1 );
51
    t::lib::Mocks::mock_preference( 'UseKohaPlugins', 1 );
52
51
53
    # remove any existing plugins that might interfere
52
    # remove any existing plugins that might interfere
54
    Koha::Plugins::Methods->search->delete;
53
    Koha::Plugins::Methods->search->delete;
Lines 84-90 subtest 'Disabled plugins tests' => sub { Link Here
84
83
85
    # enable plugins
84
    # enable plugins
86
    t::lib::Mocks::mock_config( 'enable_plugins', 1 );
85
    t::lib::Mocks::mock_config( 'enable_plugins', 1 );
87
    t::lib::Mocks::mock_preference( 'UseKohaPlugins', 1 );
88
86
89
    my $good_plugin;
87
    my $good_plugin;
90
88
(-)a/t/db_dependent/Koha/Template/Plugin/KohaPlugins.t (-2 lines)
Lines 24-30 BEGIN { Link Here
24
    use_ok('Koha::Plugin::Test');
24
    use_ok('Koha::Plugin::Test');
25
}
25
}
26
26
27
t::lib::Mocks::mock_preference( 'UseKohaPlugins', 1 );
28
t::lib::Mocks::mock_config( 'enable_plugins', 1 );
27
t::lib::Mocks::mock_config( 'enable_plugins', 1 );
29
28
30
my $schema = Koha::Database->new->schema;
29
my $schema = Koha::Database->new->schema;
Lines 53-59 ok( index( $plugin->get_plugins_opac_head, 'Koha::Plugin::Test::opac_head' ) != Link Here
53
ok( index( $plugin->get_plugins_intranet_js, 'Koha::Plugin::Test::intranet_js' ) != -1, 'Test plugin intranet_js return value is part of code returned by get_plugins_intranet_js' );
52
ok( index( $plugin->get_plugins_intranet_js, 'Koha::Plugin::Test::intranet_js' ) != -1, 'Test plugin intranet_js return value is part of code returned by get_plugins_intranet_js' );
54
ok( index( $plugin->get_plugins_intranet_head, 'Koha::Plugin::Test::intranet_head' ) != -1, 'Test plugin intranet_head return value is part of code returned by get_plugins_intranet_head' );
53
ok( index( $plugin->get_plugins_intranet_head, 'Koha::Plugin::Test::intranet_head' ) != -1, 'Test plugin intranet_head return value is part of code returned by get_plugins_intranet_head' );
55
54
56
t::lib::Mocks::mock_preference('UseKohaPlugins',0);
57
t::lib::Mocks::mock_config('enable_plugins',0);
55
t::lib::Mocks::mock_config('enable_plugins',0);
58
is( $plugin->get_plugins_opac_js, q{}, 'Test plugin opac_js return value is empty' );
56
is( $plugin->get_plugins_opac_js, q{}, 'Test plugin opac_js return value is empty' );
59
is( $plugin->get_plugins_opac_head, q{}, 'Test plugin opac_head return value is empty' );
57
is( $plugin->get_plugins_opac_head, q{}, 'Test plugin opac_head return value is empty' );
(-)a/t/db_dependent/UsageStats.t (-1 lines)
Lines 474-480 sub mocking_systempreferences_to_a_set_value { Link Here
474
        NovelistSelectEnabled
474
        NovelistSelectEnabled
475
        OpenLibraryCovers
475
        OpenLibraryCovers
476
        OpenLibrarySearch
476
        OpenLibrarySearch
477
        UseKohaPlugins
478
        SyndeticsEnabled
477
        SyndeticsEnabled
479
        TagsEnabled
478
        TagsEnabled
480
        CalendarFirstDayOfWeek
479
        CalendarFirstDayOfWeek
(-)a/tools/stage-marc-import.pl (-3 / +1 lines)
Lines 218-225 if ($completedJobID) { Link Here
218
    my @templates = GetModificationTemplates();
218
    my @templates = GetModificationTemplates();
219
    $template->param( MarcModificationTemplatesLoop => \@templates );
219
    $template->param( MarcModificationTemplatesLoop => \@templates );
220
220
221
    if ( C4::Context->preference('UseKohaPlugins') &&
221
    if ( C4::Context->config('enable_plugins') ) {
222
         C4::Context->config('enable_plugins') ) {
223
222
224
        my @plugins = Koha::Plugins->new()->GetPlugins({
223
        my @plugins = Koha::Plugins->new()->GetPlugins({
225
            method => 'to_marc',
224
            method => 'to_marc',
226
- 

Return to bug 20415