noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 20/20: Fix merge issue


From: dwm
Subject: [Noalyss-commit] [noalyss] 20/20: Fix merge issue
Date: Sun, 10 Dec 2023 03:22:25 -0500 (EST)

sparkyx pushed a commit to branch master
in repository noalyss.

commit 98390d4d48a06e816bd87d710b0bdb819b0248de
Merge: 2e294d2f9 f707e5a3c
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Fri Dec 8 14:00:32 2023 +0100

    Fix merge issue

 include/class/acc_account_ledger.class.php         | 202 ++++++---
 include/constant.php                               |   6 +
 include/export/export_gl_csv.php                   |  47 +--
 include/export/export_gl_pdf.php                   |  45 +-
 include/impress_gl_comptes.inc.php                 |  65 ++-
 include/lib/database_core.class.php                |  25 +-
 include/lib/dbg.php                                |  15 +
 .../include/class/acc_account_ledger.Test.php      | 455 ---------------------
 unit-test/test-file.sh                             |   6 +-
 9 files changed, 241 insertions(+), 625 deletions(-)

diff --cc include/class/acc_account_ledger.class.php
index fa37c6cce,03021defe..d4f20e663
--- a/include/class/acc_account_ledger.class.php
+++ b/include/class/acc_account_ledger.class.php
@@@ -214,14 -211,74 +213,74 @@@ class Acc_Account_Ledge
                                    where j_poste=$1 and 
                                    ( to_date($2,'DD.MM.YYYY') <= j_date and 
                                      to_date($3,'DD.MM.YYYY') >= j_date ) 
-                                   and $filter_sql  $sql_let ) as 
m",array($this->id,$p_from,$p_to));
-         $this->tot_deb=$this->tot_cred=0;
-         
-         if ( Database::num_row($res_saldo) > 0 ) {
-             $this->tot_deb=Database::fetch_result($res_saldo, 0, 0);
-             $this->tot_cred=Database::fetch_result($res_saldo, 0, 1);
+                                   and $filter_sql  $sql_let ) as m";
+         return $sql_saldo;
+     }
+     /*!
+      * \brief  Get data for accounting entry between 2 date
+      *
+      *\param  $p_from date from DD.MM.YYYY
+      *\param  $p_to   end date DD.MM.YYYY
+      *\param $let 0 means all rows, 1 only lettered, 2 only unlettered
+      *\param $solded 0 means all account, 1 means only accounts with a saldo 
<> 0
+      *\note the data are filtered by the access of the current user
+      * \return double array 
(j_date,deb_montant,cred_montant,description,jrn_name,j_debit,jr_internal)
+      *         (tot_deb,tot_credit
+      *
+      */
+     function get_row_date($p_from, $p_to, $let = 0, $solded = 0)
+     {
+         global $g_user;
+         $filter_sql = $g_user->get_ledger_sql('ALL', 3);
+         $sql_let = '';
+         switch ($let) {
+             case 0:
+                 break;
+             case 1:
+                 $sql_let = ' and j1.j_id in (select j_id from letter_cred 
union all select j_id from letter_deb)';
+                 break;
+             case '2':
+                 $sql_let = ' and j1.j_id not in (select j_id from letter_cred 
union all select j_id from letter_deb) ';
+                 break;
          }
-         return array($this->row,$this->tot_deb,$this->tot_cred);
+         // if accounting is balanced , D = C then returns an empty array
+         if ($solded == 1) {
+             if ($this->db->is_prepare("not_balanced_account") == false) {
 -                $filter = str_replace('jrn_def_id', 'jr_def_id', $filter_sql);
++                
$filter=noalyss_str_replace('jrn_def_id','jr_def_id',$filter_sql);
+                 $sql_balanced = $this->make_sql_not_balanced_account($filter);
+                 $this->db->prepare("not_balanced_account", $sql_balanced);
+             }
+ 
+             $ret_balanced = $this->db->execute("not_balanced_account", 
array($this->id, $p_from, $p_to));
+ 
+             $r = Database::fetch_all($ret_balanced);
+             if (empty($r)) return array();
+             if ($r[0]['s_deb'] == $r[0]['s_cred']) return array();
+         }
+ 
+         // get the detail of accouting
+         if (!$this->db->is_prepare("sql_accounting_detail")) {
+             $sql = $this->make_sql_accounting_detail($p_from, $p_to, 
$sql_let, $filter_sql);
+             $this->db->prepare("sql_accounting_detail", $sql);
+ 
+         }
+         $ret = $this->db->execute("sql_accounting_detail", array($this->id, 
$p_from, $p_to));
+         $this->row = Database::fetch_all($ret);
+ 
+         // $this->row=$this->db->get_array(,array($this->id,$p_from,$p_to));
+         if ($this->db->is_prepare("saldo_account") == false) {
+             $sql_saldo = $this->make_sql_saldo_account($filter_sql, $sql_let);
+             $this->db->prepare("saldo_account", $sql_saldo);
+         }
+         $res_saldo = $this->db->execute("saldo_account", array($this->id, 
$p_from, $p_to));
+         $result=Database::fetch_all($res_saldo);
+         $this->tot_deb = $this->tot_cred = 0;
+ 
+         if (! empty($result) > 0) {
+             $this->tot_deb = $result[0]['deb'];
+             $this->tot_cred = $result[0]['cred'];
+         }
+         return array($this->row, $this->tot_deb, $this->tot_cred);
      }
  
  
diff --cc unit-test/test-file.sh
index 912101b76,90d9f79fb..a5b84018b
--- a/unit-test/test-file.sh
+++ b/unit-test/test-file.sh
@@@ -16,8 -16,8 +16,8 @@@ FILETOTEST="
  FUNCTION=""
  COVERAGE=""
  FOLDERTEST=""
 -PHPINI="/opt/php/8.1/bin/php "
--#PHPINI="/usr/bin/php"
- PHPINI="/usr/bin/php "
++PHPINI="/opt/php/8.1/bin/php"
++#PHPINI="/usr/bin/php "
  while getopts "f:i:cd:x" opt; do
        case $opt in
                d)



reply via email to

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