Bug 39533

Summary: Use select2 to select item types and libraries in export of bibliographic records
Product: Koha Reporter: Owen Leonard <oleonard>
Component: TemplatesAssignee: Owen Leonard <oleonard>
Status: Pushed to main --- QA Contact: Lisette Scheer <lisette>
Severity: enhancement    
Priority: P5 - low CC: felicie.thiery, lisette
Version: MainKeywords: release-notes-needed
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39099
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
Bug 39533: Use select2 to select item types and libraries in biblio export
Bug 39533: Use select2 to select item types and libraries in biblio export
Bug 39533: Use select2 to select item types and libraries in biblio export

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!