diff options
author | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2008-10-10 15:35:29 +0000 |
---|---|---|
committer | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2008-10-10 15:35:29 +0000 |
commit | ba5890bd2f14e916e47f17a79af49392487dbeb0 (patch) | |
tree | 1c3577dad252566b22ec88d8745342ace914d027 /LedgerSMB | |
parent | ef0adaca475df108bb89e651c531599c23bb84e7 (diff) |
merging in fix for OE generation
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@2361 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB')
-rw-r--r-- | LedgerSMB/AM.pm | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/LedgerSMB/AM.pm b/LedgerSMB/AM.pm index d502bc20..b6834e53 100644 --- a/LedgerSMB/AM.pm +++ b/LedgerSMB/AM.pm @@ -1828,8 +1828,28 @@ sub save_defaults { || $form->dberror("Saving $_"); } else { - $sth_plain->execute( $val, $_ ) - || $form->dberror("Saving $_"); + my $found=0; + my $sth_defcheck=$dbh->prepare("select count(*) from defaults where setting_key='$_';") || $form->dberror("Select defaults $_"); + $sth_defcheck->execute() || $form->dberror("execute defaults $_"); + while(my $found1=$sth_defcheck->fetchrow()){$found=$found1;} + + if($val ne '') + { + if($found) + { + $dbh->do("update defaults set value=" . $dbh->quote($val) . " where setting_key='$_';"); + } + else + { + $dbh->do("insert into defaults(value,setting_key) values( " . $dbh->quote($val) . ",'$_');"); + } + } + else + { + if($found){$dbh->do("delete from defaults where setting_key='$_';")}; + + } + } } |