Koha/admin/didyoumean.pl
Jenny Way 3f6a7933b8 Bug 19992: use Modern::Perl in Admin perl scripts
Test plan:
Check use warnings; use strict doesn't exist and use Modern::Perl is written instead in the following files:

admin/admin-home.pl
admin/aqcontract.pl
admin/aqplan.pl
admin/auth_tag_structure.pl
admin/branch_transfer_limits.pl
admin/check_budget_parent.pl
admin/check_parent_total.pl
admin/checkmarc.pl
admin/classsources.pl
admin/clone-rules.pl
admin/didyoumean.pl
admin/edi_accounts.pl
admin/edi_ean_accounts.pl
admin/import_export_framework.pl
admin/item_circulation_alerts.pl
admin/marctagstructure.pl
admin/matching-rules.pl
admin/printers.pl
admin/smart-rules.pl
admin/systempreferences.pl
admin/transport-cost-matrix.pl

Signed-off-by: Jon Knight <J.P.Knight@lboro.ac.uk>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2018-02-05 09:45:46 -03:00

36 lines
1.3 KiB
Perl
Executable file

#!/usr/bin/perl
use Modern::Perl;
use CGI qw ( -utf8 );
use C4::Context;
use C4::Auth;
use C4::Output;
use Koha::SuggestionEngine;
use Module::Load::Conditional qw(can_load);
use JSON;
my $input = new CGI;
my ($template, $loggedinuser, $cookie)
= get_template_and_user({template_name => "admin/didyoumean.tt",
query => $input,
type => "intranet",
authnotrequired => 0,
flagsrequired => {parameters => 'parameters_remaining_permissions'},
debug => 1,
});
my $opacplugins = from_json(C4::Context->preference('OPACdidyoumean') || '[]');
my $intraplugins = from_json(C4::Context->preference('INTRAdidyoumean') || '[]');
my @pluginlist = Koha::SuggestionEngine::AvailablePlugins();
foreach my $plugin (@pluginlist) {
next if $plugin eq 'Koha::SuggestionEngine::Plugin::Null';
next unless (can_load( modules => { "$plugin" => undef } ));
push @$opacplugins, { name => $plugin->NAME } unless grep { $_->{name} eq $plugin->NAME } @$opacplugins;
push @$intraplugins, { name => $plugin->NAME } unless grep { $_->{name} eq $plugin->NAME } @$intraplugins;
}
$template->{VARS}->{OPACpluginlist} = $opacplugins;
$template->{VARS}->{INTRApluginlist} = $intraplugins;
output_html_with_http_headers $input, $cookie, $template->output;