Bugzilla – Attachment 94577 Details for
Bug 22445
Ability to define a URL for custom cover images
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22445: Replace %% with {}
Bug-22445-Replace--with-.patch (text/plain), 5.60 KB, created by
Martin Renvoize (ashimema)
on 2019-10-22 14:00:54 UTC
(
hide
)
Description:
Bug 22445: Replace %% with {}
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2019-10-22 14:00:54 UTC
Size:
5.60 KB
patch
obsolete
>From b855869fa4e1b8118454a86790d12ea20df53c3e Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 16 Oct 2019 09:13:20 +0200 >Subject: [PATCH] Bug 22445: Replace %% with {} > >Sponsored-by: Orex Digital >Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz> >Signed-off-by: Hugo Agud <hagud@orex.es> >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >Signed-off-by: Michal Denar <black23@gmail.com> >Signed-off-by: Kyle Hall <kyle@bywatersolutions.com> >Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/Biblio.pm | 14 +++++++------- > installer/data/mysql/atomicupdate/bug_xxxxx.perl | 2 +- > .../admin/preferences/enhanced_content.pref | 3 ++- > t/db_dependent/Koha/Biblios.t | 6 +++--- > 4 files changed, 13 insertions(+), 12 deletions(-) > >diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm >index 4bf153ae6f..8a450d759c 100644 >--- a/Koha/Biblio.pm >+++ b/Koha/Biblio.pm >@@ -672,20 +672,20 @@ It is built regaring the value of the system preference CustomCoverImagesURL > 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}; >diff --git a/installer/data/mysql/atomicupdate/bug_xxxxx.perl b/installer/data/mysql/atomicupdate/bug_xxxxx.perl >index 4cf30e86cc..7fbda0f10d 100644 >--- a/installer/data/mysql/atomicupdate/bug_xxxxx.perl >+++ b/installer/data/mysql/atomicupdate/bug_xxxxx.perl >@@ -6,7 +6,7 @@ if( CheckVersion( $DBversion ) ) { > 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 ); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref >index 099b8eb3fe..8f32cadb2d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref >@@ -346,7 +346,8 @@ Enhanced Content: > - "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 >diff --git a/t/db_dependent/Koha/Biblios.t b/t/db_dependent/Koha/Biblios.t >index 177eda81e8..2f62524505 100644 >--- a/t/db_dependent/Koha/Biblios.t >+++ b/t/db_dependent/Koha/Biblios.t >@@ -190,7 +190,7 @@ subtest 'can_be_transferred' => sub { > 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'; >@@ -206,10 +206,10 @@ subtest 'custom_cover_image_url' => sub { > $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" ); > }; >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 22445
:
85925
|
85926
|
85927
|
85928
|
85929
|
85930
|
85931
|
85932
|
85933
|
85934
|
85935
|
85936
|
85937
|
85938
|
86214
|
86726
|
86727
|
87434
|
89973
|
89974
|
89975
|
89976
|
89977
|
89978
|
89979
|
89980
|
89981
|
89982
|
89983
|
89984
|
89985
|
89986
|
89987
|
89988
|
89989
|
89996
|
89997
|
89998
|
89999
|
90000
|
90001
|
90002
|
90003
|
90004
|
90005
|
90006
|
90007
|
90009
|
90010
|
90011
|
90012
|
90013
|
94227
|
94228
|
94229
|
94230
|
94231
|
94232
|
94233
|
94234
|
94235
|
94236
|
94237
|
94238
|
94239
|
94240
|
94241
|
94242
|
94243
|
94244
|
94559
|
94560
|
94561
|
94562
|
94563
|
94564
|
94566
|
94567
|
94568
|
94569
|
94570
|
94571
|
94572
|
94573
|
94574
|
94575
|
94576
| 94577