From eea445aabaa65d61119979bd9b28082972d49835 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Cohen=20Arazi?= Date: Tue, 30 Dec 2025 10:09:12 -0300 Subject: [PATCH] Bug 41084: Allow utf8 export format when EnableZotero is enabled When the EnableZotero system preference is enabled, allow the utf8 format in opac-export.pl regardless of the OpacExportOptions settings. This enables Zotero integration by ensuring the required UTF-8 encoded MARC format is always available when the feature is enabled. To test: 1. Install Zotero (https://www.zotero.org) 2. Install the browser extension (I did in in Chrome, not sure it exists for FF) 3. Perform a search in your koha instance. e.g. http://kohadev.localhost/cgi-bin/koha/opac-search.pl?idx=&q=agrovoc&weight_search=1 4. Open the Zotero extension => SUCCESS: It lists the search results for saving them 5. Choose one and save => FAIL: It says there was an error saving 6. Apply this patches 7. Run: $ ktd --shell k$ updatedatabase 8. Make sure EnableZotero is enabled 9. Repeat 3-5 => SUCCESS: All good this time 10. Sign off :-D --- opac/opac-export.pl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/opac/opac-export.pl b/opac/opac-export.pl index e8ef025b5e..7d1d509482 100755 --- a/opac/opac-export.pl +++ b/opac/opac-export.pl @@ -50,6 +50,11 @@ if ( any { $_ eq 'dc' } @valid_formats ) { @valid_formats = ( @valid_formats, @dc_subtypes ); } +# Allow utf8 format if EnableZotero is enabled, regardless of OpacExportOptions +if ( C4::Context->preference('EnableZotero') && $format eq 'utf8' ) { + push @valid_formats, 'utf8' unless any { $_ eq 'utf8' } @valid_formats; +} + if ( !scalar @valid_formats || none { $format eq $_ } @valid_formats ) { # bad request: either the feature is disabled, or requested a format the -- 2.50.1 (Apple Git-155)