Removing replace sql from admin/letter.pl as per bug 1546

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
Chris Cormack 2008-01-08 19:01:37 -06:00 committed by Joshua Ferraro
parent 96e89fa4dc
commit 40851ea4cc
2 changed files with 17 additions and 3 deletions

View File

@ -148,9 +148,18 @@ if ($op eq 'add_form') {
# called by add_form, used to insert/modify data in DB
} elsif ($op eq 'add_validate') {
my $dbh = C4::Context->dbh;
my $sth=$dbh->prepare("replace letter (module,code,name,title,content) values (?,?,?,?,?)");
$sth->execute(map {$input->param('module')} qw(code name title content));
$sth->finish;
if ($query->param('add')){
# need to do an insert
my $sth=$dbh->prepare("INSERT INTO letter (module,code,name,title,content) VALUES (?,?,?,?,?)");
$sth->execute(map {$input->param('module')} qw(code name title content));
$sth->finish;
}
else {
# do an update
my $sth=$dbh->prepare("UPDATE letter SET module=?,name=?,title=?,content=? WHERE code=?");
$sth->execute(map {$input->param('module')} qw(name title content code));
$sth->finish;
}
print $input->redirect("letter.pl");
exit;
################## DELETE_CONFIRM ##################################

View File

@ -159,6 +159,11 @@
<form action="/cgi-bin/koha/tools/letter.pl" name="Aform" method="post">
<input type="hidden" name="op" value="add_validate" />
<input type="hidden" name="checked" value="0" />
<!-- TMPL_IF name="modify" -->
<input type="hidden" name="add" value="0" />
<!-- TMPL_ELSE -->
<input type="hidden" name="add" value="1" />
<!-- /TMPL_IF -->
<fieldset class="rows">
<legend><!-- TMPL_IF name="modify" -->Modify notice<!-- TMPL_ELSE -->Add notice<!-- /TMPL_IF --></legend>
<ol>