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

(-)a/C4/Breeding.pm (-1 / +304 lines)
Lines 1-6 Link Here
1
package C4::Breeding;
1
package C4::Breeding;
2
2
3
# Copyright 2000-2002 Katipo Communications
3
# Copyright 2000-2002 Katipo Communications
4
# Parts Copyright 2013 Prosentient Systems
4
#
5
#
5
# This file is part of Koha.
6
# This file is part of Koha.
6
#
7
#
Lines 25-30 use C4::Koha; Link Here
25
use C4::Charset;
26
use C4::Charset;
26
use MARC::File::USMARC;
27
use MARC::File::USMARC;
27
use C4::ImportBatch;
28
use C4::ImportBatch;
29
use C4::AuthoritiesMarc; #GuessAuthTypeCode, FindDuplicateAuthority
28
30
29
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
31
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
30
32
Lines 33-39 BEGIN { Link Here
33
    $VERSION = 3.07.00.049;
35
    $VERSION = 3.07.00.049;
34
	require Exporter;
36
	require Exporter;
35
	@ISA = qw(Exporter);
37
	@ISA = qw(Exporter);
36
    @EXPORT = qw(&ImportBreeding &BreedingSearch &Z3950Search);
38
    @EXPORT = qw(&ImportBreeding &BreedingSearch &Z3950Search &Z3950SearchAuth);
37
}
39
}
38
40
39
=head1 NAME
41
=head1 NAME
Lines 451-456 sub _isbn_replace { Link Here
451
    return $isbn;
453
    return $isbn;
452
}
454
}
453
455
456
=head2 ImportBreedingAuth
457
458
ImportBreedingAuth($marcrecords,$overwrite_auth,$filename,$encoding,$z3950random,$batch_type);
459
460
TODO description
461
462
=cut
463
464
sub ImportBreedingAuth {
465
    my ($marcrecords,$overwrite_auth,$filename,$encoding,$z3950random,$batch_type) = @_;
466
    my @marcarray = split /\x1D/, $marcrecords;
467
468
    my $dbh = C4::Context->dbh;
469
470
    my $batch_id = GetZ3950BatchId($filename);
471
    my $searchbreeding = $dbh->prepare("select import_record_id from import_auths where control_number=? and authorized_heading=?");
472
473
#     $encoding = C4::Context->preference("marcflavour") unless $encoding;
474
    # fields used for import results
475
    my $imported=0;
476
    my $alreadyindb = 0;
477
    my $alreadyinfarm = 0;
478
    my $notmarcrecord = 0;
479
    my $breedingid;
480
    for (my $i=0;$i<=$#marcarray;$i++) {
481
        my ($marcrecord, $charset_result, $charset_errors);
482
        ($marcrecord, $charset_result, $charset_errors) =
483
            MarcToUTF8Record($marcarray[$i]."\x1D", C4::Context->preference("marcflavour"), $encoding);
484
485
        # Normalize the record so it doesn't have separated diacritics
486
        SetUTF8Flag($marcrecord);
487
488
#         warn "$i : $marcarray[$i]";
489
        # FIXME - currently this does nothing
490
        my @warnings = $marcrecord->warnings();
491
492
        if (scalar($marcrecord->fields()) == 0) {
493
            $notmarcrecord++;
494
        } else {
495
            my $heading;
496
            $heading = C4::AuthoritiesMarc::GetAuthorizedHeading({ record => $marcrecord });
497
498
            my $heading_authtype_code;
499
            $heading_authtype_code = GuessAuthTypeCode($marcrecord);
500
501
            my $controlnumber;
502
            $controlnumber = $marcrecord->field('001')->data;
503
504
            #Check if the authority record already exists in the database...
505
            my ($duplicateauthid,$duplicateauthvalue);
506
            if ($marcrecord && $heading_authtype_code) {
507
                ($duplicateauthid,$duplicateauthvalue) = FindDuplicateAuthority( $marcrecord, $heading_authtype_code);
508
            }
509
510
            if ($duplicateauthid && $overwrite_auth ne 2) {
511
                #If the authority record exists and $overwrite_auth doesn't equal 2, then mark it as already in the DB
512
                #FIXME: What does $overwrite_auth = 2 even mean?
513
514
                #FIXME: Should we bother with $overwrite_auth values? Currently, the hard-coded $overwrite_auth value is 2, which means the database gets filled with import_records...
515
                #^^ of course, we might not want to reject records if their control number/heading exist in the db or breeding/import pool...as we might be wanting to update existing authority records...
516
                $alreadyindb++;
517
            } else {
518
                if ($controlnumber && $heading) {
519
                    $searchbreeding->execute($controlnumber,$heading);
520
                    ($breedingid) = $searchbreeding->fetchrow;
521
                }
522
                if ($breedingid && $overwrite_auth eq '0') {
523
                    #FIXME: What does $overwrite_auth = 0 even mean?
524
                    $alreadyinfarm++;
525
                } else {
526
                    if ($breedingid && $overwrite_auth eq '1') {
527
                        #FIXME: What does $overwrite_auth = 1 even mean?
528
                        ModAuthorityInBatch($breedingid, $marcrecord);
529
                    } else {
530
                        my $import_id = AddAuthToBatch($batch_id, $imported, $marcrecord, $encoding, $z3950random);
531
                        $breedingid = $import_id;
532
                    }
533
                    $imported++;
534
                }
535
            }
536
        }
537
    }
538
    return ($notmarcrecord,$alreadyindb,$alreadyinfarm,$imported,$breedingid);
539
}
540
541
=head2 Z3950SearchAuth
542
543
Z3950SearchAuth($pars, $template);
544
545
Parameters for Z3950 search are all passed via the $pars hash. It may contain nameany, namepersonal, namecorp, namemeetingcon,
546
title, uniform title, subject, subjectsubdiv, srchany.
547
Also it should contain an arrayref id that points to a list of IDs of the z3950 targets to be queried (see z3950servers table).
548
This code is used in cataloging/z3950_auth_search.
549
The second parameter $template is a Template object. The routine uses this parameter to store the found values into the template.
550
551
=cut
552
553
sub Z3950SearchAuth {
554
    my ($pars, $template)= @_;
555
556
    my $dbh   = C4::Context->dbh;
557
    my @id= @{$pars->{id}};
558
    my $random= $pars->{random};
559
    my $page= $pars->{page};
560
561
    my $nameany= $pars->{nameany};
562
    my $authorany= $pars->{authorany};
563
    my $authorpersonal= $pars->{authorpersonal};
564
    my $authorcorp= $pars->{authorcorp};
565
    my $authormeetingcon= $pars->{authormeetingcon};
566
    my $title= $pars->{title};
567
    my $uniformtitle= $pars->{uniformtitle};
568
    my $subject= $pars->{subject};
569
    my $subjectsubdiv= $pars->{subjectsubdiv};
570
    my $srchany= $pars->{srchany};
571
572
    my $show_next       = 0;
573
    my $total_pages     = 0;
574
    my $attr = '';
575
    my $host;
576
    my $server;
577
    my $database;
578
    my $port;
579
    my $marcdata;
580
    my @encoding;
581
    my @results;
582
    my $count;
583
    my $record;
584
    my @serverhost;
585
    my @servername;
586
    my @breeding_loop = ();
587
588
    my @oConnection;
589
    my @oResult;
590
    my @errconn;
591
    my $s = 0;
592
    my $query;
593
    my $nterms=0;
594
595
    if ($nameany) {
596
        $query .= " \@attr 1=1002 \"$nameany\" "; #Any name (this includes personal, corporate, meeting/conference authors, and author names in subject headings)
597
        #This attribute is supported by both the Library of Congress and Libraries Australia 08/05/2013
598
        $nterms++;
599
    }
600
601
    if ($authorany) {
602
        $query .= " \@attr 1=1003 \"$authorany\" "; #Author-name (this includes personal, corporate, meeting/conference authors, but not author names in subject headings)
603
        #This attribute is not supported by the Library of Congress, but is supported by Libraries Australia 08/05/2013
604
        $nterms++;
605
    }
606
607
    if ($authorcorp) {
608
        $query .= " \@attr 1=2 \"$authorcorp\" "; #1005 is another valid corporate author attribute...
609
        $nterms++;
610
    }
611
612
    if ($authorpersonal) {
613
        $query .= " \@attr 1=1 \"$authorpersonal\" "; #1004 is another valid personal name attribute...
614
        $nterms++;
615
    }
616
617
    if ($authormeetingcon) {
618
        $query .= " \@attr 1=3 \"$authormeetingcon\" "; #1006 is another valid meeting/conference name attribute...
619
        $nterms++;
620
    }
621
622
    if ($subject) {
623
        $query .= " \@attr 1=21 \"$subject\" ";
624
        $nterms++;
625
    }
626
627
    if ($subjectsubdiv) {
628
        $query .= " \@attr 1=47 \"$subjectsubdiv\" ";
629
        $nterms++;
630
    }
631
632
    if ($title) {
633
        $query .= " \@attr 1=4 \"$title\" "; #This is a regular title search. 1=6 will give just uniform titles
634
        $nterms++;
635
    }
636
637
     if ($uniformtitle) {
638
        $query .= " \@attr 1=6 \"$uniformtitle\" "; #This is the uniform title search
639
        $nterms++;
640
    }
641
642
    if($srchany) {
643
        $query .= " \@attr 1=1016 \"$srchany\" ";
644
        $nterms++;
645
    }
646
647
    for my $i (1..$nterms-1) {
648
        $query = "\@and " . $query;
649
    }
650
651
    foreach my $servid (@id) {
652
        my $sth = $dbh->prepare("select * from z3950servers where id=?");
653
        $sth->execute($servid);
654
        while ( $server = $sth->fetchrow_hashref ) {
655
            my $option1      = new ZOOM::Options();
656
            $option1->option( 'async' => 1 );
657
            $option1->option( 'elementSetName', 'F' );
658
            $option1->option( 'databaseName',   $server->{db} );
659
            $option1->option( 'user', $server->{userid} ) if $server->{userid};
660
            $option1->option( 'password', $server->{password} ) if $server->{password};
661
            $option1->option( 'preferredRecordSyntax', $server->{syntax} );
662
            $option1->option( 'timeout', $server->{timeout} ) if $server->{timeout};
663
            $oConnection[$s] = create ZOOM::Connection($option1);
664
            $oConnection[$s]->connect( $server->{host}, $server->{port} );
665
            $serverhost[$s] = $server->{host};
666
            $servername[$s] = $server->{name};
667
            $encoding[$s]   = ($server->{encoding}?$server->{encoding}:"iso-5426");
668
            $s++;
669
        }    ## while fetch
670
    }    # foreach
671
    my $nremaining  = $s;
672
673
    for ( my $z = 0 ; $z < $s ; $z++ ) {
674
        $oResult[$z] = $oConnection[$z]->search_pqf($query);
675
    }
676
677
    while ( $nremaining-- ) {
678
        my $k;
679
        my $event;
680
        while ( ( $k = ZOOM::event( \@oConnection ) ) != 0 ) {
681
            $event = $oConnection[ $k - 1 ]->last_event();
682
            last if $event == ZOOM::Event::ZEND;
683
        }
684
685
        if ( $k != 0 ) {
686
            $k--;
687
            my ($error, $errmsg, $addinfo, $diagset)= $oConnection[$k]->error_x();
688
            if ($error) {
689
                if ($error =~ m/^(10000|10007)$/ ) {
690
                    push(@errconn, {'server' => $serverhost[$k]});
691
                }
692
            }
693
            else {
694
                my $numresults = $oResult[$k]->size();
695
                my $i;
696
                my $result = '';
697
                if ( $numresults > 0  and $numresults >= (($page-1)*20)) {
698
                    $show_next = 1 if $numresults >= ($page*20);
699
                    $total_pages = int($numresults/20)+1 if $total_pages < ($numresults/20);
700
                    for ($i = ($page-1)*20; $i < (($numresults < ($page*20)) ? $numresults : ($page*20)); $i++) {
701
                        my $rec = $oResult[$k]->record($i);
702
                        if ($rec) {
703
                            my $marcrecord;
704
                            my $marcdata;
705
                            $marcdata   = $rec->raw();
706
707
                            my ($charset_result, $charset_errors);
708
                            ($marcrecord, $charset_result, $charset_errors)= MarcToUTF8Record($marcdata, C4::Context->preference('marcflavour'), $encoding[$k]);
709
710
                            my $heading;
711
                            my $heading_authtype_code;
712
                            $heading_authtype_code = GuessAuthTypeCode($marcrecord);
713
                            $heading = C4::AuthoritiesMarc::GetAuthorizedHeading({ record => $marcrecord });
714
715
                            my ($notmarcrecord, $alreadyindb, $alreadyinfarm, $imported, $breedingid)= ImportBreedingAuth( $marcdata, 2, $serverhost[$k], $encoding[$k], $random, 'z3950' );
716
                            my %row_data;
717
                            $row_data{server}       = $servername[$k];
718
                            $row_data{breedingid}   = $breedingid;
719
                            $row_data{heading}      = $heading;
720
                            $row_data{heading_code}      = $heading_authtype_code;
721
                            push( @breeding_loop, \%row_data );
722
                        }
723
                        else {
724
                            push(@breeding_loop,{'server'=>$servername[$k],'title'=>join(': ',$oConnection[$k]->error_x()),'breedingid'=>-1});
725
                        }
726
                    }
727
                }    #if $numresults
728
            }
729
        }    # if $k !=0
730
731
        $template->param(
732
            numberpending => $nremaining,
733
            current_page => $page,
734
            total_pages => $total_pages,
735
            show_nextbutton => $show_next?1:0,
736
            show_prevbutton => $page!=1,
737
        );
738
    } # while nremaining
739
740
    #close result sets and connections
741
    foreach(0..$s-1) {
742
        $oResult[$_]->destroy();
743
        $oConnection[$_]->destroy();
744
    }
745
746
    my @servers = ();
747
    foreach my $id (@id) {
748
        push @servers, {id => $id};
749
    }
750
    $template->param(
751
        breeding_loop => \@breeding_loop,
752
        servers => \@servers,
753
        errconn       => \@errconn
754
    );
755
}
756
454
1;
757
1;
455
__END__
758
__END__
456
759
(-)a/acqui/z3950_search.pl (-1 / +1 lines)
Lines 93-99 $template->param( Link Here
93
);
93
);
94
94
95
if ( $op ne "do_search" ) {
95
if ( $op ne "do_search" ) {
96
    my $sth = $dbh->prepare("select id,host,name,checked from z3950servers  order by host");
96
    my $sth = $dbh->prepare("select id,host,name,checked from z3950servers where recordtype <> 'authority' order by host");
97
    $sth->execute();
97
    $sth->execute();
98
    my $serverloop = $sth->fetchall_arrayref( {} );
98
    my $serverloop = $sth->fetchall_arrayref( {} );
99
    $template->param(
99
    $template->param(
(-)a/admin/z3950servers.pl (-54 / +61 lines)
Lines 40-46 sub StringSearch { Link Here
40
        $searchstring = '';
40
        $searchstring = '';
41
    }
41
    }
42
42
43
    my $query    = "SELECT host,port,db,userid,password,name,id,checked,rank,syntax,encoding,timeout";
43
    my $query    = "SELECT host,port,db,userid,password,name,id,checked,rank,syntax,encoding,timeout,recordtype";
44
    $query      .= " FROM z3950servers";
44
    $query      .= " FROM z3950servers";
45
    if ( $searchstring ne '' ) { $query .= " WHERE (name like ?)" }
45
    if ( $searchstring ne '' ) { $query .= " WHERE (name like ?)" }
46
    $query      .= " ORDER BY rank,name";
46
    $query      .= " ORDER BY rank,name";
Lines 85-108 $template->param(script_name => $script_name, Link Here
85
85
86
################## ADD_FORM ##################################
86
################## ADD_FORM ##################################
87
# called by default. Used to create form to add or  modify a record
87
# called by default. Used to create form to add or  modify a record
88
if ($op eq 'add_form') {
88
if ( $op eq 'add_form' ) {
89
	$template->param(add_form => 1);
89
    $template->param( add_form => 1 );
90
	#---- if primkey exists, it's a modify action, so read values to modify...
90
91
	my $data;
91
    #---- if primkey exists, it's a modify action, so read values to modify...
92
	if ($searchfield) {
92
    my $data;
93
		my $dbh = C4::Context->dbh;
93
    if ($searchfield) {
94
		my $sth=$dbh->prepare("select host,port,db,userid,password,name,id,checked,rank,syntax,encoding,timeout from z3950servers where (name = ?) order by rank,name");
94
        my $dbh = C4::Context->dbh;
95
		$sth->execute($searchfield);
95
        my $sth = $dbh->prepare(
96
		$data=$sth->fetchrow_hashref;
96
"select host,port,db,userid,password,name,id,checked,rank,syntax,encoding,timeout,recordtype from z3950servers where (name = ?) order by rank,name"
97
		$sth->finish;
97
        );
98
	}
98
        $sth->execute($searchfield);
99
    $template->param( $_ => $data->{$_} ) 
99
        $data = $sth->fetchrow_hashref;
100
        for ( qw( host port db userid password checked rank timeout encoding ) );
100
        $sth->finish;
101
    $template->param( $_ . $data->{$_} => 1)
101
    }
102
        for ( qw( syntax ) );
102
    $template->param( $_ => $data->{$_} )
103
													# END $OP eq ADD_FORM
103
      for (qw( host port db userid password checked rank timeout encoding ));
104
    $template->param( $_ . $data->{$_} => 1 ) for (qw( syntax recordtype ));
105
106
    # END $OP eq ADD_FORM
104
################## ADD_VALIDATE ##################################
107
################## ADD_VALIDATE ##################################
105
# called by add_form, used to insert/modify data in DB
108
    # called by add_form, used to insert/modify data in DB
106
} elsif ($op eq 'add_validate') {
109
} elsif ($op eq 'add_validate') {
107
	my $dbh=C4::Context->dbh;
110
	my $dbh=C4::Context->dbh;
108
	my $sth=$dbh->prepare("select * from z3950servers where name=?");
111
	my $sth=$dbh->prepare("select * from z3950servers where name=?");
Lines 110-116 if ($op eq 'add_form') { Link Here
110
	my $checked = $input->param('checked') ? 1 : 0;
113
	my $checked = $input->param('checked') ? 1 : 0;
111
	if ($sth->rows) {
114
	if ($sth->rows) {
112
        $template->param(confirm_update => 1);
115
        $template->param(confirm_update => 1);
113
		$sth=$dbh->prepare("update z3950servers set host=?, port=?, db=?, userid=?, password=?, name=?, checked=?, rank=?,syntax=?,encoding=?,timeout=? where name=?");
116
             $sth=$dbh->prepare("update z3950servers set host=?, port=?, db=?, userid=?, password=?, name=?, checked=?, rank=?,syntax=?,encoding=?,timeout=?,recordtype=? where name=?");
114
		$sth->execute($input->param('host'),
117
		$sth->execute($input->param('host'),
115
		      $input->param('port'),
118
		      $input->param('port'),
116
		      $input->param('db'),
119
		      $input->param('db'),
Lines 122-127 if ($op eq 'add_form') { Link Here
122
			  $input->param('syntax'),
125
			  $input->param('syntax'),
123
              $input->param('encoding'),
126
              $input->param('encoding'),
124
              $input->param('timeout'),
127
              $input->param('timeout'),
128
              $input->param('recordtype'),
125
		      $input->param('searchfield'),
129
		      $input->param('searchfield'),
126
		      );
130
		      );
127
	} 
131
	} 
Lines 129-172 if ($op eq 'add_form') { Link Here
129
        $template->param(confirm_add => 1);
133
        $template->param(confirm_add => 1);
130
		$sth=$dbh->prepare(
134
		$sth=$dbh->prepare(
131
		  "INSERT INTO z3950servers " .
135
		  "INSERT INTO z3950servers " .
132
		  "(host,port,db,userid,password,name,checked,rank,syntax,encoding,timeout) " .
136
              "(host,port,db,userid,password,name,checked,rank,syntax,encoding,timeout,recordtype) " .
133
		  "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" );
137
               "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" );
134
        $sth->execute(
138
        $sth->execute(
135
            $input->param( 'host' ),
139
            $input->param('host'),     $input->param('port'),
136
            $input->param( 'port' ),
140
            $input->param('db'),       $input->param('userid'),
137
            $input->param( 'db' ),
141
            $input->param('password'), $input->param('searchfield'),
138
            $input->param( 'userid' ),
142
            $checked,                  $input->param('rank'),
139
            $input->param( 'password' ),
143
            $input->param('syntax'),   $input->param('encoding'),
140
            $input->param( 'searchfield' ),
144
            $input->param('timeout'),  $input->param('recordtype')
141
            $checked,
145
        );
142
            $input->param( 'rank' ),
146
    }
143
            $input->param( 'syntax' ),
147
    $sth->finish;
144
            $input->param( 'encoding' ),
148
145
            $input->param( 'timeout' ) );
149
    # END $OP eq ADD_VALIDATE
146
	}
147
	$sth->finish;
148
													# END $OP eq ADD_VALIDATE
149
################## DELETE_CONFIRM ##################################
150
################## DELETE_CONFIRM ##################################
150
# called by default form, used to confirm deletion of data in DB
151
# called by default form, used to confirm deletion of data in DB
151
} elsif ($op eq 'delete_confirm') {
152
} elsif ($op eq 'delete_confirm') {
152
	$template->param(delete_confirm => 1);
153
    $template->param( delete_confirm => 1 );
153
	my $dbh = C4::Context->dbh;
154
    my $dbh = C4::Context->dbh;
154
155
155
	my $sth2=$dbh->prepare("select host,port,db,userid,password,name,id,checked,rank,syntax,encoding,timeout from z3950servers where (name = ?) order by rank,name");
156
    my $sth2 = $dbh->prepare(
156
	$sth2->execute($searchfield);
157
"select host,port,db,userid,password,name,id,checked,rank,syntax,encoding,timeout,recordtype from z3950servers where (name = ?) order by rank,name"
157
	my $data=$sth2->fetchrow_hashref;
158
    );
158
	$sth2->finish;
159
    $sth2->execute($searchfield);
159
160
    my $data = $sth2->fetchrow_hashref;
160
        $template->param(host => $data->{'host'},
161
    $sth2->finish;
161
                         port => $data->{'port'},
162
162
                         db   => $data->{'db'},
163
    $template->param(
163
                         userid => $data->{'userid'},
164
        host       => $data->{'host'},
164
                         password => $data->{'password'},
165
        port       => $data->{'port'},
165
                         checked => $data->{'checked'},
166
        db         => $data->{'db'},
166
                         rank => $data->{'rank'},
167
        userid     => $data->{'userid'},
167
                         syntax => $data->{'syntax'},
168
        password   => $data->{'password'},
168
                         timeout => $data->{'timeout'},
169
        checked    => $data->{'checked'},
169
                         encoding => $data->{'encoding'}            );
170
        rank       => $data->{'rank'},
171
        syntax     => $data->{'syntax'},
172
        timeout    => $data->{'timeout'},
173
        recordtype => $data->{'recordtype'},
174
        encoding   => $data->{'encoding'}
175
    );
170
176
171
													# END $OP eq DELETE_CONFIRM
177
													# END $OP eq DELETE_CONFIRM
172
################## DELETE_CONFIRMED ##################################
178
################## DELETE_CONFIRMED ##################################
Lines 197-203 if ($op eq 'add_form') { Link Here
197
			rank => $results->[$i]{'rank'},
203
			rank => $results->[$i]{'rank'},
198
			syntax => $results->[$i]{'syntax'},
204
			syntax => $results->[$i]{'syntax'},
199
			encoding => $results->[$i]{'encoding'},
205
			encoding => $results->[$i]{'encoding'},
200
      timeout => $results->[$i]{'timeout'});
206
      timeout => $results->[$i]{'timeout'},
207
            recordtype => $results->[$i]{'recordtype'});
201
		push @loop, \%row;
208
		push @loop, \%row;
202
209
203
	}
210
	}
(-)a/authorities/authorities.pl (-2 / +26 lines)
Lines 24-29 use CGI; Link Here
24
use C4::Auth;
24
use C4::Auth;
25
use C4::Output;
25
use C4::Output;
26
use C4::AuthoritiesMarc;
26
use C4::AuthoritiesMarc;
27
use C4::ImportBatch; #GetImportRecordMarc
27
use C4::Context;
28
use C4::Context;
28
use C4::Koha; # XXX subfield_is_koha_internal_p
29
use C4::Koha; # XXX subfield_is_koha_internal_p
29
use Date::Calc qw(Today);
30
use Date::Calc qw(Today);
Lines 47-52 builds list, depending on authorised value... Link Here
47
48
48
=cut
49
=cut
49
50
51
sub MARCfindbreeding_auth {
52
    my ( $id ) = @_;
53
    my ($marc, $encoding) = GetImportRecordMarc($id);
54
    if ($marc) {
55
        my $record = MARC::Record->new_from_usmarc($marc);
56
        if ( !defined(ref($record)) ) {
57
                return -1;
58
        } else {
59
            return $record, $encoding;
60
        }
61
    } else {
62
        return -1;
63
    }
64
}
65
50
sub build_authorized_values_list {
66
sub build_authorized_values_list {
51
    my ( $tag, $subfield, $value, $dbh, $authorised_values_sth,$index_tag,$index_subfield ) = @_;
67
    my ( $tag, $subfield, $value, $dbh, $authorised_values_sth,$index_tag,$index_subfield ) = @_;
52
68
Lines 544-549 my $nonav = $input->param('nonav'); Link Here
544
my $myindex = $input->param('index');
560
my $myindex = $input->param('index');
545
my $linkid=$input->param('linkid');
561
my $linkid=$input->param('linkid');
546
my $authtypecode = $input->param('authtypecode');
562
my $authtypecode = $input->param('authtypecode');
563
my $breedingid    = $input->param('breedingid');
547
564
548
my $dbh = C4::Context->dbh;
565
my $dbh = C4::Context->dbh;
549
if(!$authtypecode) {
566
if(!$authtypecode) {
Lines 558-568 my ($template, $loggedinuser, $cookie) Link Here
558
                            flagsrequired => {editauthorities => 1},
575
                            flagsrequired => {editauthorities => 1},
559
                            debug => 1,
576
                            debug => 1,
560
                            });
577
                            });
561
$template->param(nonav   => $nonav,index=>$myindex,authtypecode=>$authtypecode,);
578
$template->param(nonav   => $nonav,index=>$myindex,authtypecode=>$authtypecode,breedingid=>$breedingid,);
579
562
$tagslib = GetTagsLabels(1,$authtypecode);
580
$tagslib = GetTagsLabels(1,$authtypecode);
563
my $record=-1;
581
my $record=-1;
564
my $encoding="";
582
my $encoding="";
565
$record = GetAuthority($authid) if ($authid);
583
if (($authid) && !($breedingid)){
584
    $record = GetAuthority($authid);
585
}
586
if ($breedingid) {
587
    ( $record, $encoding ) = MARCfindbreeding_auth( $breedingid );
588
}
589
566
my ($oldauthnumtagfield,$oldauthnumtagsubfield);
590
my ($oldauthnumtagfield,$oldauthnumtagsubfield);
567
my ($oldauthtypetagfield,$oldauthtypetagsubfield);
591
my ($oldauthtypetagfield,$oldauthtypetagsubfield);
568
$is_a_modif=0;
592
$is_a_modif=0;
(-)a/cataloguing/z3950_auth_search.pl (+108 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# This is a completely new Z3950 clients search using async ZOOM -TG 02/11/06
4
# Copyright 2000-2002 Katipo Communications
5
#
6
# This is a new Z3950 authority search using the current Z3950 bibliographic search as a model 07/05/2013
7
# Parts Copyright 2013 Prosentient Systems
8
#
9
# This file is part of Koha.
10
#
11
# Koha is free software; you can redistribute it and/or modify it under the
12
# terms of the GNU General Public License as published by the Free Software
13
# Foundation; either version 2 of the License, or (at your option) any later
14
# version.
15
#
16
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
17
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
18
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
19
#
20
# You should have received a copy of the GNU General Public License along
21
# with Koha; if not, write to the Free Software Foundation, Inc.,
22
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23
24
use strict;
25
use warnings;
26
use CGI qw / -utf8 /;
27
28
use C4::Auth;
29
use C4::Output;
30
use C4::Context;
31
use C4::Breeding;
32
use C4::Koha;
33
34
my $input        = new CGI;
35
my $dbh          = C4::Context->dbh;
36
my $error         = $input->param('error');
37
my $nameany     = $input->param('nameany');
38
my $authorany     = $input->param('authorany');
39
my $authorcorp     = $input->param('authorcorp');
40
my $authorpersonal     = $input->param('authorpersonal');
41
my $authormeetingcon     = $input->param('authormeetingcon');
42
my $title         = $input->param('title');
43
my $uniformtitle         = $input->param('uniformtitle');
44
my $subject       = $input->param('subject');
45
my $subjectsubdiv       = $input->param('subjectsubdiv');
46
my $srchany       = $input->param('srchany');
47
my $op            = $input->param('op')||'';
48
my $page            = $input->param('current_page') || 1;
49
$page = $input->param('goto_page') if $input->param('changepage_goto');
50
51
my ( $template, $loggedinuser, $cookie ) = get_template_and_user({
52
        template_name   => "cataloguing/z3950_auth_search.tmpl",
53
        query           => $input,
54
        type            => "intranet",
55
        authnotrequired => 1,
56
        flagsrequired   => { catalogue => 1 },
57
});
58
59
$template->param(
60
    nameany    => $nameany,
61
    authorany    => $authorany,
62
    authorcorp    => $authorcorp,
63
    authorpersonal    => $authorpersonal,
64
    authormeetingcon    => $authormeetingcon,
65
    title        => $title,
66
    uniformtitle      => $uniformtitle,
67
    subject      => $subject,
68
    subjectsubdiv   => $subjectsubdiv,
69
    srchany      => $srchany,
70
);
71
72
if ( $op ne "do_search" ) {
73
    my $sth = $dbh->prepare("SELECT id,host,name,checked FROM z3950servers WHERE recordtype = 'authority' ORDER BY rank, name");
74
    $sth->execute();
75
    my $serverloop = $sth->fetchall_arrayref( {} );
76
    $template->param(
77
        serverloop   => $serverloop,
78
        opsearch     => "search",
79
    );
80
    output_html_with_http_headers $input, $cookie, $template->output;
81
    exit;
82
}
83
84
my @id = $input->param('id');
85
if ( @id==0 ) {
86
        # empty server list -> report and exit
87
        $template->param( emptyserverlist => 1 );
88
        output_html_with_http_headers $input, $cookie, $template->output;
89
        exit;
90
}
91
92
my $pars= {
93
        random => $input->param('random') || rand(1000000000),
94
        page => $page,
95
        id => \@id,
96
        nameany => $nameany,
97
        authorany => $authorany,
98
        authorcorp => $authorcorp,
99
        authorpersonal => $authorpersonal,
100
        authormeetingcon => $authormeetingcon,
101
        title => $title,
102
        uniformtitle => $uniformtitle,
103
        subject => $subject,
104
        subjectsubdiv => $subjectsubdiv,
105
        srchany => $srchany,
106
};
107
Z3950SearchAuth($pars, $template);
108
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/cataloguing/z3950_search.pl (-1 / +1 lines)
Lines 74-80 $template->param( Link Here
74
);
74
);
75
75
76
if ( $op ne "do_search" ) {
76
if ( $op ne "do_search" ) {
77
    my $sth = $dbh->prepare("SELECT id,host,name,checked FROM z3950servers ORDER BY rank, name");
77
    my $sth = $dbh->prepare("SELECT id,host,name,checked FROM z3950servers WHERE recordtype <> 'authority' ORDER BY rank, name");
78
    $sth->execute();
78
    $sth->execute();
79
    my $serverloop = $sth->fetchall_arrayref( {} );
79
    my $serverloop = $sth->fetchall_arrayref( {} );
80
    $template->param(
80
    $template->param(
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 2282-2287 CREATE TABLE `z3950servers` ( -- connection information for the Z39.50 targets u Link Here
2282
  `type` enum('zed','opensearch') NOT NULL default 'zed',
2282
  `type` enum('zed','opensearch') NOT NULL default 'zed',
2283
  `encoding` text default NULL, -- characters encoding provided by this target
2283
  `encoding` text default NULL, -- characters encoding provided by this target
2284
  `description` text NOT NULL, -- unused in Koha
2284
  `description` text NOT NULL, -- unused in Koha
2285
  `recordtype` varchar(45) NOT NULL default 'biblio', -- server contains bibliographic or authority records
2285
  PRIMARY KEY  (`id`)
2286
  PRIMARY KEY  (`id`)
2286
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2287
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2287
2288
(-)a/installer/data/mysql/updatedatabase.pl (+7 lines)
Lines 7155-7160 if ( CheckVersion($DBversion) ) { Link Here
7155
    SetVersion($DBversion);
7155
    SetVersion($DBversion);
7156
}
7156
}
7157
7157
7158
$DBversion = "3.13.00.XXX";
7159
if ( CheckVersion($DBversion) ) {
7160
    $dbh->do(q{ALTER TABLE `z3950servers` ADD COLUMN `recordtype` VARCHAR(45) NOT NULL DEFAULT 'biblio';});
7161
    print "Upgrade to $DBversion done (Bug 10096 - Add a Z39.50 interface for authority searching)\n";
7162
    SetVersion ($DBversion);
7163
}
7164
7158
=head1 FUNCTIONS
7165
=head1 FUNCTIONS
7159
7166
7160
=head2 TableExists($table)
7167
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-toolbar.inc (+9 lines)
Lines 5-10 Link Here
5
            confirm_deletion();
5
            confirm_deletion();
6
            return false;
6
            return false;
7
        });
7
        });
8
9
        $("#z3950submit").click(function(){
10
            window.open("/cgi-bin/koha/cataloguing/z3950_auth_search.pl","z3950search",'width=740,height=450,location=yes,toolbar=no,scrollbars=yes,resize=yes');
11
            return false;
12
        });
13
8
    });
14
    });
