[Koha-cvs] CVS: koha/admin categoryitem.pl,1.7,1.7.2.1

MJ Ray slef at users.sourceforge.net
Thu Jan 8 17:28:23 CET 2004


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

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

Index: categoryitem.pl
===================================================================
RCS file: /cvsroot/koha/koha/admin/categoryitem.pl,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -C2 -r1.7 -r1.7.2.1
*** categoryitem.pl	5 Apr 2003 03:35:09 -0000	1.7
--- categoryitem.pl	8 Jan 2004 16:28:20 -0000	1.7.2.1
***************
*** 53,68 ****
  	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);
  }
  
--- 53,65 ----
  	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);
  }
  
***************
*** 96,101 ****
  	if ($categorycode) {
  		my $dbh = C4::Context->dbh;
! 		my $sth=$dbh->prepare("select categorycode,description,enrolmentperiod,upperagelimit,dateofbirthrequired,finetype,bulk,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,finetype,bulk,enrolmentfee,issuelimit,reservefee,overduenoticerequired from categories where categorycode=?");
! 		$sth->execute($categorycode);
  		$data=$sth->fetchrow_hashref;
  		$sth->finish;
***************
*** 121,138 ****
  	$template->param(add_validate => 1);
  	my $dbh = C4::Context->dbh;
! 	my $query = "replace categories (categorycode,description,enrolmentperiod,upperagelimit,dateofbirthrequired,finetype,bulk,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('finetype')).",";
! 	$query.= $dbh->quote($input->param('bulk')).",";
! 	$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;
  	print "data recorded";
--- 118,123 ----
  	$template->param(add_validate => 1);
  	my $dbh = C4::Context->dbh;
! 	my $sth=$dbh->prepare("replace categories (categorycode,description,enrolmentperiod,upperagelimit,dateofbirthrequired,finetype,bulk,enrolmentfee,issuelimit,reservefee,overduenoticerequired) values (?,?,?,?,?,?,?,?,?,?,?)");
! 	$sth->execute(map {$input->param($_)} ('categorycode','description','enrolmentperiod','upperagelimit','dateofbirthrequired','finetype','bulk','enrolmentfee','issuelimit','reservefee','overduenoticerequired'));
  	$sth->finish;
  	print "data recorded";
***************
*** 146,156 ****
  	$template->param(delete_confirm => 1);
  	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;
  	print "TOTAL : $categorycode : $total->{'total'}<br>";
  	$sth->finish;
! 	my $sth2=$dbh->prepare("select categorycode,description,enrolmentperiod,upperagelimit,dateofbirthrequired,finetype,bulk,enrolmentfee,issuelimit,reservefee,overduenoticerequired from categories where categorycode='$categorycode'");
! 	$sth2->execute;
  	my $data=$sth2->fetchrow_hashref;
  	$sth2->finish;
--- 131,141 ----
  	$template->param(delete_confirm => 1);
  	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;
  	print "TOTAL : $categorycode : $total->{'total'}<br>";
  	$sth->finish;
! 	my $sth2=$dbh->prepare("select categorycode,description,enrolmentperiod,upperagelimit,dateofbirthrequired,finetype,bulk,enrolmentfee,issuelimit,reservefee,overduenoticerequired from categories where categorycode=?");
! 	$sth2->execute($categorycode);
  	my $data=$sth2->fetchrow_hashref;
  	$sth2->finish;
***************
*** 174,180 ****
  	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
--- 159,164 ----
  	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
***************
*** 197,201 ****
                                  issuelimit => $results->[$i]{'issuelimit'},
                                  reservefee => $results->[$i]{'reservefee'},
! 				toggle = $toggle );
                  push @loop, \%row;
                  if ( $toggle eq 'white' )
--- 181,185 ----
                                  issuelimit => $results->[$i]{'issuelimit'},
                                  reservefee => $results->[$i]{'reservefee'},
! 				toggle => $toggle );
                  push @loop, \%row;
                  if ( $toggle eq 'white' )





More information about the Koha-cvs mailing list