sub custom_cover_image_url {
my ( $self ) = @_;
my $url = C4::Context->preference('CustomCoverImagesURL');
- if ( $url =~ m|%isbn%| ) {
+ if ( $url =~ m|{isbn}| ) {
my $isbn = $self->biblioitem->isbn;
- $url =~ s|%isbn%|$isbn|g;
+ $url =~ s|{isbn}|$isbn|g;
}
- if ( $url =~ m|%normalized_isbn%| ) {
+ if ( $url =~ m|{normalized_isbn}| ) {
my $normalized_isbn = C4::Koha::GetNormalizedISBN($self->biblioitem->isbn);
- $url =~ s|%normalized_isbn%|$normalized_isbn|g;
+ $url =~ s|{normalized_isbn}|$normalized_isbn|g;
}
- if ( $url =~ m|%issn%| ) {
+ if ( $url =~ m|{issn}| ) {
my $issn = $self->biblioitem->issn;
- $url =~ s|%issn%|$issn|g;
+ $url =~ s|{issn}|$issn|g;
}
- my $re = qr|%(?<field>\d{3})\$(?<subfield>.)%|;
+ my $re = qr|{(?<field>\d{3})\$(?<subfield>.)}|;
if ( $url =~ $re ) {
my $field = $+{field};
my $subfield = $+{subfield};
VALUES
('CustomCoverImages','0',NULL,'If enabled, the custom cover images will be displayed in the staff client. CustomCoverImagesURL must be defined.','YesNo'),
('OPACCustomCoverImages','0',NULL,'If enabled, the custom cover images will be displayed at the OPAC. CustomCoverImagesURL must be defined.','YesNo'),
- ('CustomCoverImagesURL','',NULL,'Define an URL serving book cover images, using the following patterns: %issn%, %isbn%, FIXME ADD MORE (use it with CustomCoverImages and/or OPACCustomCoverImages)','free')
+ ('CustomCoverImagesURL','',NULL,'Define an URL serving book cover images, using the following patterns: {issn}, {isbn}, {normalized_isbn}, {field$subfield} (use it with CustomCoverImages and/or OPACCustomCoverImages)','free')
});
SetVersion( $DBversion );
- "Using the following URL:"
- pref: CustomCoverImagesURL
class: url
- - "You can define it using the following patterns: %isbn%, %issn%, %normalized_isbn%."
+ - "You can define it using the following patterns: {isbn}, {issn}, {normalized_isbn}.<br/>"
+ - "Or you can use the following syntax to specify a field$subfield value: {field$subfield}. For instance {024$a}."
HTML5 Media:
-
- Show a tab with a HTML5 media player for files catalogued in field 856
subtest 'custom_cover_image_url' => sub {
plan tests => 3;
- t::lib::Mocks::mock_preference( 'CustomCoverImagesURL', 'https://my_url/%isbn%_%issn%.png' );
+ t::lib::Mocks::mock_preference( 'CustomCoverImagesURL', 'https://my_url/{isbn}_{issn}.png' );
my $isbn = '0553573403 | 9780553573404 (pbk.).png';
my $issn = 'my_issn';
$marc_record->append_fields( MARC::Field->new( '024', '', '', a => $marc_024a ) );
C4::Biblio::ModBiblio( $marc_record, $biblio->biblionumber );
- t::lib::Mocks::mock_preference( 'CustomCoverImagesURL', 'https://my_url/%024$a%.png' );
+ t::lib::Mocks::mock_preference( 'CustomCoverImagesURL', 'https://my_url/{024$a}.png' );
is( $biblio->custom_cover_image_url, "https://my_url/$marc_024a.png" );
- t::lib::Mocks::mock_preference( 'CustomCoverImagesURL', 'https://my_url/%normalized_isbn%.png' );
+ t::lib::Mocks::mock_preference( 'CustomCoverImagesURL', 'https://my_url/{normalized_isbn}.png' );
my $normalized_isbn = C4::Koha::GetNormalizedISBN($isbn);
is( $biblio->custom_cover_image_url, "https://my_url/$normalized_isbn.png" );
};