Bug 39533 - Use select2 to select item types and libraries in biblio export
Summary: Use select2 to select item types and libraries in biblio export
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-04-02 15:49 UTC by Owen Leonard
Modified: 2025-04-03 09:32 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 39533: Use select2 to select item types and libraries in biblio export (10.88 KB, patch)
2025-04-02 16:19 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 39533: Use select2 to select item types and libraries in biblio export (10.87 KB, patch)
2025-04-03 09:32 UTC, Felicie
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2025-04-02 15:49:14 UTC
We can use Select2 to allow multiple selections of item types and libraries in the bibliographic record export.
Comment 1 Owen Leonard 2025-04-02 16:19:00 UTC
Created attachment 180421 [details] [review]
Bug 39533: Use select2 to select item types and libraries in biblio export

This patch updates the bibliographic export page so that item type and
library export use Select2 form fields. This change has the added
benefit of enabling the removal of a single-use include,
branch-selector.inc.

The patch also adds some JavaScript to make sure the "CSV profile" field
appears on page load if CSV is selected as the file format. This is
helpful if the user has reloaded the page or arrived at the page by
using the browser back button.

To test, apply the patch and go to Cataloging -> Export catalog data.

- Under the "Export bibliographic records" tab you should see two
  Select2-style form field under the "Select records to export" heading,
  "Item type" and "Home library."
- Confirm that the fields work correctly when adding one or more
  selections to each.
- Confirm that the selections work correctly to filter the export. I
  recommend using CSV as the file format for the export. A MARC export
  CSV profile (Tools -> CSV profiles -> New CSV profile) containing
  these fields will show the relevant information:

  Title=245$a\|Library=952$a\|Itemtype=952$y

- When you select CSV as the file format the "CSV profile" dropdown menu
  should appear. If you choose a different format, that dropdown should
  disappear.
- With CSV selected as the file format, reload the page. The "CSV
  profile" field should still be visible.

Sponsored-by: Athens County Public Libraries
Comment 2 Felicie 2025-04-03 09:32:00 UTC
Created attachment 180477 [details] [review]
Bug 39533: Use select2 to select item types and libraries in biblio export

This patch updates the bibliographic export page so that item type and
library export use Select2 form fields. This change has the added
benefit of enabling the removal of a single-use include,
branch-selector.inc.

The patch also adds some JavaScript to make sure the "CSV profile" field
appears on page load if CSV is selected as the file format. This is
helpful if the user has reloaded the page or arrived at the page by
using the browser back button.

To test, apply the patch and go to Cataloging -> Export catalog data.

- Under the "Export bibliographic records" tab you should see two
  Select2-style form field under the "Select records to export" heading,
  "Item type" and "Home library."
- Confirm that the fields work correctly when adding one or more
  selections to each.
- Confirm that the selections work correctly to filter the export. I
  recommend using CSV as the file format for the export. A MARC export
  CSV profile (Tools -> CSV profiles -> New CSV profile) containing
  these fields will show the relevant information:

  Title=245$a\|Library=952$a\|Itemtype=952$y

- When you select CSV as the file format the "CSV profile" dropdown menu
  should appear. If you choose a different format, that dropdown should
  disappear.
- With CSV selected as the file format, reload the page. The "CSV
  profile" field should still be visible.

Sponsored-by: Athens County Public Libraries
Comment 3 Felicie 2025-04-03 09:32:21 UTC
Nice!