@@ -, +, @@ -- --- C4/Breeding.pm | 41 ++++++++++++++++++++ ...47-additional_fields_in_Z3950_search_result.sql | 1 + installer/data/mysql/sysprefs.sql | 1 + .../prog/en/modules/acqui/z3950_search.tt | 20 +++++++++- .../en/modules/admin/preferences/cataloguing.pref | 4 ++ .../prog/en/modules/cataloguing/z3950_search.tt | 23 ++++++++++- t/db_dependent/Breeding.t | 44 +++++++++++++++++++++- 7 files changed, 129 insertions(+), 5 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_12747-additional_fields_in_Z3950_search_result.sql mode change 100644 => 100755 t/db_dependent/Breeding.t --- a/C4/Breeding.pm +++ a/C4/Breeding.pm @@ -25,6 +25,7 @@ use C4::Biblio; use C4::Koha; use C4::Charset; use MARC::File::USMARC; +use MARC::Field; use C4::ImportBatch; use C4::AuthoritiesMarc; #GuessAuthTypeCode, FindDuplicateAuthority use C4::Languages; @@ -336,6 +337,46 @@ sub _add_rowdata { } $row->{date}//= $row->{date2}; $row->{isbn}=_isbn_replace($row->{isbn}); + + $row = _add_custom_field_rowdata($row, $record); + + return $row; +} + +sub _add_custom_field_rowdata +{ + my ( $row, $record ) = @_; + my $pref_newtags = C4::Context->preference('AdditionalFieldsInZ3950ResultSearch'); + + $pref_newtags =~ s/^\s+|\s+$//g; + $pref_newtags =~ s/\h+/ /g; + + my @addnumberfields; + + foreach my $field (split / /, $pref_newtags) { + my ($tag, $subtags) = split(/\$/, $field); + + if ( $record->field($tag) ) { + my $marcfield = $record->field($tag); + + if ( $subtags ) { + my $content = ''; + for my $code (split //, $subtags) { + $content .= $marcfield->subfield($code) . ' '; + } + + $row->{$field} = $content; + } elsif ( $tag <= 10 ) { + $row->{$field} = $marcfield->data(); + } else { + $row->{$field} = $marcfield->as_string(); + } + push( @addnumberfields, $field ); + } + } + + $row->{'addnumberfields'} = \@addnumberfields; + return $row; } --- a/installer/data/mysql/atomicupdate/bug_12747-additional_fields_in_Z3950_search_result.sql +++ a/installer/data/mysql/atomicupdate/bug_12747-additional_fields_in_Z3950_search_result.sql @@ -0,0 +1, @@ +INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ('AdditionalFieldsInZ3950ResultSearch', '', 'NULL', 'Determines which MARC field/subfields are displayed in -Additional field- column in the result of a search Z3950', 'Free'); --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -6,6 +6,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('AcquisitionDetails', '1', '', 'Hide/Show acquisition details on the biblio detail page.', 'YesNo'), ('AcqViewBaskets','user','user|branch|all','Define which baskets a user is allowed to view: his own only, any within his branch or all','Choice'), ('AcqWarnOnDuplicateInvoice','0','','Warn librarians when they try to create a duplicate invoice','YesNo'), +('AdditionalFieldsInZ3950ResultSearch', '', NULL, 'Determines which MARC field/subfields are displayed in -Additional field- column in the result of a search Z3950', 'Free'), ('AddressFormat','us','us|de|fr','Choose format to display postal addresses', 'Choice'), ('advancedMARCeditor','0','','If ON, the MARC editor won\'t display field/subfield descriptions','YesNo'), ('AdvancedSearchLanguages','','','ISO 639-2 codes of languages you wish to see appear as an Advanced search option. Example: eng|fre|ita','Textarea'), --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt @@ -3,6 +3,9 @@ Koha › Acquisitions › [% IF ( opsearch ) %]Order from external source[% ELSE %]Order from external source › Search results[% END %] [% INCLUDE 'doc-head-close.inc' %] +[% INCLUDE 'datatables.inc' %] +[% USE Koha %] +