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 3432-3438 sub _after_biblio_action_hooks { Link Here
3432
    my $biblio_id = $args->{biblio_id};
3432
    my $biblio_id = $args->{biblio_id};
3433
    my $action    = $args->{action};
3433
    my $action    = $args->{action};
3434
3434
3435
    if ( C4::Context->preference('UseKohaPlugins') && C4::Context->config("enable_plugins") ) {
3435
    if ( C4::Context->config("enable_plugins") ) {
3436
3436
3437
        my @plugins = Koha::Plugins->new->GetPlugins({
3437
        my @plugins = Koha::Plugins->new->GetPlugins({
3438
            method => 'after_biblio_action',
3438
            method => 'after_biblio_action',
(-)a/C4/UsageStats.pm (-1 lines)
Lines 216-222 sub BuildReport { Link Here
216
        NovelistSelectEnabled
216
        NovelistSelectEnabled
217
        OpenLibraryCovers
217
        OpenLibraryCovers
218
        OpenLibrarySearch
218
        OpenLibrarySearch
219
        UseKohaPlugins
220
        SyndeticsEnabled
219
        SyndeticsEnabled
221
        TagsEnabled
220
        TagsEnabled
222
        CalendarFirstDayOfWeek
221
        CalendarFirstDayOfWeek
(-)a/Koha/Item.pm (-1 / +1 lines)
Lines 771-777 sub _after_item_action_hooks { Link Here
771
771
772
    my $action = $params->{action};
772
    my $action = $params->{action};
773
773
774
    if ( C4::Context->preference('UseKohaPlugins') && C4::Context->config("enable_plugins") ) {
774
    if ( C4::Context->config("enable_plugins") ) {
775
775
776
        my @plugins = Koha::Plugins->new->GetPlugins({
776
        my @plugins = Koha::Plugins->new->GetPlugins({
777
            method => 'after_item_action',
777
            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 676-682 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
676
('useDischarge','','','Allows librarians to discharge borrowers and borrowers to request a discharge','YesNo'),
676
('useDischarge','','','Allows librarians to discharge borrowers and borrowers to request a discharge','YesNo'),
677
('UseEmailReceipts','0','','Send email receipts for payments and write-offs','YesNo'),
677
('UseEmailReceipts','0','','Send email receipts for payments and write-offs','YesNo'),
678
('UseICU','0','1','Tell Koha if ICU indexing is in use for Zebra or not.','YesNo'),
678
('UseICU','0','1','Tell Koha if ICU indexing is in use for Zebra or not.','YesNo'),
679
('UseKohaPlugins','0','','Enable or disable the ability to use Koha Plugins.','YesNo'),
680
('UseTransportCostMatrix','0','','Use Transport Cost Matrix when filling holds','YesNo'),
679
('UseTransportCostMatrix','0','','Use Transport Cost Matrix when filling holds','YesNo'),
681
('UseWYSIWYGinSystemPreferences','0','','Show WYSIWYG editor when editing certain HTML system preferences.','YesNo'),
680
('UseWYSIWYGinSystemPreferences','0','','Show WYSIWYG editor when editing certain HTML system preferences.','YesNo'),
682
('viewISBD','1','','Allow display of ISBD view of bibiographic records','YesNo'),
681
('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 368-380 Enhanced Content: Link Here
368
                  yes: "Embed"
368
                  yes: "Embed"
369
                  no: "Don't embed"
369
                  no: "Don't embed"
370
            - YouTube links as videos.
370
            - YouTube links as videos.
371
    Plugins:
372
        -
373
            - pref: UseKohaPlugins
374
              choices:
375
                  yes: Enable
376
                  no: "Don't enable"
377
            - the ability to use Koha Plugins. Note, the plugin system must also be enabled in the Koha configuration file to be fully enabled.
378
    OverDrive:
371
    OverDrive:
379
        -
372
        -
380
            - Include OverDrive availability information with the client key
373
            - 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 477-483 sub mocking_systempreferences_to_a_set_value { Link Here
477
        NovelistSelectEnabled
477
        NovelistSelectEnabled
478
        OpenLibraryCovers
478
        OpenLibraryCovers
479
        OpenLibrarySearch
479
        OpenLibrarySearch
480
        UseKohaPlugins
481
        SyndeticsEnabled
480
        SyndeticsEnabled
482
        TagsEnabled
481
        TagsEnabled
483
        CalendarFirstDayOfWeek
482
        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