Bug 39533 - Use select2 to select item types and libraries in export of bibliographic records
Summary: Use select2 to select item types and libraries in export of bibliographic rec...
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Owen Leonard
QA Contact: Lisette Scheer
URL:
Keywords: release-notes-needed
Depends on:
Blocks:
 
Reported: 2025-04-02 15:49 UTC by Owen Leonard
Modified: 2025-04-25 17:28 UTC (History)
2 users (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
25.05.00
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
Bug 39533: Use select2 to select item types and libraries in biblio export (10.92 KB, patch)
2025-04-04 11:52 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review
Bug 39533: Use select2 to select item types and libraries in biblio export (11.02 KB, patch)
2025-04-25 16:30 UTC, Lisette Scheer
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!
Comment 4 Biblibre Sandboxes 2025-04-04 11:52:23 UTC
Created attachment 180631 [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
Signed-off-by: Janne <janne.seppanen@lahti.fi>
Comment 5 Lisette Scheer 2025-04-25 16:30:59 UTC
Created attachment 181548 [details] [review]
Bug 39533: Use select2 to select item types and libraries in biblio export

Worked great and looks much nicer.

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
Signed-off-by: Janne <janne.seppanen@lahti.fi>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Comment 6 Lisette Scheer 2025-04-25 16:32:12 UTC
I did get these warnings when I ran the QA tool:

Use of uninitialized value $new_filepath in hash element at /kohadevbox/qa-test-tools/QohA/Git.pm line 39.
Processing files before patches
Argument "value" isn't numeric in subtraction (-) at /kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/en/includes/branch-selector.inc line 10.

But no new files were added and the second warning was for a file that was deleted, so I still passed.
Comment 7 Katrin Fischer 2025-04-25 17:28:20 UTC
Pushed for 25.05!

Well done everyone, thank you!