From 6b790d9b9ad7fa77c35332b474d5fe8b4bdf7b0c Mon Sep 17 00:00:00 2001
From: Owen Leonard <oleonard@myacpl.org>
Date: Mon, 1 Aug 2016 10:20:00 -0400
Subject: [PATCH] Bug 17011 - Remove "onblur" event attribute from some
 templates
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Several templates have an "onblur" event attribute in the markup. This
patch moves the onblur event definition into the JavaScript.

To test, apply the patch and clear your browser cache if necessary.

In Administration -> Authority types:

  - Choose "New authority type."
  - Enter any text into the "Authority type" field.
  - Moving the cursor focus away from this field should convert your
    text to uppercase.

In Administration -> MARC bibliographic framework:

  - Choose "New framework."
  - Enter any text into the "Framework code" field.
  - Moving the cursor focus away from this field should convert your
    text to uppercase.

In Administration -> Currencies and exchange rates:

 - Choose "New currency."
  - Enter any text into the "Currency" field.
  - Moving the cursor focus away from this field should convert your
    text to uppercase.

In Administration -> Item types

 - Choose "New item type."
  - Enter any text into the "Item type" field.
  - Moving the cursor focus away from this field should convert your
    text to uppercase.

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
---
 koha-tmpl/intranet-tmpl/prog/en/modules/admin/authtypes.tt        | 5 ++++-
 koha-tmpl/intranet-tmpl/prog/en/modules/admin/biblio_framework.tt | 2 +-
 koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt         | 5 ++++-
 koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt        | 5 ++++-
 koha-tmpl/intranet-tmpl/prog/js/biblio_framework.js               | 5 ++++-
 5 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authtypes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authtypes.tt
index 9c7d419..7cad110 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authtypes.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authtypes.tt
@@ -18,6 +18,9 @@
             ],
             "sPaginationType": "four_button"
         }));
+        $("#authtypecode").on("blur",function(){
+            toUC(this);
+        });
     });
 //]]>
 </script>
@@ -85,7 +88,7 @@
                             <input type="hidden" name="authtypecode" value="[% authority_type.authtypecode %]" />[% authority_type.authtypecode %]
                     [% ELSE %]
                             <label for="authtypecode" class="required">Authority type: </label>
-                            <input id="authtypecode" type="text" class="required" required="required" name="authtypecode" size="10" maxlength="10" onblur="toUC(this)" />
+                            <input id="authtypecode" type="text" class="required" required="required" name="authtypecode" size="10" maxlength="10" />
                             <span class="required">Required</span>
                     [% END %]
                 </li>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/biblio_framework.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/biblio_framework.tt
index ebf449c..50cd4b2 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/biblio_framework.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/biblio_framework.tt
@@ -86,7 +86,7 @@
                 [% ELSE %]
                     <li>
                         <label for="frameworkcode" class="required">Framework code: </label>
-                        <input type="text" id="frameworkcode" name="frameworkcode" size="4" maxlength="4" onblur="toUC(this)" required="required" class="required" />
+                        <input type="text" id="frameworkcode" name="frameworkcode" size="4" maxlength="4" required="required" class="required" />
                         <span class="required">Required</span>
                     </li>
                 [% END %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt
index 90c828b..1bbacf2 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt
@@ -38,6 +38,9 @@
             check_currency( $(this).val() );
         });
         check_currency( $("#rate").val() );
+        $("#currency_code").on("blur",function(){
+            toUC(this);
+        });
     });
 //]]>
 </script>
@@ -108,7 +111,7 @@
                     <input type="hidden" name="currency_code" id="currency" value="[% currency.currency %]" />[% currency.currency %]
                 [% ELSE %]
                     <label for="currency_code" class="required">Currency: </label>
-                    <input type="text" name="currency_code" id="currency_code" size="50" maxlength="50" onblur="toUC(this);" required="required" class="required" /> <span class="required">Required</span>
+                    <input type="text" name="currency_code" id="currency_code" size="50" maxlength="50" required="required" class="required" /> <span class="required">Required</span>
                 [% END %]
             </li>
             <li>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt
index 9a8f431..95bbb7b 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt
@@ -43,6 +43,9 @@ Data deleted
                 rentalcharge: { number: true }
             }
         });
+        $("#itemtype").on("blur",function(){
+            toUC(this);
+        });
      });
 //]]>
 </script>
@@ -134,7 +137,7 @@ Item types administration
                 [% ELSE %]
                     <li>
                         <label for="itemtype" class="required">Item type: </label>
-                        <input type="text" id="itemtype" name="itemtype" size="10" maxlength="10" onblur="toUC(this)" required="required" /> <span class="required">Required</span>
+                        <input type="text" id="itemtype" name="itemtype" size="10" maxlength="10" required="required" /> <span class="required">Required</span>
                     </li>
                 [% END %]
                 <li>
diff --git a/koha-tmpl/intranet-tmpl/prog/js/biblio_framework.js b/koha-tmpl/intranet-tmpl/prog/js/biblio_framework.js
index 581c392..171cb83 100644
--- a/koha-tmpl/intranet-tmpl/prog/js/biblio_framework.js
+++ b/koha-tmpl/intranet-tmpl/prog/js/biblio_framework.js
@@ -73,4 +73,7 @@
             obj.css("background-color","white");
             return false;
         });
-    });
\ No newline at end of file
+        $("#frameworkcode").on("blur",function(){
+            toUC(this);
+        });
+    });
-- 
2.8.0