[Koha-cvs] CVS: koha/admin itemtypes.pl,1.4,1.5

Andrew Arensburger arensb at users.sourceforge.net
Sat Oct 5 12:02:51 CEST 2002


Update of /cvsroot/koha/koha/admin
In directory usw-pr-cvs1:/tmp/cvs-serv26797/admin

Modified Files:
	itemtypes.pl 
Log Message:
Merged with arensb-context branch: use C4::Context->dbh instead of
&C4Connect, and generally prefer C4::Context over C4::Database.


Index: itemtypes.pl
===================================================================
RCS file: /cvsroot/koha/koha/admin/itemtypes.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** itemtypes.pl	14 Aug 2002 18:12:53 -0000	1.4
--- itemtypes.pl	5 Oct 2002 10:02:49 -0000	1.5
***************
*** 39,50 ****
  
  use strict;
- use C4::Output;
  use CGI;
  use C4::Search;
- use C4::Database;
  
  sub StringSearch  {
  	my ($env,$searchstring,$type)=@_;
! 	my $dbh = &C4Connect;
  	$searchstring=~ s/\'/\\\'/g;
  	my @data=split(' ',$searchstring);
--- 39,50 ----
  
  use strict;
  use CGI;
+ use C4::Context;
+ use C4::Output;
  use C4::Search;
  
  sub StringSearch  {
  	my ($env,$searchstring,$type)=@_;
! 	my $dbh = C4::Context->dbh;
  	$searchstring=~ s/\'/\\\'/g;
  	my @data=split(' ',$searchstring);
***************
*** 61,65 ****
  	#  $sth->execute;
  	$sth->finish;
- 	$dbh->disconnect;
  	return ($cnt,\@results);
  }
--- 61,64 ----
***************
*** 85,89 ****
  	my $data;
  	if ($itemtype) {
! 		my $dbh = &C4Connect;
  		my $sth=$dbh->prepare("select itemtype,description,loanlength,renewalsallowed,rentalcharge from itemtypes where itemtype='$itemtype'");
  		$sth->execute;
--- 84,88 ----
  	my $data;
  	if ($itemtype) {
! 		my $dbh = C4::Context->dbh;
  		my $sth=$dbh->prepare("select itemtype,description,loanlength,renewalsallowed,rentalcharge from itemtypes where itemtype='$itemtype'");
  		$sth->execute;
***************
*** 184,188 ****
  # called by add_form, used to insert/modify data in DB
  } elsif ($op eq 'add_validate') {
! 	my $dbh=C4Connect;
  	my $query = "replace itemtypes (itemtype,description,loanlength,renewalsallowed,rentalcharge) values (";
  	$query.= $dbh->quote($input->param('itemtype')).",";
--- 183,187 ----
  # called by add_form, used to insert/modify data in DB
  } elsif ($op eq 'add_validate') {
! 	my $dbh = C4::Context->dbh;
  	my $query = "replace itemtypes (itemtype,description,loanlength,renewalsallowed,rentalcharge) values (";
  	$query.= $dbh->quote($input->param('itemtype')).",";
***************
*** 206,214 ****
  # called by default form, used to confirm deletion of data in DB
  } elsif ($op eq 'delete_confirm') {
! 	my $dbh = &C4Connect;
  	my $sth=$dbh->prepare("select count(*) as total from categoryitem where itemtype='$itemtype'");
  	$sth->execute;
  	my $total = $sth->fetchrow_hashref;
  	$sth->finish;
  	my $sth=$dbh->prepare("select itemtype,description,loanlength,renewalsallowed,rentalcharge from itemtypes where itemtype='$itemtype'");
  	$sth->execute;
--- 205,214 ----
  # called by default form, used to confirm deletion of data in DB
  } elsif ($op eq 'delete_confirm') {
! 	my $dbh = C4::Context->dbh;
  	my $sth=$dbh->prepare("select count(*) as total from categoryitem where itemtype='$itemtype'");
  	$sth->execute;
  	my $total = $sth->fetchrow_hashref;
  	$sth->finish;
+ 	# FIXME - There's already a $sth in this scope.
  	my $sth=$dbh->prepare("select itemtype,description,loanlength,renewalsallowed,rentalcharge from itemtypes where itemtype='$itemtype'");
  	$sth->execute;
***************
*** 233,237 ****
  # called by delete_confirm, used to effectively confirm deletion of data in DB
  } elsif ($op eq 'delete_confirmed') {
! 	my $dbh=C4Connect;
  	my $itemtype=uc($input->param('itemtype'));
  	my $query = "delete from itemtypes where itemtype='$itemtype'";
--- 233,237 ----
  # called by delete_confirm, used to effectively confirm deletion of data in DB
  } elsif ($op eq 'delete_confirmed') {
! 	my $dbh = C4::Context->dbh;
  	my $itemtype=uc($input->param('itemtype'));
  	my $query = "delete from itemtypes where itemtype='$itemtype'";





More information about the Koha-cvs mailing list