[Koha-patches] [PATCH 6/7] error 500 when record cannot be loaded
Henri-Damien LAURENT
henridamien.laurent at biblibre.com
Wed Jul 7 15:59:03 CEST 2010
On a basket or a basket download, or csv export, if Koha cannot get a biblio, then it failed with error 500.
This patch fixes that behaviour skipping the faulty record in order to present the user with the biblios which are not causing trouble.
---
C4/Record.pm | 2 +-
opac/opac-basket.pl | 1 +
opac/opac-downloadcart.pl | 1 +
opac/opac-downloadshelf.pl | 1 +
4 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/C4/Record.pm b/C4/Record.pm
index 3b07398..8e09adf 100644
--- a/C4/Record.pm
+++ b/C4/Record.pm
@@ -362,7 +362,7 @@ sub marcrecord2csv {
# Getting the record
my $record = GetMarcBiblio($biblio);
-
+ next unless $record;
# Getting the framework
my $frameworkcode = GetFrameworkCode($biblio);
diff --git a/opac/opac-basket.pl b/opac/opac-basket.pl
index 9562d2f..c453c87 100755
--- a/opac/opac-basket.pl
+++ b/opac/opac-basket.pl
@@ -62,6 +62,7 @@ foreach my $biblionumber ( @bibs ) {
my $dat = &GetBiblioData($biblionumber);
my $record = &GetMarcBiblio($biblionumber);
+ next unless $record;
my $marcnotesarray = GetMarcNotes( $record, $marcflavour );
my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
diff --git a/opac/opac-downloadcart.pl b/opac/opac-downloadcart.pl
index 53d1b77..ff1b58f 100755
--- a/opac/opac-downloadcart.pl
+++ b/opac/opac-downloadcart.pl
@@ -66,6 +66,7 @@ if ($bib_list && $format) {
foreach my $biblio (@bibs) {
my $record = GetMarcBiblio($biblio);
+ next unless $record;
switch ($format) {
case "iso2709" { $output .= $record->as_usmarc(); }
diff --git a/opac/opac-downloadshelf.pl b/opac/opac-downloadshelf.pl
index 5a3fb1f..d73a8e7 100755
--- a/opac/opac-downloadshelf.pl
+++ b/opac/opac-downloadshelf.pl
@@ -70,6 +70,7 @@ if ($shelfid && $format) {
my $biblionumber = $biblio->{biblionumber};
my $record = GetMarcBiblio($biblionumber);
+ next unless $record;
switch ($format) {
case "iso2709" { $output .= $record->as_usmarc(); }
--
1.7.0.4
More information about the Koha-patches
mailing list