diff --git a/C4/Output.pm b/C4/Output.pm index f1d069c033..3b87674872 100644 --- a/C4/Output.pm +++ b/C4/Output.pm @@ -392,16 +392,19 @@ Missing POD for output_error. =cut sub output_error { - my ( $query, $error ) = @_; + my ( $query, $error, $params ) = @_; if ( !$error || $error =~ /\D/ ) { Koha::Exceptions::WrongParameter->throw('output_error requires $error to be an integer'); } + my $interface = 'intranet'; + $interface = 'opac' if ( $params && $params->{interface} eq 'opac' ); + my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { template_name => 'errors/errorpage.tt', query => $query, - type => 'intranet', + type => $interface, authnotrequired => 1, } ); diff --git a/opac/tracklinks.pl b/opac/tracklinks.pl index 471615522a..3445ea4fed 100755 --- a/opac/tracklinks.pl +++ b/opac/tracklinks.pl @@ -37,7 +37,7 @@ $uri =~ s/^\s+|\s+$//g if $uri; # trim my $tracking_method = C4::Context->preference('TrackClicks'); unless ($tracking_method) { - output_error( $cgi, '404' ); + output_error( $cgi, '404', { interface => 'opac' } ); exit; } my $tracker = Koha::Linktracker->new( { trackingmethod => $tracking_method } ); @@ -85,5 +85,5 @@ if ( $uri && ( $biblionumber || $itemnumber ) ) { } } -output_error( $cgi, '404' ); +output_error( $cgi, '404', { interface => 'opac' } ); exit;