(bug #3398) fix unimarc 210c plugin
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / cataloguing / value_builder / marc21_field_008.tmpl
index 302fd60..511c027 100644 (file)
         </tr>
 
        <tr>
-                <td>15-17 Place of publication, production, or execution </td>
+                <td>15-17 Place of publication, production, or execution see <a href="http://www.loc.gov/marc/countries/countries_code.html">MARC Code List for Countries</a> </td>
                 <td>
                         <input type="text" name="f1517" size="3"  maxlength="3" value="<!-- TMPL_VAR NAME="f1517" -->"/>
                 </td>
 
                         <!-- TMPL_IF name="f34c" -->
                         <option value="c" SELECTED>c- Collective biography</option>                              <!-- TMPL_ELSE -->
-                        <option value="c">c- Collective biographyl</option>
+                        <option value="c">c- Collective biography</option>
                         <!-- /TMPL_IF -->
                        
                         <!-- TMPL_IF name="f34d" -->
 
         <tr>
 
-                <td>35-37 Language see <a href="http://www.itsmarc.com/crs/lang0098.htm">MARC Code List for Languages</a></td>
+                <td>35-37 Language see <a href="http://www.loc.gov/marc/languages/language_code.html">MARC Code List for Languages</a></td>
                 <td>
                         <input type="text" name="f3537" size="4"  maxlength="4" value="<!-- TMPL_VAR NAME="f3537" -->"/>
                 </td>
 </table>
 </form>
 <script>
+
+// Pad the string with spaces so that it is 4 characters long.
+// Also, truncate strings that are longer than 4 characters.
+function pad4(s) {
+       var pad = "";
+       if (s.length < 4) {
+               var padLength = 4 - s.length;
+               for (var i = 0; i < 4 - s.length; i++) {
+                       pad += " ";
+               }
+               s += pad;
+       } else {
+               s = s.substring(0, 4);
+       }
+       return s;
+}
+
 function report() {
             var doc   = opener.document; 
             var field = doc.getElementById("<!-- TMPL_VAR NAME='index'-->");
-        
             field.value = 
                        document.f_pop.f1.value+
                        document.f_pop.f6.value+
-                       document.f_pop.f710.value+
-                       document.f_pop.f1114.value+
+                       // bug 2563 {
+                       ( document.f_pop.f710.value.match(/^\s*$/)  ? "    " : pad4(document.f_pop.f710.value)  )+
+                       ( document.f_pop.f1114.value.match(/^\s*$/) ? "    " : pad4(document.f_pop.f1114.value) )+
+                       // }
                        document.f_pop.f1517.value+
                        document.f_pop.f1821.value+
                        document.f_pop.f22.value+