Author: danydb
Date: 2012-07-16 01:10:32 +0200 (Mon, 16 Jul 2012)
New Revision: 5070

Modified:
   phpcompta/tags/rel650/include/class_tool_uos.php
Log:
Fix bug in tool_uos

Modified: phpcompta/tags/rel650/include/class_tool_uos.php
===================================================================
--- phpcompta/tags/rel650/include/class_tool_uos.php    2012-07-15 09:15:05 UTC 
(rev 5069)
+++ phpcompta/tags/rel650/include/class_tool_uos.php    2012-07-15 23:10:32 UTC 
(rev 5070)
@@ -54,15 +54,17 @@
      * @global $cn Database connx
      * @throws Exception if the value $p_id is not unique
      */
-    function save()
+    function save($p_array=null)
     {
         global $cn;
+               if ( $p_array == null ) $p_array=$_POST;
+               $this->id=$_POST[$this->name];
         $sql="insert into tool_uos(uos_value) values ($1)";
         try {
             $cn->exec_sql($sql,array($this->id));
         } catch (Exception $e)
         {
-            throw new Exception('Duplicate value','CODE_EXCP_DUPLICATE',$e);
+            throw new Exception('Duplicate value');
         }
     }
     /**
@@ -89,7 +91,7 @@
         try
         {
             $count=$cn->get_value('select count(*) from tool_uos where 
uos_value=$1',
-                    array($p_id));
+                    array($this->id));
             if ($count != 0 ) throw new Exception 
('DUPLICATE',CODE_EXCP_DUPLICATE);
         }catch (Exception $e)
         {



---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu

_______________________________________________
Phpcompta  est un logiciel libre de comptabilité en ligne 
(http://www.phpcompta.eu)
Phpcompta-dev mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/phpcompta-dev

Reply via email to