Fixed bug #299
This commit is contained in:
parent
337f02d7ce
commit
60b1489fe5
1 changed files with 17 additions and 6 deletions
|
@ -113,12 +113,23 @@ if ($op eq 'add_form') {
|
||||||
} elsif ($op eq 'add_validate') {
|
} elsif ($op eq 'add_validate') {
|
||||||
$template->param(add_validate => 1);
|
$template->param(add_validate => 1);
|
||||||
my $dbh = C4::Context->dbh;
|
my $dbh = C4::Context->dbh;
|
||||||
my $query = "replace currency (currency,rate) values (";
|
|
||||||
$query.= $dbh->quote($input->param('currency')).",";
|
my $check = $dbh->prepare("select * from currency where currency = ?");
|
||||||
$query.= $dbh->quote($input->param('rate')).")";
|
$check->execute($input->param('currency'));
|
||||||
my $sth=$dbh->prepare($query);
|
if ( $check->fetchrow )
|
||||||
$sth->execute;
|
{
|
||||||
$sth->finish;
|
my $sth = $dbh->prepare("UPDATE currency SET rate = ? WHERE currency = ?");
|
||||||
|
$sth->execute($input->param('rate'),$input->param('currency'));
|
||||||
|
$sth->finish;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
my $sth = $dbh->prepare("INSERT INTO currency (currency, rate) VALUES (?,?)");
|
||||||
|
$sth->execute($input->param('currency'),$input->param('rate'));
|
||||||
|
$sth->finish;
|
||||||
|
}
|
||||||
|
|
||||||
|
$check->finish;
|
||||||
# END $OP eq ADD_VALIDATE
|
# END $OP eq ADD_VALIDATE
|
||||||
################## DELETE_CONFIRM ##################################
|
################## DELETE_CONFIRM ##################################
|
||||||
# called by default form, used to confirm deletion of data in DB
|
# called by default form, used to confirm deletion of data in DB
|
||||||
|
|
Loading…
Reference in a new issue