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

Steve Tonnesen tonnesen at users.sourceforge.net
Tue Sep 17 22:23:29 CEST 2002


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

Modified Files:
      Tag: rel-1-2
	printers.pl 
Log Message:
Fixed printers.pl so that printers can be edited (would previously just add a
new printer instead of editing an existing one).


Index: printers.pl
===================================================================
RCS file: /cvsroot/koha/koha/admin/printers.pl,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -C2 -r1.1.2.4 -r1.1.2.5
*** printers.pl	20 Aug 2002 09:28:26 -0000	1.1.2.4
--- printers.pl	17 Sep 2002 20:23:27 -0000	1.1.2.5
***************
*** 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>";
--- 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>";





More information about the Koha-cvs mailing list