noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 08/107: Mantis #1693: CA - problème avec la


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 08/107: Mantis #1693: CA - problème avec la balance croisée double
Date: Mon, 26 Aug 2019 10:31:46 -0400 (EDT)

sparkyx pushed a commit to branch master
in repository noalyss.

commit bcc97e50ccaf8858e2c99982ebe952ade4c13f4c
Author: Dany De Bontridder <address@hidden>
Date:   Wed Feb 13 23:14:06 2019 +0100

    Mantis #1693: CA - problème avec la balance croisée double
---
 include/anc_balance_double.inc.php         | 27 +++++++++++++++------------
 include/class/anc_balance_double.class.php |  9 +++++----
 2 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/include/anc_balance_double.inc.php 
b/include/anc_balance_double.inc.php
index b8ab929..6b56ec8 100644
--- a/include/anc_balance_double.inc.php
+++ b/include/anc_balance_double.inc.php
@@ -15,18 +15,21 @@ echo $bc->display_form();
 echo '</form>';
 if (isset($_GET['result']))
 {
-    $result=$bc->display_html();
-    if ($bc->has_data > 0)
-    {
-        echo $bc->show_button();
-        echo $result;
+    try {
+        $result = $bc->display_html();
+        if ($bc->has_data > 0) {
+            echo $bc->show_button();
+            echo $result;
+        }else
+        {
+            echo '<p class="notice">';
+            echo _('Aucune donnée trouvée');
+            echo '</p>';
+        }
+
+    } catch (Exception $e){
+        alert($e->getMessage());
     }
-    else
-    {
-        echo '<p class="notice">';
-        echo _('Aucune donnée trouvée');
-        echo '</p>';
-    }
-        
 }
+
 ?>
diff --git a/include/class/anc_balance_double.class.php 
b/include/class/anc_balance_double.class.php
index 26fed20..3aed8e3 100644
--- a/include/class/anc_balance_double.class.php
+++ b/include/class/anc_balance_double.class.php
@@ -48,6 +48,8 @@ class Anc_Balance_Double extends Anc_Print
 
     function display_html ()
     {
+        if ($this->pa_id == $this->pa_id2) throw new Exception(_("Pas de 
croisement avec un seul plan"),1000);
+
         bcscale(2);
         $r="";
 
@@ -475,9 +477,8 @@ class Anc_Balance_Double extends Anc_Print
              operation_analytique as a join operation_analytique as b on 
(a.oa_row=b.oa_row and a.oa_group=b.oa_group)
                join poste_analytique as poa on (a.po_id=poa.po_id)
                join poste_analytique as pob on (b.po_id=pob.po_id)
-             where poa.pa_id=".
-             $this->pa_id."
-             and pob.pa_id=".$this->pa_id2."  ".$this->set_sql_filter()."
+             where poa.pa_id= $1
+             and pob.pa_id= $2 ".$this->set_sql_filter()."
              ) as m join poste_analytique as pa on ( a_po_id=pa.po_id)
              join poste_analytique as pb on (b_po_id=pb.po_id)
 
@@ -488,7 +489,7 @@ class Anc_Balance_Double extends Anc_Print
              ";
 
 
-        $array=$this->db->get_array($sql);
+        $array=$this->db->get_array($sql,[$this->pa_id,$this->pa_id2]);
         $this->has_data=count($array);
         if ( $this->has_data == 0 )
             return null;



reply via email to

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