9
15
10
//]]>
16
//]]>
Lines 47-52 Link Here
47
            [% END %]
53
            [% END %]
48
        </ul>
54
        </ul>
49
    </div>
55
    </div>
56
    <div class="btn-group">
57
        <a class="btn btn-small" id="z3950submit" href="#"><i class="icon-search"></i> Z39.50 search</a>
58
    </div>
50
[% END %]
59
[% END %]
51
</div>
60
</div>
52
61
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt (-4 / +21 lines)
Lines 238-243 Link Here
238
    <li><label for="timeout">Timeout (0 its like not set): </label>
238
    <li><label for="timeout">Timeout (0 its like not set): </label>
239
		<input type="text" name="timeout" id="timeout" size="4" value="[% timeout %]" onblur="isNum(this)" /> seconds
239
		<input type="text" name="timeout" id="timeout" size="4" value="[% timeout %]" onblur="isNum(this)" /> seconds
240
	</li>
240
	</li>
241
    <li><label for="recordtype">Record type: </label>
242
    <select name="recordtype" id="recordtype">
243
            [% IF ( recordtypebiblio ) %]
244
            <option value="biblio" selected="selected">Bibliographic</option>
245
            [% ELSE %]
246
                   <option value="biblio">Bibliographic</option>
247
            [% END %]
