|
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 |
} |