Bug 7394 : Fixing scoping issue with XSLT processing. Also bailing out early for 404 inestead of doing unnessecary processing

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>

I can confirm the bug and the solution.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Second sign-off from me, patch fixes display of detail page
for last record on a result page.

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
This commit is contained in:
Chris Cormack 2012-01-03 19:57:41 +13:00 committed by Paul Poulain
parent 7ea4760b06
commit fa1a90fd4f
2 changed files with 17 additions and 13 deletions

View file

@ -58,7 +58,7 @@ Replaces codes with authorized values in a MARC::Record object
sub transformMARCXML4XSLT { sub transformMARCXML4XSLT {
my ($biblionumber, $record) = @_; my ($biblionumber, $record) = @_;
my $frameworkcode = GetFrameworkCode($biblionumber); my $frameworkcode = GetFrameworkCode($biblionumber) || '';
my $tagslib = &GetMarcStructure(1,$frameworkcode); my $tagslib = &GetMarcStructure(1,$frameworkcode);
my @fields; my @fields;
# FIXME: wish there was a better way to handle exceptions # FIXME: wish there was a better way to handle exceptions

View file

@ -66,6 +66,22 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
my $biblionumber = $query->param('biblionumber') || $query->param('bib'); my $biblionumber = $query->param('biblionumber') || $query->param('bib');
my $record = GetMarcBiblio($biblionumber);
if ( ! $record ) {
print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early
exit;
}
$template->param( biblionumber => $biblionumber );
SetUTF8Flag($record);
# XSLT processing of some stuff
if (C4::Context->preference("OPACXSLTDetailsDisplay") ) {
$template->param( 'XSLTBloc' => XSLTParse4Display($biblionumber, $record, 'Detail', 'opac') );
}
# We look for the busc param to build the simple paging from the search # We look for the busc param to build the simple paging from the search
my $session = get_session($query->cookie("CGISESSID")); my $session = get_session($query->cookie("CGISESSID"));
my %paging = (previous => {}, next => {}); my %paging = (previous => {}, next => {});
@ -351,19 +367,7 @@ if ($session->param('busc')) {
$template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') ); $template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) ); $template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) );
my $record = GetMarcBiblio($biblionumber);
if ( ! $record ) {
print $query->redirect("/cgi-bin/koha/errors/404.pl");
exit;
}
$template->param( biblionumber => $biblionumber );
SetUTF8Flag($record);
# XSLT processing of some stuff
if (C4::Context->preference("OPACXSLTDetailsDisplay") ) {
$template->param( 'XSLTBloc' => XSLTParse4Display($biblionumber, $record, 'Detail', 'opac') );
}
$template->param('OPACShowCheckoutName' => C4::Context->preference("OPACShowCheckoutName") ); $template->param('OPACShowCheckoutName' => C4::Context->preference("OPACShowCheckoutName") );
# change back when ive fixed request.pl # change back when ive fixed request.pl