248
            [% IF ( recordtypeauthority ) %]
249
            <option value="authority" selected="selected">Authority</option>
250
            [% ELSE %]
251
                   <option value="authority">Authority</option>
252
            [% END %]
253
        </select>
254
    </li>
241
</ol>
255
</ol>
242
        </fieldset>
256
        </fieldset>
243
		
257
		
Lines 274-279 Link Here
274
                <li><strong>Syntax: </strong>[% syntax %]</li>
288
                <li><strong>Syntax: </strong>[% syntax %]</li>
275
                <li><strong>Encoding: </strong>[% encoding %]</li>
289
                <li><strong>Encoding: </strong>[% encoding %]</li>
276
                <li><strong>Timeout: </strong>[% timeout %]</li>
290
                <li><strong>Timeout: </strong>[% timeout %]</li>
291
                <li><strong>Record type: </strong>[% recordtype %]</li>
277
	</ul>                <form action="[% script_name %]" method="post"><input type="hidden" name="op" value="delete_confirmed" /><input type="hidden" name="searchfield" value="[% searchfield %]" /><input type="submit" value="Delete this server" /></form>  <form action="[% script_name %]" method="post"><input type="submit" value="Do not delete" /></form>
292
	</ul>                <form action="[% script_name %]" method="post"><input type="hidden" name="op" value="delete_confirmed" /><input type="hidden" name="searchfield" value="[% searchfield %]" /><input type="submit" value="Delete this server" /></form>  <form action="[% script_name %]" method="post"><input type="submit" value="Do not delete" /></form>
