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

SF.net SVN: ledger-smb:[2361] trunk



Revision: 2361
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2361&view=rev
Author:   einhverfr
Date:     2008-10-10 15:35:29 +0000 (Fri, 10 Oct 2008)

Log Message:
-----------
merging in fix for OE generation

Modified Paths:
--------------
    trunk/LedgerSMB/AM.pm
    trunk/bin/pe.pl
    trunk/sql/modules/Account.sql

Modified: trunk/LedgerSMB/AM.pm
===================================================================
--- trunk/LedgerSMB/AM.pm	2008-10-10 15:34:24 UTC (rev 2360)
+++ trunk/LedgerSMB/AM.pm	2008-10-10 15:35:29 UTC (rev 2361)
@@ -1828,8 +1828,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=" . $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='$_';")};      	
+
+				    }
+
         }
 
     }

Modified: trunk/bin/pe.pl
===================================================================
--- trunk/bin/pe.pl	2008-10-10 15:34:24 UTC (rev 2360)
+++ trunk/bin/pe.pl	2008-10-10 15:35:29 UTC (rev 2361)
@@ -2891,8 +2891,8 @@
     }
 
     $order = new Form;
-    $order->{dbh} = $form->{dbh};
     for ( keys %{ $form->{order} } ) {
+        $order->{dbh} = $form->{dbh};
 
         for (qw(type vc defaultcurrency login)) { $order->{$_} = $form->{$_} }
         for ( split / /, $form->{taxaccounts} ) {

Modified: trunk/sql/modules/Account.sql
===================================================================
--- trunk/sql/modules/Account.sql	2008-10-10 15:34:24 UTC (rev 2360)
+++ trunk/sql/modules/Account.sql	2008-10-10 15:35:29 UTC (rev 2361)
@@ -13,7 +13,7 @@
 CREATE OR REPLACE FUNCTION account_is_orphaned (in_id int) RETURNS bool AS
 $$
 BEGIN
-	SELECT trans_id FROM acc_trans WHERE chart_id = in_id LIMIT 1;
+	PERFORM trans_id FROM acc_trans WHERE chart_id = in_id LIMIT 1;
 	IF FOUND THEN
 		RETURN true;
 	ELSE


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