category entry javascript fix
authorRyan Higgins <rch@balrog.liblime.com>
Fri, 11 Jan 2008 07:32:09 +0000 (01:32 -0600)
committerJoshua Ferraro <jmf@liblime.com>
Mon, 14 Jan 2008 22:40:46 +0000 (16:40 -0600)
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tmpl
members/memberentry.pl

index a62d149..3bad64f 100644 (file)
                    ok=1;
                        _alertString += "- description missing\n";
                }
-               if (!isNum(ff.upperagelimit,0)) {
+               if (!isNum(ff.upperagelimit,0) && ff.category_type.value=='C') {
                    ok=1;
-                       _alertString += "- upperagelimit is not a number\n";
+                       _alertString += "- upperagelimit is not a number\n";
+                               
                }
                
                if (ok) { // if there is a problem
                        alert(_alertString);
-            return;
+             return false;
         }
         // if all is good
                ff.submit();
        </li></ol>
 </fieldset>
 
-       <fieldset class="action"><input type="submit" value="Save" onclick="Check(this.form);" /> </fieldset>
+       <fieldset class="action"><input type="button" value="Save" onclick="Check(this.form);" /> </fieldset>
        </form>
 
 <!-- /TMPL_IF -->
index 67a9ccf..f28583e 100755 (executable)
@@ -187,7 +187,7 @@ if ($op eq 'save' || $op eq 'insert'){
     my $age = GetAge($newdata{dateofbirth});
     my $borrowercategory=GetBorrowercategory($newdata{'categorycode'});   
        my ($low,$high) = ($borrowercategory->{'dateofbirthrequired'}, $borrowercategory->{'upperagelimit'});
-    if (($age > $high) or ($age < $low)) {
+    if (($high && ($age > $high)) or ($age < $low)) {
       push @errors, 'ERROR_age_limitations';
          $template->param('ERROR_age_limitations' => "$low to $high");
     }