278
293
279
294
Lines 297-305 Link Here
297
312
298
        [% IF ( searchfield ) %]
313
        [% IF ( searchfield ) %]
299
                You searched for [% searchfield %]
314
                You searched for [% searchfield %]
300
        [% END %]		
315
        [% END %]
301
<table id="serverst">
316
<table id="serverst">
302
                <thead><tr><th>Target</th><th>Hostname/Port</th><th>Database</th><th>Userid</th><th>Password</th><th>Checked</th><th>Rank</th><th>Syntax</th><th>Encoding</th><th>Timeout</th><th>&nbsp;</th><th>&nbsp;</th>
317
                <thead><tr><th>Target</th><th>Hostname/Port</th><th>Database</th><th>Userid</th><th>Password</th><th>Checked</th><th>Rank</th><th>Syntax</th><th>Encoding</th><th>Timeout</th><th>Record type</th><th>&nbsp;</th><th>&nbsp;</th>
303
                </tr></thead>
318
                </tr></thead>
304
                <tbody>[% FOREACH loo IN loop %]
319
                <tbody>[% FOREACH loo IN loop %]
305
                [% UNLESS ( loop.odd ) %]
320
                [% UNLESS ( loop.odd ) %]
Lines 307-315 Link Here
307
                [% ELSE %]
