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

(-)a/admin/z3950servers.pl (-10 / +14 lines)
Lines 32-38 sub StringSearch { Link Here
32
	$searchstring=~ s/\'/\\\'/g;
32
	$searchstring=~ s/\'/\\\'/g;
33
	my @data=split(' ',$searchstring);
33
	my @data=split(' ',$searchstring);
34
	my $count=@data;
34
	my $count=@data;
35
	my $sth=$dbh->prepare("Select host,port,db,userid,password,name,id,checked,rank,syntax,encoding from z3950servers where (name like ?) order by rank,name");
35
	my $sth=$dbh->prepare("Select host,port,db,userid,password,name,id,checked,rank,syntax,encoding,timeout from z3950servers where (name like ?) order by rank,name");
36
	$sth->execute("$data[0]\%");
36
	$sth->execute("$data[0]\%");
37
	my @results;
37
	my @results;
38
	while (my $data=$sth->fetchrow_hashref) {
38
	while (my $data=$sth->fetchrow_hashref) {
Lines 74-86 if ($op eq 'add_form') { Link Here
74
	my $data;
74
	my $data;
75
	if ($searchfield) {
75
	if ($searchfield) {
76
		my $dbh = C4::Context->dbh;
76
		my $dbh = C4::Context->dbh;
77
		my $sth=$dbh->prepare("select host,port,db,userid,password,name,id,checked,rank,syntax,encoding from z3950servers where (name = ?) order by rank,name");
77
		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");
78
		$sth->execute($searchfield);
78
		$sth->execute($searchfield);
79
		$data=$sth->fetchrow_hashref;
79
		$data=$sth->fetchrow_hashref;
80
		$sth->finish;
80
		$sth->finish;
81
	}
81
	}
82
    $template->param( $_ => $data->{$_} ) 
82
    $template->param( $_ => $data->{$_} ) 
83
        for ( qw( host port db userid password checked rank ) );
83
        for ( qw( host port db userid password checked rank timeout ) );
84
    $template->param( $_ . $data->{$_} => 1)
84
    $template->param( $_ . $data->{$_} => 1)
85
        for ( qw( syntax encoding ) );
85
        for ( qw( syntax encoding ) );
86
													# END $OP eq ADD_FORM
86
													# END $OP eq ADD_FORM
Lines 92-98 if ($op eq 'add_form') { Link Here
92
	my $sth=$dbh->prepare("select * from z3950servers where name=?");
92
	my $sth=$dbh->prepare("select * from z3950servers where name=?");
93
	$sth->execute($input->param('searchfield'));
93
	$sth->execute($input->param('searchfield'));
94
	if ($sth->rows) {
94
	if ($sth->rows) {
95
		$sth=$dbh->prepare("update z3950servers set host=?, port=?, db=?, userid=?, password=?, name=?, checked=?, rank=?,syntax=?,encoding=? where name=?");
95
		$sth=$dbh->prepare("update z3950servers set host=?, port=?, db=?, userid=?, password=?, name=?, checked=?, rank=?,syntax=?,encoding=?,timeout=? where name=?");
96
		$sth->execute($input->param('host'),
96
		$sth->execute($input->param('host'),
97
		      $input->param('port'),
97
		      $input->param('port'),
98
		      $input->param('db'),
98
		      $input->param('db'),
Lines 103-116 if ($op eq 'add_form') { Link Here
103
		      $input->param('rank'),
103
		      $input->param('rank'),
104
			  $input->param('syntax'),
104
			  $input->param('syntax'),
105
              $input->param('encoding'),
105
              $input->param('encoding'),
106
              $input->param('timeout'),
106
		      $input->param('searchfield'),
107
		      $input->param('searchfield'),
107
		      );
108
		      );
108
	} 
109
	} 
109
	else {
110
	else {
110
		$sth=$dbh->prepare(
111
		$sth=$dbh->prepare(
111
		  "INSERT INTO z3950servers " .
112
		  "INSERT INTO z3950servers " .
112
		  "(host,port,db,userid,password,name,checked,rank,syntax,encoding) " .
113
		  "(host,port,db,userid,password,name,checked,rank,syntax,encoding,timeout) " .
113
		  "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" );
114
		  "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" );
114
        $sth->execute(
115
        $sth->execute(
115
            $input->param( 'host' ),
116
            $input->param( 'host' ),
116
            $input->param( 'port' ),
117
            $input->param( 'port' ),
Lines 121-127 if ($op eq 'add_form') { Link Here
121
            $input->param( 'checked' ),
122
            $input->param( 'checked' ),
122
            $input->param( 'rank' ),
123
            $input->param( 'rank' ),
123
            $input->param( 'syntax' ),
124
            $input->param( 'syntax' ),
124
            $input->param( 'encoding' ) );
125
            $input->param( 'encoding' ),
126
            $input->param( 'timeout' ) );
125
	}
127
	}
126
	$sth->finish;
128
	$sth->finish;
127
													# END $OP eq ADD_VALIDATE
129
													# END $OP eq ADD_VALIDATE
Lines 131-137 if ($op eq 'add_form') { Link Here
131
	$template->param(delete_confirm => 1);
133
	$template->param(delete_confirm => 1);
132
	my $dbh = C4::Context->dbh;
134
	my $dbh = C4::Context->dbh;
133
135
134
	my $sth2=$dbh->prepare("select host,port,db,userid,password,name,id,checked,rank,syntax,encoding from z3950servers where (name = ?) order by rank,name");
136
	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");
135
	$sth2->execute($searchfield);
137
	$sth2->execute($searchfield);
136
	my $data=$sth2->fetchrow_hashref;
138
	my $data=$sth2->fetchrow_hashref;
137
	$sth2->finish;
139
	$sth2->finish;
Lines 144-150 if ($op eq 'add_form') { Link Here
144
                         checked => $data->{'checked'},
146
                         checked => $data->{'checked'},
145
                         rank => $data->{'rank'},
147
                         rank => $data->{'rank'},
146
                         syntax => $data->{'syntax'},
148
                         syntax => $data->{'syntax'},
147
                         encoding => $data->{'encoding'}            );
149
                         encoding => $data->{'encoding'},
150
                         timeout => $data->{'timeout'}            );
148
151
149
													# END $OP eq DELETE_CONFIRM
152
													# END $OP eq DELETE_CONFIRM
150
################## DELETE_CONFIRMED ##################################
153
################## DELETE_CONFIRMED ##################################
Lines 174-180 if ($op eq 'add_form') { Link Here
174
			checked => $results->[$i]{'checked'},
177
			checked => $results->[$i]{'checked'},
175
			rank => $results->[$i]{'rank'},
178
			rank => $results->[$i]{'rank'},
176
			syntax => $results->[$i]{'syntax'},
179
			syntax => $results->[$i]{'syntax'},
177
      encoding => $results->[$i]{'encoding'});
180
            encoding => $results->[$i]{'encoding'},
181
            timeout => $results->[$i]{'timeout'});
178
		push @loop, \%row;
182
		push @loop, \%row;
179
183
180
	}
184
	}
(-)a/cataloguing/z3950_search.pl (+1 lines)
Lines 179-184 warn "query ".$query if $DEBUG; Link Here
179
            $option1->option('user',         $server->{userid}  ) if $server->{userid};
179
            $option1->option('user',         $server->{userid}  ) if $server->{userid};
180
            $option1->option('password',     $server->{password}) if $server->{password};
180
            $option1->option('password',     $server->{password}) if $server->{password};
181
            $option1->option('preferredRecordSyntax', $server->{syntax});
181
            $option1->option('preferredRecordSyntax', $server->{syntax});
182
            $option1->option( 'timeout', $server->{timeout} ) if ($server->{timeout});
182
            $oConnection[$s] = create ZOOM::Connection($option1)
183
            $oConnection[$s] = create ZOOM::Connection($option1)
183
              || $DEBUG
184
              || $DEBUG
184
              && warn( "" . $oConnection[$s]->errmsg() );
185
              && warn( "" . $oConnection[$s]->errmsg() );
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 2018-2023 CREATE TABLE `z3950servers` ( -- connection information for the Z39.50 targets u Link Here
2018
  `checked` smallint(6) default NULL, -- whether this target is checked by default  (1 for yes, 0 for no)
2018
  `checked` smallint(6) default NULL, -- whether this target is checked by default  (1 for yes, 0 for no)
2019
  `rank` int(11) default NULL, -- where this target appears in the list of targets
2019
  `rank` int(11) default NULL, -- where this target appears in the list of targets
2020
  `syntax` varchar(80) default NULL, -- marc format provided by this target
2020
  `syntax` varchar(80) default NULL, -- marc format provided by this target
2021
  `timeout` int(11) NOT NULL DEFAULT '0',
2021
  `icon` text, -- unused in Koha
2022
  `icon` text, -- unused in Koha
2022
  `position` enum('primary','secondary','') NOT NULL default 'primary',
2023
  `position` enum('primary','secondary','') NOT NULL default 'primary',
2023
  `type` enum('zed','opensearch') NOT NULL default 'zed',
2024
  `type` enum('zed','opensearch') NOT NULL default 'zed',
(-)a/installer/data/mysql/updatedatabase.pl (+9 lines)
Lines 4671-4676 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
4671
    SetVersion ($DBversion);
4671
    SetVersion ($DBversion);
4672
}
4672
}
4673
4673
4674
$DBversion = "3.07.00.xxx";
4675
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
4676
    $dbh->do(qq{
4677
       ALTER TABLE `z3950servers` ADD `timeout` INT( 11 ) NOT NULL DEFAULT '0' AFTER `syntax`;
4678
    });
4679
    print "Upgrade to $DBversion done (New timeout field in z3950servers)\n";
4680
    SetVersion($DBversion);
4681
}
4682
4674
=head1 FUNCTIONS
4683
=head1 FUNCTIONS
4675
4684
4676
=head2 DropAllForeignKeys($table)
4685
=head2 DropAllForeignKeys($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt (-3 / +6 lines)
Lines 226-231 Link Here
226
[% END %]
226
[% END %]
227
</select>
227
</select>
228
</li>
228
</li>
229
    <li><label for="timeout">Timeout (0 its like not set): </label>
230
		<input type="text" name="timeout" id="timeout" size="4" value="[% timeout %]" onblur="isNum(this)" />
231
	</li>	
229
</ol>
232
</ol>
230
        </fieldset>
233
        </fieldset>
231
		
234
		
Lines 254-259 Link Here
254
                <li><strong>Rank: </strong>[% rank %]</li>
257
                <li><strong>Rank: </strong>[% rank %]</li>
255
                <li><strong>Syntax: </strong>[% syntax %]</li>
258
                <li><strong>Syntax: </strong>[% syntax %]</li>
256
                <li><strong>Encoding: </strong>[% encoding %]</li>
259
                <li><strong>Encoding: </strong>[% encoding %]</li>
260
				<li><strong>Timeout: </strong>[% timeout %]</li>
257
 	</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>
261
 	</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>
258
262
259
263
Lines 297-303 Link Here
297
                You searched for [% searchfield %]
301
                You searched for [% searchfield %]
298
        [% END %]		
302
        [% END %]		
299
<table id="serverst">
303
<table id="serverst">
300
                <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 colspan="2">&nbsp;</th>
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 colspan="2">&nbsp;</th>
301
                </tr></thead>
305
                </tr></thead>
302
                <tbody>[% FOREACH loo IN loop %]
306
                <tbody>[% FOREACH loo IN loop %]
303
                [% UNLESS ( loop.odd ) %]
307
                [% UNLESS ( loop.odd ) %]
Lines 305-311 Link Here
305
                [% ELSE %]
309
                [% ELSE %]
306
                    <tr>
310
                    <tr>
307
                [% END %]
311
                [% END %]
308
<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>[% loo.checked %]</td><td>[% loo.rank %]</td>			<td>[% loo.syntax %]</td><td>[% loo.encoding %]</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>
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>[% loo.checked %]</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>
309
                [% END %]</tbody>
313
                [% END %]</tbody>
310
	</table>
314
	</table>
311
315
312
- 

Return to bug 6140