Bug 41084 - Zotero connector broken by bug 37370
Summary: Zotero connector broken by bug 37370
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Web services (show other bugs)
Version: Main
Hardware: All All
: P5 - low major
Assignee: Tomás Cohen Arazi (tcohen)
QA Contact: Testopia
URL:
Keywords:
Depends on: 37370
Blocks:
  Show dependency treegraph
 
Reported: 2025-10-23 13:22 UTC by Martin Renvoize (ashimema)
Modified: 2025-12-31 16:54 UTC (History)
4 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 41084: Add EnableZotero system preference (3.42 KB, patch)
2025-12-30 13:29 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 41084: Allow utf8 export format when EnableZotero is enabled (1.25 KB, patch)
2025-12-30 13:29 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 41084: Allow utf8 export format when EnableZotero is enabled (1.82 KB, patch)
2025-12-30 13:44 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 41084: Add EnableZotero system preference (3.42 KB, patch)
2025-12-30 13:56 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 41084: Allow utf8 export format when EnableZotero is enabled (1.82 KB, patch)
2025-12-30 13:56 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Renvoize (ashimema) 2025-10-23 13:22:56 UTC
This is difficult.. as I said in the comment on bug 37370, we find libraries don't want to visually show utf8 in the export menu, but do want Zotero to work.

As such, completely denying the utf8 option, which is the default fallback when no format is passed too, breaks the Zotero browser extension.
Comment 1 Martin Renvoize (ashimema) 2025-10-23 13:24:40 UTC
Perhaps a possible solution is a second preference to allow Zotero specifically for export.. and use that to trigger an allow on utf8 export even if it's not selected in the UI facing preference?
Comment 2 Tomás Cohen Arazi (tcohen) 2025-12-30 13:29:28 UTC
Created attachment 190775 [details] [review]
Bug 41084: Add EnableZotero system preference

This system preference will be used to enable opac-export.pl?format=utf8
regardless of the OpacExportOptions values, specifically for Zotero
integration support.
Comment 3 Tomás Cohen Arazi (tcohen) 2025-12-30 13:29:30 UTC Comment hidden (obsolete)
Comment 4 Tomás Cohen Arazi (tcohen) 2025-12-30 13:44:53 UTC
Created attachment 190777 [details] [review]
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
Comment 5 Tomás Cohen Arazi (tcohen) 2025-12-30 13:56:42 UTC
Created attachment 190778 [details] [review]
Bug 41084: Add EnableZotero system preference

This system preference will be used to enable opac-export.pl?format=utf8
regardless of the OpacExportOptions values, specifically for Zotero
integration support.
Comment 6 Tomás Cohen Arazi (tcohen) 2025-12-30 13:56:44 UTC
Created attachment 190779 [details] [review]
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
Comment 7 David Nind 2025-12-30 19:36:59 UTC
I'm not seeing any error when using the Zotero connector for the browsers I use (I've used Zotero for a while, on and off).

For me, it seems to work OK from:
- The search results page
- Individual bibliographic record pages

My set up:
- Zotero version: 7.0.30 (the latest)
- Browser: Firefox connector
- Browser: Chrome connector
- There are also connectors for Edge and Safari (bundled with the Zotero Connector for Safari)
- Operating system: Ubuntu 22.04

I can test on Windows if that would help.
Comment 8 Tomás Cohen Arazi (tcohen) 2025-12-30 19:47:43 UTC
(In reply to David Nind from comment #7)
> I'm not seeing any error when using the Zotero connector for the browsers I
> use (I've used Zotero for a while, on and off).
> 
> For me, it seems to work OK from:
> - The search results page
> - Individual bibliographic record pages
> 
> My set up:
> - Zotero version: 7.0.30 (the latest)
> - Browser: Firefox connector
> - Browser: Chrome connector
> - There are also connectors for Edge and Safari (bundled with the Zotero
> Connector for Safari)
> - Operating system: Ubuntu 22.04
> 
> I can test on Windows if that would help.

Have you disabled all export options?
Comment 9 David Nind 2025-12-30 20:52:17 UTC
(In reply to Tomás Cohen Arazi (tcohen) from comment #8)
> 
> Have you disabled all export options?

I hadn't!

If no options are selected for OpacExportOptions, I now get the error.

Other testing notes, after the patches, the book details are saved in Zotero no matter what I set. 

That is, it makes no difference if I set EnableZotero or not or OpacExportOptions or not, or any combination.

The only exception is with "Don't enable" and "none selected", there is a Zotero plugin error. The record is still saved into Zotero anyway.

1. If I set
   - EnableZotero = Enable
   - OpacExportOptions: All selected
   ==> Book details saved in Zotero

3. If I set
   - EnableZotero = Enable
   - OpacExportOptions: None selected
   ==> Book details saved in Zotero

4. If I set
   - EnableZotero = Don't enable
   - OpacExportOptions: All selected
   ==> Book details saved in Zotero

5. If I set
   - EnableZotero = Don't enable
   - OpacExportOptions: None selected
   ==> There is an error for the Zotero plugin "An error occurred saving with Library Catalog (Koha). Attempting to save using unAPI instead."
   ==> Book details saved in Zotero

In terms of the description for the EnableZotero system preference, I don't understand what it means.
Comment 10 Lucas Gass (lukeg) 2025-12-31 16:54:24 UTC
This also seems to be causing t/db_dependent/api/v1/holds.t to fail.
Comment 11 Lucas Gass (lukeg) 2025-12-31 16:54:46 UTC
(In reply to Lucas Gass (lukeg) from comment #10)
> This also seems to be causing t/db_dependent/api/v1/holds.t to fail.

Please ignore me, I'm clearly lost. :(