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

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


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

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


Index: currency.pl
===================================================================
RCS file: /cvsroot/koha/koha/admin/currency.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** currency.pl	14 Aug 2002 18:12:53 -0000	1.4
--- currency.pl	5 Oct 2002 10:02:39 -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 ----
***************
*** 89,93 ****
  	my $data;
  	if ($searchfield) {
! 		my $dbh = &C4Connect;
  		my $sth=$dbh->prepare("select currency,rate from currency where currency='$searchfield'");
  		$sth->execute;
--- 88,92 ----
  	my $data;
  	if ($searchfield) {
! 		my $dbh = C4::Context->dbh;
  		my $sth=$dbh->prepare("select currency,rate from currency where currency='$searchfield'");
  		$sth->execute;
***************
*** 173,177 ****
  # called by add_form, used to insert/modify data in DB
  } elsif ($op eq 'add_validate') {
! 	my $dbh=C4Connect;
  	my $query = "replace currency (currency,rate) values (";
  	$query.= $dbh->quote($input->param('currency')).",";
--- 172,176 ----
  # called by add_form, used to insert/modify data in DB
  } elsif ($op eq 'add_validate') {
! 	my $dbh = C4::Context->dbh;
  	my $query = "replace currency (currency,rate) values (";
  	$query.= $dbh->quote($input->param('currency')).",";
***************
*** 188,196 ****
  # 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 aqbooksellers where currency='$searchfield'");
  	$sth->execute;
  	my $total = $sth->fetchrow_hashref;
  	$sth->finish;
  	my $sth=$dbh->prepare($reqsel);
  	$sth->execute;
--- 187,196 ----
  # 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 aqbooksellers where currency='$searchfield'");
  	$sth->execute;
  	my $total = $sth->fetchrow_hashref;
  	$sth->finish;
+ 	# FIXME - There's already a $sth in this scope.
  	my $sth=$dbh->prepare($reqsel);
  	$sth->execute;
***************
*** 212,216 ****
  # called by delete_confirm, used to effectively confirm deletion of data in DB
  } elsif ($op eq 'delete_confirmed') {
! 	my $dbh=C4Connect;
  #	my $searchfield=$input->param('branchcode');
  	my $sth=$dbh->prepare($reqdel);
--- 212,216 ----
  # called by delete_confirm, used to effectively confirm deletion of data in DB
  } elsif ($op eq 'delete_confirmed') {
! 	my $dbh = C4::Context->dbh;
  #	my $searchfield=$input->param('branchcode');
  	my $sth=$dbh->prepare($reqdel);





More information about the Koha-cvs mailing list