@@ -, +, @@ subfield values for MARC21 a) You must have at least one authority type besides the 'Default'. b) View the MARC structure of the 'Default' auth type, then click on 'Actions->Subfields' for tag 500; click on 'Edit subfields'. Select the subfield 'a' tab, then pick an auth type from the 'Thesaurus:' dropdown menu; click 'Save changes' at the top. and pick the 'Default' authority type (or edit an existing auth). a relator code from the 'Special relationship:' dropdown, and then click on the 'Choose' button for one of the authorities you found. UNIMARC setup: notice how subfields $3 and $5 are not populated. MARC21/NORMARC: all subfields are populated correctly, as before. UNIMARC: both the relator code and the authority id are copied over along with any other subfields that may exist. as before, launch the biblio editor, find a MARC tag that allows you to search for an authority, and link it. MARC21/NORMARC: all authority data is copied over (auth id in $9). UNIMARC: all authority data is copied over (auth id in $9). --- authorities/blinddetail-biblio-search.pl | 22 ++++++++++++++++++---- .../authorities/blinddetail-biblio-search.tt | 15 +++++++++++++-- .../modules/authorities/searchresultlist-auth.tt | 11 ++++++----- 3 files changed, 37 insertions(+), 11 deletions(-) --- a/authorities/blinddetail-biblio-search.pl +++ a/authorities/blinddetail-biblio-search.pl @@ -57,8 +57,11 @@ my $dbh = C4::Context->dbh; my $authid = $query->param('authid'); my $index = $query->param('index'); my $tagid = $query->param('tagid'); +my $source = $query->param('source'); my $relationship = $query->param('relationship'); +my $marcflavour = C4::Context->preference("marcflavour"); + # open template my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { @@ -89,7 +92,8 @@ if ($authid) { # Get all values for each distinct subfield and add to subfield loop my %done_subfields; for ( $field->subfields ) { - next if $_->[0] eq '9'; # $9 will be set with authid value + next if $_->[0] eq '3'; # $3 will be set with authid value (in UNIMARC authorities) + next if $_->[0] eq '9'; # $9 will be set with authid value (in MARC21/NORMARC authorities and also MARC21/NORMARC/UNIMARC biblios) my $letter = $_->[0]; $letter ||= '@'; next if defined $done_subfields{$letter}; @@ -98,7 +102,17 @@ if ($authid) { $done_subfields{$letter} = 1; } - push( @subfield_loop, { marc_subfield => 'w', marc_values => $relationship } ) if ( $relationship ); + # If a relationship code has been selected, add it to the appropriate + # subfield of @subfield_loop, depending on the MARC flavour being used. + if ( $relationship ) { + my $relationship_subfield; + if ( $marcflavour eq 'UNIMARC' ) { + $relationship_subfield = '5'; + } elsif ( $marcflavour eq 'MARC21' || $marcflavour eq 'NORMARC' ) { + $relationship_subfield = 'w'; + } + push( @subfield_loop, { marc_subfield => $relationship_subfield, marc_values => $relationship } ) ; + } my $controlled_ind = $auth->controlled_indicators({ record => $record, biblio_tag => $tag_number }); $indicator1 = $controlled_ind->{ind1}; @@ -112,9 +126,9 @@ if ($authid) { $template->param( "clear" => 1 ); } - - $template->param( + source => $source, + marcflavour => $marcflavour, authid => $authid ? $authid : "", index => $index, tagid => $tagid, --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tt @@ -35,7 +35,9 @@ [%- FOREACH marc_value IN SUBFIELD_LOO.marc_values -%] [%- marc_value |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html -%] [%- END -%] - [%- END -%]‡9[% authid | html %]"; + [%- END -%][% IF ( marcflavour == 'UNIMARC' ) %]‡3[% authid %]"; + [% ELSIF ( marcflavour == 'MARC21' ) || ( marcflavour == 'NORMARC' ) %]‡9[% authid %]"; + [% END %] [% END %] RancorReplaceField( new_line, "[% indicator1 | html %]", "[% indicator2 | html %]" ); [% ELSE %] @@ -135,7 +137,16 @@ [% IF ( clear ) %] if (subfield){subfield.value="" ;} [% ELSE %] - if(code.value=='9'){ + [% IF ( marcflavour == 'UNIMARC' ) %] + [% IF ( source == 'auth' ) %] + var authid_subfield = "3"; + [% ELSIF ( source == 'biblio' ) %] + var authid_subfield = "9"; + [% END %] + [% ELSIF ( marcflavour == 'MARC21' ) || ( marcflavour == 'NORMARC' ) %] + var authid_subfield = "9"; + [% END %] + if(code.value==authid_subfield){ subfield.value = "[% authid |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]"; break; } --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tt @@ -99,14 +99,15 @@ } function doauth(authid, index, repet){ - [% IF source == 'auth' %] + var source = "[% source %]"; + if ( source == 'auth' ) { var e = document.getElementById("relationship"); var relationship = e.options[e.selectedIndex].value; - jumpfull('blinddetail-biblio-search.pl?authid=' + authid + '&index=' + index + '&repet=' + repet + '&relationship=' + relationship); - [% ELSE %] - jumpfull('blinddetail-biblio-search.pl?authid=' + authid + '&index=' + index + '&repet=' + repet); - [% END %] + jumpfull('blinddetail-biblio-search.pl?authid=' + authid + '&index=' + index + '&repet=' + repet + '&source=' + source + '&relationship=' + relationship); + } else { + jumpfull('blinddetail-biblio-search.pl?authid=' + authid + '&index=' + index + '&repet=' + repet + '&source=' + source); + } } [% END %] --