Bugzilla – Attachment 67314 Details for
Bug 12747
Add configurable extra column in Z3950 search result
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12747 - Corrections on QA feedback
Bug-12747---Corrections-on-QA-feedback.patch (text/plain), 8.99 KB, created by
David Bourgault
on 2017-09-22 15:38:32 UTC
(
hide
)
Description:
Bug 12747 - Corrections on QA feedback
Filename:
MIME Type:
Creator:
David Bourgault
Created:
2017-09-22 15:38:32 UTC
Size:
8.99 KB
patch
obsolete
>From 3755a5d01c03ebe043b267c0d239af7a60b67dab Mon Sep 17 00:00:00 2001 >From: David Bourgault <david.bourgault@inlibro.com> >Date: Fri, 22 Sep 2017 11:29:14 -0400 >Subject: [PATCH] Bug 12747 - Corrections on QA feedback > >C4/Breeding.pm >+ code in _add_rowdata moved to new subroutine (_add_custom_field_rowdata) >- removed useless code > >Templates: >* template use Koha.Preference instead of passed param. > >Syspref.sql >* corrected order >- removed unrelated modification to other system preferences >--- > C4/Breeding.pm | 78 ++++++++++++---------- > installer/data/mysql/sysprefs.sql | 3 +- > .../prog/en/modules/acqui/z3950_search.tt | 5 +- > .../prog/en/modules/cataloguing/z3950_search.tt | 5 +- > t/db_dependent/Breeding.t | 2 +- > 5 files changed, 49 insertions(+), 44 deletions(-) > >diff --git a/C4/Breeding.pm b/C4/Breeding.pm >index cfa5626..d4f56b2 100644 >--- a/C4/Breeding.pm >+++ b/C4/Breeding.pm >@@ -221,19 +221,11 @@ sub Z3950Search { > $oConnection[$_]->destroy(); > } > >- @servers = (); >- foreach my $id (@id) { >- push @servers, {id => $id}; >- } >- > $template->param( > breeding_loop => \@breeding_loop, > servers => \@servers, > errconn => \@errconn > ); >- $template->param( >- additionalFields => '1' >- ) if C4::Context->preference('AdditionalFieldsInZ3950ResultSearch'); > } > > sub _build_query { >@@ -348,39 +340,51 @@ sub _add_rowdata { > $row->{date}//= $row->{date2}; > $row->{isbn}=_isbn_replace($row->{isbn}); > >- my $pref_addnumber = C4::Context->preference('AdditionalFieldsInZ3950ResultSearch'); >+ $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; > >- $pref_addnumber =~ s/^\s+|\s+$//g; >- $pref_addnumber =~ s/\h+/ /g; >- my @addnumber_array = split / /, $pref_addnumber; >+ my @addnumber_array = split / /, $pref_newtags; > my @addnumberfields; >+ > foreach (@addnumber_array) { > my $length = length($_); >- my $adTag = substr($_, 0, 3); >- if ($record->field($adTag)) { >- my $field = $record->field($adTag); >- my $fieldContent=''; >- if ($length > 3){ >- my $adSubfield; >- for (my $i=0; $i<$length-4; $i++){ # 4 because 3 digits, 1 dollar sign ($) >- $adSubfield = substr($_, 4+$i, 1); >- $fieldContent = $fieldContent.$field->subfield($adSubfield).' '; >- } >- push(@addnumberfields, $_); >- $row->{$_} = $fieldContent; >- } >- else { >- if($adTag <= 10){ >- my $data = $field->data(); >- push(@addnumberfields, $_); >- $row->{$_} = $data; >- } >- else { >- my $subfields_text = $field->as_string(); >- push(@addnumberfields, $_); >- $row->{$_} = $subfields_text; >- } >- } >+ my $adTag = substr( $_, 0, 3 ); >+ >+ if ( $record->field($adTag) ) { >+ my $field = $record->field($adTag); >+ my $fieldContent = ''; >+ >+ if ( $length > 3 ) { >+ my $adSubfield; >+ for ( my $i = 4; $i < $length; $i++ ) { # 4 because 3 digits, 1 dollar sign ($) >+ $adSubfield = substr( $_, $i, 1 ); >+ $fieldContent = $fieldContent . $field->subfield($adSubfield) . ' '; >+ } >+ push( @addnumberfields, $_ ); >+ $row->{$_} = $fieldContent; >+ } >+ else { >+ if ( $adTag <= 10 ) { >+ my $data = $field->data(); >+ push( @addnumberfields, $_ ); >+ $row->{$_} = $data; >+ } >+ else { >+ my $subfields_text = $field->as_string(); >+ push( @addnumberfields, $_ ); >+ $row->{$_} = $subfields_text; >+ } >+ } > } > } > >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 3f1f558..0e4651e 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -6,9 +6,8 @@ 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'), >-('AddressFormat','us','','Choose format to display postal addresses', 'Choice'), > ('AdditionalFieldsInZ3950ResultSearch', '', NULL, 'Determines which MARC field/subfields are displayed in -Additional field- column in the result of a search Z3950', 'Free'), >-('AddPatronLists','categorycode','categorycode|category_type','Allow user to choose what list to pick up from when adding patrons','Choice'), >+('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'), > ('AdvancedSearchTypes','itemtypes','itemtypes|ccode','Select which set of fields comprise the Type limit in the advanced search','Choice'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt >index 3f8d3b0..b9edb72 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt >@@ -1,3 +1,4 @@ >+[% USE Koha %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Acquisitions › [% IF ( opsearch ) %]Order from external source[% ELSE %]Order from external source › Search results[% END %]</title> > <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> >@@ -132,7 +133,7 @@ tr.selected { background-color : #FFFFCC; } tr.selected td { background-color : > <th>Author</th> > <th>ISBN</th> > <th>LCCN</th> >- [% IF additionalFields %] >+ [% IF Koha.Preference('AdditionalFieldsInZ3950ResultSearch') != '' %] > <th>Additional fields</th> > [% END %] > <th>Preview</th> >@@ -147,7 +148,7 @@ tr.selected { background-color : #FFFFCC; } tr.selected td { background-color : > <td>[% breeding_loo.author %]</td> > <td>[% breeding_loo.isbn %]</td> > <td>[% breeding_loo.lccn %]</td> >- [% IF additionalFields %] >+ [% IF Koha.Preference('AdditionalFieldsInZ3950ResultSearch') != '' %] > <td> > <dl> > [% FOREACH addnumberfield IN breeding_loo.addnumberfields %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tt >index 52c2873..d4813d4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tt >@@ -1,3 +1,4 @@ >+[% USE Koha %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Z39.50/SRU search results</title> > [% INCLUDE 'doc-head-close.inc' %] >@@ -144,7 +145,7 @@ tr.selected { background-color : #FFFFCC; } tr.selected td { background-color : > <th>Edition</th> > <th>ISBN</th> > <th>LCCN</th> >- [% IF additionalFields %] >+ [% IF Koha.Preference('AdditionalFieldsInZ3950ResultSearch') != '' %] > <th>Additional fields</th> > [% END %] > <th>MARC</th> >@@ -162,7 +163,7 @@ tr.selected { background-color : #FFFFCC; } tr.selected td { background-color : > <td>[% breeding_loo.edition %]</td> > <td>[% breeding_loo.isbn %]</td> > <td>[% breeding_loo.lccn %]</td> >- [% IF additionalFields %] >+ [% IF Koha.Preference('AdditionalFieldsInZ3950ResultSearch') != '' %] > <td> > <dl> > [% FOREACH addnumberfield IN breeding_loo.addnumberfields %] >diff --git a/t/db_dependent/Breeding.t b/t/db_dependent/Breeding.t >index 8bb4c2a..9856b9a 100755 >--- a/t/db_dependent/Breeding.t >+++ b/t/db_dependent/Breeding.t >@@ -195,7 +195,7 @@ sub test_do_xslt { > > sub test_add_rowdata { > >- my $old_preference = C4::Context->preference("AdditionalFieldsInZ3950ResultSearch"); >+ my $old_preference = C4::Context->preference("AdditionalFieldsInZ3950ResultSearch"); > C4::Context->set_preference("AdditionalFieldsInZ3950ResultSearch",""); > > my $row = { >-- >2.7.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 12747
:
30713
|
36823
|
37836
|
37893
|
38221
|
38233
|
38240
|
38286
|
38439
|
38440
|
38456
|
38457
|
38458
|
38460
|
41313
|
41317
|
41318
|
41319
|
58424
|
58425
|
58426
|
60965
|
66586
|
66587
|
66588
|
66589
|
67314
|
67315
|
68214
|
68215
|
69297
|
72706
|
72896
|
72897
|
72898
|
72979
|
72980
|
72981
|
73930
|
73955
|
74035
|
74037
|
74038
|
74039
|
74040
|
74783
|
74784
|
74785
|
74786
|
74787
|
75096
|
77729
|
78270
|
78271
|
78272
|
78687
|
78688
|
79349
|
79350
|
79351