[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[2353] branches/1.2



Revision: 2353
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2353&view=rev
Author:   einhverfr
Date:     2008-10-07 16:19:44 +0000 (Tue, 07 Oct 2008)

Log Message:
-----------
Adding Sadashiva's fix for non-existant defaults values

Modified Paths:
--------------
    branches/1.2/CONTRIBUTORS
    branches/1.2/LedgerSMB/AM.pm

Modified: branches/1.2/CONTRIBUTORS
===================================================================
--- branches/1.2/CONTRIBUTORS	2008-10-06 20:47:39 UTC (rev 2352)
+++ branches/1.2/CONTRIBUTORS	2008-10-07 16:19:44 UTC (rev 2353)
@@ -69,8 +69,7 @@
 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:
 ===================================

Modified: branches/1.2/LedgerSMB/AM.pm
===================================================================
--- branches/1.2/LedgerSMB/AM.pm	2008-10-06 20:47:39 UTC (rev 2352)
+++ branches/1.2/LedgerSMB/AM.pm	2008-10-07 16:19:44 UTC (rev 2353)
@@ -1415,8 +1415,28 @@
               || $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='$_';")};      	
+
+				    }
+
         }
 
     }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.