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 begining, "Max length" should show 9999 on the new
  subfield tab.
- Leave it empty, it is saved as 9999.

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

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit b5eab7c20b)
Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>

Conflicts:
	installer/data/mysql/updatedatabase.pl
This commit is contained in:
Tomas Cohen Arazi 2013-12-12 12:24:11 -03:00 committed by Fridolin SOMERS
parent a3f0eb9769
commit 828d9b9f20
3 changed files with 10 additions and 1 deletions

View File

@ -276,6 +276,7 @@ if ( $op eq 'add_form' ) {
my %row_data; # get a fresh hash for the row data
$row_data{'new_subfield'} = 1;
$row_data{'subfieldcode'} = '';
$row_data{'maxlength'} = 9999;
$row_data{tab} = CGI::scrolling_list(
-name => 'tab',

View File

@ -7847,6 +7847,14 @@ $DBversion = "3.14.01.004";
if(CheckVersion($DBversion)) {
$dbh->do("ALTER TABLE deleteditems DROP COLUMN marc");
print "Upgrade to $DBversion done (Bug 6331: Obsolete marc column in deleteditems)\n";
print "Upgrade to $DBversion done (Bug 6331: remove obsolete column in deleteditems.marc)\n";
SetVersion ($DBversion);
}
$DBversion = "3.15.00.XXX";
if(CheckVersion($DBversion)) {
$dbh->do("UPDATE marc_subfield_structure SET maxlength=9999 WHERE maxlength IS NULL OR maxlength=0;");
print "Upgrade to $DBversion done (Bug 8018: new subfields have a default max length of zero)\n";
SetVersion($DBversion);
}

View File

@ -69,7 +69,7 @@ To edit the subfields associated with the tag, click 'Subfields' to the right of
<ul>
<li>Max length
<ul>
<li>Define the max characters to fill.</li>
<li>Set the max characters allowed for the subfield. If empty or 0, it defaults to 9999.</li>
</ul>
</li>
</ul>