Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #100 from ctfliblime/PT16029551-4_08

Pt16029551 4 08
  • Loading branch information...
commit 5c82c68bb85f50eaefc65f40c7f640134f6bf354 2 parents 8d811a9 + e479362
@ctfliblime ctfliblime authored
View
3  C4/Biblio.pm
@@ -19,7 +19,7 @@ package C4::Biblio;
use strict;
use warnings;
-# use utf8;
+use Carp;
use MARC::Record;
use MARC::File::USMARC;
use MARC::File::XML;
@@ -1066,6 +1066,7 @@ Returns the COinS(a span) which can be included in a biblio record
sub GetCOinSBiblio {
my ( $biblionumber ) = @_;
my $record = GetMarcBiblio($biblionumber);
+ croak "Unable to find record ($biblionumber)" if !$record;
# get the coin format
my $pos7 = substr $record->leader(), 7,1;
View
15 C4/VirtualShelves/Page.pm
@@ -203,13 +203,14 @@ SWITCH: {
}
($items, $totitems) = GetShelfContents($shelfnumber, $shelflimit, $shelfoffset);
for my $this_item (@$items) {
- # the virtualshelfcontents table does not store these columns nor are they retrieved from the items
- # and itemtypes tables, so I'm commenting them out for now to quiet the log -crn
- #$this_item->{imageurl} = $imgdir."/".$itemtypes->{ $this_item->{itemtype} }->{'imageurl'};
- #$this_item->{'description'} = $itemtypes->{ $this_item->{itemtype} }->{'description'};
- $this_item->{'dateadded'} = format_date($this_item->{'dateadded'});
- $this_item->{'imageurl'} = getitemtypeinfo($this_item->{'itemtype'})->{'imageurl'};
- $this_item->{'coins'} = GetCOinSBiblio($this_item->{'biblionumber'});
+ # the virtualshelfcontents table does not store these columns nor are they retrieved from the items
+ # and itemtypes tables, so I'm commenting them out for now to quiet the log -crn
+ #$this_item->{imageurl} = $imgdir."/".$itemtypes->{ $this_item->{itemtype} }->{'imageurl'};
+ #$this_item->{'description'} = $itemtypes->{ $this_item->{itemtype} }->{'description'};
+ $this_item->{dateadded} = format_date($this_item->{dateadded});
+ $this_item->{imageurl} = getitemtypeinfo($this_item->{itemtype})->{imageurl};
+ $this_item->{coins} = try{GetCOinSBiblio($this_item->{biblionumber})} catch {warn $_; undef};
+ warn "ASDFASDFASDFASDF";
}
push @paramsloop, {display => 'privateshelves'} if $category == 1;
$showadd = 1;
View
14 opac/opac-detail.pl
@@ -20,7 +20,7 @@
use strict;
use warnings;
-
+use Try::Tiny;
use CGI;
use C4::Auth;
use C4::Branch;
@@ -270,9 +270,15 @@ BEGIN
);
# COinS format FIXME: for books Only
-$template->param(
- ocoins => GetCOinSBiblio($biblionumber),
-);
+my $coins = try {
+ return GetCOinSBiblio($_->{biblionumber})
+}
+catch {
+ warn $_;
+ return undef;
+};
+
+$template->param(ocoins => $coins);
my $loggedincommenter;
my $reviews;
View
9 opac/opac-search.pl
@@ -7,6 +7,7 @@
# to perform, etc.
## load Koha modules
use Koha;
+use Try::Tiny;
use C4::Context;
use C4::Output;
use C4::Auth qw(:DEFAULT get_session);
@@ -512,7 +513,13 @@ ($)
}
}
foreach (@newresults) {
- $_->{coins} = GetCOinSBiblio($_->{'biblionumber'});
+ $_->{coins} = try {
+ return GetCOinSBiblio($_->{biblionumber})
+ }
+ catch {
+ warn $_;
+ return undef;
+ };
}
if ($results_hashref->{$server}->{"hits"}){
Please sign in to comment.
Something went wrong with that request. Please try again.