noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 01/02: Bug : if all the quantity are NULL, th


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 01/02: Bug : if all the quantity are NULL, then we have only one row in jrn
Date: Mon, 4 Jan 2021 12:18:52 -0500 (EST)

sparkyx pushed a commit to tag rel8003
in repository noalyss.

commit a9d6970055bf057ef3b4f1ff9269943bce4a780f
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Mon Jan 4 13:04:47 2021 +0100

    Bug : if all the quantity are NULL, then we have only
    one row in jrn
---
 include/class/acc_ledger_purchase.class.php | 2 +-
 include/class/acc_ledger_sold.class.php     | 4 +++-
 include/class/acc_operation.class.php       | 4 ++++
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/include/class/acc_ledger_purchase.class.php 
b/include/class/acc_ledger_purchase.class.php
index 2417446..667e032 100644
--- a/include/class/acc_ledger_purchase.class.php
+++ b/include/class/acc_ledger_purchase.class.php
@@ -260,7 +260,7 @@ class  Acc_Ledger_Purchase extends Acc_Ledger
                      }
                  }
              }
-           $nb++;
+            if ( ${"e_quant".$i} != 0 && trim(${"e_quant".$i}) !="" ) {$nb++;}
         }
 
         if ( $nb == 0 )
diff --git a/include/class/acc_ledger_sold.class.php 
b/include/class/acc_ledger_sold.class.php
index 9cb0668..27ec56a 100644
--- a/include/class/acc_ledger_sold.class.php
+++ b/include/class/acc_ledger_sold.class.php
@@ -208,7 +208,9 @@ class Acc_Ledger_Sold extends Acc_Ledger {
             $fiche->get_by_qcode(${'e_march' . $i});
             if ($fiche->belong_ledger($p_jrn, 'cred') != 1)
                 throw new Exception(_('La fiche ') . ${'e_march' . $i} . 
_('n\'est pas accessible à ce journal'), 10);
-            $nb++;
+           
+            if ( ${"e_quant".$i} != 0 && trim(${"e_quant".$i}) !="" ) {$nb++;}
+
         }
         if ($nb == 0)
             throw new Exception(_('Il n\'y a aucune marchandise'), 12);
diff --git a/include/class/acc_operation.class.php 
b/include/class/acc_operation.class.php
index 06946c7..f5ff15d 100644
--- a/include/class/acc_operation.class.php
+++ b/include/class/acc_operation.class.php
@@ -60,6 +60,7 @@ class Acc_Operation
         $this->periode=$g_user->get_periode();
         $this->jr_id=0;
         $this->jr_optype="NOR";
+        $this->amount=0;
     }
     /**
      *@brief retrieve the grpt_id from jrn for a jr_id
@@ -183,6 +184,7 @@ class Acc_Operation
         $this->amount=abs($this->amount);
         $debit=($this->type=='c')?'false':'true';
         $this->desc=(isset($this->desc))?$this->desc:'';
+        
$this->amount=(trim($this->amount)==''||$this->amount==NULL)?0:$this->amount;
         $Res=$this->db->exec_sql("select insert_jrnx
                                  
($1::text,abs($2)::numeric,$3::account_type,$4::integer,$5::integer,$6::bool,$7::text,$8::integer,upper($9),$10::text)",
                                  array(
@@ -287,8 +289,10 @@ class Acc_Operation
         {
             $this->mt=microtime(true);
         }
+        
         // if amount == -1then the triggers will throw an error
         //
+        
$this->amount=(trim($this->amount)==''||$this->amount==NULL)?0:$this->amount;
         $Res=$this->db->exec_sql("insert into jrn 
(jr_def_id,jr_montant,jr_comment,".
                                  
"jr_date,jr_ech,jr_grpt_id,jr_tech_per,jr_mt,jr_optype)   values (".
                                  "$1,$2,$3,".



reply via email to

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