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

(-)a/C4/Breeding.pm (-106 / +71 lines)
Lines 227-232 sub Z3950Search { Link Here
227
    );
227
    );
228
}
228
}
229
229
230
sub _auth_build_query {
231
    my ( $pars ) = @_;
232
233
    my $nameany= $pars->{nameany};
234
    my $authorany= $pars->{authorany};
235
    my $authorpersonal= $pars->{authorpersonal};
236
    my $authorcorp= $pars->{authorcorp};
237
    my $authormeetingcon= $pars->{authormeetingcon};
238
    my $title= $pars->{title};
239
    my $uniformtitle= $pars->{uniformtitle};
240
    my $subject= $pars->{subject};
241
    my $subjectsubdiv= $pars->{subjectsubdiv};
242
    my $srchany= $pars->{srchany};
243
    my $authid= $pars->{authid};
244
245
    my $qry_build = {
246
        nameany           => '@attr 1=1002 "#term" ',
247
        authorany         => '@attr 1=1003 "#term" ',
248
        authorcorp        => '@attr 1=2 "#term" ',
249
        authorpersonal    => '@attr 1=1 "#term" ',
250
        authormeetingcon  => '@attr 1=3 "#term" ',
251
        subject           => '@attr 1=21 "#term" ',
252
        subjectsubdiv     => '@attr 1=47 "#term" ',
253
        title             => '@attr 1=4 "#term" ',
254
        uniformtitle      => '@attr 1=6 "#term" ',
255
        srchany           => '@attr 1=1016 "#term" ',
256
    };
257
258
    my $zquery='';
259
    my $squery='';
260
    my $nterms=0;
261
    foreach my $k ( sort keys %$pars ) {
262
    #note that the sort keys forces an identical result under Perl 5.18
263
    #one of the unit tests is based on that assumption
264
        if( ( my $val=$pars->{$k} ) && $qry_build->{$k} ) {
265
            $qry_build->{$k} =~ s/#term/$val/g;
266
            $zquery .= $qry_build->{$k};
267
            $squery .= "[$k]=\"$val\" and ";
268
            $nterms++;
269
        }
270
    }
271
    $zquery = "\@and " . $zquery for 2..$nterms;
272
    $squery =~ s/ and $//;
273
    return ( $zquery, $squery );
274
275
}
276
230
sub _build_query {
277
sub _build_query {
231
    my ( $pars ) = @_;
278
    my ( $pars ) = @_;
232
279
Lines 268-278 sub _handle_one_result { Link Here
268
    my $raw= $zoomrec->raw();
315
    my $raw= $zoomrec->raw();
269
    my $marcrecord;
316
    my $marcrecord;
270
    if( $servhref->{servertype} eq 'sru' ) {
317
    if( $servhref->{servertype} eq 'sru' ) {
271
        $marcrecord= MARC::Record->new_from_xml( $raw, 'UTF-8',
318
        $raw= MARC::Record->new_from_xml( $raw, $servhref->{encoding}, $servhref->{syntax} );
272
            $servhref->{syntax} );
273
    } else {
274
        ($marcrecord) = MarcToUTF8Record($raw, C4::Context->preference('marcflavour'), $servhref->{encoding} // "iso-5426" ); #ignores charset return values
275
    }
319
    }
320
    ($marcrecord) = MarcToUTF8Record($raw, C4::Context->preference('marcflavour'), $servhref->{encoding} // "iso-5426" ); #ignores charset return values
276
    SetUTF8Flag($marcrecord);
321
    SetUTF8Flag($marcrecord);
277
    my $error;
322
    my $error;
278
    ( $marcrecord, $error ) = _do_xslt_proc($marcrecord, $servhref, $xslh);
323
    ( $marcrecord, $error ) = _do_xslt_proc($marcrecord, $servhref, $xslh);
Lines 369-375 sub _create_connection { Link Here
369
        $option1->option( 'user', $server->{userid} ) if $server->{userid};
414
        $option1->option( 'user', $server->{userid} ) if $server->{userid};
370
        $option1->option( 'password', $server->{password} ) if $server->{password};
415
        $option1->option( 'password', $server->{password} ) if $server->{password};
371
    }
416
    }
372
373
    my $obj= ZOOM::Connection->create($option1);
417
    my $obj= ZOOM::Connection->create($option1);
374
    if( $server->{servertype} eq 'sru' ) {
418
    if( $server->{servertype} eq 'sru' ) {
375
        my $host= $server->{host};
419
        my $host= $server->{host};
Lines 410-416 sub _translate_query { #SRU query adjusted per server cf. srufields column Link Here
410
454
411
=head2 ImportBreedingAuth
455
=head2 ImportBreedingAuth
412
456
413
ImportBreedingAuth($marcrecords,$overwrite_auth,$filename,$encoding,$z3950random,$batch_type);
457
ImportBreedingAuth($marcrecords,$overwrite_auth,$filename,$encoding,$z3950random);
414
458
415
    ImportBreedingAuth imports MARC records in the reservoir (import_records table).
459
    ImportBreedingAuth imports MARC records in the reservoir (import_records table).
416
    ImportBreedingAuth is based on the ImportBreeding subroutine.
460
    ImportBreedingAuth is based on the ImportBreeding subroutine.
Lines 418-426 ImportBreedingAuth($marcrecords,$overwrite_auth,$filename,$encoding,$z3950random Link Here
418
=cut
462
=cut
419
463
420
sub ImportBreedingAuth {
464
sub ImportBreedingAuth {
421
    my ($marcrecords,$overwrite_auth,$filename,$encoding,$z3950random,$batch_type) = @_;
465
    my ($marcrecord,$overwrite_auth,$filename,$encoding,$z3950random) = @_;
422
    my @marcarray = split /\x1D/, $marcrecords;
423
424
    my $dbh = C4::Context->dbh;
466
    my $dbh = C4::Context->dbh;
425
467
426
    my $batch_id = GetZ3950BatchId($filename);
468
    my $batch_id = GetZ3950BatchId($filename);
Lines 435-444 sub ImportBreedingAuth { Link Here
435
    my $alreadyinfarm = 0;
477
    my $alreadyinfarm = 0;
436
    my $notmarcrecord = 0;
478
    my $notmarcrecord = 0;
437
    my $breedingid;
479
    my $breedingid;
438
    for (my $i=0;$i<=$#marcarray;$i++) {
439
        my ($marcrecord, $charset_result, $charset_errors);
440
        ($marcrecord, $charset_result, $charset_errors) =
441
            MarcToUTF8Record($marcarray[$i]."\x1D", $marc_type, $encoding);
442
480
443
        # Normalize the record so it doesn't have separated diacritics
481
        # Normalize the record so it doesn't have separated diacritics
444
        SetUTF8Flag($marcrecord);
482
        SetUTF8Flag($marcrecord);
Lines 482-488 sub ImportBreedingAuth { Link Here
482
                }
520
                }
483
            }
521
            }
484
        }
522
        }
485
    }
486
    return ($notmarcrecord,$alreadyindb,$alreadyinfarm,$imported,$breedingid);
523
    return ($notmarcrecord,$alreadyindb,$alreadyinfarm,$imported,$breedingid);
487
}
524
}
488
525
Lines 506-523 sub Z3950SearchAuth { Link Here
506
    my $random= $pars->{random};
543
    my $random= $pars->{random};
507
    my $page= $pars->{page};
544
    my $page= $pars->{page};
508
545
509
    my $nameany= $pars->{nameany};
546
    
510
    my $authorany= $pars->{authorany};
511
    my $authorpersonal= $pars->{authorpersonal};
512
    my $authorcorp= $pars->{authorcorp};
513
    my $authormeetingcon= $pars->{authormeetingcon};
514
    my $title= $pars->{title};
515
    my $uniformtitle= $pars->{uniformtitle};
516
    my $subject= $pars->{subject};
517
    my $subjectsubdiv= $pars->{subjectsubdiv};
518
    my $srchany= $pars->{srchany};
519
    my $authid= $pars->{authid};
520
521
    my $show_next       = 0;
547
    my $show_next       = 0;
522
    my $total_pages     = 0;
548
    my $total_pages     = 0;
523
    my $attr = '';
549
    my $attr = '';
Lines 531-631 sub Z3950SearchAuth { Link Here
531
    my $count;
557
    my $count;
532
    my $record;
558
    my $record;
533
    my @serverhost;
559
    my @serverhost;
534
    my @servername;
535
    my @breeding_loop = ();
560
    my @breeding_loop = ();
536
561
537
    my @oConnection;
562
    my @oConnection;
538
    my @oResult;
563
    my @oResult;
539
    my @errconn;
564
    my @errconn;
565
    my @servers;
540
    my $s = 0;
566
    my $s = 0;
541
    my $query;
567
    my $query;
542
    my $nterms=0;
568
    my $nterms=0;
543
569
544
    my $marcflavour = C4::Context->preference('marcflavour');
570
    my $marcflavour = C4::Context->preference('marcflavour');
545
    my $marc_type = $marcflavour eq 'UNIMARC' ? 'UNIMARCAUTH' : $marcflavour;
571
    my $marc_type = $marcflavour eq 'UNIMARC' ? 'UNIMARCAUTH' : $marcflavour;
546
572
    my $authid= $pars->{authid};
547
    if ($nameany) {
573
    my ( $zquery, $squery ) = _auth_build_query( $pars );
548
        $query .= " \@attr 1=1002 \"$nameany\" "; #Any name (this includes personal, corporate, meeting/conference authors, and author names in subject headings)
549
        #This attribute is supported by both the Library of Congress and Libraries Australia 08/05/2013
550
        $nterms++;
551
    }
552
553
    if ($authorany) {
554
        $query .= " \@attr 1=1003 \"$authorany\" "; #Author-name (this includes personal, corporate, meeting/conference authors, but not author names in subject headings)
555
        #This attribute is not supported by the Library of Congress, but is supported by Libraries Australia 08/05/2013
556
        $nterms++;
557
    }
558
559
    if ($authorcorp) {
560
        $query .= " \@attr 1=2 \"$authorcorp\" "; #1005 is another valid corporate author attribute...
561
        $nterms++;
562
    }
563
564
    if ($authorpersonal) {
565
        $query .= " \@attr 1=1 \"$authorpersonal\" "; #1004 is another valid personal name attribute...
566
        $nterms++;
567
    }
568
569
    if ($authormeetingcon) {
570
        $query .= " \@attr 1=3 \"$authormeetingcon\" "; #1006 is another valid meeting/conference name attribute...
571
        $nterms++;
572
    }
573
574
    if ($subject) {
575
        $query .= " \@attr 1=21 \"$subject\" ";
576
        $nterms++;
577
    }
578
579
    if ($subjectsubdiv) {
580
        $query .= " \@attr 1=47 \"$subjectsubdiv\" ";
581
        $nterms++;
582
    }
583
584
    if ($title) {
585
        $query .= " \@attr 1=4 \"$title\" "; #This is a regular title search. 1=6 will give just uniform titles
586
        $nterms++;
587
    }
588
589
     if ($uniformtitle) {
590
        $query .= " \@attr 1=6 \"$uniformtitle\" "; #This is the uniform title search
591
        $nterms++;
592
    }
593
594
    if($srchany) {
595
        $query .= " \@attr 1=1016 \"$srchany\" ";
596
        $nterms++;
597
    }
598
599
    for my $i (1..$nterms-1) {
600
        $query = "\@and " . $query;
601
    }
602
603
    foreach my $servid (@id) {
574
    foreach my $servid (@id) {
604
        my $sth = $dbh->prepare("select * from z3950servers where id=?");
575
        my $sth = $dbh->prepare("select * from z3950servers where id=?");
605
        $sth->execute($servid);
576
        $sth->execute($servid);
606
        while ( $server = $sth->fetchrow_hashref ) {
577
        while ( $server = $sth->fetchrow_hashref ) {
607
            my $option1      = new ZOOM::Options();
578
            $oConnection[$s] = _create_connection( $server );
608
            $option1->option( 'async' => 1 );
579
609
            $option1->option( 'elementSetName', 'F' );
580
            $oResult[$s] =
610
            $option1->option( 'databaseName',   $server->{db} );
581
            $server->{servertype} eq 'zed'?
611
            $option1->option( 'user', $server->{userid} ) if $server->{userid};
582
                $oConnection[$s]->search_pqf( $zquery ):
612
            $option1->option( 'password', $server->{password} ) if $server->{password};
583
                $oConnection[$s]->search(new ZOOM::Query::CQL(
613
            $option1->option( 'preferredRecordSyntax', $server->{syntax} );
584
                    _translate_query( $server, $squery )));
614
            $option1->option( 'timeout', $server->{timeout} ) if $server->{timeout};
615
            $oConnection[$s] = create ZOOM::Connection($option1);
616
            $oConnection[$s]->connect( $server->{host}, $server->{port} );
617
            $serverhost[$s] = $server->{host};
618
            $servername[$s] = $server->{servername};
619
            $encoding[$s]   = ($server->{encoding}?$server->{encoding}:"iso-5426");
585
            $encoding[$s]   = ($server->{encoding}?$server->{encoding}:"iso-5426");
586
            $servers[$s] = $server;
620
            $s++;
587
            $s++;
621
        }    ## while fetch
588
        }   ## while fetch
622
    }    # foreach
589
    }    # foreach
623
    my $nremaining  = $s;
590
    my $nremaining  = $s;
624
591
625
    for ( my $z = 0 ; $z < $s ; $z++ ) {
626
        $oResult[$z] = $oConnection[$z]->search_pqf($query);
627
    }
628
629
    while ( $nremaining-- ) {
592
    while ( $nremaining-- ) {
630
        my $k;
593
        my $k;
631
        my $event;
594
        my $event;
Lines 657-672 sub Z3950SearchAuth { Link Here
657
                            $marcdata   = $rec->raw();
620
                            $marcdata   = $rec->raw();
658
621
659
                            my ($charset_result, $charset_errors);
622
                            my ($charset_result, $charset_errors);
623
                            if( $servers[$k]->{servertype} eq 'sru' ) {
624
                                $marcdata = MARC::Record->new_from_xml( $marcdata, $encoding[$k], $servers[$k]->{syntax} );
625
                            }
660
                            ($marcrecord, $charset_result, $charset_errors)= MarcToUTF8Record($marcdata, $marc_type, $encoding[$k]);
626
                            ($marcrecord, $charset_result, $charset_errors)= MarcToUTF8Record($marcdata, $marc_type, $encoding[$k]);
661
662
                            my $heading;
627
                            my $heading;
663
                            my $heading_authtype_code;
628
                            my $heading_authtype_code;
664
                            $heading_authtype_code = GuessAuthTypeCode($marcrecord);
629
                            $heading_authtype_code = GuessAuthTypeCode($marcrecord);
665
                            $heading = C4::AuthoritiesMarc::GetAuthorizedHeading({ record => $marcrecord });
630
                            $heading = C4::AuthoritiesMarc::GetAuthorizedHeading({ record => $marcrecord });
666
631
667
                            my ($notmarcrecord, $alreadyindb, $alreadyinfarm, $imported, $breedingid)= ImportBreedingAuth( $marcdata, 2, $serverhost[$k], $encoding[$k], $random, 'z3950' );
632
                            my ($notmarcrecord, $alreadyindb, $alreadyinfarm, $imported, $breedingid)= ImportBreedingAuth( $marcrecord, 2, $serverhost[$k], $encoding[$k], $random);
668
                            my %row_data;
633
                            my %row_data;
669
                            $row_data{server}       = $servername[$k];
634
                            $row_data{server}       = $servers[$k]->{'servername'};
670
                            $row_data{breedingid}   = $breedingid;
635
                            $row_data{breedingid}   = $breedingid;
671
                            $row_data{heading}      = $heading;
636
                            $row_data{heading}      = $heading;
672
                            $row_data{authid}       = $authid;
637
                            $row_data{authid}       = $authid;
Lines 674-680 sub Z3950SearchAuth { Link Here
674
                            push( @breeding_loop, \%row_data );
639
                            push( @breeding_loop, \%row_data );
675
                        }
640
                        }
676
                        else {
641
                        else {
677
                            push(@breeding_loop,{'server'=>$servername[$k],'title'=>join(': ',$oConnection[$k]->error_x()),'breedingid'=>-1,'authid'=>-1});
642
                            push(@breeding_loop,{'server'=>$servers[$k]->{'servername'},'title'=>join(': ',$oConnection[$k]->error_x()),'breedingid'=>-1,'authid'=>-1});
678
                        }
643
                        }
679
                    }
644
                    }
680
                }    #if $numresults
645
                }    #if $numresults
Lines 696-702 sub Z3950SearchAuth { Link Here
696
        $oConnection[$_]->destroy();
661
        $oConnection[$_]->destroy();
697
    }
662
    }
698
663
699
    my @servers = ();
664
    @servers = ();
700
    foreach my $id (@id) {
665
    foreach my $id (@id) {
701
        push @servers, {id => $id};
666
        push @servers, {id => $id};
702
    }
667
    }
(-)a/admin/sru_modmapping.pl (-2 / +3 lines)
Lines 26-33 use C4::Output; Link Here
26
26
27
my $input = new CGI;
27
my $input = new CGI;
28
my $mapstr = $input->param('mapping')//'';
28
my $mapstr = $input->param('mapping')//'';
29
my $type = $input->param('type')//'';
29
my ( $template, $loggedinuser, $cookie ) = get_template_and_user( {
30
my ( $template, $loggedinuser, $cookie ) = get_template_and_user( {
30
    template_name => "admin/sru_modmapping.tt",
31
    template_name => $type eq "authority" ? "admin/sru_modmapping_auth.tt" : "admin/sru_modmapping.tt",
31
    query => $input,
32
    query => $input,
32
    type => "intranet",
33
    type => "intranet",
33
    authnotrequired => 0,
34
    authnotrequired => 0,
Lines 37-43 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { Link Here
37
38
38
my %map;
39
my %map;
39
foreach my $singlemap ( split ',', $mapstr ) {
40
foreach my $singlemap ( split ',', $mapstr ) {
40
    my @temp = split '=', $singlemap;
41
    my @temp = split '=', $singlemap, 2;
41
    $map{ $temp[0] } = $temp[1] if @temp>1;
42
    $map{ $temp[0] } = $temp[1] if @temp>1;
42
}
43
}
43
$template->param( mapping => \%map );
44
$template->param( mapping => \%map );
(-)a/cataloguing/z3950_auth_search.pl (-1 / +1 lines)
Lines 66-72 $template->param( Link Here
66
);
66
);
67
67
68
if ( $op ne "do_search" ) {
68
if ( $op ne "do_search" ) {
69
    my $sth = $dbh->prepare("SELECT id,host,servername,checked FROM z3950servers WHERE recordtype = 'authority' AND servertype='zed' ORDER BY rank, servername");
69
    my $sth = $dbh->prepare("SELECT id,host,servername,checked FROM z3950servers WHERE recordtype = 'authority' ORDER BY rank, servername");
70
    $sth->execute();
70
    $sth->execute();
71
    my $serverloop = $sth->fetchall_arrayref( {} );
71
    my $serverloop = $sth->fetchall_arrayref( {} );
72
    $template->param(
72
    $template->param(
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-toolbar.inc (-1 / +1 lines)
Lines 38-44 Link Here
38
    </div>
38
    </div>
39
    [% IF servers.count > 0 %]
39
    [% IF servers.count > 0 %]
40
        <div class="btn-group">
40
        <div class="btn-group">
41
            <a class="btn btn-default btn-sm" id="z3950submit" href="#"><i class="fa fa-search"></i> New from Z39.50</a>
41
            <a class="btn btn-default btn-sm" id="z3950submit" href="#"><i class="fa fa-search"></i> New from Z39.50/SRU</a>
42
        </div>
42
        </div>
43
    [% END %]
43
    [% END %]
44
[% END %]
44
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/sru_modmapping.tt (-2 / +2 lines)
Lines 1-6 Link Here
1
[% SET footerjs = 1 %]
1
[% SET footerjs = 1 %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; SRU search fields mapping</title>
3
<title>Koha &rsaquo; SRU search fields mapping for bibliographic records</title>
4
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
5
</head>
5
</head>
6
6
Lines 9-15 Link Here
9
<div id="custom-doc" class="yui-t7">
9
<div id="custom-doc" class="yui-t7">
10
10
11
    <div id="bd">
11
    <div id="bd">
12
        <h1>Modify SRU search fields mapping</h1>
12
        <h1>Modify SRU search fields mapping for bibliographic records</h1>
13
        <form id="form01" method="post">
13
        <form id="form01" method="post">
14
            <fieldset class="rows">
14
            <fieldset class="rows">
15
                <div class="yui-g">
15
                <div class="yui-g">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/sru_modmapping_auth.tt (+98 lines)
Line 0 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; SRU search fields mapping for authorities</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
5
<script type="text/javascript">
6
//<![CDATA[
7
    $(document).ready(function() {
8
        $("#form01").submit(function(event) {
9
            if(window.opener) {
10
                var newmap=allInputs();
11
                window.opener.$('#show_sru_fields').val(newmap);
12
                window.close();
13
            } else {
14
                // In this case not called as a popup. Just do nothing.
15
                event.preventDefault();
16
            }
17
        });
18
    });
19
    function allInputs () {
20
        var aInput= new Array();
21
        $("form :input").each(function() {
22
            if( this.id && $(this).val() ) {
23
                aInput.push(this.id+'='+$(this).val());
24
            }
25
        });
26
        return aInput.join(',');
27
    }
28
//]]>
29
</script>
30
</head>
31
32
<body id="admin_sru_modmapping" class="admin">
33
34
<div id="custom-doc" class="yui-t7">
35
36
    <div id="bd">
37
        <h1>Modify SRU search fields mapping for authorities</h1>
38
        <form id="form01" method="post">
39
            <fieldset class="rows">
40
                <div class="yui-g">
41
                    <div class="yui-u first">
42
                        <ol>
43
                            <li>
44
                                <label for="srchany">Keyword (any): </label>
45
                                <input id="srchany" type="text" value="[% FILTER html %][% mapping.srchany %][% END %]" />
46
                            </li>
47
                            <li>
48
                                <label for="nameany">Name (any): </label>
49
                                <input id="nameany" type="text" value="[% FILTER html %][% mapping.nameany %][% END %]" />
50
                            </li>
51
                            <li>
52
                                <label for="authorany">Author (any): </label>
53
                                <input id="authorany" type="text" value="[% FILTER html %][% mapping.authorany %][% END %]" />
54
                            </li>
55
                            <li>
56
                                <label for="authorpersonal">Author (personal): </label>
57
                                <input id="authorpersonal" type="text" value="[% FILTER html %][% mapping.authorpersonal %][% END %]" />
58
                            </li>
59
                            <li>
60
                                <label for="authorcorp">Author (corporate): </label>
61
                                <input id="authorcorp" type="text" value="[% FILTER html %][% mapping.authorcorp %][% END %]" />
62
                            </li>
63
                            <li>
64
                                <label for="authormeetingcon">Author (meeting/conference): </label>
65
                                <input id="authormeetingcon" type="text" value="[% FILTER html %][% mapping.authormeetingcon %][% END %]" />
66
                            </li>
67
                        </ol>
68
                    </div>
69
                    <div class="yui-u">
70
                        <ol>
71
                            <li>
72
                                <label for="subject">Subject heading: </label>
73
                                <input id="subject" type="text" value="[% FILTER html %][% mapping.subject %][% END %]" />
74
                            </li>
75
                            <li>
76
                                <label for="subjectsubdiv">Subject sub-division: </label>
77
                                <input id="subjectsubdiv" type="text" value="[% FILTER html %][% mapping.subjectsubdiv %][% END %]" />
78
                            </li>
79
                            <li>
80
                                <label for="title">Title (any): </label>
81
                                <input id="title" type="text" value="[% FILTER html %][% mapping.title %][% END %]" />
82
                            </li>
83
                            <li>
84
                                <label for="uniformtitle">Title (uniform): </label>
85
                                <input id="uniformtitle" type="text" value="[% FILTER html %][% mapping.uniformtitle %][% END %]" />
86
                            </li>
87
                        </ol>
88
                    </div>
89
                </div>
90
            </fieldset>
91
            <fieldset class="action">
92
                <input type="submit" value="Save" class="submit" />
93
                <a class="close cancel" href="#">Cancel</a>
94
            </fieldset>
95
        </form>
96
    </div>
97
98
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt (-7 / +5 lines)
Lines 18-23 Link Here
18
[% IF op == 'list' %]
18
[% IF op == 'list' %]
19
    <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
19
    <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
20
[% END %]
20
[% END %]
21
21
</head>
22
</head>
22
23
23
<body id="admin_z3950servers" class="admin">
24
<body id="admin_z3950servers" class="admin">
Lines 130-137 Link Here
130
        </li>
131
        </li>
131
        <li>
132
        <li>
132
        <label for="sru_fields">SRU Search fields mapping: </label>
133
        <label for="sru_fields">SRU Search fields mapping: </label>
133
        <input type="hidden" name="sru_fields" id="sru_fields" value="[% server.sru_fields %]" />
134
        <input type="hidden" name="sru_fields" id="sru_fields" value="[% FILTER html %][% server.sru_fields %][% END %]" />
134
            <input type="text" name="show_sru_fields" id="show_sru_fields" size="100" value="[% server.sru_fields %]" disabled="disabled" /> <input type="button" id="modify_sru_fields" value="Modify" />
135
            <input type="text" name="show_sru_fields" id="show_sru_fields" size="100" value="[% FILTER html %][% server.sru_fields %][% END %]" disabled="disabled" /> <input type="button" id="modify_sru_fields" value="Modify" />
135
        </li>
136
        </li>
136
        [% END %]
137
        [% END %]
137
        <li>
138
        <li>
Lines 212-221 Link Here
212
                    $("#encoding").val('[% server.encoding %]');
213
                    $("#encoding").val('[% server.encoding %]');
213
                    $("#recordtype").val('[% server.recordtype %]');
214
                    $("#recordtype").val('[% server.recordtype %]');
214
                [% END %]
215
                [% END %]
215
                // Disable recordtype (and default to bib) for non-Z3950 servers until auth is supported
216
                [% UNLESS (server.servertype||type) == 'zed' %]
217
                    $("#recordtype").prop('disabled',true);
218
                [% END %]
219
                $( "#serverentry" ).validate({
216
                $( "#serverentry" ).validate({
220
                    rules: {
217
                    rules: {
221
                        servername: { required: true },
218
                        servername: { required: true },
Lines 248-254 Link Here
248
            });
245
            });
249
            function ModMapping () {
246
            function ModMapping () {
250
                var map= $('#show_sru_fields').val();
247
                var map= $('#show_sru_fields').val();
251
                window.open('/cgi-bin/koha/admin/sru_modmapping.pl?mapping='+map,'popup','width=800,height=400,resizable=yes,toolbar=false,scrollbars=yes,top');
248
                var type= $('#recordtype').val();
249
                window.open('/cgi-bin/koha/admin/sru_modmapping.pl?mapping='+map + '&type=' + type,'popup','width=800,height=400,resizable=yes,toolbar=false,scrollbars=yes,top');
252
            }
250
            }
253
        [% ELSE %]
251
        [% ELSE %]
254
            $(document).ready(function() {
252
            $(document).ready(function() {
(-)a/t/db_dependent/Breeding.t (-2 / +15 lines)
Lines 36-42 use Koha::XSLT_Handler; Link Here
36
36
37
#Group 1: testing _build_query and _translate_query (part of Z3950Search)
37
#Group 1: testing _build_query and _translate_query (part of Z3950Search)
38
subtest '_build_query' => sub {
38
subtest '_build_query' => sub {
39
    plan tests => 12;
39
    plan tests => 14;
40
    test_build_translate_query();
40
    test_build_translate_query();
41
};
41
};
42
#Group 2: testing _create_connection (part of Z3950Search)
42
#Group 2: testing _create_connection (part of Z3950Search)
Lines 107-112 sub test_build_translate_query { Link Here
107
    my @queries2= C4::Breeding::_build_query( $pars3 );
107
    my @queries2= C4::Breeding::_build_query( $pars3 );
108
    is( $queries[0] eq $queries2[0] && $queries[1] eq $queries2[1], 1,
108
    is( $queries[0] eq $queries2[0] && $queries[1] eq $queries2[1], 1,
109
        'Third query makes no difference');
109
        'Third query makes no difference');
110
111
    # Check that indexes with equal signs are ok
112
    $server = { sru_fields => 'subjectsubdiv=aut.type=ram_pe and aut.accesspoint' };
113
    my $pars4 = { subjectsubdiv => 'mysubjectsubdiv' };
114
    @queries = C4::Breeding::_auth_build_query( $pars4 );
115
    my $zquery = C4::Breeding::_translate_query( $server, $queries[1] );
116
    is ( $zquery, 'aut.type=ram_pe and aut.accesspoint="mysubjectsubdiv"', 'SRU query with equal sign in index');
117
118
    # Check that indexes with double-quotes are ok
119
    $server = { sru_fields => 'subject=(aut.type any "geo ram_nc ram_ge ram_pe ram_co") and aut.accesspoint' };
120
    my $pars5 = { subject => 'mysubject' };
121
    @queries = C4::Breeding::_auth_build_query( $pars5 );
122
    $zquery = C4::Breeding::_translate_query( $server, $queries[1] );
123
    is ( $zquery, '(aut.type any "geo ram_nc ram_ge ram_pe ram_co") and aut.accesspoint="mysubject"', 'SRU query with double quotes in index');
110
}
124
}
111
125
112
sub test_create_connection {
126
sub test_create_connection {
113
- 

Return to bug 19436