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

(-)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 (-9 / +13 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 91-97 if ($op eq 'add_form') { Link Here
91
	my $data;
91
	my $data;
92
	if ($searchfield) {
92
	if ($searchfield) {
93
		my $dbh = C4::Context->dbh;
93
		my $dbh = C4::Context->dbh;
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 $sth=$dbh->prepare("select host,port,db,userid,password,name,id,checked,rank,syntax,encoding,timeout,recordtype from z3950servers where (name = ?) order by rank,name");
95
		$sth->execute($searchfield);
95
		$sth->execute($searchfield);
96
		$data=$sth->fetchrow_hashref;
96
		$data=$sth->fetchrow_hashref;
97
		$sth->finish;
97
		$sth->finish;
Lines 99-105 if ($op eq 'add_form') { Link Here
99
    $template->param( $_ => $data->{$_} ) 
99
    $template->param( $_ => $data->{$_} ) 
100
        for ( qw( host port db userid password checked rank timeout encoding ) );
100
        for ( qw( host port db userid password checked rank timeout encoding ) );
101
    $template->param( $_ . $data->{$_} => 1)
101
    $template->param( $_ . $data->{$_} => 1)
102
        for ( qw( syntax ) );
102
        for ( qw( syntax recordtype ) );
103
													# END $OP eq ADD_FORM
103
													# END $OP eq ADD_FORM
104
################## ADD_VALIDATE ##################################
104
################## ADD_VALIDATE ##################################
105
# called by add_form, used to insert/modify data in DB
105
# called by add_form, used to insert/modify data in DB
Lines 110-116 if ($op eq 'add_form') { Link Here
110
	my $checked = $input->param('checked') ? 1 : 0;
110
	my $checked = $input->param('checked') ? 1 : 0;
111
	if ($sth->rows) {
111
	if ($sth->rows) {
112
        $template->param(confirm_update => 1);
112
        $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=?");
113
		$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'),
114
		$sth->execute($input->param('host'),
115
		      $input->param('port'),
115
		      $input->param('port'),
116
		      $input->param('db'),
116
		      $input->param('db'),
Lines 122-127 if ($op eq 'add_form') { Link Here
122
			  $input->param('syntax'),
122
			  $input->param('syntax'),
123
              $input->param('encoding'),
123
              $input->param('encoding'),
124
              $input->param('timeout'),
124
              $input->param('timeout'),
125
              $input->param('recordtype'),
125
		      $input->param('searchfield'),
126
		      $input->param('searchfield'),
126
		      );
127
		      );
127
	} 
128
	} 
Lines 129-136 if ($op eq 'add_form') { Link Here
129
        $template->param(confirm_add => 1);
130
        $template->param(confirm_add => 1);
130
		$sth=$dbh->prepare(
131
		$sth=$dbh->prepare(
131
		  "INSERT INTO z3950servers " .
132
		  "INSERT INTO z3950servers " .
132
		  "(host,port,db,userid,password,name,checked,rank,syntax,encoding,timeout) " .
133
		  "(host,port,db,userid,password,name,checked,rank,syntax,encoding,timeout,recordtype) " .
133
		  "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" );
134
		  "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" );
134
        $sth->execute(
135
        $sth->execute(
135
            $input->param( 'host' ),
136
            $input->param( 'host' ),
136
            $input->param( 'port' ),
137
            $input->param( 'port' ),
Lines 142-148 if ($op eq 'add_form') { Link Here
142
            $input->param( 'rank' ),
143
            $input->param( 'rank' ),
143
            $input->param( 'syntax' ),
144
            $input->param( 'syntax' ),
144
            $input->param( 'encoding' ),
145
            $input->param( 'encoding' ),
145
            $input->param( 'timeout' ) );
146
            $input->param( 'timeout' ),
147
            $input->param( 'recordtype' ) );
146
	}
148
	}
147
	$sth->finish;
149
	$sth->finish;
148
													# END $OP eq ADD_VALIDATE
150
													# END $OP eq ADD_VALIDATE
Lines 152-158 if ($op eq 'add_form') { Link Here
152
	$template->param(delete_confirm => 1);
154
	$template->param(delete_confirm => 1);
153
	my $dbh = C4::Context->dbh;
155
	my $dbh = C4::Context->dbh;
154
156
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");
157
	my $sth2=$dbh->prepare("select host,port,db,userid,password,name,id,checked,rank,syntax,encoding,timeout,recordtype from z3950servers where (name = ?) order by rank,name");
156
	$sth2->execute($searchfield);
158
	$sth2->execute($searchfield);
157
	my $data=$sth2->fetchrow_hashref;
159
	my $data=$sth2->fetchrow_hashref;
158
	$sth2->finish;
160
	$sth2->finish;
Lines 166-171 if ($op eq 'add_form') { Link Here
166
                         rank => $data->{'rank'},
168
                         rank => $data->{'rank'},
167
                         syntax => $data->{'syntax'},
169
                         syntax => $data->{'syntax'},
168
                         timeout => $data->{'timeout'},
170
                         timeout => $data->{'timeout'},
171
                         recordtype => $data->{'recordtype'},
169
                         encoding => $data->{'encoding'}            );
172
                         encoding => $data->{'encoding'}            );
170
173
171
													# END $OP eq DELETE_CONFIRM
174
													# END $OP eq DELETE_CONFIRM
Lines 197-203 if ($op eq 'add_form') { Link Here
197
			rank => $results->[$i]{'rank'},
200
			rank => $results->[$i]{'rank'},
198
			syntax => $results->[$i]{'syntax'},
201
			syntax => $results->[$i]{'syntax'},
199
			encoding => $results->[$i]{'encoding'},
202
			encoding => $results->[$i]{'encoding'},
200
      timeout => $results->[$i]{'timeout'});
203
      timeout => $results->[$i]{'timeout'},
204
            recordtype => $results->[$i]{'recordtype'});
201
		push @loop, \%row;
205
		push @loop, \%row;
202
206
203
	}
207
	}
(-)a/cataloguing/z3950_auth_search.pl (-1 / +1 lines)
Lines 70-76 $template->param( Link Here
70
);
70
);
71
71
72
if ( $op ne "do_search" ) {
72
if ( $op ne "do_search" ) {
73
    my $sth = $dbh->prepare("SELECT id,host,name,checked FROM z3950servers ORDER BY rank, name");
73
    my $sth = $dbh->prepare("SELECT id,host,name,checked FROM z3950servers WHERE recordtype = 'authority' ORDER BY rank, name");
74
    $sth->execute();
74
    $sth->execute();
75
    my $serverloop = $sth->fetchall_arrayref( {} );
75
    my $serverloop = $sth->fetchall_arrayref( {} );
76
    $template->param(
76
    $template->param(
(-)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 2280-2285 CREATE TABLE `z3950servers` ( -- connection information for the Z39.50 targets u Link Here
2280
  `type` enum('zed','opensearch') NOT NULL default 'zed',
2280
  `type` enum('zed','opensearch') NOT NULL default 'zed',
2281
  `encoding` text default NULL, -- characters encoding provided by this target
2281
  `encoding` text default NULL, -- characters encoding provided by this target
2282
  `description` text NOT NULL, -- unused in Koha
2282
  `description` text NOT NULL, -- unused in Koha
2283
  `recordtype` varchar(45) NOT NULL default 'biblio', -- server contains bibliographic or authority records
2283
  PRIMARY KEY  (`id`)
2284
  PRIMARY KEY  (`id`)
2284
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2285
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2285
2286
(-)a/installer/data/mysql/updatedatabase.pl (+7 lines)
Lines 7067-7072 if ( CheckVersion($DBversion) ) { Link Here
7067
    SetVersion($DBversion);
7067
    SetVersion($DBversion);
7068
}
7068
}
7069
7069
7070
$DBversion = "3.13.00.XXX";
7071
if ( CheckVersion($DBversion) ) {
7072
    $dbh->do(q{ALTER TABLE `z3950servers` ADD COLUMN `recordtype` VARCHAR(45) NOT NULL DEFAULT 'biblio';});
7073
    print "Upgrade to $DBversion done (Bug 10096 - Add a Z39.50 interface for authority searching)\n";
7074
    SetVersion ($DBversion);
7075
}
7076
7070
=head1 FUNCTIONS
7077
=head1 FUNCTIONS
7071
7078
7072
=head2 TableExists($table)
7079
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt (-2 / +17 lines)
Lines 240-245 Link Here
240
    <li><label for="timeout">Timeout (0 its like not set): </label>
240
    <li><label for="timeout">Timeout (0 its like not set): </label>
241
		<input type="text" name="timeout" id="timeout" size="4" value="[% timeout %]" onblur="isNum(this)" /> seconds
241
		<input type="text" name="timeout" id="timeout" size="4" value="[% timeout %]" onblur="isNum(this)" /> seconds
242
	</li>
242
	</li>
243
    <li><label for="recordtype">Record type: </label>
244
		<select name="recordtype" id="recordtype">
245
            [% IF ( recordtypebiblio ) %]
246
            <option value="biblio" selected="selected">Bibliographic</option>
247
            [% ELSE %]
248
                   <option value="biblio">Bibliographic</option>
249
            [% END %]
250
            [% IF ( recordtypeauthority ) %]
251
            <option value="authority" selected="selected">Authority</option>
252
            [% ELSE %]
253
                   <option value="authority">Authority</option>
254
            [% END %]
255
        </select>
256
	</li>
243
</ol>
257
</ol>
244
        </fieldset>
258
        </fieldset>
245
		
259
		
Lines 276-281 Link Here
276
                <li><strong>Syntax: </strong>[% syntax %]</li>
290
                <li><strong>Syntax: </strong>[% syntax %]</li>
277
                <li><strong>Encoding: </strong>[% encoding %]</li>
291
                <li><strong>Encoding: </strong>[% encoding %]</li>
278
                <li><strong>Timeout: </strong>[% timeout %]</li>
292
                <li><strong>Timeout: </strong>[% timeout %]</li>
293
                <li><strong>Record type: </strong>[% recordtype %]</li>
279
	</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>
294
	</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>
280
295
281
296
Lines 301-307 Link Here
301
                You searched for [% searchfield %]
316
                You searched for [% searchfield %]
302
        [% END %]		
317
        [% END %]		
303
<table id="serverst">
318
<table id="serverst">
304
                <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>
319
                <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>
305
                </tr></thead>
320
                </tr></thead>
306
                <tbody>[% FOREACH loo IN loop %]
321
                <tbody>[% FOREACH loo IN loop %]
307
                [% UNLESS ( loop.odd ) %]
322
                [% UNLESS ( loop.odd ) %]
Lines 309-315 Link Here
309
                [% ELSE %]
324
                [% ELSE %]
310
                    <tr>
325
                    <tr>
311
                [% END %]
326
                [% END %]
312
<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>
327
<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>[% 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>
313
                [% END %]</tbody>
328
                [% END %]</tbody>
314
	</table>
329
	</table>
315
330
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_auth_search.tt (-2 / +1 lines)
Lines 109-115 tr.selected { background-color : #FFFFCC; } tr.selected td { background-color : Link Here
109
            <div class="yui-u first">
109
            <div class="yui-u first">
110
                <fieldset class="rows">
110
                <fieldset class="rows">
111
                <ol>
111
                <ol>
112
                    <li><label for="srchany">Raw (any): </label> <input type="text" id="srchany" name="srchany" value="" /></li>
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>
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>
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>
115
                    <li><label for="authorpersonal">Author (personal): </label> <input type="text" id="authorpersonal" name="authorpersonal" value="" /></li>
116
- 

Return to bug 10096