Bug 25333: (QA follow-up) Change phone to itiva on overduerules.tt
[koha.git] / admin / didyoumean.pl
blob9ac72dd51e961dd6b1e740d9edfec83197124228
1 #!/usr/bin/perl
3 use Modern::Perl;
4 use CGI qw ( -utf8 );
5 use C4::Context;
6 use C4::Auth;
7 use C4::Output;
8 use Koha::SuggestionEngine;
9 use Module::Load::Conditional qw(can_load);
10 use JSON;
12 my $input = CGI->new;
14 my ($template, $loggedinuser, $cookie)
15 = get_template_and_user({template_name => "admin/didyoumean.tt",
16 query => $input,
17 type => "intranet",
18 flagsrequired => {parameters => 'manage_didyoumean'},
19 debug => 1,
20 });
22 my $opacplugins = from_json(C4::Context->preference('OPACdidyoumean') || '[]');
24 my @pluginlist = Koha::SuggestionEngine::AvailablePlugins();
25 foreach my $plugin (@pluginlist) {
26 next if $plugin eq 'Koha::SuggestionEngine::Plugin::Null';
27 next unless (can_load( modules => { "$plugin" => undef } ));
28 push @$opacplugins, { name => $plugin->NAME } unless grep { $_->{name} eq $plugin->NAME } @$opacplugins;
30 $template->{VARS}->{OPACpluginlist} = $opacplugins;
32 output_html_with_http_headers $input, $cookie, $template->output;