noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 88/119: Fix bug : follow up option contact ar


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 88/119: Fix bug : follow up option contact are not remove when document type changed
Date: Mon, 26 Oct 2020 18:27:31 -0400 (EDT)

sparkyx pushed a commit to branch master
in repository noalyss.

commit f2ae91ed7c93fd43457607c3951cf0b63d82a599
Author: Dany De Bontridder <danydb@noalyss.eu>
AuthorDate: Mon Oct 12 13:33:08 2020 +0200

    Fix bug : follow up option contact are not remove when document type changed
---
 include/class/action_document_type_mtable.class.php | 13 +++++++++++++
 include/class/card_multiple.class.php               |  7 ++++---
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/include/class/action_document_type_mtable.class.php 
b/include/class/action_document_type_mtable.class.php
index a48b98a..64c8c57 100644
--- a/include/class/action_document_type_mtable.class.php
+++ b/include/class/action_document_type_mtable.class.php
@@ -197,6 +197,19 @@ class Action_Document_Type_MTable extends Manage_Table_SQL
                     document_type_id is null
                     or document_type_id = $1
                     order by cor_label", [$this->table->dt_id]);
+                
+                // delete unused option by the action_person_
+                $cn->exec_sql("delete from action_person_option  where ap_id 
in (select apo.ap_id 
+                    from action_person a 
+                    left join action_person_option apo ON  
(a.ap_id=apo.action_person_id)
+                    left join contact_option_ref cor on 
(apo.contact_option_ref_id=cor.cor_id)
+                    join action_gestion ag  on (a.ag_id=ag.ag_id)
+                    where  
+                    cor.cor_id not in (select jdoc2.contact_option_ref_id 
+                                        from jnt_document_option_contact jdoc2 
+                                        where jdoc2.document_type_id =$1 
+                                        and jdoc2.jdoc_enable =1));
+                    ",[$table->dt_id]);
             }
 
             // Detail option
diff --git a/include/class/card_multiple.class.php 
b/include/class/card_multiple.class.php
index 60ed305..13ca09f 100644
--- a/include/class/card_multiple.class.php
+++ b/include/class/card_multiple.class.php
@@ -146,9 +146,10 @@ class Card_Multiple
         // delete disable
         $cn->exec_sql("delete 
                 from action_person_option apo 
-                where contact_option_ref_id  in 
-               (select contact_option_ref_id from jnt_document_option_contact 
jdoc join action_gestion on                       (ag_type=document_type_id) 
-                    where ag_id=$1 and jdoc_enable=0)",[$ag_id]);
+                where contact_option_ref_id  not in 
+               (select contact_option_ref_id from jnt_document_option_contact 
jdoc join action_gestion on   
+               (ag_type=document_type_id) 
+                    where ag_id=$1 and jdoc_enable=1)",[$ag_id]);
         
         // First select the option
         $sql="select ap_id,cor_id,ap_value,cor_type ,cor_label,cor_value_select



reply via email to

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