diff --git a/admin/currency.pl b/admin/currency.pl index 003ff89858..1e3f16082b 100755 --- a/admin/currency.pl +++ b/admin/currency.pl @@ -181,9 +181,6 @@ sub add_form { sub add_validate { $template->param( add_validate => 1 ); - if ( $input->param('active') == 1 ) { - $dbh->do('UPDATE currency SET active = 0'); - } my $rec = { rate => $input->param('rate'), symbol => $input->param('symbol') || q{}, @@ -191,6 +188,10 @@ sub add_validate { currency => $input->param('currency'), }; + if ( $rec->{active} == 1 ) { + $dbh->do('UPDATE currency SET active = 0'); + } + my ($row_count) = $dbh->selectrow_array( 'select count(*) as count from currency where currency = ?', {}, $input->param('currency') );