phpcompta-dev
[Top][All Lists]
Advanced

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

[Phpcompta-dev] r4731 - phpcompta/tags/rel600/include


From: phpcompta-dev
Subject: [Phpcompta-dev] r4731 - phpcompta/tags/rel600/include
Date: Wed, 25 Jan 2012 00:42:15 +0100 (CET)

Author: danydb
Date: 2012-01-25 00:42:14 +0100 (Wed, 25 Jan 2012)
New Revision: 4731

Modified:
   phpcompta/tags/rel600/include/class_fiche.php
Log:
probleme mise ?\195?\160 jour fiche avec double poste comptable

Modified: phpcompta/tags/rel600/include/class_fiche.php
===================================================================
--- phpcompta/tags/rel600/include/class_fiche.php       2012-01-24 12:49:31 UTC 
(rev 4730)
+++ phpcompta/tags/rel600/include/class_fiche.php       2012-01-24 23:42:14 UTC 
(rev 4731)
@@ -934,47 +934,51 @@
                 }
 
                 // account
-                if ( $id == ATTR_DEF_ACCOUNT )
-                {
-                    $v=sql_string($value);
-                    if ( trim($v) != ''  )
-                    {
-                       if ( strpos($v,',') != 0)
-                       {
-                               $v=$this->cn->get_value('select 
format_account($1)',
-                                   array($v));
-                       }
-                        $sql=sprintf("select account_update(%d,'%s')",
-                                     $this->id,$v);
-                        try
-                        {
-                            $this->cn->exec_sql($sql);
-                        }
-                        catch (Exception $e)
-                        {
-                            throw new Exception(__LINE__."Erreur : ce compte 
[$v] n'a pas de compte parent.".
-                                                "L'opération est 
annulée");
-                        }
-                        continue;
-                    }
-                    if ( strlen (trim($v)) == 0 )
-                    {
+                if ($id == ATTR_DEF_ACCOUNT)
+                               {
+                                       $v = sql_string($value);
+                                       if (trim($v) != '')
+                                       {
+                                               if (strpos($v, ',') != 0)
+                                               {
+                                                       $ac_array = 
explode(",", $v);
+                                                       if (count($ac_array) <> 
2)
+                                                               throw new 
Exception('Désolé, il y a trop de virgule dans le poste comptable ' . h($v));
+                                                       $part1 = $ac_array[0];
+                                                       $part2 = $ac_array[1];
+                                                       $part1 = 
$this->cn->get_value('select format_account($1)', array($part1));
+                                                       $part2 = 
$this->cn->get_value('select format_account($1)', array($part2));
+                                                       $v = $part1 . ',' . 
$part2;
+                                               }
+                                               $sql = sprintf("select 
account_update(%d,'%s')", $this->id, $v);
+                                               try
+                                               {
+                                                       
$this->cn->exec_sql($sql);
+                                               }
+                                               catch (Exception $e)
+                                               {
+                                                       throw new 
Exception(__LINE__ . "Erreur : ce compte [$v] n'a pas de compte parent." .
+                                                                       
"L'op&eacute;ration est annul&eacute;e");
+                                               }
+                                               continue;
+                                       }
+                                       if (strlen(trim($v)) == 0)
+                                       {
 
-                        $sql=sprintf("select account_update(%d,null)",
-                                     $this->id);
-                        try
-                        {
-                            $Ret=$this->cn->exec_sql($sql);
-                        }
-                        catch (Exception $e)
-                        {
-                            throw new Exception(__LINE__."Erreur : ce compte 
[$v] n'a pas de compte parent.".
-                                                "L'opération est annulée");
-                        }
+                                               $sql = sprintf("select 
account_update(%d,null)", $this->id);
+                                               try
+                                               {
+                                                       $Ret = 
$this->cn->exec_sql($sql);
+                                               }
+                                               catch (Exception $e)
+                                               {
+                                                       throw new 
Exception(__LINE__ . "Erreur : ce compte [$v] n'a pas de compte parent." .
+                                                                       
"L'opération est annulée");
+                                               }
 
-                        continue;
-                    }
-                }
+                                               continue;
+                                       }
+                               }
                 // TVA
                 if ( $id == ATTR_DEF_TVA )
                 {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]