Bug 13203: Plugin housekeeping: UNIMARC field 123i, 123j, 210c
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Mon, 20 Oct 2014 10:36:36 +0000 (12:36 +0200)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Tue, 11 Nov 2014 17:10:34 +0000 (14:10 -0300)
In working on bug 10480, I noticed that these plugins needed some attention:

[2] unimarc_field_123i.pl: added missing template
[3] unimarc_field_123j.pl: resolved missing template with same file
[4] unimarc_field_210c_bis.pl: removed a warn, corrected some POD lines

Note about UNIMARC field 123i and 123j: Subfields $i and $j are each 8
characters long and contain the same components as subfields $f and $g
except that character position 0 contains a plus sign (for the northern
celestial hemisphere) or a minus sign (for the southern celestial hemisphere).

Test plan:
Connect unimarc_field_123i and 123j to some field.
Look especially at changing + or - for the hemisphere in the popup.
Check left-padding with zeroes for the other positions.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes tests and QA script.
Checked plugin in a UNIMARC installation.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

cataloguing/value_builder/unimarc_field_123i.pl
cataloguing/value_builder/unimarc_field_123j.pl
cataloguing/value_builder/unimarc_field_210c_bis.pl
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_123i_j.tt [new file with mode: 0644]

index 8b39e73..5ada49f 100755 (executable)
@@ -72,7 +72,7 @@ my ($input) = @_;
        my $dbh = C4::Context->dbh;
 
 my ($template, $loggedinuser, $cookie)
-    = get_template_and_user({template_name => "cataloguing/value_builder/unimarc_field_123i.tt",
+    = get_template_and_user({template_name => "cataloguing/value_builder/unimarc_field_123i_j.tt",
                             query => $input,
                             type => "intranet",
                             authnotrequired => 0,
@@ -84,7 +84,7 @@ my ($template, $loggedinuser, $cookie)
        my $f3 = substr($result,4,2);
        my $f4 = substr($result,6,2);
        $template->param(index => $index,
-                        "f1$f1" => 1,
+             "f1".($f1 eq '-'?'s':'n') => 1,
                         f2 => $f2,
                         f3 => $f3,
                         f4 => $f4);
index 9b0903e..8ce202e 100755 (executable)
@@ -75,7 +75,7 @@ sub plugin {
        my ($template, $loggedinuser, $cookie)
     = get_template_and_user(
        {
-            template_name => "cataloguing/value_builder/unimarc_field_123j.tt",
+            template_name => "cataloguing/value_builder/unimarc_field_123i_j.tt",
                        query => $input,
                        type => "intranet",
                        authnotrequired => 0,
@@ -88,7 +88,7 @@ sub plugin {
        my $f3 = substr($result,4,2);
        my $f4 = substr($result,6,2);
        $template->param(index => $index,
-                        "f1$f1" => 1,
+             "f1".($f1 eq '-'?'s':'n') => 1,
                         f2 => $f2,
                         f3 => $f3,
                         f4 => $f4);
index ab8d41a..d9e02b2 100755 (executable)
@@ -36,8 +36,6 @@ It need :
   if the biblio has no isbn, then the search if done on editor only
   If the biblio ha an isbn, the search is done on isbn and editor. It's faster.
 
-=over 2
-
 =cut
 
 use strict;
@@ -50,7 +48,9 @@ use C4::Context;
 use C4::AuthoritiesMarc;
 use C4::Output;
 
-=head1
+=head1 FUNCTIONS
+
+=head2 plugin_parameters
 
 plugin_parameters : other parameters added when the plugin is called by the dopop function
 
@@ -89,7 +89,6 @@ sub plugin {
     my $result       = $input->param('result');
     my $editor_found = $input->param('editor_found');
     my $AuthoritySeparator = C4::Context->preference("AuthoritySeparator");
-    warn Data::Dumper::Dumper $index;
 
     my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
         {   template_name   => "cataloguing/value_builder/unimarc_field_210c_bis.tt",
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_123i_j.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_123i_j.tt
new file mode 100644 (file)
index 0000000..898953d
--- /dev/null
@@ -0,0 +1,57 @@
+[% INCLUDE 'doc-head-open.inc' %]
+<title>UNIMARC field 123i/j builder</title>
+[% INCLUDE 'doc-head-close.inc' %]
+</head>
+<body id="cat_unimarc_field_123ij" class="cat" style="padding:1em;">
+<h3>UNIMARC field 123i/j builder</h3>
+<form name="f_pop" action="">
+<table>
+    <tr>
+        <td><label for="f1">Hemisphere:</label></td>
+        <td>
+            <select name="f1" id="f1" size="1">
+
+            [% IF ( f1n ) %]
+                <option value="+" selected="selected">north</option>
+            [% ELSE %]
+                <option value="+">north</option>
+            [% END %]
+            [% IF ( f1s ) %]
+                <option value="-" selected="selected">south</option>
+            [% ELSE %]
+                <option value="-">south</option>
+            [% END %]
+            </select>
+        </td></tr>
+
+<tr>          <td><label for="f2">Degree (complete with 0):</label></td>
+                         <td><input type="text" name="f2" id="f2" maxlength="3" size="4" value="[% f2 %]" /></td>
+</tr>
+<tr>          <td><label for="f3">Minute (complete with 0):</label></td>
+                         <td><input type="text" name="f3" id="f3" maxlength="2" size="3" value="[% f3 %]" /></td>
+</tr>
+<tr>          <td><label for="f4">Second (complete with 0):</label></td>
+                         <td><input type="text" name="f4" id="f4" maxlength="2" size="3" value="[% f4 %]" /></td>
+</tr>
+</table>
+<fieldset class="action"><input type="button" value="OK" onclick="report();" /> <a href="#" class="cancel close">Cancel</a></fieldset>
+</form>
+<script type="text/javascript">
+//<![CDATA[
+    function report() {
+        var f2= "000" + document.f_pop.f2.value;
+        f2 = f2.substring(f2.length-3);
+        var f3= "00" + document.f_pop.f3.value;
+        f3 = f3.substring(f3.length-2);
+        var f4= "00" + document.f_pop.f4.value;
+        f4 = f4.substring(f4.length-2);
+        var doc   = opener.document;
+        var field = doc.getElementById("[% index %]");
+        field.value =  document.f_pop.f1.value+ f2 + f3 + f4;
+        window.close();
+        return false;
+    }
+//]]>
+</script>
+
+[% INCLUDE 'popup-bottom.inc' %]