noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 24/33: allow many-to-many lettering + cosmeti


From: dwm
Subject: [Noalyss-commit] [noalyss] 24/33: allow many-to-many lettering + cosmetic
Date: Thu, 18 Jul 2024 12:24:48 -0400 (EDT)

sparkyx pushed a commit to branch unstable
in repository noalyss.

commit d810da721ef31ccf59ed673c86013bca8e44a54c
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Fri Jul 12 18:39:12 2024 +0200

    allow many-to-many lettering + cosmetic
---
 include/class/acc_ledger.class.php          |  8 +++-----
 include/class/acc_ledger_purchase.class.php |  4 +++-
 include/class/acc_ledger_sale.class.php     |  4 ++--
 include/class/acc_reconciliation.class.php  |  5 +++--
 include/class/lettering.class.php           | 15 +++++++++------
 5 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/include/class/acc_ledger.class.php 
b/include/class/acc_ledger.class.php
index e3e5b9f99..17f6dd420 100644
--- a/include/class/acc_ledger.class.php
+++ b/include/class/acc_ledger.class.php
@@ -439,7 +439,7 @@ class Acc_Ledger  extends jrn_def_sql
 
             // Add a "concerned operation to bound these op.together
             //
-        $rec=new Acc_Reconciliation($this->db);
+            $rec=new Acc_Reconciliation($this->db);
             $rec->set_jr_id($seq);
             $rec->insert($this->jr_id);
 
@@ -449,13 +449,11 @@ class Acc_Ledger  extends jrn_def_sql
                 throw (new Exception(__FILE__.__LINE__."SQL ERROR [ $sql ]"));
             }
 
-
-
             // the table stock must updated
             // also in the stock table
             $sql="delete from stock_goods where sg_id = any ( select sg_id
-             from stock_goods natural join jrnx  where 
j_grpt=".$this->jr_grpt_id.")";
-            $Res=$this->db->exec_sql($sql);
+             from stock_goods natural join jrnx  where j_grpt=$1)";
+            $Res=$this->db->exec_sql($sql,array($this->jr_grpt_id));
             if ($Res==false)
             {
                 throw (new Exception(__FILE__.__LINE__."SQL ERROR [ $sql ]"));
diff --git a/include/class/acc_ledger_purchase.class.php 
b/include/class/acc_ledger_purchase.class.php
index c28e7eb9b..2eebca15e 100644
--- a/include/class/acc_ledger_purchase.class.php
+++ b/include/class/acc_ledger_purchase.class.php
@@ -1804,6 +1804,8 @@ class  Acc_Ledger_Purchase extends Acc_Ledger
 </tr>
 EOF;
     if ($p_currency_code !=0) {
+        $sql_currency=new Currency_SQL($this->cn,0);
+        $iso_code=$sql_currency->getp("cr_code_iso");
         $rate=_("Taux ");
 $r.=<<<EOF
 <tr class="highlight">
@@ -1818,7 +1820,7 @@ $r.=<<<EOF
         {$rate} {$p_currency_rate}
     </td>
     <td class="num">
-        {$tot_eur}  EUR
+        {$tot_eur}  {$iso_code}
     </td>
 </tr>
 EOF;
diff --git a/include/class/acc_ledger_sale.class.php 
b/include/class/acc_ledger_sale.class.php
index 75f27c89c..bfa9eb539 100644
--- a/include/class/acc_ledger_sale.class.php
+++ b/include/class/acc_ledger_sale.class.php
@@ -1064,9 +1064,9 @@ if ( $g_parameter->MY_TVA_USE=="Y")        {
         </td>
        </tr>
 EOF;
-      $sql_currency=new Currency_SQL($this->cn,$p_currency_code);
-      $iso_code=$sql_currency->getp("cr_code_iso");
         if ($p_currency_code !=0) {
+          $sql_currency=new Currency_SQL($this->cn,0);
+          $iso_code=$sql_currency->getp("cr_code_iso");
 
     $r.=<<<EOF
     <tr class="highlight">
diff --git a/include/class/acc_reconciliation.class.php 
b/include/class/acc_reconciliation.class.php
index 52d0f7abc..6b4cf8439 100644
--- a/include/class/acc_reconciliation.class.php
+++ b/include/class/acc_reconciliation.class.php
@@ -121,8 +121,9 @@ class Acc_Reconciliation
                 ==0)
         {
             // Ok we can insert
-            $Res=$this->db->exec_sql("insert into 
jrn_rapt(jr_id,jra_concerned) values ".
-                                    "(".$this->jr_id.",$jr_id2)");
+            $Res=$this->db->exec_sql("insert into 
jrn_rapt(jr_id,jra_concerned) values ($1,$2)",
+                                        array($this->jr_id,$jr_id2)
+                                    );
             // try to letter automatically same account from both operation
             $this->auto_letter($jr_id2);
             
diff --git a/include/class/lettering.class.php 
b/include/class/lettering.class.php
index 63e9a9a5c..579f1fac1 100644
--- a/include/class/lettering.class.php
+++ b/include/class/lettering.class.php
@@ -161,20 +161,23 @@ class Lettering
             return;
 
         // already linked
-        if ($let1!=0&&$let2!=0&&$let1!=$let2)
+     /*   if ($let1!=0&&$let2!=0&&$let1!=$let2)
             return;
-
+*/
         // none is linked
         if ($let1==0&&$let2==0)
         {
             $jl_id=$this->db->get_next_seq("jnt_letter_jl_id_seq");
             $this->db->exec_sql('insert into jnt_letter(jl_id) values($1)', 
array($jl_id));
-        }
-        // one is linked but not the other
-        if ($let1==0&&$let2!=0)
+        } elseif ($let1==0&&$let2!=0)
+        {
+            // one is linked but not the other
             $jl_id=$let2;
-        if ($let1!=0&&$let2==0)
+        }elseif  ($let1!=0&&$let2==0) {
             $jl_id=$let1;
+        } else {
+            throw new \Exception ("LET179 invalid");
+        }
 
         /* insert */
         if ($first=='t')



reply via email to

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