summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTORS3
-rwxr-xr-xLedgerSMB/AM.pm24
2 files changed, 23 insertions, 4 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index b8c2ef5c..e8023818 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -69,8 +69,7 @@ Donna Robinson [email omitted] contributed some fixes to the HTML code.
Victor Sterpu <victor @ ambra.ro> has contributed several bug fixes to COGS
handling.
-Sadashiva Ambiger [email omitted] has committed a fix to the admin screen regarding
-access errors when deleting a user.
+Sadashiva Ambiger [email omitted] has contributed several bug fixes.
Original Authors of SQL-Ledger:
===================================
diff --git a/LedgerSMB/AM.pm b/LedgerSMB/AM.pm
index 328a745b..1d209358 100755
--- a/LedgerSMB/AM.pm
+++ b/LedgerSMB/AM.pm
@@ -1415,8 +1415,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='$val' where setting_key='$_';");
+ }
+ else
+ {
+ $dbh->do("insert into defaults(value,setting_key) values('$val','$_');");
+ }
+ }
+ else
+ {
+ if($found){$dbh->do("delete from defaults where setting_key='$_';")};
+
+ }
+
}
}