322
                [% ELSE %]
308
                    <tr>
323
                    <tr>
309
                [% END %]
324
                [% END %]
310
<td><a href="[% loo.script_name %]?op=add_form&amp;searchfield=[% loo.name |url %]">[% loo.name %]</a></td><td>[% loo.host %]:[% loo.port %]</td><td>[% loo.db %]</td><td>[% loo.userid %]</td><td>[% loo.password %]</td><td>[% IF ( loo.checked ) %]Yes[% ELSE %]No[% END %]</td><td>[% loo.rank %]</td>			<td>[% loo.syntax %]</td><td>[% loo.encoding %]</td><td>[% loo.timeout %]</td><td><a href="[% loo.script_name %]?op=add_form&amp;searchfield=[% loo.name |url %]">Edit</a></td><td><a href="[% loo.script_name %]?op=delete_confirm&amp;searchfield=[% loo.name |url %]">Delete</a></td>                </tr>
325
<td><a href="[% loo.script_name %]?op=add_form&amp;searchfield=[% loo.name |url %]">[% loo.name %]</a></td><td>[% loo.host %]:[% loo.port %]</td><td>[% loo.db %]</td><td>[% loo.userid %]</td><td>[% loo.password %]</td><td>[% IF ( loo.checked ) %]Yes[% ELSE %]No[% END %]</td><td>[% loo.rank %]</td>
326
327
<td>[% loo.syntax %]</td><td>[% loo.encoding %]</td><td>[% loo.timeout %]</td><td>[% loo.recordtype %]</td><td><a href="[% loo.script_name %]?op=add_form&amp;searchfield=[% loo.name |url %]">Edit</a></td><td><a href="[% loo.script_name %]?op=delete_confirm&amp;searchfield=[% loo.name |url %]">Delete</a></td>                </tr>
311
                [% END %]</tbody>
