use Koha::ItemTypes;
sub GetDescription {
- my ( $self, $itemtype ) = @_;
- return Koha::ItemTypes->find( $itemtype )->translated_description;
+ my ( $self, $itemtypecode ) = @_;
+ my $itemtype = Koha::ItemTypes->find( $itemtypecode );
+ return $itemtype ? $itemtype->translated_description : q{};
}
sub Get {
my ( $charge, $itemtype ) =
GetIssuingCharges( $issue->{itemnumber}, $borrowernumber );
- my $itemtype = Koha::ItemTypes->find( $itemtype );
+ $itemtype = Koha::ItemTypes->find( $itemtype );
$row{'itemtype_description'} = $itemtype->description; #FIXME Should not it be translated_description
$row{'charge'} = sprintf( "%.2f", $charge );
my $marcflavour = C4::Context->preference("marcflavour");
my $itemtype = Koha::Biblioitems->search({ biblionumber => $content->biblionumber })->next->itemtype;
$itemtype = Koha::ItemTypes->find( $itemtype );
- $this_item->{imageurl} = C4::Koha::getitemtypeimagelocation( 'opac', $itemtype->imageurl );
- $this_item->{description} = $itemtype->description; #FIXME Should not it be translated_description?
- $this_item->{notforloan} = $itemtype->notforloan;
+ if( $itemtype ) {
+ $this_item->{imageurl} = C4::Koha::getitemtypeimagelocation( 'opac', $itemtype->imageurl );
+ $this_item->{description} = $itemtype->description; #FIXME Should not it be translated_description?
+ $this_item->{notforloan} = $itemtype->notforloan;
+ }
$this_item->{'coins'} = GetCOinSBiblio($record);
$this_item->{'subtitle'} = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $biblionumber ) );
$this_item->{'normalized_upc'} = GetNormalizedUPC( $record, $marcflavour );
$this_item->{title} = $biblio->title;
$this_item->{author} = $biblio->author;
$this_item->{dateadded} = $content->dateadded;
- $this_item->{imageurl} = C4::Koha::getitemtypeimagelocation( 'intranet', $itemtype->imageurl );
- $this_item->{description} = $itemtype->description; #FIXME Should not it be translated_description
- $this_item->{notforloan} = $itemtype->notforloan;
+ $this_item->{imageurl} = $itemtype ? C4::Koha::getitemtypeimagelocation( 'intranet', $itemtype->imageurl ) : q{};
+ $this_item->{description} = $itemtype ? $itemtype->description : q{}; #FIXME Should this be translated_description ?
+ $this_item->{notforloan} = $itemtype->notforloan if $itemtype;
$this_item->{'coins'} = GetCOinSBiblio($record);
$this_item->{'subtitle'} = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $biblionumber ) );
$this_item->{'normalized_upc'} = GetNormalizedUPC( $record, $marcflavour );