From: Frédéric Demians <f.demi...@tamil.fr> 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.
When there is just one authority repetition, the first one is displayed to choose, as previously. This patch is REQUIRED by French libraries following SUDOC UNIMARC format, and cataloguing multilingual materials ie all Higher Educational and Research libraries. Signed-off-by: Henri-Damien LAURENT <henridamien.laur...@biblibre.com> --- authorities/auth_finder.pl | 14 ++++++ authorities/blinddetail-biblio-search.pl | 47 ++++++-------------- .../authorities/blinddetail-biblio-search.tmpl | 15 +++--- .../modules/authorities/searchresultlist-auth.tmpl | 6 +++ 4 files changed, 41 insertions(+), 41 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 1495348..0f734b2 100755 --- a/authorities/blinddetail-biblio-search.pl +++ b/authorities/blinddetail-biblio-search.pl @@ -75,46 +75,27 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( ); # fill arrays -my @loop_data = (); +my @subfield_loop; if ($authid) { - foreach my $field ( $record->field( $auth_type->{auth_tag_to_report} ) ) { - my @subfields_data; - my @subf = $field->subfields; - - # loop through each subfield - my %result; - for my $i ( 0 .. $#subf ) { - $subf[$i][0] = "@" unless $subf[$i][0]; - $result{ $subf[$i][0] } .= $subf[$i][1] . "|"; - } - foreach ( keys %result ) { - my %subfield_data; - chop $result{$_}; - $subfield_data{marc_value} = $result{$_}; - $subfield_data{marc_subfield} = $_; - - # $subfield_data{marc_tag}=$field->tag(); - push( @subfields_data, \%subfield_data ); - } - if ( $#subfields_data >= 0 ) { - my %tag_data; - $tag_data{tag} = $field->tag() . ' -' . $tagslib->{ $field->tag() }->{lib}; - $tag_data{subfield} = \...@subfields_data; - push( @loop_data, \%tag_data ); - } + 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 { +} +else { # authid is empty => the user want to empty the entry. $template->param( "clear" => 1 ); -# warn Data::Dumper::Dumper(\...@loop_data); } -$template->param( "0XX" => \...@loop_data ); - $template->param( - authid => $authid ? $authid : "", - index => $index, - tagid => $tagid, + authid => $authid ? $authid : "", + index => $index, + tagid => $tagid, + SUBFIELD_LOOP => \...@subfield_loop, ); output_html_with_http_headers $query, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tmpl index a6e4723..a9753b3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tmpl @@ -19,19 +19,18 @@ if(subfields[i].getAttribute('name').match(re)){ // it s a subfield var code = subfields[i]; // code is the first input var subfield = subfields[i+1]; // subfield the second + <!-- TMPL_IF NAME="clear" --> if (subfield){subfield.value="" ;} <!--TMPL_ELSE--> - <!-- TMPL_LOOP NAME="0XX" --> - <!-- TMPL_LOOP NAME="subfield" --> - if (code.value == "<!-- TMPL_VAR ESCAPE="JS" NAME="marc_subfield" -->"){ + <!-- TMPL_LOOP NAME="SUBFIELD_LOOP" --> + if (code.value == "<!-- TMPL_VAR ESCAPE="JS" NAME="marc_subfield" -->"){ subfield.value = "<!-- TMPL_VAR ESCAPE="JS" NAME="marc_value" -->"; - } - <!-- /TMPL_LOOP --> - <!-- /TMPL_LOOP --> - if(code.value=='9'){ - subfield.value = "<!-- TMPL_VAR ESCAPE="JS" NAME="authid" -->"; } + <!-- /TMPL_LOOP --> + if(code.value=='9'){ + subfield.value = "<!-- TMPL_VAR ESCAPE="JS" NAME="authid" -->"; + } <!--/TMPL_IF--> } } 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" -->&index=<!-- TMPL_VAR NAME="index" -->&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" -->&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.7.1 _______________________________________________ Koha-patches mailing list Koha-patches@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/