[Koha-cvs] CVS: koha/admin systempreferences.pl,1.15,1.15.2.1

MJ Ray slef at users.sourceforge.net
Fri Dec 19 13:51:19 CET 2003


Update of /cvsroot/koha/koha/admin
In directory sc8-pr-cvs1:/tmp/cvs-serv3036/admin

Modified Files:
      Tag: rel_2_0
	systempreferences.pl 
Log Message:
DBI call fix for bug 662

Index: systempreferences.pl
===================================================================
RCS file: /cvsroot/koha/koha/admin/systempreferences.pl,v
retrieving revision 1.15
retrieving revision 1.15.2.1
diff -C2 -r1.15 -r1.15.2.1
*** systempreferences.pl	1 Aug 2003 14:24:47 -0000	1.15
--- systempreferences.pl	19 Dec 2003 12:51:17 -0000	1.15.2.1
***************
*** 55,61 ****
  	my @data=split(' ',$searchstring);
  	my $count=@data;
! 	my $query="Select variable,value,explanation,type,options from systempreferences where (variable like \"$data[0]%\") order by variable";
! 	my $sth=$dbh->prepare($query);
! 	$sth->execute;
  	my @results;
  	my $cnt=0;
--- 55,60 ----
  	my @data=split(' ',$searchstring);
  	my $count=@data;
! 	my $sth=$dbh->prepare("Select variable,value,explanation,type,options from systempreferences where (variable like ?) order by variable");
! 	$sth->execute("$data[0]%");
  	my @results;
  	my $cnt=0;
***************
*** 70,76 ****
  my $input = new CGI;
  my $searchfield=$input->param('searchfield');
- my $pkfield="variable";
- my $reqsel="select variable,value,explanation,type,options from systempreferences where $pkfield='$searchfield'";
- my $reqdel="delete from systempreferences where $pkfield='$searchfield'";
  my $offset=$input->param('offset');
  my $script_name="/cgi-bin/koha/admin/systempreferences.pl";
--- 69,72 ----
***************
*** 136,141 ****
  	if ($sth->rows) {
  		unless (C4::Context->config('demo') eq 1) {
! 			my $query = "update systempreferences set value=?,explanation=? where variable=?";
! 			my $sth=$dbh->prepare($query);
  			$sth->execute($value, $input->param('explanation'), $input->param('variable'));
  			$sth->finish;
--- 132,136 ----
  	if ($sth->rows) {
  		unless (C4::Context->config('demo') eq 1) {
! 			my $sth=$dbh->prepare("update systempreferences set value=?,explanation=? where variable=?");
  			$sth->execute($value, $input->param('explanation'), $input->param('variable'));
  			$sth->finish;
***************
*** 143,148 ****
      } else {
  		unless (C4::Context->config('demo') eq 1) {
! 			my $query = "insert into systempreferences (variable,value,explanation) values (?,?,?)";
! 			my $sth=$dbh->prepare($query);
  			$sth->execute($input->param('variable'), $input->param('value'), $input->param('explanation'));
  			$sth->finish;
--- 138,142 ----
      } else {
  		unless (C4::Context->config('demo') eq 1) {
! 			my $sth=$dbh->prepare("insert into systempreferences (variable,value,explanation) values (?,?,?)");
  			$sth->execute($input->param('variable'), $input->param('value'), $input->param('explanation'));
  			$sth->finish;
***************
*** 161,166 ****
  	if ($searchfield) {
  		my $dbh = C4::Context->dbh;
! 		my $sth=$dbh->prepare("select variable,value,explanation,type,options from systempreferences where variable='$searchfield'");
! 		$sth->execute;
  		$data=$sth->fetchrow_hashref;
  		$sth->finish;
--- 155,160 ----
  	if ($searchfield) {
  		my $dbh = C4::Context->dbh;
! 		my $sth=$dbh->prepare("select variable,value,explanation,type,options from systempreferences where variable=?");
! 		$sth->execute($searchfield);
  		$data=$sth->fetchrow_hashref;
  		$sth->finish;
***************
*** 237,247 ****
  } elsif ($op eq 'add_validate') {
  	my $dbh = C4::Context->dbh;
! 	my $query="select * from systempreferences where variable=?";
! 	my $sth=$dbh->prepare($query);
  	$sth->execute($input->param('variable'));
  	if ($sth->rows) {
  		unless (C4::Context->config('demo') eq 1) {
! 			my $query = "update systempreferences set value=?,explanation=? where variable=?";
! 			my $sth=$dbh->prepare($query);
  			$sth->execute($input->param('value'), $input->param('explanation'), $input->param('variable'));
  			$sth->finish;
--- 231,239 ----
  } elsif ($op eq 'add_validate') {
  	my $dbh = C4::Context->dbh;
! 	my $sth=$dbh->prepare("select * from systempreferences where variable=?");
  	$sth->execute($input->param('variable'));
  	if ($sth->rows) {
  		unless (C4::Context->config('demo') eq 1) {
! 			my $sth=$dbh->prepare("update systempreferences set value=?,explanation=? where variable=?");
  			$sth->execute($input->param('value'), $input->param('explanation'), $input->param('variable'));
  			$sth->finish;
***************
*** 249,254 ****
  	} else {
  		unless (C4::Context->config('demo') eq 1) {
! 			my $query = "insert into systempreferences (variable,value,explanation) values (?,?,?)";
! 			my $sth=$dbh->prepare($query);
  			$sth->execute($input->param('variable'), $input->param('value'), $input->param('explanation'));
  			$sth->finish;
--- 241,245 ----
  	} else {
  		unless (C4::Context->config('demo') eq 1) {
! 			my $sth=$dbh->prepare("insert into systempreferences (variable,value,explanation) values (?,?,?)");
  			$sth->execute($input->param('variable'), $input->param('value'), $input->param('explanation'));
  			$sth->finish;
***************
*** 260,265 ****
  } elsif ($op eq 'delete_confirm') {
  	my $dbh = C4::Context->dbh;
! 	my $sth=$dbh->prepare($reqsel);
! 	$sth->execute;
  	my $data=$sth->fetchrow_hashref;
  	$sth->finish;
--- 251,256 ----
  } elsif ($op eq 'delete_confirm') {
  	my $dbh = C4::Context->dbh;
! 	my $sth=$dbh->prepare("select variable,value,explanation,type,options from systempreferences where variable=?");
! 	$sth->execute($searchfield);
  	my $data=$sth->fetchrow_hashref;
  	$sth->finish;
***************
*** 273,278 ****
  } elsif ($op eq 'delete_confirmed') {
  	my $dbh = C4::Context->dbh;
! 	my $sth=$dbh->prepare($reqdel);
! 	$sth->execute;
  	$sth->finish;
  													# END $OP eq DELETE_CONFIRMED
--- 264,269 ----
  } elsif ($op eq 'delete_confirmed') {
  	my $dbh = C4::Context->dbh;
! 	my $sth=$dbh->prepare("delete from systempreferences where variable=?");
! 	$sth->execute($searchfield);
  	$sth->finish;
  													# END $OP eq DELETE_CONFIRMED





More information about the Koha-cvs mailing list