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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Tomás Cohen Arazi 2025-12-30 10:09:12 -03:00 committed by Lucas Gass
parent 646321adb6
commit 59e3bfc022
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 5 additions and 0 deletions

View File

@ -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