Lines 85-108
$template->param(script_name => $script_name,
Link Here
|
85 |
|
85 |
|
86 |
################## ADD_FORM ################################## |
86 |
################## ADD_FORM ################################## |
87 |
# called by default. Used to create form to add or modify a record |
87 |
# called by default. Used to create form to add or modify a record |
88 |
if ($op eq 'add_form') { |
88 |
if ( $op eq 'add_form' ) { |
89 |
$template->param(add_form => 1); |
89 |
$template->param( add_form => 1 ); |
90 |
#---- if primkey exists, it's a modify action, so read values to modify... |
90 |
|
91 |
my $data; |
91 |
#---- if primkey exists, it's a modify action, so read values to modify... |
92 |
if ($searchfield) { |
92 |
my $data; |
93 |
my $dbh = C4::Context->dbh; |
93 |
if ($searchfield) { |
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"); |
94 |
my $dbh = C4::Context->dbh; |
95 |
$sth->execute($searchfield); |
95 |
my $sth = $dbh->prepare( |
96 |
$data=$sth->fetchrow_hashref; |
96 |
"select host,port,db,userid,password,name,id,checked,rank,syntax,encoding,timeout,recordtype from z3950servers where (name = ?) order by rank,name" |
97 |
$sth->finish; |
97 |
); |
98 |
} |
98 |
$sth->execute($searchfield); |
99 |
$template->param( $_ => $data->{$_} ) |
99 |
$data = $sth->fetchrow_hashref; |
100 |
for ( qw( host port db userid password checked rank timeout encoding ) ); |
100 |
$sth->finish; |
101 |
$template->param( $_ . $data->{$_} => 1) |
101 |
} |
102 |
for ( qw( syntax recordtype ) ); |
102 |
$template->param( $_ => $data->{$_} ) |
103 |
# END $OP eq ADD_FORM |
103 |
for (qw( host port db userid password checked rank timeout encoding )); |
|
|
104 |
$template->param( $_ . $data->{$_} => 1 ) for (qw( syntax recordtype )); |
105 |
|
106 |
# END $OP eq ADD_FORM |
104 |
################## ADD_VALIDATE ################################## |
107 |
################## ADD_VALIDATE ################################## |
105 |
# called by add_form, used to insert/modify data in DB |
108 |
# called by add_form, used to insert/modify data in DB |
106 |
} elsif ($op eq 'add_validate') { |
109 |
} elsif ($op eq 'add_validate') { |
107 |
my $dbh=C4::Context->dbh; |
110 |
my $dbh=C4::Context->dbh; |
108 |
my $sth=$dbh->prepare("select * from z3950servers where name=?"); |
111 |
my $sth=$dbh->prepare("select * from z3950servers where name=?"); |
Lines 133-175
if ($op eq 'add_form') {
Link Here
|
133 |
"(host,port,db,userid,password,name,checked,rank,syntax,encoding,timeout,recordtype) " . |
136 |
"(host,port,db,userid,password,name,checked,rank,syntax,encoding,timeout,recordtype) " . |
134 |
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" ); |
137 |
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" ); |
135 |
$sth->execute( |
138 |
$sth->execute( |
136 |
$input->param( 'host' ), |
139 |
$input->param('host'), $input->param('port'), |
137 |
$input->param( 'port' ), |
140 |
$input->param('db'), $input->param('userid'), |
138 |
$input->param( 'db' ), |
141 |
$input->param('password'), $input->param('searchfield'), |
139 |
$input->param( 'userid' ), |
142 |
$checked, $input->param('rank'), |
140 |
$input->param( 'password' ), |
143 |
$input->param('syntax'), $input->param('encoding'), |
141 |
$input->param( 'searchfield' ), |
144 |
$input->param('timeout'), $input->param('recordtype') |
142 |
$checked, |
145 |
); |
143 |
$input->param( 'rank' ), |
146 |
} |
144 |
$input->param( 'syntax' ), |
147 |
$sth->finish; |
145 |
$input->param( 'encoding' ), |
148 |
|
146 |
$input->param( 'timeout' ), |
149 |
# END $OP eq ADD_VALIDATE |
147 |
$input->param( 'recordtype' ) ); |
|
|
148 |
} |
149 |
$sth->finish; |
150 |
# END $OP eq ADD_VALIDATE |
151 |
################## DELETE_CONFIRM ################################## |
150 |
################## DELETE_CONFIRM ################################## |
152 |
# called by default form, used to confirm deletion of data in DB |
151 |
# called by default form, used to confirm deletion of data in DB |
153 |
} elsif ($op eq 'delete_confirm') { |
152 |
} elsif ($op eq 'delete_confirm') { |
154 |
$template->param(delete_confirm => 1); |
153 |
$template->param( delete_confirm => 1 ); |
155 |
my $dbh = C4::Context->dbh; |
154 |
my $dbh = C4::Context->dbh; |
156 |
|
155 |
|
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 |
my $sth2 = $dbh->prepare( |
158 |
$sth2->execute($searchfield); |
157 |
"select host,port,db,userid,password,name,id,checked,rank,syntax,encoding,timeout,recordtype from z3950servers where (name = ?) order by rank,name" |
159 |
my $data=$sth2->fetchrow_hashref; |
158 |
); |
160 |
$sth2->finish; |
159 |
$sth2->execute($searchfield); |
161 |
|
160 |
my $data = $sth2->fetchrow_hashref; |
162 |
$template->param(host => $data->{'host'}, |
161 |
$sth2->finish; |
163 |
port => $data->{'port'}, |
162 |
|
164 |
db => $data->{'db'}, |
163 |
$template->param( |
165 |
userid => $data->{'userid'}, |
164 |
host => $data->{'host'}, |
166 |
password => $data->{'password'}, |
165 |
port => $data->{'port'}, |
167 |
checked => $data->{'checked'}, |
166 |
db => $data->{'db'}, |
168 |
rank => $data->{'rank'}, |
167 |
userid => $data->{'userid'}, |
169 |
syntax => $data->{'syntax'}, |
168 |
password => $data->{'password'}, |
170 |
timeout => $data->{'timeout'}, |
169 |
checked => $data->{'checked'}, |
171 |
recordtype => $data->{'recordtype'}, |
170 |
rank => $data->{'rank'}, |
172 |
encoding => $data->{'encoding'} ); |
171 |
syntax => $data->{'syntax'}, |
|
|
172 |
timeout => $data->{'timeout'}, |
173 |
recordtype => $data->{'recordtype'}, |
174 |
encoding => $data->{'encoding'} |
175 |
); |
173 |
|
176 |
|
174 |
# END $OP eq DELETE_CONFIRM |
177 |
# END $OP eq DELETE_CONFIRM |
175 |
################## DELETE_CONFIRMED ################################## |
178 |
################## DELETE_CONFIRMED ################################## |