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: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: System Administration (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor (vote)
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-05-21 10:38 UTC by Owen Leonard
Modified: 2024-05-23 06:08 UTC (History)
2 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:


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

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>