From: Pablo Bianchi <pablo.bian...@gmail.com>

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 <tomasco...@gmail.com>
Works by defaulting 0 or "" to 9999.
---
 admin/marc_subfields_structure.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/admin/marc_subfields_structure.pl 
b/admin/marc_subfields_structure.pl
index 615fbcf..d347012 100755
--- a/admin/marc_subfields_structure.pl
+++ b/admin/marc_subfields_structure.pl
@@ -425,7 +425,7 @@ elsif ( $op eq 'add_validate' ) {
         my $isurl  = $input->param("isurl$i") ? 1 : 0;
         my $link   = $link[$i];
         my $defaultvalue = $defaultvalue[$i];
-        my $maxlength = $maxlength[$i];
+        my $maxlength = $maxlength[$i] ? $maxlength[$i] : 9999;
         
         if (defined($liblibrarian) && $liblibrarian ne "") {
             unless ( C4::Context->config('demo') eq 1 ) {
-- 
1.8.3.2

_______________________________________________
Koha-patches mailing list
Koha-patches@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to