View | Details | Raw Unified | Return to bug 12747
Collapse All | Expand All

(-)a/C4/Breeding.pm (-8 lines)
Lines 228-241 sub Z3950Search { Link Here
228
        push @servers, {id => $id};
228
        push @servers, {id => $id};
229
    }
229
    }
230
230
231
    my $pref_addnumber = C4::Context->preference('AdditionalFieldsInZ3950ResultSearch');
232
    $pref_addnumber =~ s/^\s+|\s+$//g;
233
    $pref_addnumber =~ s/\h+/ /g;
234
    if ($pref_addnumber){
235
        $template->param(
236
            additionalFields => '1',
237
        );
238
    }
239
231
240
    $template->param(
232
    $template->param(
241
        breeding_loop => \@breeding_loop,
233
        breeding_loop => \@breeding_loop,
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt (-2 / +3 lines)
Lines 4-9 Link Here
4
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
4
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
5
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'doc-head-close.inc' %]
6
[% INCLUDE 'datatables.inc' %]
6
[% INCLUDE 'datatables.inc' %]
7
[% USE Koha %]
7
8
8
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
9
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
9
<script type="text/javascript">
10
<script type="text/javascript">
Lines 168-174 tr.selected { background-color : #FFFFCC; } tr.selected td { background-color : Link Here
168
        <th>Author</th>
169
        <th>Author</th>
169
        <th>ISBN</th>
170
        <th>ISBN</th>
170
        <th>LCCN</th>
171
        <th>LCCN</th>
171
        [% IF additionalFields %]
172
        [%- IF Koha.Preference( 'AdditionalFieldsInZ3950ResultSearch' ) -%]
172
        <th>Additional fields</th>
173
        <th>Additional fields</th>
173
        [% END %]
174
        [% END %]
174
        <th>Preview</th>
175
        <th>Preview</th>
Lines 183-189 tr.selected { background-color : #FFFFCC; } tr.selected td { background-color : Link Here
183
            <td>[% breeding_loo.author %]</td>
184
            <td>[% breeding_loo.author %]</td>
184
            <td>[% breeding_loo.isbn %]</td>
185
            <td>[% breeding_loo.isbn %]</td>
185
            <td>[% breeding_loo.lccn %]</td>
186
            <td>[% breeding_loo.lccn %]</td>
186
            [% IF additionalFields %]
187
            [%- IF Koha.Preference( 'AdditionalFieldsInZ3950ResultSearch' ) -%]
187
            <td>
188
            <td>
188
               <dl>
189
               <dl>
189
                  [% FOREACH addnumberfield IN breeding_loo.addnumberfields %]
190
                  [% FOREACH addnumberfield IN breeding_loo.addnumberfields %]
(-)a/t/db_dependent/Breeding.t (-2 / +47 lines)
Lines 20-28 Link Here
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use FindBin;
22
use FindBin;
23
use Test::More tests => 3;
23
use Test::More tests => 4;
24
use Test::Warn;
24
use Test::Warn;
25
25
26
use C4::Context;
26
use C4::Breeding;
27
use C4::Breeding;
27
use Koha::XSLT_Handler;
28
use Koha::XSLT_Handler;
28
29
Lines 49-54 subtest '_do_xslt_proc' => sub { Link Here
49
    plan tests => 7;
50
    plan tests => 7;
50
    test_do_xslt();
51
    test_do_xslt();
51
};
52
};
53
#Group 4: testing _add_rowdata (part of Z3950Search)
54
subtest '_add_rowdata' => sub {
55
    plan tests => 4;
56
    test_add_rowdata();
57
};
52
58
53
#-------------------------------------------------------------------------------
59
#-------------------------------------------------------------------------------
54
60
Lines 186-188 sub test_do_xslt { Link Here
186
    is ( $res[0]->subfield('245','a') eq 'Just a title', 1,
192
    is ( $res[0]->subfield('245','a') eq 'Just a title', 1,
187
        'At least the title is the same :)' );
193
        'At least the title is the same :)' );
188
}
194
}
189
- 
195
196
sub test_add_rowdata {
197
198
	my $old_preference = C4::Context->preference("AdditionalFieldsInZ3950ResultSearch");
199
    C4::Context->set_preference("AdditionalFieldsInZ3950ResultSearch","");
200
201
    my $row = {
202
       biblionumber => 0,
203
       server => "testServer",
204
       breedingid => 0,
205
   };
206
207
    my $biblio = MARC::Record->new();
208
    $biblio->append_fields(
209
        MARC::Field->new('245', ' ', ' ', a => 'Just a title'), #title
210
    );
211
212
    my $returned_row = C4::Breeding::_add_rowdata($row,$biblio);
213
214
    is($returned_row->{title} ,"Just a title","_add_rowdata returns the title of a biblio");
215
    is($returned_row->{addnumberfields}[0],undef,"_add_rowdata returns undef if it has no additionnal field");
216
217
    C4::Context->set_preference("AdditionalFieldsInZ3950ResultSearch","245\$a");
218
219
    $row = {
220
       biblionumber => 0,
221
       server => "testServer",
222
       breedingid => 0,
223
   };
224
   $biblio = MARC::Record->new();
225
   $biblio->append_fields(
226
       MARC::Field->new('245', ' ', ' ', a => 'Just a title'), #title
227
   );
228
   $returned_row = C4::Breeding::_add_rowdata($row,$biblio);
229
230
   is($returned_row->{title} ,"Just a title","_add_rowdata returns the title of a biblio");
231
   is($returned_row->{addnumberfields}[0],"245\$a","_add_rowdata returns the field number chosen in the AdditionalFieldsInZ3950ResultSearch preference");
232
233
   C4::Context->set_preference("AdditionalFieldsInZ3950ResultSearch",$old_preference); #resets the preferences to their original values
234
}

Return to bug 12747