[Koha-patches] [PATCH] [SIGNED-OFF] Bug 6715 - Fix xmlControlfield.js so the xml files are fetched in the correct language directory.

Katrin Fischer Katrin.Fischer.83 at web.de
Sun Aug 14 16:56:02 CEST 2011


From: preprod34 <preprod34 at koha.ccsr.qc.ca>

xmlControlfield.js was always fetching the "en" xml file, preventing the translations
from working.

http://bugs.koha-community.org/show_bug.cgi?id=6715

Signed-off-by: Katrin Fischer <Katrin.Fischer.83 at web.de>
- Apply patch
- Install language files, example: perl translate install de-DE
- Edit .xml files for value builders 006 and 008
- Test by creating a new record and using value builders
---
 .../intranet-tmpl/prog/en/js/xmlControlfield.js    |    6 ++++--
 .../cataloguing/value_builder/marc21_field_006.tt  |    2 +-
 .../cataloguing/value_builder/marc21_field_008.tt  |    2 +-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/xmlControlfield.js b/koha-tmpl/intranet-tmpl/prog/en/js/xmlControlfield.js
index 5acb5fd..608b79b 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/js/xmlControlfield.js
+++ b/koha-tmpl/intranet-tmpl/prog/en/js/xmlControlfield.js
@@ -168,7 +168,7 @@ function changeH4Result(form, h4_result, tr_result, pos, value)
 (function()
 {
 
-    xmlControlField = function(tagfield, form_id, select, table, h4_result, tr_result, idMaterial)
+    xmlControlField = function(tagfield, form_id, select, table, h4_result, tr_result, idMaterial, themelang)
     {
         this.tagfield = tagfield;
         this.idMaterial = idMaterial;
@@ -178,6 +178,7 @@ function changeH4Result(form, h4_result, tr_result, pos, value)
         this.table = table;
         this.h4_result = h4_result;
         this.tr_result = tr_result;
+        this.themelang = themelang;
     };//xmlControlField
 
 
@@ -192,6 +193,7 @@ function changeH4Result(form, h4_result, tr_result, pos, value)
         table: null,
         h4_result: "",
         tr_result: "",
+        themelang: "",
 
 
         setIdMaterial: function(idMaterial)
@@ -203,7 +205,7 @@ function changeH4Result(form, h4_result, tr_result, pos, value)
         {
             this.xmlDoc = $.ajax({
                 type: "GET",
-                url: "/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_" + this.tagfield + ".xml",
+                url: this.themelang + "/modules/cataloguing/value_builder/marc21_field_" + this.tagfield + ".xml",
                 dataType: "xml",
                 async: false
             }).responseXML;
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_006.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_006.tt
index 3c2e02c..66a2a5a 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_006.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_006.tt
@@ -16,7 +16,7 @@
         var form = document.f_pop;
         h4_result = document.getElementById("h4_result");
         tr_result = document.getElementById("tr_result");
-        objXmlControlField = new xmlControlField('[% tagfield %]', 'f_pop', document.getElementById('material_type'), document.getElementById('table_material_types'), 'h4_result', 'tr_result', '');
+        objXmlControlField = new xmlControlField('[% tagfield %]', 'f_pop', document.getElementById('material_type'), document.getElementById('table_material_types'), 'h4_result', 'tr_result', '', '[% themelang %]');
         objXmlControlField.loadXmlValues();
         renderResult(tr_result, (form.result.value != "")?form.result.value:returnValueParam("result"));
         [% END %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_008.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_008.tt
index 8083c0f..9561ae5 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_008.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_008.tt
@@ -16,7 +16,7 @@
         var form = document.f_pop;
         h4_result = document.getElementById("h4_result");
         tr_result = document.getElementById("tr_result");
-        objXmlControlField = new xmlControlField('[% tagfield %]', 'f_pop', document.getElementById('material_type'), document.getElementById('table_material_types'), 'h4_result', 'tr_result', '');
+        objXmlControlField = new xmlControlField('[% tagfield %]', 'f_pop', document.getElementById('material_type'), document.getElementById('table_material_types'), 'h4_result', 'tr_result', '', '[% themelang %]');
         objXmlControlField.loadXmlValues();
         renderResult(tr_result, (form.result.value != "")?form.result.value:returnValueParam("result"));
         [% END %]
-- 
1.7.4.1



More information about the Koha-patches mailing list