From 82f672294378712d719493e359ed20de35834a97 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 12 Dec 2013 12:24:11 -0300 Subject: [PATCH] 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 --- admin/marc_subfields_structure.pl | 1 + installer/data/mysql/updatedatabase.pl | 6 ++++++ .../prog/en/modules/help/admin/marc_subfields_structure.tt | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/admin/marc_subfields_structure.pl b/admin/marc_subfields_structure.pl index d347012..0589968 100755 --- a/admin/marc_subfields_structure.pl +++ b/admin/marc_subfields_structure.pl @@ -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', diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 19893b4..11feae3 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -7824,6 +7824,12 @@ if ( CheckVersion($DBversion) ) { 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); +} =head1 FUNCTIONS diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/help/admin/marc_subfields_structure.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/help/admin/marc_subfields_structure.tt index 9308e98..00e7b02 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/help/admin/marc_subfields_structure.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/help/admin/marc_subfields_structure.tt @@ -69,7 +69,7 @@ To edit the subfields associated with the tag, click 'Subfields' to the right of -- 1.8.3.2