[Koha-cvs] CVS: koha/admin categorie.pl,1.13,1.13.2.1

MJ Ray slef at users.sourceforge.net
Tue Jan 6 20:02:41 CET 2004


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

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

Index: categorie.pl
===================================================================
RCS file: /cvsroot/koha/koha/admin/categorie.pl,v
retrieving revision 1.13
retrieving revision 1.13.2.1
diff -C2 -r1.13 -r1.13.2.1
*** categorie.pl	13 Jun 2003 14:41:34 -0000	1.13
--- categorie.pl	6 Jan 2004 19:02:39 -0000	1.13.2.1
***************
*** 52,67 ****
  	my @data=split(' ',$searchstring);
  	my $count=@data;
! 	my $query="Select * from categories where (description like \"$data[0]%\")";
! 	my $sth=$dbh->prepare($query);
! 	$sth->execute;
  	my @results;
- 	my $cnt=0;
  	while (my $data=$sth->fetchrow_hashref){
  	push(@results,$data);
- 	$cnt ++;
  	}
  	#  $sth->execute;
  	$sth->finish;
! 	return ($cnt,\@results);
  }
  
--- 52,64 ----
  	my @data=split(' ',$searchstring);
  	my $count=@data;
! 	my $sth=$dbh->prepare("Select * from categories where (description like ?)");
! 	$sth->execute("$data[0]%");
  	my @results;
  	while (my $data=$sth->fetchrow_hashref){
  	push(@results,$data);
  	}
  	#  $sth->execute;
  	$sth->finish;
! 	return (scalar(@results),\@results);
  }
  
***************
*** 71,75 ****
  my $categorycode=$input->param('categorycode');
  my $op = $input->param('op');
- $searchfield=~ s/\,//g;
  
  my ($template, $loggedinuser, $cookie)
--- 68,71 ----
***************
*** 97,102 ****
  	if ($categorycode) {
  		my $dbh = C4::Context->dbh;
! 		my $sth=$dbh->prepare("select categorycode,description,enrolmentperiod,upperagelimit,dateofbirthrequired,enrolmentfee,issuelimit,reservefee,overduenoticerequired from categories where categorycode='$categorycode'");
! 		$sth->execute;
  		$data=$sth->fetchrow_hashref;
  		$sth->finish;
--- 93,98 ----
  	if ($categorycode) {
  		my $dbh = C4::Context->dbh;
! 		my $sth=$dbh->prepare("select categorycode,description,enrolmentperiod,upperagelimit,dateofbirthrequired,enrolmentfee,issuelimit,reservefee,overduenoticerequired from categories where categorycode=?");
! 		$sth->execute($categorycode);
  		$data=$sth->fetchrow_hashref;
  		$sth->finish;
***************
*** 117,132 ****
  	$template->param(add_validate => 1);
  	my $dbh = C4::Context->dbh;
! 	my $query = "replace categories (categorycode,description,enrolmentperiod,upperagelimit,dateofbirthrequired,enrolmentfee,issuelimit,reservefee,overduenoticerequired) values (";
! 	$query.= $dbh->quote($input->param('categorycode')).",";
! 	$query.= $dbh->quote($input->param('description')).",";
! 	$query.= $dbh->quote($input->param('enrolmentperiod')).",";
! 	$query.= $dbh->quote($input->param('upperagelimit')).",";
! 	$query.= $dbh->quote($input->param('dateofbirthrequired')).",";
! 	$query.= $dbh->quote($input->param('enrolmentfee')).",";
! 	$query.= $dbh->quote($input->param('issuelimit')).",";
! 	$query.= $dbh->quote($input->param('reservefee')).",";
! 	$query.= $dbh->quote($input->param('overduenoticerequired')).")";
! 	my $sth=$dbh->prepare($query);
! 	$sth->execute;
  	$sth->finish;
  													# END $OP eq ADD_VALIDATE
--- 113,118 ----
  	$template->param(add_validate => 1);
  	my $dbh = C4::Context->dbh;
! 	my $sth=$dbh->prepare("replace categories (categorycode,description,enrolmentperiod,upperagelimit,dateofbirthrequired,enrolmentfee,issuelimit,reservefee,overduenoticerequired) values (?,?,?,?,?,?,?,?,?)");
! 	$sth->execute(map { $input->param($_) } ('categorycode','description','enrolmentperiod','upperagelimit','dateofbirthrequired','enrolmentfee','issuelimit','reservefee','overduenoticerequired'));
  	$sth->finish;
  													# END $OP eq ADD_VALIDATE
***************
*** 137,148 ****
  
  	my $dbh = C4::Context->dbh;
! 	my $sth=$dbh->prepare("select count(*) as total from categoryitem where categorycode='$categorycode'");
! 	$sth->execute;
  	my $total = $sth->fetchrow_hashref;
  	$sth->finish;
  	$template->param(total => $total->{'total'});
  	
! 	my $sth2=$dbh->prepare("select categorycode,description,enrolmentperiod,upperagelimit,dateofbirthrequired,enrolmentfee,issuelimit,reservefee,overduenoticerequired from categories where categorycode='$categorycode'");
! 	$sth2->execute;
  	my $data=$sth2->fetchrow_hashref;
  	$sth2->finish;
--- 123,134 ----
  
  	my $dbh = C4::Context->dbh;
! 	my $sth=$dbh->prepare("select count(*) as total from categoryitem where categorycode=?");
! 	$sth->execute($categorycode);
  	my $total = $sth->fetchrow_hashref;
  	$sth->finish;
  	$template->param(total => $total->{'total'});
  	
! 	my $sth2=$dbh->prepare("select categorycode,description,enrolmentperiod,upperagelimit,dateofbirthrequired,enrolmentfee,issuelimit,reservefee,overduenoticerequired from categories where categorycode=?");
! 	$sth2->execute($categorycode);
  	my $data=$sth2->fetchrow_hashref;
  	$sth2->finish;
***************
*** 168,174 ****
  	my $dbh = C4::Context->dbh;
  	my $categorycode=uc($input->param('categorycode'));
! 	my $query = "delete from categories where categorycode='$categorycode'";
! 	my $sth=$dbh->prepare($query);
! 	$sth->execute;
  	$sth->finish;
  													# END $OP eq DELETE_CONFIRMED
--- 154,159 ----
  	my $dbh = C4::Context->dbh;
  	my $categorycode=uc($input->param('categorycode'));
! 	my $sth=$dbh->prepare("delete from categories where categorycode=?");
! 	$sth->execute($categorycode);
  	$sth->finish;
  													# END $OP eq DELETE_CONFIRMED





More information about the Koha-cvs mailing list