phpcompta-dev
[Top][All Lists]
Advanced

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

[Phpcompta-dev] r5066 - phpcompta/tags/rel650/include


From: phpcompta-dev
Subject: [Phpcompta-dev] r5066 - phpcompta/tags/rel650/include
Date: Mon, 9 Jul 2012 18:43:20 +0200 (CEST)

Author: danydb
Date: 2012-07-09 18:43:20 +0200 (Mon, 09 Jul 2012)
New Revision: 5066

Modified:
   phpcompta/tags/rel650/include/action.common.inc.php
   phpcompta/tags/rel650/include/class_follow_up.php
Log:
0000674: Deux actions-gestion ne peuvent avoir le m?\195?\170me num?\195?\169ro 
de pi?\195?\168ce

Modified: phpcompta/tags/rel650/include/action.common.inc.php
===================================================================
--- phpcompta/tags/rel650/include/action.common.inc.php 2012-07-08 18:58:45 UTC 
(rev 5065)
+++ phpcompta/tags/rel650/include/action.common.inc.php 2012-07-09 16:43:20 UTC 
(rev 5066)
@@ -84,19 +84,16 @@
        {
                $act2 = new Follow_Up($cn);
                $act2->fromArray($_POST);
-               $sub_action = "detail";
-               put_global(array(array('key' => "sa", "value" => "detail")));
-               if ($g_user->can_write_action($act2->ag_id))
+               if ($g_user->can_write_action($act2->ag_id) == false )
                {
-                       $act2->Update();
-               }
-               else
-               {
                        echo '<div class="redcontent">';
                        echo '<h2 class="error"> Cette action ne vous est pas 
autorisée Contactez votre responsable</h2>';
                        echo '</div>';
                        exit();
                }
+               $sub_action = "detail";
+               put_global(array(array('key' => "sa", "value" => "detail")));
+               $act2->Update() ;
        }
        //----------------------------------------------------------------------
        // Add a related action

Modified: phpcompta/tags/rel650/include/class_follow_up.php
===================================================================
--- phpcompta/tags/rel650/include/class_follow_up.php   2012-07-08 18:58:45 UTC 
(rev 5065)
+++ phpcompta/tags/rel650/include/class_follow_up.php   2012-07-09 16:43:20 UTC 
(rev 5066)
@@ -847,7 +847,22 @@
                if ($contact->get_by_qcode($this->ag_contact) == -1)
                        $contact->id = 0;
 
+               // reload the old one
+               $old=new Follow_Up($this->db,$this->ag_id);
+               $old->get();
 
+               // If ag_ref changed then check if unique
+               if ($old->ag_ref != $this->ag_ref)
+               {
+                       $nAg_ref=$this->db->get_value("select count(*) from 
action_gestion where ag_ref=$1",array($this->ag_ref));
+                       if ($nAg_ref != 0 )
+                       {
+                               echo h2("Référence en double, référence non 
sauvée",'class="error"');
+                               $this->ag_ref=$old->ag_ref;
+                       }
+               }
+
+
                if ($this->ag_remind_date != null)
                {
                        $this->db->exec_sql("update action_gestion set " .



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



reply via email to

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