328
                [% END %]</tbody>
312
	</table>
329
</table>
313
330
314
[% IF ( offsetgtzero ) %]<form action="[% script_name %]" method="get">
331
[% IF ( offsetgtzero ) %]<form action="[% script_name %]" method="get">
315
	<input type="hidden" name="offset" value="[% prevpage %]" />
332
	<input type="hidden" name="offset" value="[% prevpage %]" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_auth_search.tt (-1 / +227 lines)
Line 0 Link Here
0
- 
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Z39.50 search results</title>
3
[% INCLUDE 'greybox.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
5
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
6
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
7
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
8
[% INCLUDE 'datatables-strings.inc' %]
9
<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
10
<script type="text/javascript">
11
//<![CDATA[
12
function Import(Breeding,AuthType) {
13
    opener.document.location="../authorities/authorities.pl?breedingid="+Breeding+"&authtypecode="+AuthType;
14
    window.close();
15
    return false;
16
}
17
18
function closemenu(){
19
    $(".linktools").hide();
20
    $("tr").removeClass("selected");
21
}
22
23
$(document).ready(function(){
24
    $("#CheckAll").click(function(){
25
        $(".checkboxed").checkCheckboxes();
26
        return false;
27
    });
28
    $("#CheckNone").click(function(){
29
        $(".checkboxed").unCheckCheckboxes();
30
        return false;
31
    });
32
    $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, {
33
        "sDom": 't',
34
        "aoColumnDefs": [
35
            { "aTargets": [ -1,-2,-3 ], "bSortable": false, "bSearchable": false },
36
        ],
37
        "aaSorting": [[ 1, "asc" ]],
38
        "bPaginate": false
39
    }));
40
        /* Inline edit/delete links */
41
        $("td").click(function(event){
42
            var $tgt = $(event.target);
43
            var row = $(this).parent();
44
            $(".linktools").hide();
45
            $("tr").removeClass("selected");
46
            row.addClass("selected");
47
            if($tgt.is("a")||$tgt.is(":nth-child(7)")||$tgt.is(":nth-child(8)")||$tgt.is(":nth-child(9)")||$tgt.is(":nth-child(10)")){
48
                return true;
49
            } else {
50
                var position = $(this).offset();
51
                var top = position.top+5;
52
                var left = position.left+5;
53
                $(".linktools",row).show().css("position","absolute").css("top",top).css("left",left);
54
            }
55
        });
56
    $("form[name='f']").submit(function(){
57
        if ($('input[type=checkbox]').filter(':checked').length == 0) {
58
            alert(_("Please choose at least one Z39.50 target"));
59
            return false;
60
        } else
61
            return true;
62
    });
63
});
64
65
[% IF ( total_pages ) %]
66
function validate_goto_page(){
67
    var page = $('#goto_page').val();
68
    if(isNaN(page)) {
69
        alert(_("The page entered is not a number."));
70
        return false;
71
    }
72
    else if(page < 1 || page > [% total_pages %] ) {
73
        alert(_("The page should be a number between 1 and ") + [% total_pages %] + ".");
74
        return false;
75
    }
76
    else {
77
        return true;
78
    }
79
}
80
[% END %]
81
82
//]]>
83
</script>
84
<style type="text/css">
85
.linktools { background-color:#FFF;border-top:1px solid #DDD; border-left: 1px solid #DDD; border-right: 1px solid #666; border-bottom:1px solid #666;display: none; white-space: nowrap;}
86
.linktools a { font-size : 85%; text-decoration:none; padding:.3em;;background-color:#FFF; display:block;float:left;border-right:1px solid #DDD;}
87
.linktools a:hover { background-color:#EEE;color:#CC3300;border-right:1px solid #CCC;}
88
tr.selected { background-color : #FFFFCC; } tr.selected td { background-color : transparent; }
89
</style>
90
91
    [% IF ( opsearch ) %]
92
        <style type="text/css">
93
        #custom-doc { width:53em;*width:51.72em;min-width:689px; margin:auto; text-align:left; }
94
        </style>
95
        </head>
96
        <body id="cat_z3950_auth_search" class="cat">
97
        <div id="custom-doc" class="yui-t7">
98
    [% ELSE %]
99
        </head>
100
        <body style="padding:.5em;">
101
        <div>
102
    [% END %]
103
    <div id="bd">
104
    [% IF ( opsearch ) %]
105
        <h2>Z39.50 Authority search points</h2>
106
        <form method="post" action="z3950_auth_search.pl" name="f" class="checkboxed">
107
        <input type="hidden" name="op" id="op" value="do_search" />
108
        <div class="yui-g">
109
            <div class="yui-u first">
110
                <fieldset class="rows">
111
                <ol>
112
                    <li><label for="srchany">Keyword (any): </label> <input type="text" id="srchany" name="srchany" value="" /></li>
113
                    <li><label for="nameany">Name (any): </label> <input type="text" id="nameany" name="nameany" value="" /></li>
114
                    <li><label for="authorany">Author (any): </label> <input type="text" id="authorany" name="authorany" value="" /></li>
115
                    <li><label for="authorpersonal">Author (personal): </label> <input type="text" id="authorpersonal" name="authorpersonal" value="" /></li>
116
                    <li><label for="authorcorp">Author (corporate): </label> <input type="text" id="authorcorp" name="authorcorp" value="" /></li>
117
                    <li><label for="authormeetingcon">Author (meeting/conference): </label> <input type="text" id="authormeetingcon" name="authormeetingcon" value="" /></li>
118
                </ol>
119
                </fieldset>
120
            </div>
121
            <div class="yui-u">
122
                <fieldset class="rows">
123
                <ol>
124
                    <li><label for="subject">Subject heading: </label> <input type="text" id="subject" name="subject" value="" /></li>
125
                    <li><label for="subjectsubdiv">Subject sub-division: </label> <input type="text" id="subjectsubdiv" name="subjectsubdiv" value="" /></li>
126
                    <li><label for="title">Title (any): </label> <input type="text" id="title"  name="title" value="[% title |html %]" /></li>
127
                    <li><label for="uniformtitle">Title (uniform): </label> <input type="text" id="uniformtitle"  name="uniformtitle" value="[% uniformtitle |html %]" /></li>
128
                </ol>
129
                </fieldset>
130
            </div>
131
        </div>
132
        <div class="yui-g">
133
            <h2>Search targets <span style="display: inline; font-size: 70%; padding-left: 1em;"><span class="checkall"><a id="CheckAll" href="#">Select all</a></span><span class="clearall"><a id="CheckNone" href="#">Clear all</a></span></span></h2>
134
            [% FOREACH serverloo IN serverloop %]
135
                <p>
136
                [% IF ( serverloo.checked ) %]
137
                    <input type="checkbox" name="id" id="z3950_[% serverloo.id %]" value="[% serverloo.id %]" checked="checked" />
138
                [% ELSE %]
139
                    <input type="checkbox" name="id" id="z3950_[% serverloo.id %]" value="[% serverloo.id %]" />
140
                [% END %]
141
                <label for="z3950_[% serverloo.id %]">[% serverloo.name %]</label>
142
                </p>
143
            [% END %]
144
        </div>
145
        <fieldset class="action"><input type="submit"  class="submit" value="Search" onclick="cursor :'wait'"/> <a class="cancel close" href="#">Cancel</a></fieldset>
146
        </form>
147
148
149
[% ELSE %]
150
    <h2>Results for Authority Records</h2>
151
    [% IF ( breeding_loop ) %]
152
    <table id="resultst">
153
<thead>    <tr>
154
        <th>Server</th>
155
        <th>Heading</th>
156
        <th>Authority Type</th>
157
        <th>MARC</th>
158
        <!-- <th>Card</th> -->
159
        <th>&nbsp;</th>
160
    </tr></thead>
161
    <tbody>[% FOREACH breeding_loo IN breeding_loop %]
162
        [% IF ( breeding_loo.breedingid ) %]
163
        <tr id="row[% breeding_loo.breedingid %]">
164
            <td>[% breeding_loo.server %] <div class="linktools"><a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% breeding_loo.breedingid %]" rel="gb_page_center[600,500]">Preview MARC</a> <a href="#" onclick="Import([% breeding_loo.breedingid %],'[% breeding_loo.heading_code %]'); return false">Import</a><a href="#" onclick="closemenu();return false;" title="Close this menu"> X </a></div> </td>
165
            <td>[% breeding_loo.heading %]</td>
166
            <td>[% breeding_loo.heading_code %]</td>
167
            <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% breeding_loo.breedingid %]" title="MARC" rel="gb_page_center[600,500]">MARC</a></td>
168
            <!-- <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;importid=[% breeding_loo.breedingid %]" title="MARC" rel="gb_page_center[600,500]">Card</a></td> -->
169
            <td><a href="#" onclick="Import([% breeding_loo.breedingid %],'[% breeding_loo.heading_code %]'); return false">Import</a></td>
170
        </tr>
171
        [% END %]
172
    [% END %]</tbody>
173
</table>
174
175
    <form method="post" action="z3950_auth_search.pl" id="page_form" name="page_form" class="checkboxed">
176
        <input type="hidden" name="op" id="op" value="do_search" />
177
        <input type="hidden" name="current_page" id="current_page" value="[% current_page %]" />
178
        <input type="hidden" id="nameany"  name="nameany" value="[% nameany %]" />
179
        <input type="hidden" id="authorany"  name="authorany" value="[% authorany %]" />
180
        <input type="hidden" id="authorcorp"  name="authorcorp" value="[% authorcorp %]" />
181
        <input type="hidden" id="authorpersonal"  name="authorpersonal" value="[% authorpersonal %]" />
182
        <input type="hidden" id="authormeetingcon"  name="authormeetingcon" value="[% authormeetingcon %]" />
183
        <input type="hidden" id="title"  name="title" value="[% title %]" />
184
        <input type="hidden" id="uniformtitle"  name="uniformtitle" value="[% uniformtitle %]" />
185
        <input type="hidden" id="subject" name="subject" value="[% subject %]" />
186
        <input type="hidden" id="subjectsubdiv" name="subjectsubdiv" value="[% subjectsubdiv %]" />
187
        <input type="hidden" id="heading"  name="heading" value="[% heading %]" />
188
        <input type="hidden" id="srchany" name="srchany" value="[% srchany %]" />
189
190
        [% FOREACH server IN servers %]
191
        <input type="hidden" name="id" id="z3950_[% server.id %]" value="[% server.id %]" />
192
        [% END %]
193
194
        [% IF ( show_prevbutton ) %]
195
            <input type="button" name="changepage_prev" value="Previous Page" onclick="$('#current_page').val([% current_page %]-1);$('#page_form').submit();" />
196
        [% END %]
197
        Page [% current_page %] / [% total_pages %]
198
        [% IF ( show_nextbutton ) %]
199
            <input type="button" name="changepage_next" value="Next Page" onclick="$('#current_page').val([% current_page %]+1);$('#page_form').submit();" />
200
        [% END %]
201
        <br />Go to page : <input id="goto_page" name="goto_page" value="[% current_page %]" size="4" /><input type="submit" name="changepage_goto" onclick="return validate_goto_page();" value="Go" />
202
    </form>
203
204
<p><form method="get" action="/cgi-bin/koha/cataloguing/z3950_auth_search.pl"><input type="submit" value="Try Another Search"/></form></p>
205
    [% ELSE %]
206
        [% IF ( errconn ) %]
207
            <div class="dialog alert">
208
                <ul>
209
                [% FOREACH errcon IN errconn %]
210
                    [% IF ( errcon.error == '10000' ) %]<li>Connection failed to [% errcon.server %]</li>
211
                    [% ELSIF ( errcon.error == '10007' ) %]<li>Connection timeout to [% errcon.server %]</li>[% END %]
212
                [% END %]
213
                </ul>
214
            </div>
215
         [% END %]
216
   <div class="dialog message">Nothing found.</div>
217
    <p><form method="get" action="/cgi-bin/koha/cataloguing/z3950_auth_search.pl"><input type="submit" value="Try Another Search"/></form></p>
218
    [% END %]
219
220
[% END %]
221
</div>
222
</div>
223
224
[% IF ( numberpending ) %]<h3 align="center">Still [% numberpending %] servers to search</h3>[% END %]
225
226
</body>
227
</html>

Return to bug 10096