Bug 36907

Summary: OAI set mapping form field maxlength should match table column sizes
Product: Koha Reporter: Owen Leonard <oleonard>
Component: System AdministrationAssignee: Owen Leonard <oleonard>
Status: Pushed to oldstable --- QA Contact: Marcel de Rooy <m.de.rooy>
Severity: minor    
Priority: P5 - low CC: david, fridolin.somers, gmcharlt, lucas, m.de.rooy, wainuiwitikapark
Version: Main   
Hardware: All   
OS: All   
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,23.11.10
Circulation function:
Attachments: Bug 36907: Add maxlength to OAI set mapping form fields
Bug 36907: Add maxlength to OAI set mapping form fields
Bug 36907: Add maxlength to OAI set mapping form fields

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
Comment 6 Fridolin Somers 2024-10-21 12:25:51 UTC
Pushed to 23.11.x for 23.11.10
Comment 7 Wainui Witika-Park 2024-11-03 23:58:53 UTC
Not backporting to 23.05.x unless requested