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

(-)a/admin/z3950servers.pl (-8 / +12 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 93-99 if ($op eq 'add_form') { Link Here
93
	$sth->execute($input->param('searchfield'));
93
	$sth->execute($input->param('searchfield'));
94
	my $checked = $input->param('checked') ? 1 : 0;
94
	my $checked = $input->param('checked') ? 1 : 0;
95
	if ($sth->rows) {
95
	if ($sth->rows) {
96
		$sth=$dbh->prepare("update z3950servers set host=?, port=?, db=?, userid=?, password=?, name=?, checked=?, rank=?,syntax=?,encoding=? where name=?");
96
		$sth=$dbh->prepare("update z3950servers set host=?, port=?, db=?, userid=?, password=?, name=?, checked=?, rank=?,syntax=?,encoding=?,timeout=? where name=?");
97
		$sth->execute($input->param('host'),
97
		$sth->execute($input->param('host'),
98
		      $input->param('port'),
98
		      $input->param('port'),
99
		      $input->param('db'),
99
		      $input->param('db'),
Lines 104-117 if ($op eq 'add_form') { Link Here
104
		      $input->param('rank'),
104
		      $input->param('rank'),
105
			  $input->param('syntax'),
105
			  $input->param('syntax'),
106
              $input->param('encoding'),
106
              $input->param('encoding'),
107
              $input->param('timeout'),
107
		      $input->param('searchfield'),
108
		      $input->param('searchfield'),
108
		      );
109
		      );
109
	} 
110
	} 
110
	else {
111
	else {
111
		$sth=$dbh->prepare(
112
		$sth=$dbh->prepare(
112
		  "INSERT INTO z3950servers " .
113
		  "INSERT INTO z3950servers " .
113
		  "(host,port,db,userid,password,name,checked,rank,syntax,encoding) " .
114
		  "(host,port,db,userid,password,name,checked,rank,syntax,encoding,timeout) " .
114
		  "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" );
115
		  "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" );
115
        $sth->execute(
116
        $sth->execute(
116
            $input->param( 'host' ),
117
            $input->param( 'host' ),
117
            $input->param( 'port' ),
118
            $input->param( 'port' ),
Lines 122-127 if ($op eq 'add_form') { Link Here
122
            $input->param( 'checked' ),
123
            $input->param( 'checked' ),
123
            $input->param( 'rank' ),
124
            $input->param( 'rank' ),
124
            $input->param( 'syntax' ),
125
            $input->param( 'syntax' ),
126
            $input->param( 'timeout' ),
125
            $input->param( 'encoding' ) );
127
            $input->param( 'encoding' ) );
126
	}
128
	}
127
	$sth->finish;
129
	$sth->finish;
Lines 132-138 if ($op eq 'add_form') { Link Here
132
	$template->param(delete_confirm => 1);
134
	$template->param(delete_confirm => 1);
133
	my $dbh = C4::Context->dbh;
135
	my $dbh = C4::Context->dbh;
134
136
135
	my $sth2=$dbh->prepare("select host,port,db,userid,password,name,id,checked,rank,syntax,encoding from z3950servers where (name = ?) order by rank,name");
137
	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");
136
	$sth2->execute($searchfield);
138
	$sth2->execute($searchfield);
137
	my $data=$sth2->fetchrow_hashref;
139
	my $data=$sth2->fetchrow_hashref;
138
	$sth2->finish;
140
	$sth2->finish;
Lines 145-150 if ($op eq 'add_form') { Link Here
145
                         checked => $data->{'checked'},
147
                         checked => $data->{'checked'},
146
                         rank => $data->{'rank'},
148
                         rank => $data->{'rank'},
147
                         syntax => $data->{'syntax'},
149
                         syntax => $data->{'syntax'},
150
                         timeout => $data->{'timeout'},
148
                         encoding => $data->{'encoding'}            );
151
                         encoding => $data->{'encoding'}            );
149
152
150
													# END $OP eq DELETE_CONFIRM
153
													# END $OP eq DELETE_CONFIRM
Lines 175-181 if ($op eq 'add_form') { Link Here
175
			checked => $results->[$i]{'checked'},
178
			checked => $results->[$i]{'checked'},
176
			rank => $results->[$i]{'rank'},
179
			rank => $results->[$i]{'rank'},
177
			syntax => $results->[$i]{'syntax'},
180
			syntax => $results->[$i]{'syntax'},
178
      encoding => $results->[$i]{'encoding'});
181
			encoding => $results->[$i]{'encoding'},
182
      timeout => $results->[$i]{'timeout'});
179
		push @loop, \%row;
183
		push @loop, \%row;
180
184
181
	}
185
	}
(-)a/cataloguing/z3950_search.pl (-1 / +2 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() );
Lines 222-228 warn "query ".$query if $DEBUG; Link Here
222
          $oConnection[$k]->error_x();
223
          $oConnection[$k]->error_x();
223
        if ($error) {
224
        if ($error) {
224
            if ($error =~ m/^(10000|10007)$/ ) {
225
            if ($error =~ m/^(10000|10007)$/ ) {
225
                push(@errconn, {'server' => $serverhost[$k]});
226
                push(@errconn, {'server' => $serverhost[$k], 'error' => $error});
226
            }
227
            }
227
            $DEBUG and warn "$k $serverhost[$k] error $query: $errmsg ($error) $addinfo\n";
228
            $DEBUG and warn "$k $serverhost[$k] error $query: $errmsg ($error) $addinfo\n";
228
        }
229
        }
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 2090-2095 CREATE TABLE `z3950servers` ( -- connection information for the Z39.50 targets u Link Here
2090
  `checked` smallint(6) default NULL, -- whether this target is checked by default  (1 for yes, 0 for no)
2090
  `checked` smallint(6) default NULL, -- whether this target is checked by default  (1 for yes, 0 for no)
2091
  `rank` int(11) default NULL, -- where this target appears in the list of targets
2091
  `rank` int(11) default NULL, -- where this target appears in the list of targets
2092
  `syntax` varchar(80) default NULL, -- marc format provided by this target
2092
  `syntax` varchar(80) default NULL, -- marc format provided by this target
2093
  `timeout` int(11) NOT NULL DEFAULT '0',
2093
  `icon` text, -- unused in Koha
2094
  `icon` text, -- unused in Koha
2094
  `position` enum('primary','secondary','') NOT NULL default 'primary',
2095
  `position` enum('primary','secondary','') NOT NULL default 'primary',
2095
  `type` enum('zed','opensearch') NOT NULL default 'zed',
2096
  `type` enum('zed','opensearch') NOT NULL default 'zed',
(-)a/installer/data/mysql/updatedatabase.pl (+9 lines)
Lines 4944-4949 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
4944
}
4944
}
4945
4945
4946
4946
4947
$DBversion = "3.07.00.xxx";
4948
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
4949
    $dbh->do(qq{
4950
       ALTER TABLE `z3950servers` ADD `timeout` INT( 11 ) NOT NULL DEFAULT '0' AFTER `syntax`;
4951
    });
