If you add a new subfield to a framework, the maximum length of the field defaults to 0, and the "Max length" box is hidden under "Display more constraints." The result is that if someone simply adds a new subfield, they will be unable to type in it, with no indication of what the problem is.
I think I solved this problem, just adding something like $row_data{maxlength} = "4"; near line 365 on marc_subfields_structure.pl: @ -360,6 +360,9 @@ -multiple => 0, ); + # This (I think) fix Bug #8018 + $row_data{maxlength} = "4"; + $row_data{link} = CGI::escapeHTML( $data->{'link'} ); $row_data{row} = $i; push( @loop_data, \%row_data );
9999 as default value is much more reasonable.
Created attachment 23483 [details] [review] Set new subfields maxlenght by default to 9999.
Created attachment 23485 [details] [review] Bug 8018: maxlenght should default to 9999 for subfields The default value for the marc_subfield_structure.maxlenght is 9999 in the DB. Currently the template passes an empty value which is casted to 0 by the CGI. This simple patch validates the input and converts to the default (9999) if not defined or 0. Another approach could be changing the 9999 default and/or treating 0 as 'no-limit'. PabloAB Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com> Works by defaulting 0 or "" to 9999.
Created attachment 23487 [details] [review] Bug 8018: (followup) make the default more explicit This patch: - Makes the new subfield tab show maxlength=9999 as default (instead of empty-then-zero). - Updates the help to make exlpicit that 0 or empty defaults to 9999. - Assumes all the subfields created with maxlength=0 inadvertedly are meant to mean "no limit" and hence update the database to reflect that. To test (this patch and Pablo's): - Edit a MARC framework, edit some field's subfields. - Use the 'New' tab to create a new subfield (choose an unused letter). - See in "More constrains" that the "Max length" field is empty. Leave it as-is. - Save the changes (the new subfield). - Edit the field again, verify that "Max length" is 0. - Try tu use the framework and the the field/subfield just created > FAIL - Apply the patches, upgrade - Try to use the framework/field/subfield > SUCCESS (0 was converted to 9999) - Repeat from the beggining, "Max length" should show 9999 on the new subfield tab. - Leave it empty, it is saved as 9999. Regards To+ Sponsored-by: Universidad Nacionald de Cordoba
Created attachment 23488 [details] [review] Bug 8018: (followup) make the default more explicit Edit: small typo Sponsored-by: Universidad Nacionald de Cordoba
Created attachment 23758 [details] [review] Bug 8018: maxlenght should default to 9999 for subfields The default value for the marc_subfield_structure.maxlenght is 9999 in the DB. Currently the template passes an empty value which is casted to 0 by the CGI. This simple patch validates the input and converts to the default (9999) if not defined or 0. Another approach could be changing the 9999 default and/or treating 0 as 'no-limit'. PabloAB Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com> Works by defaulting 0 or "" to 9999. Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Created attachment 23759 [details] [review] Bug 8018: (followup) make the default more explicit This patch: - Makes the new subfield tab show maxlength=9999 as default (instead of empty-then-zero). - Updates the help to make exlpicit that 0 or empty defaults to 9999. - Assumes all the subfields created with maxlength=0 inadvertedly are meant to mean "no limit" and hence update the database to reflect that. To test (this patch and Pablo's): - Edit a MARC framework, edit some field's subfields. - Use the 'New' tab to create a new subfield (choose an unused letter). - See in "More constrains" that the "Max length" field is empty. Leave it as-is. - Save the changes (the new subfield). - Edit the field again, verify that "Max length" is 0. - Try tu use the framework and the the field/subfield just created > FAIL - Apply the patches, upgrade - Try to use the framework/field/subfield > SUCCESS (0 was converted to 9999) - Repeat from the beggining, "Max length" should show 9999 on the new subfield tab. - Leave it empty, it is saved as 9999. Regards To+ Edit: small typo Sponsored-by: Universidad Nacionald de Cordoba Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Created attachment 23789 [details] [review] [PASSED QA] Bug 8018: maxlenght should default to 9999 for subfields The default value for the marc_subfield_structure.maxlenght is 9999 in the DB. Currently the template passes an empty value which is casted to 0 by the CGI. This simple patch validates the input and converts to the default (9999) if not defined or 0. Another approach could be changing the 9999 default and/or treating 0 as 'no-limit'. PabloAB Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com> Works by defaulting 0 or "" to 9999. Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Created attachment 23790 [details] [review] [PASSED QA] Bug 8018: (followup) make the default more explicit This patch: - Makes the new subfield tab show maxlength=9999 as default (instead of empty-then-zero). - Updates the help to make exlpicit that 0 or empty defaults to 9999. - Assumes all the subfields created with maxlength=0 inadvertedly are meant to mean "no limit" and hence update the database to reflect that. To test (this patch and Pablo's): - Edit a MARC framework, edit some field's subfields. - Use the 'New' tab to create a new subfield (choose an unused letter). - See in "More constrains" that the "Max length" field is empty. Leave it as-is. - Save the changes (the new subfield). - Edit the field again, verify that "Max length" is 0. - Try tu use the framework and the the field/subfield just created > FAIL - Apply the patches, upgrade - Try to use the framework/field/subfield > SUCCESS (0 was converted to 9999) - Repeat from the beggining, "Max length" should show 9999 on the new subfield tab. - Leave it empty, it is saved as 9999. Regards To+ Edit: small typo Sponsored-by: Universidad Nacionald de Cordoba Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Passes QA script and tests in t and xt. Tested: - deleting an existing subfield - adding a new subfield with new default 9999 - editing the new subfield, changing value to 8888 - deleting new subfield - adding new subfield, using 8888 as length
Created attachment 23791 [details] [review] Bug 8018: Follow-up - fixing some wrong capitalization Fixes capitalization in 2 places: - Delete a subfield - Yes/No options - Edit a subfield - Edit subfield
Pushed to master. Thanks Pablo and Tomás!
Patches pushed to 3.14.x, will be in 3.14.2. (creates version 3.14.01.005)
This patch has been pushed to 3.12.x, will be in 3.12.11. Thanks Pablo and Katrina!