Bug 36907 - OAI set mapping form field maxlength should match table column sizes
Summary: OAI set mapping form field maxlength should match table column sizes
Status: Pushed to stable
Alias: None
Product: Koha
Classification: Unclassified
Component: System Administration (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor
Assignee: Owen Leonard
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-05-21 10:38 UTC by Owen Leonard
Modified: 2024-09-12 22:00 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This fixes the OIA set mappings form so that you can't enter more characters than the maximum length for the input fields (Field (3), Subfield (1), and Value (80)). Previously, you could enter more characters - however, when you saved the form it generated an error.
Version(s) released in:
24.11.00,24.05.04
Circulation function:


Attachments
Bug 36907: Add maxlength to OAI set mapping form fields (3.71 KB, patch)
2024-05-21 15:19 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 36907: Add maxlength to OAI set mapping form fields (3.76 KB, patch)
2024-05-23 06:01 UTC, David Nind
Details | Diff | Splinter Review
Bug 36907: Add maxlength to OAI set mapping form fields (3.85 KB, patch)
2024-08-16 09:01 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2024-05-21 10:38:44 UTC
If you enter text in the OAI set mapping form which contains more characters than the size of the oai_sets_mappings database columns and submit the form there is causes an error.

"C4::OAI::Sets::ModOAISetMappings(): DBI Exception: DBD::mysql::st execute failed: Data too long for column 'marcfield' at row 1"

We should add maxlength attributes to these fields to prevent that possibility.
Comment 1 Owen Leonard 2024-05-21 15:19:55 UTC
Created attachment 166984 [details] [review]
Bug 36907: Add maxlength to OAI set mapping form fields

This patch adds a maxlength attribute to the field, subfield, and value
fields in the OAI set mapping form. This helps prevent an error when the
form data is too long for the database columns.

Unrelated: The patch also adds quotes around two unquoted name
attributes.

To test, apply the patch and go to Administration -> OAI sets.

- If necessary, create a new set.
- Click Actions -> Define mappings.
- Test that each form field is limited correctly:
  Field: 3
  Subfield: 1
  Value: 80
- Test that the form can be submitted successfully with the maximum
  number of characters in each field.
Comment 2 David Nind 2024-05-23 06:01:58 UTC
Created attachment 167062 [details] [review]
Bug 36907: Add maxlength to OAI set mapping form fields

This patch adds a maxlength attribute to the field, subfield, and value
fields in the OAI set mapping form. This helps prevent an error when the
form data is too long for the database columns.

Unrelated: The patch also adds quotes around two unquoted name
attributes.

To test, apply the patch and go to Administration -> OAI sets.

- If necessary, create a new set.
- Click Actions -> Define mappings.
- Test that each form field is limited correctly:
  Field: 3
  Subfield: 1
  Value: 80
- Test that the form can be submitted successfully with the maximum
  number of characters in each field.

Signed-off-by: David Nind <david@davidnind.com>
Comment 3 Marcel de Rooy 2024-08-16 09:01:18 UTC
Created attachment 170442 [details] [review]
Bug 36907: Add maxlength to OAI set mapping form fields

This patch adds a maxlength attribute to the field, subfield, and value
fields in the OAI set mapping form. This helps prevent an error when the
form data is too long for the database columns.

Unrelated: The patch also adds quotes around two unquoted name
attributes.

To test, apply the patch and go to Administration -> OAI sets.

- If necessary, create a new set.
- Click Actions -> Define mappings.
- Test that each form field is limited correctly:
  Field: 3
  Subfield: 1
  Value: 80
- Test that the form can be submitted successfully with the maximum
  number of characters in each field.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 4 Katrin Fischer 2024-08-19 15:31:07 UTC
Pushed for 24.11!

Well done everyone, thank you!
Comment 5 Lucas Gass (lukeg) 2024-09-12 22:00:45 UTC
Backported to 24.05.x for upcoming 24.05.04