Bugzilla – Attachment 62938 Details for
Bug 11297
Add support for custom PQF attributes for Z39.50 server searches
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED OFF] Bug 11297 - Add support for custom PQF attributes for Z39.50 server searches.
SIGNED-OFF-Bug-11297---Add-support-for-custom-PQF-.patch (text/plain), 8.26 KB, created by
Katrin Fischer
on 2017-05-01 23:29:47 UTC
(
hide
)
Description:
[SIGNED OFF] Bug 11297 - Add support for custom PQF attributes for Z39.50 server searches.
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2017-05-01 23:29:47 UTC
Size:
8.26 KB
patch
obsolete
>From 1439870a3a1f00cbe59d04836c419a8c7d046e4f Mon Sep 17 00:00:00 2001 >From: mxbeaulieu <maxime.beaulieu@inlibro.com> >Date: Tue, 7 Jul 2015 14:15:13 -0400 >Subject: [PATCH] [SIGNED OFF] Bug 11297 - Add support for custom PQF > attributes for Z39.50 server searches. >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Adds the "Attributes" field to z3950 servers. > >The feature here is not quite de same. > >In the old patches, the attributes were applied to individual query parts if the part already contains "@attr" and the additionnal attribute is not already in the query part. > >Here, the content of the new field is prepended to all PQF queries sent to the server. > >This new way of doing is simpler and works for the sponsor. > >Test plan: > I) Apply the patch >II) Run updatedatabase.pl > >1) Add a new z3950 server with the following parameters: >Hostname : catalogue.banq.qc.ca >Port : 210 >Database : IRIS >Syntax : Marc21 > >2) Perform a z3950 search on that server. > Keyword (Any) : egypt >2.1) Nothing Found. > >3) Add attributes on the server administration page > @attr 4=1 > >4) Perform the same z3950 search >4.1) A lot of results > > modified: C4/Breeding.pm > modified: Koha/Schema/Result/Z3950server.pm > modified: admin/z3950servers.pl > new file: installer/data/mysql/atomicupdate/Bug11297_z3950servers_attributes.sql > modified: installer/data/mysql/kohastructure.sql > modified: koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt > >Followed test plan, works as expected. >Signed-off-by: Marc Véron <veron@veron.ch> > >New sign-off, works as expected. >Signed-off-by: Marc Véron <veron@veron.ch> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > C4/Breeding.pm | 8 ++++++++ > Koha/Schema/Result/Z3950server.pm | 12 ++++++++++-- > admin/z3950servers.pl | 2 +- > .../mysql/atomicupdate/Bug11297_z3950servers_attributes.sql | 1 + > installer/data/mysql/kohastructure.sql | 1 + > .../intranet-tmpl/prog/en/modules/admin/z3950servers.tt | 7 ++++++- > 6 files changed, 27 insertions(+), 4 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/Bug11297_z3950servers_attributes.sql > >diff --git a/C4/Breeding.pm b/C4/Breeding.pm >index ee14c81..9f516c7 100644 >--- a/C4/Breeding.pm >+++ b/C4/Breeding.pm >@@ -156,6 +156,9 @@ sub Z3950Search { > ); > my @servers = $rs->all; > foreach my $server ( @servers ) { >+ if(my $attributes = $server->{attributes}){ >+ $zquery = "$attributes $zquery"; >+ } > $oConnection[$s] = _create_connection( $server ); > $oResult[$s] = > $server->{servertype} eq 'zed'? >@@ -534,6 +537,7 @@ sub Z3950SearchAuth { > my $record; > my @serverhost; > my @servername; >+ my @server_attributes = (); > my @breeding_loop = (); > > my @oConnection; >@@ -619,12 +623,16 @@ sub Z3950SearchAuth { > $serverhost[$s] = $server->{host}; > $servername[$s] = $server->{servername}; > $encoding[$s] = ($server->{encoding}?$server->{encoding}:"iso-5426"); >+ $server_attributes[$s] = $server->{attributes}; > $s++; > } ## while fetch > } # foreach > my $nremaining = $s; > > for ( my $z = 0 ; $z < $s ; $z++ ) { >+ if(my $attributes = $server_attributes[$z]){ >+ $query = "$attributes $query"; >+ } > $oResult[$z] = $oConnection[$z]->search_pqf($query); > } > >diff --git a/Koha/Schema/Result/Z3950server.pm b/Koha/Schema/Result/Z3950server.pm >index d3f3f50..8c7872c 100644 >--- a/Koha/Schema/Result/Z3950server.pm >+++ b/Koha/Schema/Result/Z3950server.pm >@@ -120,6 +120,12 @@ __PACKAGE__->table("z3950servers"); > data_type: 'mediumtext' > is_nullable: 1 > >+=head2 attributes >+ >+ data_type: 'varchar' >+ is_nullable: 1 >+ size: 255 >+ > =cut > > __PACKAGE__->add_columns( >@@ -167,6 +173,8 @@ __PACKAGE__->add_columns( > { data_type => "mediumtext", is_nullable => 1 }, > "add_xslt", > { data_type => "mediumtext", is_nullable => 1 }, >+ "attributes", >+ { data_type => "varchar", is_nullable => 1, size => 255 }, > ); > > =head1 PRIMARY KEY >@@ -182,8 +190,8 @@ __PACKAGE__->add_columns( > __PACKAGE__->set_primary_key("id"); > > >-# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-09-01 10:16:04 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:q0y03nGYIt0eDIVui0UUdw >+# Created by DBIx::Class::Schema::Loader v0.07042 @ 2015-07-07 12:23:15 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:jyVvIir/Xm1d4t11W2XwZA > > > # You can replace this text with custom code or comments, and it will be preserved on regeneration >diff --git a/admin/z3950servers.pl b/admin/z3950servers.pl >index d1fe85b..8e085ed 100755 >--- a/admin/z3950servers.pl >+++ b/admin/z3950servers.pl >@@ -66,7 +66,7 @@ if( $op eq 'delete_confirmed' && $id ) { > $id = 0; > } elsif ( $op eq 'add_validated' ) { > my @fields=qw/host port db userid password rank syntax encoding timeout >- recordtype checked servername servertype sru_options sru_fields >+ recordtype checked servername servertype sru_options sru_fields attributes > add_xslt/; > my $formdata = _form_data_hashref( $input, \@fields ); > if( $id ) { >diff --git a/installer/data/mysql/atomicupdate/Bug11297_z3950servers_attributes.sql b/installer/data/mysql/atomicupdate/Bug11297_z3950servers_attributes.sql >new file mode 100644 >index 0000000..a4e56e5 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/Bug11297_z3950servers_attributes.sql >@@ -0,0 +1 @@ >+ ALTER TABLE z3950servers ADD COLUMN attributes VARCHAR(255) after add_xslt; >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 94ef125..9034d51 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -2320,6 +2320,7 @@ CREATE TABLE `z3950servers` ( -- connection information for the Z39.50 targets u > `sru_options` varchar(255) default NULL, -- options like sru=get, sru_version=1.1; will be passed to the server via ZOOM > `sru_fields` mediumtext default NULL, -- contains the mapping between the Z3950 search fields and the specific SRU server indexes > `add_xslt` mediumtext default NULL, -- zero or more paths to XSLT files to be processed on the search results >+ `attributes` VARCHAR(255) default NULL, -- additionnal attributes passed to PQF queries > PRIMARY KEY (`id`) > ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt >index 4a6a968..2cf1cbf 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt >@@ -152,6 +152,9 @@ > </li> > <li><label for="rank">Rank (display order): </label> <input type="text" name="rank" id="rank" size="4" value="[% server.rank %]" /> > </li> >+ <li><label for="attributes">Attributes (additional PQF attributes added to each query): </label><input type="text" name="attributes" id="attributes" size="30" value="[% server.attributes %]" /> >+ </li> >+ > > <li><label for="syntax">Syntax (z3950 can send<br /> records in various format. Choose one): </label> > <select name="syntax" id="syntax"> >@@ -228,7 +231,8 @@ > You searched for [% searchfield %] > [% END %] > <table id="serverst"> >- <thead><tr><th>Target</th><th>Hostname/Port</th><th>Database</th><th>Userid</th><th>Password</th><th>Preselected</th><th>Rank</th><th>Syntax</th><th>Encoding</th><th>Timeout</th><th>Record type</th><th></th> >+ >+ <thead><tr><th>Target</th><th>Hostname/Port</th><th>Database</th><th>Userid</th><th>Password</th><th>Preselected</th><th>Rank</th><th>Syntax</th><th>Encoding</th><th>Timeout</th><th>Record type</th><th>Attributes</th><th>Options</th> > </tr></thead> > <tbody> > [% FOREACH loo IN loop %] >@@ -241,6 +245,7 @@ > <span>Authority</span> > [% END %] > </td> >+ <td>[% loo.attributes %]</td> > <td> > <div class="dropdown"> > <a class="btn btn-default btn-xs dropdown-toggle" id="reportactions[% savedreport.id %]" role="button" data-toggle="dropdown" href="#"> >-- >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 11297
:
23144
|
23145
|
40829
|
40889
|
48649
|
50415
|
50416
|
50420
|
50954
|
59448
|
62938
|
62939
|
70190
|
70191
|
70192
|
70193
|
70194
|
70195
|
70196
|
71992
|
71993
|
71994
|
72061
|
72062
|
72063
|
77718
|
77719
|
77720
|
77721
|
77722
|
77723
|
78294
|
78295
|
78296
|
78297
|
80372
|
80496
|
80497
|
80498
|
80499
|
81328
|
81342
|
81343
|
81344
|
81345
|
81346
|
92719
|
92720
|
92721
|
92722
|
98598
|
98599
|
98600
|
98601
|
99227
|
99228
|
99229
|
99230
|
99231