Bug 8119 - Followup Show hint when disabling active currency checkbox
authorJonathan Druart <jonathan.druart@biblibre.com>
Tue, 22 May 2012 09:31:32 +0000 (11:31 +0200)
committerPaul Poulain <paul.poulain@biblibre.com>
Sat, 9 Jun 2012 10:34:50 +0000 (12:34 +0200)
Display the message on editing

Signed-off-by: Shari Perkins <dear.shari+koha@gmail.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt

index e235838..1d327be 100644 (file)
         }
     }
 
+    function check_currency(val) {
+        if ( val == 1.0 ) {
+            $("#active").removeAttr('disabled');
+            $("#hint").html("");
+        } else {
+            $("#active").removeAttr('checked');
+            $("#active").attr('disabled','disabled');
+            $("#hint").html(_("The active currency must have a rate of 1.0"));
+        }
+    }
+
     $(document).ready(function() {
         new YAHOO.widget.Button("newcurrency");
 
         // prevents users to check active with a currency != 1
         $("#rate").keyup(function() {
-            if ( $(this).val() == 1.0 ) {
-                $("#active").removeAttr('disabled');
-                $("#hint").html("");
-            } else {
-                $("#active").removeAttr('checked');
-                $("#active").attr('disabled','disabled');
-                $("#hint").html(_("The active currency must have a rate of 1.0"));
-            }
+            check_currency( $(this).val() );
         });
+        check_currency( $("#rate").val() );
     });
 //]]>
 </script>