use URI;
use URI::Escape;
+use C4::Koha;
use C4::Biblio qw();
use Koha::Database;
return 0;
}
+
+=head3 pickup_locations
+
+@pickup_locations = $biblio->pickup_locations( {patron => $patron } )
+
+Returns possible pickup locations for this biblio items, according to patron's home library (if patron is defined and holds are allowed only from hold groups)
+and if item can be transfered to each pickup location.
+
+=cut
+
+sub pickup_locations {
+ my ($self, $params) = @_;
+
+ my $patron = $params->{patron};
+
+ my @pickup_locations;
+ foreach my $item_of_bib ($self->items) {
+ push @pickup_locations, $item_of_bib->pickup_locations( {patron => $patron} );
+ }
+
+ my %seen;
+ @pickup_locations =
+ grep { !$seen{ $_->{branchcode} }++ } @pickup_locations;
+
+ return wantarray ? @pickup_locations : \@pickup_locations;
+}
+
=head3 hidden_in_opac
my $bool = $biblio->hidden_in_opac({ [ rules => $rules ] })
push @authors, $au;
}
}
- $title = $record->subfield( '245', 'a' ) . $record->subfield( '245', 'b' );
+ $title = $record->field('245')->as_string('ab');
if ($titletype eq 'a') {
$pubyear = $record->field('008') || '';
$pubyear = substr($pubyear->data(), 7, 4) if $pubyear;
return 0;
}
+=head3 custom_cover_image_url
+
+my $image_url = $biblio->custom_cover_image_url
+
+Return the specific url of the cover image for this bibliographic record.
+It is built regaring the value of the system preference CustomCoverImagesURL
+
+=cut
+
+sub custom_cover_image_url {
+ my ( $self ) = @_;
+ my $url = C4::Context->preference('CustomCoverImagesURL');
+ if ( $url =~ m|{isbn}| ) {
+ my $isbn = $self->biblioitem->isbn;
+ $url =~ s|{isbn}|$isbn|g;
+ }
+ if ( $url =~ m|{normalized_isbn}| ) {
+ my $normalized_isbn = C4::Koha::GetNormalizedISBN($self->biblioitem->isbn);
+ $url =~ s|{normalized_isbn}|$normalized_isbn|g;
+ }
+ if ( $url =~ m|{issn}| ) {
+ my $issn = $self->biblioitem->issn;
+ $url =~ s|{issn}|$issn|g;
+ }
+
+ my $re = qr|{(?<field>\d{3})\$(?<subfield>.)}|;
+ if ( $url =~ $re ) {
+ my $field = $+{field};
+ my $subfield = $+{subfield};
+ my $marc_record = $self->metadata->record;
+ my $value = $marc_record->subfield($field, $subfield);
+ $url =~ s|$re|$value|;
+ }
+
+ return $url;
+}
+
=head3 type
=cut