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
	$sth->execute($input->param('searchfield'));
110
	$sth->execute($input->param('searchfield'));
111
	my $checked = $input->param('checked') ? 1 : 0;
111
	my $checked = $input->param('checked') ? 1 : 0;
112
	if ($sth->rows) {
112
	if ($sth->rows) {
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-135 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
	} 
128
	else {
129
	else {
129
		$sth=$dbh->prepare(
130
		$sth=$dbh->prepare(
130
		  "INSERT INTO z3950servers " .
131
		  "INSERT INTO z3950servers " .
131
		  "(host,port,db,userid,password,name,checked,rank,syntax,encoding,timeout) " .
132
		  "(host,port,db,userid,password,name,checked,rank,syntax,encoding,timeout,recordtype) " .
132
		  "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" );
133
		  "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" );
133
        $sth->execute(
134
        $sth->execute(
134
            $input->param( 'host' ),
135
            $input->param( 'host' ),
135
            $input->param( 'port' ),
136
            $input->param( 'port' ),
Lines 141-147 if ($op eq 'add_form') { Link Here
141
            $input->param( 'rank' ),
142
            $input->param( 'rank' ),
142
            $input->param( 'syntax' ),
143
            $input->param( 'syntax' ),
143
            $input->param( 'encoding' ),
144
            $input->param( 'encoding' ),
144
            $input->param( 'timeout' ) );
145
            $input->param( 'timeout' ),
146
            $input->param( 'recordtype' ) );
145
	}
147
	}
146
	$sth->finish;
148
	$sth->finish;
147
													# END $OP eq ADD_VALIDATE
149
													# END $OP eq ADD_VALIDATE
Lines 151-157 if ($op eq 'add_form') { Link Here
151
	$template->param(delete_confirm => 1);
153
	$template->param(delete_confirm => 1);
152
	my $dbh = C4::Context->dbh;
154
	my $dbh = C4::Context->dbh;
153
155
154
	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("select host,port,db,userid,password,name,id,checked,rank,syntax,encoding,timeout,recordtype from z3950servers where (name = ?) order by rank,name");
155
	$sth2->execute($searchfield);
157
	$sth2->execute($searchfield);
156
	my $data=$sth2->fetchrow_hashref;
158
	my $data=$sth2->fetchrow_hashref;
157
	$sth2->finish;
159
	$sth2->finish;
Lines 165-170 if ($op eq 'add_form') { Link Here
165
                         rank => $data->{'rank'},
167
                         rank => $data->{'rank'},
166
                         syntax => $data->{'syntax'},
168
                         syntax => $data->{'syntax'},
167
                         timeout => $data->{'timeout'},
169
                         timeout => $data->{'timeout'},
170
                         recordtype => $data->{'recordtype'},
168
                         encoding => $data->{'encoding'}            );
171
                         encoding => $data->{'encoding'}            );
169
172
170
													# END $OP eq DELETE_CONFIRM
173
													# END $OP eq DELETE_CONFIRM
Lines 196-202 if ($op eq 'add_form') { Link Here
196
			rank => $results->[$i]{'rank'},
199
			rank => $results->[$i]{'rank'},
197
			syntax => $results->[$i]{'syntax'},
200
			syntax => $results->[$i]{'syntax'},
198
			encoding => $results->[$i]{'encoding'},
201
			encoding => $results->[$i]{'encoding'},
199
      timeout => $results->[$i]{'timeout'});
202
      timeout => $results->[$i]{'timeout'},
203
            recordtype => $results->[$i]{'recordtype'});
200
		push @loop, \%row;
204
		push @loop, \%row;
201
205
202
	}
206
	}
(-)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 (+6 lines)
Lines 6983-6988 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( Link Here
6983
    SetVersion($DBversion);
6983
    SetVersion($DBversion);
6984
}
6984
}
6985
6985
6986
$DBversion = "3.13.00.XXX";
6987
if ( CheckVersion($DBversion) ) {
6988
    $dbh->do(q{ALTER TABLE `z3950servers` ADD COLUMN `recordtype` VARCHAR(45) NOT NULL DEFAULT 'biblio';});
6989
    print "Upgrade to $DBversion done (Bug 10096 - Add a Z39.50 interface for authority searching)\n";
6990
    SetVersion ($DBversion);
6991
}
6986
6992
6987
=head1 FUNCTIONS
6993
=head1 FUNCTIONS
6988
6994
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt (-2 / +17 lines)
Lines 237-242 Link Here
237
    <li><label for="timeout">Timeout (0 its like not set): </label>
237
    <li><label for="timeout">Timeout (0 its like not set): </label>
238
		<input type="text" name="timeout" id="timeout" size="4" value="[% timeout %]" onblur="isNum(this)" /> seconds
238
		<input type="text" name="timeout" id="timeout" size="4" value="[% timeout %]" onblur="isNum(this)" /> seconds
239
	</li>
239
	</li>
240
    <li><label for="recordtype">Record type: </label>
241
		<select name="recordtype" id="recordtype">
242
            [% IF ( recordtypebiblio ) %]
243
            <option value="biblio" selected="selected">Bibliographic</option>
244
            [% ELSE %]
245
                   <option value="biblio">Bibliographic</option>
246
            [% END %]
247
            [% IF ( recordtypeauthority ) %]
248
            <option value="authority" selected="selected">Authority</option>
249
            [% ELSE %]
250
                   <option value="authority">Authority</option>
251
            [% END %]
252
        </select>
253
	</li>
240
</ol>
254
</ol>
241
        </fieldset>
255
        </fieldset>
242
		
256
		
Lines 266-271 Link Here
266
                <li><strong>Syntax: </strong>[% syntax %]</li>
280
                <li><strong>Syntax: </strong>[% syntax %]</li>
267
                <li><strong>Encoding: </strong>[% encoding %]</li>
281
                <li><strong>Encoding: </strong>[% encoding %]</li>
268
                <li><strong>Timeout: </strong>[% timeout %]</li>
282
                <li><strong>Timeout: </strong>[% timeout %]</li>
283
                <li><strong>Record type: </strong>[% recordtype %]</li>
269
 	</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>
284
 	</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>
270
285
271
286
Lines 291-297 Link Here
291
                You searched for [% searchfield %]
306
                You searched for [% searchfield %]
292
        [% END %]		
307
        [% END %]		
293
<table id="serverst">
308
<table id="serverst">
294
                <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>
309
                <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>
295
                </tr></thead>
310
                </tr></thead>
296
                <tbody>[% FOREACH loo IN loop %]
311
                <tbody>[% FOREACH loo IN loop %]
297
                [% UNLESS ( loop.odd ) %]
312
                [% UNLESS ( loop.odd ) %]
Lines 299-305 Link Here
299
                [% ELSE %]
314
                [% ELSE %]
300
                    <tr>
315
                    <tr>
301
                [% END %]
316
                [% END %]
302
<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>
317
<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>
303
                [% END %]</tbody>
318
                [% END %]</tbody>
304
	</table>
319
	</table>
305
320
(-)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