[Koha-patches] [PATCH] Bug 4838 Allow to choose which authority heading to copy into biblio record

Frédéric Demians f.demians at tamil.fr
Sun May 30 12:34:48 CEST 2010


With this patch, in biblio record data entry form, when ... is clicked for an
authority controlled field, it's possible to select which heading repetion to
copy if the authority has repeated headings.

This patch, with the previous one, is REQUIRED by French libraries following
SUDOC UNIMARC format, ie all Higher Educational and Research libraries.
---
 authorities/auth_finder.pl                         |   14 ++++++++++++++
 authorities/blinddetail-biblio-search.pl           |   16 +++++++---------
 .../modules/authorities/searchresultlist-auth.tmpl |    6 ++++++
 3 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/authorities/auth_finder.pl b/authorities/auth_finder.pl
index 89f632f..99ac2c1 100755
--- a/authorities/auth_finder.pl
+++ b/authorities/auth_finder.pl
@@ -70,6 +70,20 @@ if ( $op eq "do_search" ) {
       SearchAuthorities( \@marclist, \@and_or, \@excluding, \@operator, \@value,
         $startfrom * $resultsperpage,
         $resultsperpage, $authtypecode, $orderby);
+
+    # If an authority heading is repeated, add an arrayref to those repetions
+    # First heading -- Second heading
+    for my $heading ( @$results ) {
+        my @repets = split / -- /, $heading->{summary};
+        if ( @repets > 1 ) {
+            my @repets_loop;
+            for (my $i = 0; $i < @repets; $i++) {
+                push @repets_loop,
+                    { index => $index, repet => $i+1, value => $repets[$i] };
+            }
+            $heading->{repets} = \@repets_loop;
+        }
+    }
     # multi page display gestion
     my $displaynext = 0;
     my $displayprev = $startfrom;
diff --git a/authorities/blinddetail-biblio-search.pl b/authorities/blinddetail-biblio-search.pl
index 08058a2..a849cc8 100755
--- a/authorities/blinddetail-biblio-search.pl
+++ b/authorities/blinddetail-biblio-search.pl
@@ -78,15 +78,13 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
 # fill arrays
 my @subfield_loop;
 if ($authid) {
-    foreach my $field ( $record->field( $auth_type->{auth_tag_to_report} ) ) {
-        for ( $field->subfields ) {
-            my ($letter, $value) = @$_;
-            $letter = '@' unless $letter;
-            push @subfield_loop, { marc_subfield => $letter, marc_value => $value };
-        }
-        # We take the first entry of a repeatable authority heading.
-        # This situation can occur in a multilingual UNIMARC DB
-        last;
+    my @fields = $record->field( $auth_type->{auth_tag_to_report} );
+    my $repet = ($query->param('repet') || 1) - 1;
+    my $field = $fields[$repet];
+    for ( $field->subfields ) {
+        my ($letter, $value) = @$_;
+        $letter = '@' unless $letter;
+        push @subfield_loop, { marc_subfield => $letter, marc_value => $value };
     }
 }
 else {
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tmpl
index e327451..5d1f9a4 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tmpl
@@ -70,7 +70,13 @@ function jumpfull(page)
                         <td><!-- TMPL_VAR NAME="summary" --></td>
                         <td><!-- TMPL_VAR NAME="used" --> times</td>
                         <td>
+                          <!-- TMPL_IF name="repets" -->
+                            <!-- TMPL_LOOP NAME="repets" -->
+                              <a href="javascript:jumpfull('blinddetail-biblio-search.pl?authid=<!-- TMPL_VAR NAME="authid" -->&amp;index=<!-- TMPL_VAR NAME="index" -->&amp;repet=<!-- TMPL_VAR NAME="repet" -->')" title="<!-- TMPL_VAR NAME="value" -->"><!-- TMPL_VAR NAME="repet" --></a>
+                            <!-- /TMPL_LOOP -->
+                          <!-- TMPL_ELSE -->
                             <a href="javascript:jumpfull('blinddetail-biblio-search.pl?authid=<!-- TMPL_VAR NAME="authid" -->&amp;index=<!-- TMPL_VAR NAME="index" -->')">choose</a>
+                          <!-- /TMPL_IF -->
                         </td>
                         <td><a href="authorities.pl?authid=<!-- TMPL_VAR NAME="authid" -->">Edit authority</a></td>
                     </tr>
-- 
1.5.6.5



More information about the Koha-patches mailing list