4952
    print "Upgrade to $DBversion done (New timeout field in z3950servers)\n";
4953
    SetVersion($DBversion);
4954
}
4955
4947
=head1 FUNCTIONS
4956
=head1 FUNCTIONS
4948
4957
4949
=head2 DropAllForeignKeys($table)
4958
=head2 DropAllForeignKeys($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt (-2 / +6 lines)
Lines 230-235 Link Here
230
[% END %]
230
[% END %]
231
</select>
231
</select>
232
</li>
232
</li>
233
    <li><label for="timeout">Timeout (0 its like not set): </label>
234
		<input type="text" name="timeout" id="timeout" size="4" value="[% timeout %]" onblur="isNum(this)" /> seconds
235
	</li>	
233
</ol>
236
</ol>
234
        </fieldset>
237
        </fieldset>
235
		
238
		
Lines 258-263 Link Here
258
                <li><strong>Rank: </strong>[% rank %]</li>
261
                <li><strong>Rank: </strong>[% rank %]</li>
259
                <li><strong>Syntax: </strong>[% syntax %]</li>
262
                <li><strong>Syntax: </strong>[% syntax %]</li>
260
                <li><strong>Encoding: </strong>[% encoding %]</li>
263
                <li><strong>Encoding: </strong>[% encoding %]</li>
264
                <li><strong>Timeout: </strong>[% timeout %]</li>
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>
265
 	</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>
262
266
263
267
Lines 301-307 Link Here
301
                You searched for [% searchfield %]
305
                You searched for [% searchfield %]
302
        [% END %]		
306
        [% END %]		
303
<table id="serverst">
307
<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 colspan="2">&nbsp;</th>
308
                <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>
305
                </tr></thead>
309
                </tr></thead>
306
                <tbody>[% FOREACH loo IN loop %]
310
                <tbody>[% FOREACH loo IN loop %]
307
                [% UNLESS ( loop.odd ) %]
311
                [% UNLESS ( loop.odd ) %]
Lines 309-315 Link Here
309
                [% ELSE %]
313
                [% ELSE %]
310
                    <tr>
314
                    <tr>
311
                [% END %]
315
                [% 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><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>
316
<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>
313
                [% END %]</tbody>
317
                [% END %]</tbody>
314
	</table>
318
	</table>
315
319
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tt (-2 / +2 lines)
Lines 166-172 tr.selected { background-color : #FFFFCC; } tr.selected td { background-color : Link Here
166
            <div class="dialog alert">
166
            <div class="dialog alert">
167
                <ul>
167
                <ul>
168
                [% FOREACH errcon IN errconn %]
168
                [% FOREACH errcon IN errconn %]
169
                    <li>Connection failed to [% errcon.server %]</li>
169
                    [% IF ( errcon.error == '10000' ) %]<li>Connection failed to [% errcon.server %]</li>
170
                    [% ELSIF ( errcon.error == '10007' ) %]<li>Connection timeout to [% errcon.server %]</li>[% END %]
170
                [% END %]
171
                [% END %]
171
                </ul>
172
                </ul>
172
            </div>
173
            </div>
173
- 

Return to bug 6140