[Koha-cvs] CVS: koha/admin printers.pl,1.1.2.5,1.1.2.6

Steve Tonnesen tonnesen at users.sourceforge.net
Wed Sep 18 00:30:39 CEST 2002


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

Modified Files:
      Tag: rel-1-2
	printers.pl 
Log Message:
Found the real culprit.  The printers table did not have a primary key so
replace was not working.


Index: printers.pl
===================================================================
RCS file: /cvsroot/koha/koha/admin/printers.pl,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -C2 -r1.1.2.5 -r1.1.2.6
*** printers.pl	17 Sep 2002 20:23:27 -0000	1.1.2.5
--- printers.pl	17 Sep 2002 22:30:36 -0000	1.1.2.6
***************
*** 157,171 ****
  } elsif ($op eq 'add_validate') {
  	my $dbh=C4Connect;
! 	my $sth=$dbh->prepare("select * from printers where printername=?");
! 	$sth->execute($input->param('printername'));
! 	if ($sth->rows) {
! 	    my $sti=$dbh->prepare("update printers set printqueue=?,printtype=? where printername=?");
! 	    $sti->execute($input->param('printqueue'), $input->param('printtype'), $input->param('printername'));
! 	    $sti->finish;
! 	} else {
! 	    my $sti=$dbh->prepare("insert into printers (printqueue,printtype,printername) values (?,?,?)");
! 	    $sti->execute($input->param('printqueue'), $input->param('printtype'), $input->param('printername'));
! 	    $sti->finish;
! 	}
  	print "data recorded";
  	print "<form action='$script_name' method=post>";
--- 157,167 ----
  } elsif ($op eq 'add_validate') {
  	my $dbh=C4Connect;
! 	my $query = "replace printers (printername,printqueue,printtype) values (";
! 	$query.= $dbh->quote($input->param('printername')).",";
! 	$query.= $dbh->quote($input->param('printqueue')).",";
! 	$query.= $dbh->quote($input->param('printtype')).")";
! 	my $sth=$dbh->prepare($query);
! 	$sth->execute;
! 	$sth->finish;
  	print "data recorded";
  	print "<form action='$script_name' method=post>";





More information about the Koha-cvs mailing list