noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 01/03: Bug #2098: Les fiches utilisées dans l


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 01/03: Bug #2098: Les fiches utilisées dans le suivi ne peuvent pas être effacées
Date: Thu, 25 Nov 2021 08:22:56 -0500 (EST)

sparkyx pushed a commit to branch devel
in repository noalyss.

commit d54d2bcdb65dfc1fa4a75d1a03a5227396fbcf88
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Tue Nov 23 19:40:57 2021 +0100

    Bug #2098: Les fiches utilisées dans le suivi ne peuvent pas être effacées
---
 include/class/fiche.class.php | 28 ++++++++++------------------
 1 file changed, 10 insertions(+), 18 deletions(-)

diff --git a/include/class/fiche.class.php b/include/class/fiche.class.php
index 6a12dd0..79b263a 100644
--- a/include/class/fiche.class.php
+++ b/include/class/fiche.class.php
@@ -540,31 +540,23 @@ class Fiche
         $this->quick_code=$this->strAttribut(ATTR_DEF_QUICKCODE);
     }
 
-    /*!\brief  remove a card
+    /*!\brief  remove a card, check if not used first, must be synchro with 
is_used
     */
     function remove($silent=false)
     {
         if ( $this->id==0 ) return;
-        // verify if that card has not been used is a ledger
+        // verify if that card has not been used is a ledger nor in the 
followup
         // if the card has its own account in PCMN
         // Get the fiche_def.fd_id from fiche.f_id
-        $this->Get();
-        $fiche_def=new Fiche_Def($this->cn,$this->fiche_def);
-        $fiche_def->get();
-
-        // if the card is used do not removed it
-        $qcode=$this->strAttribut(ATTR_DEF_QUICKCODE);
-
-        if ( $this->cn->count_sql("select * from jrnx where 
j_qcode='".Database::escape_string($qcode)."'") != 0)
-        {
-            if ( ! $silent ) {
-               alert(_('Impossible cette fiche est utilisée dans un journal'));
-            }
-            return 1;
+        if ( $this->is_used() == FALSE) {
+            $this->delete();
+            return 0;
         }
-
-        $this->delete();
-               return 0;
+        
+        if ( ! $silent ) {
+            alert(_('Impossible cette fiche est utilisée dans un journal'));
+        }
+        return 1;
     }
 
 



reply via email to

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