Bugzilla – Attachment 41313 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]
Bug12747 - Follow-up to QA
Bug12747---Follow-up-to-QA.patch (text/plain), 4.88 KB, created by
Rémi Mayrand-Provencher
on 2015-08-03 14:43:14 UTC
(
hide
)
Description:
Bug12747 - Follow-up to QA
Filename:
MIME Type:
Creator:
Rémi Mayrand-Provencher
Created:
2015-08-03 14:43:14 UTC
Size:
4.88 KB
patch
obsolete
>From fba6e6119937679222908488528e754061b23ec7 Mon Sep 17 00:00:00 2001 >From: remi <remi.mayrand-provencher@inLibro.com> >Date: Mon, 3 Aug 2015 10:35:02 -0400 >Subject: [PATCH] Bug12747 - Follow-up to QA > >Removed unnecessary code in Breeding.pm and provided a new test in Breeding.t >--- > C4/Breeding.pm | 8 ---- > .../prog/en/modules/acqui/z3950_search.tt | 5 +- > t/db_dependent/Breeding.t | 48 +++++++++++++++++++- > 3 files changed, 50 insertions(+), 11 deletions(-) > mode change 100644 => 100755 t/db_dependent/Breeding.t > >diff --git a/C4/Breeding.pm b/C4/Breeding.pm >index 4f9a94b..6ca499d 100644 >--- a/C4/Breeding.pm >+++ b/C4/Breeding.pm >@@ -228,14 +228,6 @@ sub Z3950Search { > push @servers, {id => $id}; > } > >- my $pref_addnumber = C4::Context->preference('AdditionalFieldsInZ3950ResultSearch'); >- $pref_addnumber =~ s/^\s+|\s+$//g; >- $pref_addnumber =~ s/\h+/ /g; >- if ($pref_addnumber){ >- $template->param( >- additionalFields => '1', >- ); >- } > > $template->param( > breeding_loop => \@breeding_loop, >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 046e402..58a3ee8 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 >@@ -4,6 +4,7 @@ > <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" /> > [% INCLUDE 'doc-head-close.inc' %] > [% INCLUDE 'datatables.inc' %] >+[% USE Koha %] > > <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script> > <script type="text/javascript"> >@@ -168,7 +169,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> >@@ -183,7 +184,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/t/db_dependent/Breeding.t b/t/db_dependent/Breeding.t >old mode 100644 >new mode 100755 >index 6cfd684..8bb4c2a >--- a/t/db_dependent/Breeding.t >+++ b/t/db_dependent/Breeding.t >@@ -20,9 +20,10 @@ > use Modern::Perl; > > use FindBin; >-use Test::More tests => 3; >+use Test::More tests => 4; > use Test::Warn; > >+use C4::Context; > use C4::Breeding; > use Koha::XSLT_Handler; > >@@ -49,6 +50,11 @@ subtest '_do_xslt_proc' => sub { > plan tests => 7; > test_do_xslt(); > }; >+#Group 4: testing _add_rowdata (part of Z3950Search) >+subtest '_add_rowdata' => sub { >+ plan tests => 4; >+ test_add_rowdata(); >+}; > > #------------------------------------------------------------------------------- > >@@ -186,3 +192,43 @@ sub test_do_xslt { > is ( $res[0]->subfield('245','a') eq 'Just a title', 1, > 'At least the title is the same :)' ); > } >+ >+sub test_add_rowdata { >+ >+ my $old_preference = C4::Context->preference("AdditionalFieldsInZ3950ResultSearch"); >+ C4::Context->set_preference("AdditionalFieldsInZ3950ResultSearch",""); >+ >+ my $row = { >+ biblionumber => 0, >+ server => "testServer", >+ breedingid => 0, >+ }; >+ >+ my $biblio = MARC::Record->new(); >+ $biblio->append_fields( >+ MARC::Field->new('245', ' ', ' ', a => 'Just a title'), #title >+ ); >+ >+ my $returned_row = C4::Breeding::_add_rowdata($row,$biblio); >+ >+ is($returned_row->{title} ,"Just a title","_add_rowdata returns the title of a biblio"); >+ is($returned_row->{addnumberfields}[0],undef,"_add_rowdata returns undef if it has no additionnal field"); >+ >+ C4::Context->set_preference("AdditionalFieldsInZ3950ResultSearch","245\$a"); >+ >+ $row = { >+ biblionumber => 0, >+ server => "testServer", >+ breedingid => 0, >+ }; >+ $biblio = MARC::Record->new(); >+ $biblio->append_fields( >+ MARC::Field->new('245', ' ', ' ', a => 'Just a title'), #title >+ ); >+ $returned_row = C4::Breeding::_add_rowdata($row,$biblio); >+ >+ is($returned_row->{title} ,"Just a title","_add_rowdata returns the title of a biblio"); >+ is($returned_row->{addnumberfields}[0],"245\$a","_add_rowdata returns the field number chosen in the AdditionalFieldsInZ3950ResultSearch preference"); >+ >+ C4::Context->set_preference("AdditionalFieldsInZ3950ResultSearch",$old_preference); #resets the preferences to their original values >+} >-- >1.7.9.5
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