View | Details | Raw Unified | Return to bug 22445
Collapse All | Expand All

(-)a/Koha/Biblio.pm (-7 / +7 lines)
Lines 672-691 It is built regaring the value of the system preference CustomCoverImagesURL Link Here
672
sub custom_cover_image_url {
672
sub custom_cover_image_url {
673
    my ( $self ) = @_;
673
    my ( $self ) = @_;
674
    my $url = C4::Context->preference('CustomCoverImagesURL');
674
    my $url = C4::Context->preference('CustomCoverImagesURL');
675
    if ( $url =~ m|%isbn%| ) {
675
    if ( $url =~ m|{isbn}| ) {
676
        my $isbn = $self->biblioitem->isbn;
676
        my $isbn = $self->biblioitem->isbn;
677
        $url =~ s|%isbn%|$isbn|g;
677
        $url =~ s|{isbn}|$isbn|g;
678
    }
678
    }
679
    if ( $url =~ m|%normalized_isbn%| ) {
679
    if ( $url =~ m|{normalized_isbn}| ) {
680
        my $normalized_isbn = C4::Koha::GetNormalizedISBN($self->biblioitem->isbn);
680
        my $normalized_isbn = C4::Koha::GetNormalizedISBN($self->biblioitem->isbn);
681
        $url =~ s|%normalized_isbn%|$normalized_isbn|g;
681
        $url =~ s|{normalized_isbn}|$normalized_isbn|g;
682
    }
682
    }
683
    if ( $url =~ m|%issn%| ) {
683
    if ( $url =~ m|{issn}| ) {
684
        my $issn = $self->biblioitem->issn;
684
        my $issn = $self->biblioitem->issn;
685
        $url =~ s|%issn%|$issn|g;
685
        $url =~ s|{issn}|$issn|g;
686
    }
686
    }
687
687
688
    my $re = qr|%(?<field>\d{3})\$(?<subfield>.)%|;
688
    my $re = qr|{(?<field>\d{3})\$(?<subfield>.)}|;
689
    if ( $url =~ $re ) {
689
    if ( $url =~ $re ) {
690
        my $field = $+{field};
690
        my $field = $+{field};
691
        my $subfield = $+{subfield};
691
        my $subfield = $+{subfield};
(-)a/installer/data/mysql/atomicupdate/bug_xxxxx.perl (-1 / +1 lines)
Lines 6-12 if( CheckVersion( $DBversion ) ) { Link Here
6
        VALUES
6
        VALUES
7
            ('CustomCoverImages','0',NULL,'If enabled, the custom cover images will be displayed in the staff client. CustomCoverImagesURL must be defined.','YesNo'),
7
            ('CustomCoverImages','0',NULL,'If enabled, the custom cover images will be displayed in the staff client. CustomCoverImagesURL must be defined.','YesNo'),
8
            ('OPACCustomCoverImages','0',NULL,'If enabled, the custom cover images will be displayed at the OPAC. CustomCoverImagesURL must be defined.','YesNo'),
8
            ('OPACCustomCoverImages','0',NULL,'If enabled, the custom cover images will be displayed at the OPAC. CustomCoverImagesURL must be defined.','YesNo'),
9
            ('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')
9
            ('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')
10
    });
10
    });
11
11
12
    SetVersion( $DBversion );
12
    SetVersion( $DBversion );
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref (-1 / +2 lines)
Lines 346-352 Enhanced Content: Link Here
346
            - "Using the following URL:"
346
            - "Using the following URL:"
347
            - pref: CustomCoverImagesURL
347
            - pref: CustomCoverImagesURL
348
              class: url
348
              class: url
349
            - "You can define it using the following patterns: %isbn%, %issn%, %normalized_isbn%."
349
            - "You can define it using the following patterns: {isbn}, {issn}, {normalized_isbn}.<br/>"
350
            - "Or you can use the following syntax to specify a field$subfield value: {field$subfield}. For instance {024$a}."
350
    HTML5 Media:
351
    HTML5 Media:
351
        -
352
        -
352
            - Show a tab with a HTML5 media player for files catalogued in field 856
353
            - Show a tab with a HTML5 media player for files catalogued in field 856
(-)a/t/db_dependent/Koha/Biblios.t (-4 / +3 lines)
Lines 190-196 subtest 'can_be_transferred' => sub { Link Here
190
subtest 'custom_cover_image_url' => sub {
190
subtest 'custom_cover_image_url' => sub {
191
    plan tests => 3;
191
    plan tests => 3;
192
192
193
    t::lib::Mocks::mock_preference( 'CustomCoverImagesURL', 'https://my_url/%isbn%_%issn%.png' );
193
    t::lib::Mocks::mock_preference( 'CustomCoverImagesURL', 'https://my_url/{isbn}_{issn}.png' );
194
194
195
    my $isbn       = '0553573403 | 9780553573404 (pbk.).png';
195
    my $isbn       = '0553573403 | 9780553573404 (pbk.).png';
196
    my $issn       = 'my_issn';
196
    my $issn       = 'my_issn';
Lines 206-215 subtest 'custom_cover_image_url' => sub { Link Here
206
    $marc_record->append_fields( MARC::Field->new( '024', '', '', a => $marc_024a ) );
206
    $marc_record->append_fields( MARC::Field->new( '024', '', '', a => $marc_024a ) );
207
    C4::Biblio::ModBiblio( $marc_record, $biblio->biblionumber );
207
    C4::Biblio::ModBiblio( $marc_record, $biblio->biblionumber );
208
208
209
    t::lib::Mocks::mock_preference( 'CustomCoverImagesURL', 'https://my_url/%024$a%.png' );
209
    t::lib::Mocks::mock_preference( 'CustomCoverImagesURL', 'https://my_url/{024$a}.png' );
210
    is( $biblio->custom_cover_image_url, "https://my_url/$marc_024a.png" );
210
    is( $biblio->custom_cover_image_url, "https://my_url/$marc_024a.png" );
211
211
212
    t::lib::Mocks::mock_preference( 'CustomCoverImagesURL', 'https://my_url/%normalized_isbn%.png' );
212
    t::lib::Mocks::mock_preference( 'CustomCoverImagesURL', 'https://my_url/{normalized_isbn}.png' );
213
    my $normalized_isbn = C4::Koha::GetNormalizedISBN($isbn);
213
    my $normalized_isbn = C4::Koha::GetNormalizedISBN($isbn);
214
    is( $biblio->custom_cover_image_url, "https://my_url/$normalized_isbn.png" );
214
    is( $biblio->custom_cover_image_url, "https://my_url/$normalized_isbn.png" );
215
};
215
};
216
- 

Return to bug 22445