noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] branch devel updated: merge devel-france


From: dwm
Subject: [Noalyss-commit] [noalyss] branch devel updated: merge devel-france
Date: Thu, 27 Jul 2023 14:26:03 -0400

This is an automated email from the git hooks/post-receive script.

sparkyx pushed a commit to branch devel
in repository noalyss.

The following commit(s) were added to refs/heads/devel by this push:
     new 844484c39 merge devel-france
844484c39 is described below

commit 844484c39dc687d58f067164ebdf58ba1d368d48
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Thu Jul 27 20:24:34 2023 +0200

    merge devel-france
---
 .gitignore                                         |   1 +
 html/ajax_misc.php                                 |  10 +-
 html/compute.php                                   |   4 +-
 html/do.php                                        |   1 +
 html/fid.php                                       |  10 +-
 html/fid_card.php                                  |   2 +-
 html/js/noalyss_script.js                          |   4 +-
 html/login.php                                     |   2 +
 html/test.php                                      |   6 +-
 html/user_login.php                                |   1 +
 include/balance.inc.php                            |  10 +-
 include/category_detail.inc.php                    |   2 +-
 include/class/acc_account_ledger.class.php         |   4 +-
 include/class/acc_bilan.class.php                  | 179 ++++++++++++++-------
 include/class/acc_ledger.class.php                 |   2 +-
 include/class/acc_ledger_history_generic.class.php |   8 +-
 include/class/acc_ledger_search.class.php          |   7 +-
 include/class/acc_operation.class.php              |  11 +-
 include/class/acc_reconciliation.class.php         |   9 +-
 include/class/acc_report.class.php                 |   4 +-
 include/class/acc_tva.class.php                    |  13 +-
 include/class/anc_account_table.class.php          |   6 +-
 include/class/anc_group.class.php                  |   2 +-
 include/class/anc_key.class.php                    |   4 +-
 include/class/anc_operation.class.php              |   4 +-
 include/class/document.class.php                   |  20 +--
 include/class/document_export.class.php            |   2 +-
 include/class/exercice.class.php                   |   1 +
 include/class/fiche.class.php                      |  14 +-
 include/class/fiche_def.class.php                  |   4 +-
 include/class/follow_up.class.php                  |   7 +-
 include/class/follow_up_detail.class.php           |   1 +
 include/class/lettering.class.php                  |  10 +-
 include/class/menu_ref.class.php                   |   4 +-
 include/class/mobile.class.php                     |   2 +-
 include/class/noalyss_parameter_folder.class.php   |  13 +-
 include/class/noalyss_user.class.php               |   3 +-
 include/class/periode.class.php                    |  21 ++-
 include/class/todo_list.class.php                  |   2 +-
 include/company.inc.php                            |  19 ++-
 include/export/export_receipt.php                  |   2 +-
 include/export/export_stock_histo_csv.php          |   2 +-
 include/header_print.php                           |   2 +-
 include/impress_bilan.inc.php                      |  12 +-
 include/lib/ac_common.php                          |  38 ++---
 include/lib/data_sql.class.php                     |   1 +
 include/lib/database_core.class.php                |   2 +-
 include/lib/function_javascript.php                |  20 +--
 include/lib/html_input.class.php                   |  15 +-
 include/lib/icon_action.class.php                  |   4 +-
 include/lib/impress.class.php                      |  60 +++----
 include/lib/itext.class.php                        |   2 +
 include/lib/manage_table_sql.class.php             |   2 +-
 include/lib/message_javascript.php                 |   1 +
 include/lib/noalyss_csv.class.php                  |  19 +--
 include/lib/select_box.class.php                   |   4 +-
 include/lib/table_data_sql.class.php               |   2 +-
 include/lib/user_common.php                        |   8 +-
 include/template/ledger_detail_bottom.php          |   2 +-
 include/template/mobile-display_menu.php           |   2 +-
 include/template/module.php                        |   4 +-
 include/tfpdf/font/unifont/ttfonts.php             |   2 +-
 include/tfpdf/tfpdf.php                            |   7 +-
 sql/upgrade.sql                                    |   7 +
 unit-test/create-dossier-test.sh                   |   2 +-
 .../class/{periode.Test.php => periodeTest.php}    |  85 +++++++++-
 unit-test/test-file.sh                             |   2 +-
 67 files changed, 488 insertions(+), 250 deletions(-)

diff --git a/.gitignore b/.gitignore
index c90aa18df..45c09b82e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -45,3 +45,4 @@ include/ext/etat_annexe_ohada/*
 local/*
 /include/ext/noalyss_document/.idea/
 .idea/*
+include/tfpdf/font/unifont/*
diff --git a/html/ajax_misc.php b/html/ajax_misc.php
index fb1494896..623ec6012 100644
--- a/html/ajax_misc.php
+++ b/html/ajax_misc.php
@@ -373,6 +373,7 @@ switch ($op)
        
         break;
     case "periode_change":
+
         $field=$http->get("field");
         $type=$http->get("type");
         $exercice=$http->get("exercice","number");
@@ -382,19 +383,24 @@ switch ($op)
         // exercice
         $periode_start=0;
         $periode_end=0;
+        $t_periode=new Periode($cn);
         if ( $last==1) {
-            $t_periode=new Periode($cn);
             list($per_max,$per_min)=$t_periode->get_limit($exercice);
             $periode_start=$per_max->p_id;
             $periode_end=$per_min->p_id;
         }
-        
+
         $iperiod = new IPeriod($field);
         $iperiod->id=$field;
         $iperiod->user = $g_user;
         $iperiod->cn = $cn;
         $iperiod->filter_year = true;
         $iperiod->exercice=$exercice;
+        // For France , propose the first periode
+        if ( $g_parameter->MY_REPORT=='N') {
+            $periode_start=$t_periode->get_first_periode();
+            $iperiod->filter_year = false;
+        }
         if ( $type=="from")
         {
             $iperiod->show_end_date=FALSE;
diff --git a/html/compute.php b/html/compute.php
index 7d70e99dd..01570b029 100644
--- a/html/compute.php
+++ b/html/compute.php
@@ -54,8 +54,8 @@ foreach (array('t','c','p','q','n','gDossier') as $a)
 $http=new HttpInput();
 $tax_ac_id=$http->request("other_tax_id","number",-1);
 // sometime number uses coma instead of dot for dec
-$p=str_replace(",",".",$p);
-$q=str_replace(",",".",$q);
+$p=noalyss_str_replace(",",".",$p);
+$q=noalyss_str_replace(",",".",$q);
 
 $cn=Dossier::connect();
 $User=new Noalyss_user($cn);
diff --git a/html/do.php b/html/do.php
index 68e9b21c2..88ad76d4d 100644
--- a/html/do.php
+++ b/html/do.php
@@ -74,6 +74,7 @@ if ( ! $cn->exist_table('version')) {
     echo '</p>';
     return;
 }
+
 /**
  * if access_mode is MOBILE than force it to mobile.php
  */
diff --git a/html/fid.php b/html/fid.php
index 854b6a512..6fc1fa3eb 100644
--- a/html/fid.php
+++ b/html/fid.php
@@ -113,7 +113,7 @@ if ( isset($_SESSION[SESSION_KEY.'isValid']) && 
$_SESSION[SESSION_KEY.'isValid']
     else
     {
         $filter_card=$d;
-        $filter_card=str_replace('[sql]','',$d);
+        $filter_card=noalyss_str_replace('[sql]','',$d);
     }
     $sql="select vw_name,vw_addr,vw_cp,vw_buy,vw_sell,tva_id
          from vw_fiche_attr
@@ -135,10 +135,10 @@ if ( isset($_SESSION[SESSION_KEY.'isValid']) && 
$_SESSION[SESSION_KEY.'isValid']
     $tva_id=$array[0]['tva_id'];
 
     // Check null
-    $name=($name==null)?" ":str_replace('"','',$name);
-    $sell=($sell==null)?"0":str_replace('"','',$sell);
-    $buy=($buy==null)?"0":str_replace('"','',$buy);
-    $tva_id=($tva_id==null)?" ":str_replace('"','',$tva_id);
+    $name=($name==null)?" ":noalyss_str_replace('"','',$name);
+    $sell=($sell==null)?"0":noalyss_str_replace('"','',$sell);
+    $buy=($buy==null)?"0":noalyss_str_replace('"','',$buy);
+    $tva_id=($tva_id==null)?" ":noalyss_str_replace('"','',$tva_id);
     /* store the answer in an array and transform it later into a JSON object 
*/
     $tmp=array();
     $tmp[]=array('flabel',$fLabel);
diff --git a/html/fid_card.php b/html/fid_card.php
index fa8a98694..45231a973 100644
--- a/html/fid_card.php
+++ b/html/fid_card.php
@@ -75,7 +75,7 @@ if ( $typecard == 'all')
 }
 else if (strpos($typecard,'sql]')==true)
 {
-       $filter_card=  str_replace('[sql]', " and ", $typecard);
+       $filter_card=  noalyss_str_replace('[sql]', " and ", $typecard);
 } else 
 {
     $typecard=(empty($typecard))?-1:sql_string($typecard);
diff --git a/html/js/noalyss_script.js b/html/js/noalyss_script.js
index 3e6301e22..e4f6831d4 100644
--- a/html/js/noalyss_script.js
+++ b/html/js/noalyss_script.js
@@ -3712,10 +3712,10 @@ function updatePeriodePreference(p_dossier)
 /**
  * Update the from and to periode list when changing the exercice
  * @param {int} p_dossier
- * @param {string} p_exercice id of the exercice
+ * @param {string} p_exercice dom id of the exercice (SELECT)
  * @param {type} p_periode_from id of the starting periode
  * @param {type} p_periode_to id of the ending periode
- * @param {type} p_last possible value = 1 to show last periode or 0 the first
+ * @param {type} p_last possible value = 1 to show last date or 0 the first
  */
 function updatePeriode(p_dossier, p_exercice, p_periode_from, p_periode_to, 
p_last)
 {
diff --git a/html/login.php b/html/login.php
index d3588d023..4bea6697a 100644
--- a/html/login.php
+++ b/html/login.php
@@ -36,6 +36,8 @@ if (defined('MULTI') && MULTI == 0)
        else
                $version = $rep->get_value('select val from version');
 
+$http=new HttpInput();
+
 if (  isset ($_POST["p_user"] ) )
 {
     $http=new HttpInput();
diff --git a/html/test.php b/html/test.php
index b6cf0ba01..e5eeb9adc 100644
--- a/html/test.php
+++ b/html/test.php
@@ -115,7 +115,7 @@ for ($e_scan=0; $e_scan<$maxscan; $e_scan++)
                 if (strpos($a_description[$w], '@description:')==true)
                 {
                     $description=$a_description[$w];
-                    $description=str_replace('//@description:', '', 
$description);
+                    $description=noalyss_str_replace('//@description:', '', 
$description);
                 }
             }
             $scenario[$cnt_scenario]['file']=$scan[$e_scan];
@@ -175,7 +175,7 @@ else if ($script=='all')
     
             $start_mem=memory_get_usage();
             $start_time=microtime(true);
-            $script=str_replace('../', '', $script);
+            $script=noalyss_str_replace('../', '', $script);
     
             echo '<h1>'.$nb." ".$scenario[$nb]['file']."</h1>";
             echo '<h2> description = '.$scenario[$nb]["desc"].'</h2>';
@@ -207,7 +207,7 @@ else
 {
     $start_mem=memory_get_usage();
     $start_time=microtime(true);
-    $script=str_replace('../', '', $script);
+    $script=noalyss_str_replace('../', '', $script);
     $description=$http->get("description","string", "aucune description");
     echo '<h1>'.$script."</h1>";
     echo '<p> description = '.$description.'<p>';
diff --git a/html/user_login.php b/html/user_login.php
index 126a4ebec..488dffae2 100644
--- a/html/user_login.php
+++ b/html/user_login.php
@@ -34,6 +34,7 @@ MaintenanceMode("block.html");
 
 $rep=new Database();
 require_once NOALYSS_INCLUDE . '/class/noalyss_user.class.php';
+
 $User=new Noalyss_user($rep);
 
 $User->Check();
diff --git a/include/balance.inc.php b/include/balance.inc.php
index 8974a6da2..7b186b49d 100644
--- a/include/balance.inc.php
+++ b/include/balance.inc.php
@@ -26,7 +26,7 @@
 if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
 include_once  NOALYSS_INCLUDE.'/lib/ac_common.php';
 include_once NOALYSS_INCLUDE.'/class/acc_balance.class.php';
-global $g_user, $http;
+global $g_user, $http,$g_parameter;
 $gDossier=dossier::id();
 // Get the exercice
 $exercice=$http->request("exercice","number",0);
@@ -56,7 +56,7 @@ echo HtmlInput::hidden('type','bal');
 echo dossier::hidden();
 
 
-
+$periode=new Periode($cn);
 // filter on the current year
 $from=$http->get("from_periode", "number",0);
 $input_from=new IPeriod("from_periode",$from,$exercice);
@@ -66,7 +66,10 @@ $input_from->type=ALL;
 $input_from->cn=$cn;
 $input_from->filter_year=true;
 $input_from->user=$g_user;
-
+if ( $g_parameter->MY_REPORT=='N') {
+    $input_from->filter_year=false;
+    if ($from == 0) { $input_from->value=$periode->get_first_periode();}
+}
 echo _('Depuis').' :'.$input_from->input();
 // filter on the current year
 $to=$http->get("to_periode", "number",0);
@@ -84,6 +87,7 @@ $input_to->filter_year=true;
 $input_to->type=ALL;
 $input_to->cn=$cn;
 $input_to->user=$g_user;
+
 echo "  "._('jusque').' :'.$input_to->input();
 echo '<br>';
 echo HtmlInput::button_action(_('Avancé'), " if 
(\$('balance_advanced_div').style.display=='none') { 
\$('balance_advanced_div').show();} else { 
\$('balance_advanced_div').hide();}",uniqid(),"smallbutton");
diff --git a/include/category_detail.inc.php b/include/category_detail.inc.php
index e3380bc55..122e7d87c 100644
--- a/include/category_detail.inc.php
+++ b/include/category_detail.inc.php
@@ -33,7 +33,7 @@
 //---------------------------------------------------------------------------
 if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
 global $http;
-
+Noalyss\Dbg::echo_file(__FILE__);
  $f_id=$http->request('f_id','number');
 if ( isset ($_POST['mod']))
 {
diff --git a/include/class/acc_account_ledger.class.php 
b/include/class/acc_account_ledger.class.php
index eb51c051b..fa37c6cce 100644
--- a/include/class/acc_account_ledger.class.php
+++ b/include/class/acc_account_ledger.class.php
@@ -33,6 +33,8 @@ class Acc_Account_Ledger
     var $row;         /*!< $row double array see get_row */
     var $tot_deb;    /*!< value set by  get_row */
     var $tot_cred;    /*!< value by  get_row */
+    var $name;
+
     function __construct ($p_cn,$p_id)
     {
         $this->db=$p_cn;
@@ -141,7 +143,7 @@ class Acc_Account_Ledger
         }
        if ( $solded == 1)
          {
-           $filter=str_replace('jrn_def_id','jr_def_id',$filter_sql);
+           $filter=noalyss_str_replace('jrn_def_id','jr_def_id',$filter_sql);
            $bal_sql="select sum(amount_deb) as s_deb,sum(amount_cred) as 
s_cred, j_poste
                         from                                           
                         (select case when j_debit='t' then j_montant else 0 
end as amount_deb,
diff --git a/include/class/acc_bilan.class.php 
b/include/class/acc_bilan.class.php
index 9b30ed5e1..34160aa41 100644
--- a/include/class/acc_bilan.class.php
+++ b/include/class/acc_bilan.class.php
@@ -29,6 +29,7 @@ require_once NOALYSS_INCLUDE.'/header_print.php';
  * \brief this class handle the different bilan, from the table bilan, parse 
the form and replace
  * in the template
  */
+#[AllowDynamicProperties]
 class Acc_Bilan
 {
     var $db;                                           /*!< database 
connection */
@@ -49,37 +50,62 @@ class Acc_Bilan
      */
     function display_form($p_filter_year="")
     {
+        global $g_parameter;
         $r="";
         $r.=dossier::hidden();
-        $r.= '<TABLE>';
-
-        $r.='<TR>';
-// filter on the current year
-        $w=new ISelect();
-        $w->table=1;
-
-        $periode_start=$this->db->make_array("select 
p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $p_filter_year order by 
p_start,p_end");
-
-        $periode_end=$this->db->make_array("select 
p_id,to_char(p_end,'DD-MM-YYYY') from parm_periode $p_filter_year order by 
p_end,p_start");
-
-        $w->label=_("Depuis");
-        $w->value=$this->from;
-        $w->selected=$this->from;
-        $r.= td($w->input('from_periode',$periode_start));
-        $w->label=_(" jusque ");
-        $w->value=$this->to;
-        $w->selected=$this->to;
-        $r.= td($w->input('to_periode',$periode_end));
-        $r.= "</TR>";
-        $r.="<tr>";
-        $mod=new ISelect();
-        $mod->table=1;
-        $mod->value=$this->db->make_array("select b_id, b_name from bilan 
order by b_name");
-        $mod->label=_("Choix du bilan");
-        $r.=td($mod->input('b_id'));
-        $r.="</tr>";
-        $r.= '</TABLE>';
-        return $r;
+        if ( $g_parameter->MY_REPORT == 'Y') {
+
+            $r.= '<TABLE>';
+
+            $r.='<TR>';
+    // filter on the current year
+            $w=new ISelect();
+            $w->table=1;
+
+            $periode_start=$this->db->make_array("select 
p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $p_filter_year order by 
p_start,p_end");
+
+            $periode_end=$this->db->make_array("select 
p_id,to_char(p_end,'DD-MM-YYYY') from parm_periode $p_filter_year order by 
p_end,p_start");
+
+            $w->label=_("Depuis");
+            $w->value=$this->from;
+            $w->selected=$this->from;
+            $r.= td($w->input('from_periode',$periode_start));
+            $w->label=_(" jusque ");
+            $w->value=$this->to;
+            $w->selected=$this->to;
+            $r.= td($w->input('to_periode',$periode_end));
+            $r.= "</TR>";
+            $r.="<tr>";
+            $mod=new ISelect();
+            $mod->table=1;
+            $mod->value=$this->db->make_array("select b_id, b_name from bilan 
order by b_name");
+            $mod->label=_("Choix du bilan");
+            $r.=td($mod->input('b_id'));
+            $r.="</tr>";
+            $r.= '</TABLE>';
+            return $r;
+        } elseif($g_parameter->MY_REPORT=="N") {
+
+            $periode=new Periode($this->db);
+            $from_periode=new IDate("from_periode");
+            $from_periode->value=$periode->get_first_date();
+            $to_periode=new IDate("to_periode");
+            $to_periode->value=$this->db->get_value("select 
to_char(max(p_end),'DD.MM.YYYY') from parm_periode $p_filter_year");
+            $r.='<p>';
+            $r.=_("Depuis")." ".$from_periode->input()." "._("jusque")." 
".$to_periode->input();
+            $r.='</p>';
+            $mod=new ISelect();
+            $mod->value=$this->db->make_array("select b_id, b_name from bilan 
order by b_name");
+            $r.='<p>';
+            $r.=_("Choix du bilan");
+            $r.=$mod->input('b_id');
+            $r.='</p>';
+            return $r;
+        }else {
+            $dossier_id=Dossier::id();
+            $msg=_("Configurer le report ");
+            echo_warning($msg . 
HtmlInput::anchor('COMPANY',"?gDossier=$dossier_id&ac=CFG/COMPANY"));
+        }
     }
     /**
      * @brief check and warn if an accound has the wrong saldo
@@ -89,6 +115,19 @@ class Acc_Bilan
      */
     private function warning($p_message,$p_type,$p_deb)
     {
+        global $g_parameter;
+        $filter_sql="";
+        if ( $g_parameter->MY_REPORT=="Y") {
+            $filter_sql= 
sql_filter_per($this->db,$this->from,$this->to,'p_id','j_tech_per') ;
+            $periode=new Periode($this->db,$this->from);
+            $exercice=$periode->get_exercice();
+        } else {
+            $filter_sql=$this->filter_date();
+            $exercice=$this->db->get_value("select max( p_exercice) from 
parm_periode 
+                                            where p_start >= 
to_date($1,'DD.MM.YYYY') 
+                                              and p_end <=  
to_date($2,'DD.MM.YYYY') ",
+                [$this->from,$this->to]);
+        }
         $sql="select
                 pcm_val,
                 pcm_lib,
@@ -101,7 +140,7 @@ class Acc_Bilan
                         case when j_debit='t' then j_montant  else 0 end as 
amount_deb,
                         case when j_debit='f' then j_montant else 0 end as 
amount_cred
                         from jrnx
-                        where 
".sql_filter_per($this->db,$this->from,$this->to,'p_id','j_tech_per') ."
+                        where ".$filter_sql."
                  
                 ) as m on (j_poste=pcm_val)
         where
@@ -115,10 +154,9 @@ class Acc_Bilan
 
         $ret="";
         $obj=new Acc_Account_Ledger($this->db,0);
-        
$sql=sql_filter_per($this->db,$this->from,$this->to,'p_id','j_tech_per');
+       // 
$sql=sql_filter_per($this->db,$this->from,$this->to,'p_id','j_tech_per');
         // Find exercice
-        $periode=new Periode($this->db,$this->from);
-        $exercice=$periode->get_exercice();
+
         for ($i=0;$i<$nRow;$i++)
         {
 
@@ -156,6 +194,7 @@ class Acc_Bilan
     /*!\brief verify that the saldo is good for the type of account */
     function verify()
     {
+        global $g_parameter;
                bcscale(2);
         echo '<h3>'._("Comptes normaux").'</h3>';
         $this->warning(_('Actif avec un solde crediteur'),'ACT','D');
@@ -169,8 +208,13 @@ class Acc_Bilan
         $this->warning(_('Compte inverse : Charge avec un solde 
debiteur'),'CHAINV','C');
         $this->warning(_('Compte inverse : produit avec un solde 
crediteur'),'PROINV','D');
         echo '<h3'._("Solde").' </h3>';
-        /* set the periode filter */
-        
$sql_periode=sql_filter_per($this->db,$this->from,$this->to,'p_id','j_tech_per');
+        if ( $g_parameter->MY_REPORT == 'Y') {
+
+            /* set the periode filter */
+            $sql_periode = sql_filter_per($this->db, $this->from, $this->to, 
'p_id', 'j_tech_per');
+        } else {
+            $sql_periode=$this->filter_date();
+        }
         $sqlAccount="select sum(amount_deb) as amount_debit ,
                             sum(amount_cred) as amount_credit
                  from (
@@ -183,7 +227,8 @@ class Acc_Bilan
                     $sql_periode
                 ) as JP1 join tmp_pcmn on (JP1.j_poste=pcm_val) 
               where pcm_type=$1 or pcm_type=$2";
-        
+
+
         $this->db->prepare("sqlAccount",$sqlAccount);
         
       
@@ -253,10 +298,17 @@ class Acc_Bilan
      */
     function get_request_get()
     {
+        $g_parameter=new Noalyss_Parameter_Folder($this->db);
         $http=new \HttpInput();
         $this->b_id=$http->get("b_id","number","");
-        $this->from=$http->get("from_periode","number",-1);
-        $this->to=$http->get("to_periode","number",-1);
+        if ( $g_parameter->MY_REPORT=="Y") {
+            $this->from=$http->get("from_periode","number",-1);
+            $this->to=$http->get("to_periode","number",-1);
+        }else {
+            $this->from=$http->get("from_periode","date","");
+            $this->to=$http->get("to_periode","date","");
+
+        }
     }
     /*!\brief load from the database the document data  */
     function load():void
@@ -322,6 +374,7 @@ class Acc_Bilan
      */
     function compute_formula($p_handle)
     {
+        $g_parameter=new Noalyss_Parameter_Folder($this->db);
         while (! feof ($p_handle))
         {
             $buffer=trim(fgets($p_handle));
@@ -336,8 +389,9 @@ class Acc_Bilan
                 continue;
             // buffer contains a formula A$=....
             // We need to eval it
-            
$a=Impress::parse_formula($this->db,"$buffer",$buffer,$this->from,$this->to,false);
-            $b=str_replace("$","\$this->",$a);
+            $type_date= ($g_parameter->MY_REPORT=="Y")?0:1;
+            
$a=Impress::parse_formula($this->db,"$buffer",$buffer,$this->from,$this->to,false,$type_date);
+            $b=noalyss_str_replace("$","\$this->",$a);
            // echo $b;
             if ( eval("$b;") === false )
                 echo(__FILE__.__LINE__."Code failed with $b");
@@ -398,7 +452,7 @@ class Acc_Bilan
         $regex="/&lt;&lt;\\$[A-Z]*[0-9]*&gt;&gt;/";
         $lt="&lt;";
         $gt="&gt;";
-       $header_txt=utf8_encode(header_txt($this->db));
+           
$header_txt=mb_convert_encoding(header_txt($this->db),'UTF-8','ISO8859-1');
 
         while ( !feof($p_file) )
         {
@@ -422,9 +476,9 @@ class Acc_Bilan
                    foreach ($f2_array as $f2_str)
                      {
                        $to_remove=$f2_str;
-                       $f2_value=str_replace("&lt;","",$f2_str);
-                       $f2_value=str_replace("&gt;","",$f2_value);
-                       $f2_value=str_replace("$","",$f2_value);
+                       $f2_value=noalyss_str_replace("&lt;","",$f2_str);
+                       $f2_value=noalyss_str_replace("&gt;","",$f2_value);
+                       $f2_value=noalyss_str_replace("$","",$f2_value);
 
 
 
@@ -440,8 +494,8 @@ class Acc_Bilan
                                if($ret[0]['acct_name'])
                                  {
                                    $a = $ret[0]['acct_name'];
-                                   $a=str_replace('<','&lt;',$a);
-                                   $a=str_replace('>','&gt;',$a);
+                                   $a=noalyss_str_replace('<','&lt;',$a);
+                                   $a=noalyss_str_replace('>','&gt;',$a);
                                  }
                              }
                          }
@@ -457,15 +511,15 @@ class Acc_Bilan
                             /* -- for libreOffice < 5 or openoffice -- */
                            
$searched='office:value-type="string"><text:p>'.$f2_str;
                            $replaced='office:value-type="float" 
office:value="'.$a.'"><text:p>'.$f2_str;
-                           $line_rtf=str_replace($searched, $replaced, 
$line_rtf);
+                           $line_rtf=noalyss_str_replace($searched, $replaced, 
$line_rtf);
                             /* -- for libreOffice > 5 -- */
                            $searched='office:value-type="string" 
calcext:value-type="string"><text:p>'.$f2_str;
                            $replaced='office:value-type="float" 
office:value="'.$a.'" calcext:value-type="float"><text:p>'.$f2_str;
-                           $line_rtf=str_replace($searched, $replaced, 
$line_rtf);
+                           $line_rtf=noalyss_str_replace($searched, $replaced, 
$line_rtf);
                          }
 
 
-                       $line_rtf=str_replace($f2_str,$a,$line_rtf);
+                       $line_rtf=noalyss_str_replace($f2_str,$a,$line_rtf);
 
                      }// foreach end
                  } // foreach
@@ -521,9 +575,9 @@ class Acc_Bilan
                     // DEBUG
                     // echo "single_f2 = $f2_str <br>";
                     // replace single_f2 by its value
-                    $f2_value=str_replace($lt,"",$f2_str);
-                    $f2_value=str_replace($gt,"",$f2_value);
-                    $f2_value=str_replace("$","",$f2_value);
+                    $f2_value=noalyss_str_replace($lt,"",$f2_str);
+                    $f2_value=noalyss_str_replace($gt,"",$f2_value);
+                    $f2_value=noalyss_str_replace("$","",$f2_value);
                    $f2_value=$f2_value[0];
 
                     // check for missing variables and labels (N vars)
@@ -538,7 +592,7 @@ class Acc_Bilan
                             if($ret[0]['acct_name'])
                             {
                                 /* for rtf we have the string to put it in 
latin1 */
-                                if ( $this->b_type != "rtf") { $a = 
utf8_decode($ret[0]['acct_name']);}
+                                if ( $this->b_type != "rtf") { $a = 
mb_convert_encoding(($ret[0]['acct_name']),'ISO-8859-1','UTF-8');}
                                 if ( $this->b_type == "rtf") { $a 
=convert_to_rtf($ret[0]['acct_name']);}
                             }
                         }
@@ -552,7 +606,7 @@ class Acc_Bilan
                     }
                     // DEBUG      echo " a = $a";
                     if ( $a=='-0' ) $a=0;
-                    $line_rtf=str_replace($f2_str,$a,$line_rtf);
+                    $line_rtf=noalyss_str_replace($f2_str,$a,$line_rtf);
 
                 }// foreach end
             }
@@ -758,5 +812,22 @@ class Acc_Bilan
             echo '</form>';
         }
     }
+
+    /**
+     * @brief compute the where clause for filtering with the date
+     * @return string where clause : where jrnx.j_date < ...
+     * @throws Exception if one of the dates is not valid
+     */
+    private function filter_date():string
+    {
+        global $g_parameter;
+        if ( empty(isDate($this->from)) || empty(isDate($this->to)))
+            throw new Exception (_("Date invalide"));
+        $from=format_date($this->from,'DD.MM.YYYY','YYYYMMDD');
+        $to=format_date($this->to,'DD.MM.YYYY','YYYYMMDD');
+        $sql_periode=" to_char(jrnx.j_date,'YYYYMMDD')>= '$from' 
+        and  to_char(jrnx.j_date,'YYYYMMDD') <='$to' ";
+        return $sql_periode;
+    }
 }
 
diff --git a/include/class/acc_ledger.class.php 
b/include/class/acc_ledger.class.php
index 5f9cce127..94f89cb11 100644
--- a/include/class/acc_ledger.class.php
+++ b/include/class/acc_ledger.class.php
@@ -1986,7 +1986,7 @@ class Acc_Ledger  extends jrn_def_sql
     {
         global $g_user;
         $filter_ledger=$g_user->get_ledger_sql('ALL', 3);
-        $filter_ledger=str_replace('jrn_def_id', 'jr_def_id', $filter_ledger);
+        $filter_ledger=noalyss_str_replace('jrn_def_id', 'jr_def_id', 
$filter_ledger);
         $sql="
                        select 
jr_id,jr_pj_number,jr_date,to_char(jr_date,'DD.MM.YYYY') as 
jr_date_fmt,jr_montant, jr_comment,jr_internal,jrn_def_code
                        from jrn
diff --git a/include/class/acc_ledger_history_generic.class.php 
b/include/class/acc_ledger_history_generic.class.php
index e81a12bc8..b99bde395 100644
--- a/include/class/acc_ledger_history_generic.class.php
+++ b/include/class/acc_ledger_history_generic.class.php
@@ -810,10 +810,10 @@ class Acc_Ledger_History_Generic extends 
Acc_Ledger_History
         {
             // should clean description : remove <b><i> tag and '; char
             $desc=$op['description'];
-            $desc=str_replace("<b>", "", $desc);
-            $desc=str_replace("</b>", "", $desc);
-            $desc=str_replace("<i>", "", $desc);
-            $desc=str_replace("</i>", "", $desc);
+            $desc=noalyss_str_replace("<b>", "", $desc);
+            $desc=noalyss_str_replace("</b>", "", $desc);
+            $desc=noalyss_str_replace("<i>", "", $desc);
+            $desc=noalyss_str_replace("</i>", "", $desc);
             if ($op['j_id']!="")
                 $old_id=$op['j_id'];
 
diff --git a/include/class/acc_ledger_search.class.php 
b/include/class/acc_ledger_search.class.php
index 673b2720c..81ffc5878 100644
--- a/include/class/acc_ledger_search.class.php
+++ b/include/class/acc_ledger_search.class.php
@@ -37,7 +37,8 @@ class Acc_Ledger_Search
     private $type; //!< type of ledger : FIN,ODS,VEN,ACH
     private $all; //!< Flag to indicate if all ledgers must searched (1 for 
yes)
     private $div; //! prefix for id of DOM id
-
+    //! id of the ledger
+    var $id ;
     /**
      * @brief return a HTML string with the form for the search
      * @param  $p_type if the type of ledger possible 
values=ALL,VEN,ACH,ODS,FIN: uppercase !
@@ -114,7 +115,7 @@ class Acc_Ledger_Search
             'div'=>$this->div
         ));
 
-        $bledger_param=str_replace('"', "'", $bledger_param);
+        $bledger_param=noalyss_str_replace('"', "'", $bledger_param);
         $bledger=new ISmallButton('l');
         $bledger->label=_("choix des journaux");
         $bledger->javascript=" show_ledger_choice($bledger_param)";
@@ -266,7 +267,7 @@ class Acc_Ledger_Search
     {
         $json=json_encode(["div"=>$this->div, "ledger_type"=>$this->type, 
"all_type"=>$this->all,
             "dossier"=>Dossier::id()]);
-        $json=str_replace('"', "'", $json);
+        $json=noalyss_str_replace('"', "'", $json);
         $r=sprintf('manage_search_filter(%s)', $json);
         return $r;
     }
diff --git a/include/class/acc_operation.class.php 
b/include/class/acc_operation.class.php
index 57d1d7022..56f22bf89 100644
--- a/include/class/acc_operation.class.php
+++ b/include/class/acc_operation.class.php
@@ -48,6 +48,11 @@ class Acc_Operation
     var $currency_rate;             /*< currency rate used */
     var $currency_id;               /*< currency id */
     var $currency_rate_ref;         /*< currency rate in the table currency*/
+    //!< Qcode of item
+    var $qcode;
+    //!< internal code from jrn
+    var $jr_internal;
+    var $signature;
     /*!
      * \brief constructor set automatically the attributes user and periode
      * \param $p_cn the databse connection
@@ -397,7 +402,7 @@ EOF;
     {
         global $g_user;
         $filter_sql=$g_user->get_ledger_sql('ALL',3);
-        $filter_sql=str_replace('jrn_def_id','jr_def_id',$filter_sql);
+        $filter_sql=noalyss_str_replace('jrn_def_id','jr_def_id',$filter_sql);
         if ( $this->jr_id==0 ) return;
         $sql=" select  
jr_id,j_id,jr_date,j_qcode,j_poste,j_montant,jr_internal,case when j_debit = 
'f' then 'C' else 'D' end as debit,jr_comment as description,
              
vw_name,pcm_lib,j_debit,coalesce(comptaproc.get_letter_jnt(j_id),-1) as 
letter,jr_def_id ".
@@ -941,6 +946,10 @@ EOF;
  */
 class Acc_Detail extends Acc_Operation
 {
+    public $det;
+    public $jr_id;
+    public $info;
+
     function __construct($p_cn,$p_jrid=0)
     {
         parent::__construct($p_cn);
diff --git a/include/class/acc_reconciliation.class.php 
b/include/class/acc_reconciliation.class.php
index e1c31ab56..52d0f7abc 100644
--- a/include/class/acc_reconciliation.class.php
+++ b/include/class/acc_reconciliation.class.php
@@ -33,11 +33,14 @@ class Acc_Reconciliation
 {
     var $db;                   /*!< database connection */
     var $jr_id;                        /*!< jr_id */
-
+    var $a_jrn;
+    var $start_day;
+    var $end_day;
     function   __construct($cn)
     {
         $this->db=$cn;
         $this->jr_id=0;
+        $this->a_jrn=null;
     }
 
     function set_jr_id($jr_id)
@@ -296,10 +299,10 @@ j1.j_poste as poste
         global $g_user;
         /* get the available ledgers for current user */
         $sql=$g_user->get_ledger_sql('ALL',3);
-        $sql=str_replace('jrn_def_id','jr_def_id',$sql);
+        $sql=noalyss_str_replace('jrn_def_id','jr_def_id',$sql);
         $r='';
         /* filter by this->r_jrn */
-        if ($this->a_jrn != null )
+        if ( ! empty ($this->a_jrn ) && is_array($this->a_jrn))
         {
             $sep='';
             $r='and jr_def_id in (';
diff --git a/include/class/acc_report.class.php 
b/include/class/acc_report.class.php
index 31988a46a..6c2ef98d3 100644
--- a/include/class/acc_report.class.php
+++ b/include/class/acc_report.class.php
@@ -32,8 +32,8 @@ require_once 
NOALYSS_INCLUDE.'/database/form_definition_sql.class.php';
 class Acc_Report
 {
 
-    private $form_definition; /*!< form_definition_sql
-  
+    private $form_definition; /*!< form_definition_sql */
+    var $row;
     var $nb;
     /*!
     \brief  Constructor
diff --git a/include/class/acc_tva.class.php b/include/class/acc_tva.class.php
index 4f719c5ff..144ce1e85 100644
--- a/include/class/acc_tva.class.php
+++ b/include/class/acc_tva.class.php
@@ -41,12 +41,12 @@ class Acc_Tva
                                    "comment"=>"tva_comment",
                                    "account"=>"tva_poste",
                                     "both_side"=>'tva_both_side');
-    public $tva_id;
-    public $tva_label;
-    public $tva_poste;
-    public $tva_rate;
-    public $tva_comment;
-    public $tva_both_side;
+    public $tva_id,
+        $tva_label,
+        $tva_rate,
+        $tva_comment,
+        $tva_poste,
+        $tva_both_side;
 
     private Tva_Rate_SQL $tva_rate_sql;
 
@@ -62,7 +62,6 @@ class Acc_Tva
         $this->tva_both_side=&$this->tva_rate_sql->tva_both_side;
 
     }
-
     /**
      * @return Tva_Rate_SQL
      */
diff --git a/include/class/anc_account_table.class.php 
b/include/class/anc_account_table.class.php
index b6769962f..25bbe27d0 100644
--- a/include/class/anc_account_table.class.php
+++ b/include/class/anc_account_table.class.php
@@ -73,9 +73,9 @@ class Anc_Account_Table extends Manage_Table_SQL
         $is_error=0;
         $table->po_amount=0;
         // po_name must contains only valid letter (remove < > and ')
-        $table->po_name=str_replace("'", '', $table->po_name);
-        $table->po_name=str_replace("<", '', $table->po_name);
-        $table->po_name=str_replace(">", '', $table->po_name);
+        $table->po_name=noalyss_str_replace("'", '', $table->po_name);
+        $table->po_name=noalyss_str_replace("<", '', $table->po_name);
+        $table->po_name=noalyss_str_replace(">", '', $table->po_name);
         
         // po_name must be uniq in the Analytic Plan
         if ( $cn->get_value("select count(*) from poste_analytique where 
pa_id=$1 and po_name=upper($2) and po_id != $3",
diff --git a/include/class/anc_group.class.php 
b/include/class/anc_group.class.php
index 3a0c543df..11a754775 100644
--- a/include/class/anc_group.class.php
+++ b/include/class/anc_group.class.php
@@ -72,7 +72,7 @@ class Anc_Group extends Anc_Print
 
     function remove()
     {
-        $this->ga_id=str_replace(' ','',$this->ga_id);
+        $this->ga_id=noalyss_str_replace(' ','',$this->ga_id);
         $this->ga_id=strtoupper($this->ga_id);
         $sql=" delete from groupe_analytique where ga_id=$1";
 
diff --git a/include/class/anc_key.class.php b/include/class/anc_key.class.php
index a5e8697b5..ab5c22bc4 100644
--- a/include/class/anc_key.class.php
+++ b/include/class/anc_key.class.php
@@ -313,8 +313,8 @@ class Anc_Key
         global $cn;
         /* number is the index of the plan, he's computed from p_target */
         $number=preg_replace('/det[0-9]/', '', $p_target);
-        $number=str_replace('t', '', $number);
-        $number=str_replace('popup', '', $number);
+        $number=noalyss_str_replace('t', '', $number);
+        $number=noalyss_str_replace('popup', '', $number);
         
         $op[$number]=$p_amount;
         $array['op']=$op;
diff --git a/include/class/anc_operation.class.php 
b/include/class/anc_operation.class.php
index 6bd88313f..49ff5aa44 100644
--- a/include/class/anc_operation.class.php
+++ b/include/class/anc_operation.class.php
@@ -52,7 +52,9 @@ class Anc_Operation
      * the amount
      */
     var $oa_jrnx_id_source;    
-    
+    var $has_data;
+    var $oa_id;
+    var $oa_row;
     public function get_currency_rate()
     {
         return $this->currency_rate;
diff --git a/include/class/document.class.php b/include/class/document.class.php
index d32af6d63..ade8c930a 100644
--- a/include/class/document.class.php
+++ b/include/class/document.class.php
@@ -87,16 +87,16 @@ class Document
         
         foreach (array('/', '*', '<', '>', ';', ',', '\\', '.', ':', '(', ')', 
' ', '[', ']',"'") as $i)
         {
-            $pj=str_replace($i, "-", $pj);
-            $filename_no=str_replace($i,"-",$filename_no);
+            $pj=noalyss_str_replace($i, "-", $pj);
+            $filename_no=noalyss_str_replace($i,"-",$filename_no);
         }
         
        
         $new_filename=strtolower($filename_no."-".$pj.$filename_suff);
-        $pj=str_replace("---","-",$pj);
-        $pj=str_replace("--","-",$pj);
-        $new_filename=str_replace("---","-",$new_filename);
-        $new_filename=str_replace("--","-",$new_filename);
+        $pj=noalyss_str_replace("---","-",$pj);
+        $pj=noalyss_str_replace("--","-",$pj);
+        $new_filename=noalyss_str_replace("---","-",$new_filename);
+        $new_filename=noalyss_str_replace("--","-",$new_filename);
         return $new_filename;
     }
 
@@ -299,8 +299,8 @@ class Document
 
                         $to_remove=$pattern;
                         // we remove the < and > from the pattern
-                        $tag=str_replace($lt, '', $pattern);
-                        $tag=str_replace($gt, '', $tag);
+                        $tag=noalyss_str_replace($lt, '', $pattern);
+                        $tag=noalyss_str_replace($gt, '', $tag);
 
 
                         // if the pattern if found we replace it
@@ -689,7 +689,7 @@ class Document
     {
         global $g_parameter;
         $p_tag=strtoupper($p_tag);
-        $p_tag=str_replace('=', '', $p_tag);
+        $p_tag=noalyss_str_replace('=', '', $p_tag);
         $r="Tag inconnu";
         static $aComment=NULL;
         static $counter_comment=1; /* <! counter for the comment , skip the 
first one which is the descrition */
@@ -1800,7 +1800,7 @@ class Document
     static function replace_value($p_buffer, $p_pattern, $p_value, 
$p_limit=-1, $p_type='OOo')
     {
         $check=$p_pattern;
-        $check=str_replace(['&lt;', '&gt;', '<', '>', '='], "", $check);
+        $check=noalyss_str_replace(['&lt;', '&gt;', '<', '>', '='], "", 
$check);
         if (preg_replace('/[^[:alnum:]^_]/', '', $check)!=$check)
         {
             throw new Exception(sprintf(_("chaine à remplacer [%s] contient un 
caractère interdit"), $p_pattern));
diff --git a/include/class/document_export.class.php 
b/include/class/document_export.class.php
index 86b1aa38f..302b85d6b 100644
--- a/include/class/document_export.class.php
+++ b/include/class/document_export.class.php
@@ -332,7 +332,7 @@ class Document_Export
 
         $filename=clean_filename($file[0]['jr_pj_name']);
         $receipt=clean_filename($file[0]['jr_pj_number']);
-        $receipt=str_replace('.','-',$receipt);
+        $receipt=noalyss_str_replace('.','-',$receipt);
         $filename=$receipt.'-'.$filename;
 
         $cn->start();
diff --git a/include/class/exercice.class.php b/include/class/exercice.class.php
index f6e657c8e..49a88f6a4 100644
--- a/include/class/exercice.class.php
+++ b/include/class/exercice.class.php
@@ -29,6 +29,7 @@
  */
 class Exercice
 {
+    var $cn;
   function __construct($cn)
   {
     $this->cn=$cn;
diff --git a/include/class/fiche.class.php b/include/class/fiche.class.php
index 9c3169a29..1624c329c 100644
--- a/include/class/fiche.class.php
+++ b/include/class/fiche.class.php
@@ -45,6 +45,9 @@ class Fiche
     var $quick_code;           /*!< quick_code of the card */
     private $f_enable;  /*!< if card is enable (fiche.f_enable) */
     private $display_mode ; /*!< how the card is displaid */
+    var $tot_cred;
+    var $tot_deb;
+
     function __construct($p_cn,$p_id=0)
     {
         $this->cn=$p_cn;
@@ -1293,6 +1296,7 @@ class Fiche
     function Summary($p_search="",$p_action="",$p_sql="",$p_amount=false)
     {
         global $g_user;
+        global $g_parameter;
         $http=new HttpInput();
         $bank=new Acc_Parm_Code($this->cn,'BANQUE');
         $cash=new Acc_Parm_Code($this->cn,'CAISSE');
@@ -1361,7 +1365,11 @@ class Fiche
             $i++;
 
              /* Filter on the default year */
-             $amount=$tiers->get_solde_detail($filter_year);
+            if ( $g_parameter->MY_REPORT == 'N') {
+                $amount=$tiers->get_solde_detail($filter_year);
+            } else {
+                $amount = $tiers->get_solde_detail();
+            }
 
             /* skip the tiers without operation */
             if ( $p_amount && $amount['debit']==0 && $amount['credit'] == 0 && 
$amount['solde'] == 0 ) continue;
@@ -1688,7 +1696,7 @@ class Fiche
             }
             else
             {
-                $filter_fd_id=str_replace('[sql]', '', $typecard);
+                $filter_fd_id=noalyss_str_replace('[sql]', '', $typecard);
             }
         }
 
@@ -1699,7 +1707,7 @@ class Fiche
 
             if (noalyss_strlentrim($query)>0)
             {
-                $query=str_replace(" ", "%", $query);
+                $query=noalyss_str_replace(" ", "%", $query);
                 $filter_query=$and."(vw_name ilike '%$query%' or quick_code 
ilike ('%$query%') "
                         ." or vw_description ilike '%$query%' or tva_num ilike 
'%$query%' or accounting like upper('$query%'))";
             }
diff --git a/include/class/fiche_def.class.php 
b/include/class/fiche_def.class.php
index 1b137af87..d48fd6767 100644
--- a/include/class/fiche_def.class.php
+++ b/include/class/fiche_def.class.php
@@ -37,6 +37,8 @@ class Fiche_Def
     var $create_account;               //!< fd_create_account: flag
     var $all;
     var $attribut;             //!< get from attr_xxx tables
+    var $fd_description; //!< Description  of the Card Category
+
     function __construct($p_cn,$p_id = 0)
     {
         $this->cn=$p_cn;
@@ -874,7 +876,7 @@ $order
         $array=array();
         foreach($ret as $idx=>$val)
         {
-            $a=str_replace(' ','',$val['key']);
+            $a=noalyss_str_replace(' ','',$val['key']);
             $array[$a]=$val['ad_text'];
         }
         return $array;
diff --git a/include/class/follow_up.class.php 
b/include/class/follow_up.class.php
index 1faa605ee..ae9308982 100644
--- a/include/class/follow_up.class.php
+++ b/include/class/follow_up.class.php
@@ -55,15 +55,17 @@ class Follow_Up
     var $d_filename; /*!<   $d_filename filename's document      */
     var $d_mimetype; /*!<   $d_mimetype document's filename      */
     var $ag_title;   /*!<   $ag_title title document         */
-    var $f_id; /*!<   $f_id_dest fiche id (From field )  */
+    var $f_id; /*!<   $f_id fiche id (From field )  */
     var $ag_ref;  /*!< $ag_ref is the ref  */
     var $ag_hour;  /*!< $ag_hour is the hour of the meeting, action */
     var $ag_priority; /*!< $ag_priority is the priority 1 High, 2 medium, 3 
low */
     var $ag_dest;  /*!< $ag_dest person who is in charged */
     var $ag_contact;  /*!< $ag_contact contact */
     var $ag_remind_date;  /*!< $ag_contact contact */
-    var $f_id_dest ; /*!< followup action recipient */
     var $ag_description; /*!< description of the action with HTML tag*/
+    var $ag_id; //!< Follow_Up.ag_id
+    var $f_id_dest; /*!< followup action recipient */
+    var $aAction_detail; //!< Array of action details
 
     /**
      * @var integer $ag_description_id if greater than 0 , it is the id in 
action_comment
@@ -93,7 +95,6 @@ class Follow_Up
         $this->aAction_detail=array();
         $this->operation="";
         $this->action="";
-        $this->f_dest_id=0;
         $this->f_id_dest=0;
         $this->ag_priority=2;
     }
diff --git a/include/class/follow_up_detail.class.php 
b/include/class/follow_up_detail.class.php
index 70aa42f00..8ed2d1653 100644
--- a/include/class/follow_up_detail.class.php
+++ b/include/class/follow_up_detail.class.php
@@ -50,6 +50,7 @@ class Follow_Up_Detail
                                  "total"=>"ad_total_amount",
                                  "ag_id"=>"ag_id"
                              );
+    public $db,$ad_id,$ag_id;
     function __construct ($p_cn,$p_id=0)
     {
         $this->db=$p_cn;
diff --git a/include/class/lettering.class.php 
b/include/class/lettering.class.php
index 799e8acbc..924610eca 100644
--- a/include/class/lettering.class.php
+++ b/include/class/lettering.class.php
@@ -44,13 +44,17 @@ class Lettering
             )
 
     ;
-
+    var $db;
+    var $start;
+    var $end;
+    var $sql_ledger;
+    
     /**
      * constructor
      * @param $p_init resource to database
      * @note by default start and end are the 1.1.exercice to 31.12.exercice
      */
-    function __construct($p_init)
+    function __construct(public $p_init)
     {
         $this->db=$p_init;
         $a=new Noalyss_user($p_init);
@@ -68,7 +72,7 @@ class Lettering
             $this->end='31.12.'.$exercice;
         }
         // available ledgers
-        $this->sql_ledger=str_replace('jrn_def_id', 'jr_def_id', 
$a->get_ledger_sql('ALL', 3));
+        $this->sql_ledger=noalyss_str_replace('jrn_def_id', 'jr_def_id', 
$a->get_ledger_sql('ALL', 3));
     }
 
     public function get_parameter($p_string)
diff --git a/include/class/menu_ref.class.php b/include/class/menu_ref.class.php
index 86cfd1edd..aab3b5f0c 100644
--- a/include/class/menu_ref.class.php
+++ b/include/class/menu_ref.class.php
@@ -32,8 +32,8 @@ class Menu_Ref extends Menu_Ref_SQL
     {
         $this->me_code=strtoupper($this->me_code);
         $this->me_code=trim($this->me_code);
-        $this->me_code=str_replace('<','',$this->me_code);
-        $this->me_code=str_replace('>','',$this->me_code);
+        $this->me_code=noalyss_str_replace('<','',$this->me_code);
+        $this->me_code=noalyss_str_replace('>','',$this->me_code);
         
     }
     function verify()
diff --git a/include/class/mobile.class.php b/include/class/mobile.class.php
index 30a6040b1..80d86ec0a 100644
--- a/include/class/mobile.class.php
+++ b/include/class/mobile.class.php
@@ -231,7 +231,7 @@ class Mobile
         }
         elseif ($aModule['me_javascript']!='')
         {
-            $js=str_replace('<DOSSIER>', dossier::id(), 
$aModule['me_javascript']);
+            $js=noalyss_str_replace('<DOSSIER>', dossier::id(), 
$aModule['me_javascript']);
             echo create_script($js);
         }
     }
diff --git a/include/class/noalyss_parameter_folder.class.php 
b/include/class/noalyss_parameter_folder.class.php
index 23df7d79c..bee7d8d12 100644
--- a/include/class/noalyss_parameter_folder.class.php
+++ b/include/class/noalyss_parameter_folder.class.php
@@ -23,7 +23,7 @@
 /*!
  * \brief Class to manage the company parameter (address, name...)
  */
-
+#[AllowDynamicProperties]
 class Noalyss_Parameter_Folder
 {
     var $db;
@@ -50,6 +50,7 @@ class Noalyss_Parameter_Folder
     var $MY_ANC_FILTER;
     var $MY_CURRENCY;
     var $MY_COUNTRY;
+    var $MY_REPORT; //!< In Belgium , we need a report on the beginning of the 
exercice , not in French,
 
     
     // constructor
@@ -91,14 +92,13 @@ MY_STOCK= [ {$this->MY_STOCK }]
 MY_DEFAULT_ROUND_ERROR_DEB= [  {$this->MY_DEFAULT_ROUND_ERROR_DEB }]
 MY_DEFAULT_ROUND_ERROR_CRED= [ {$this->MY_DEFAULT_ROUND_ERROR_CRED }]
 MY_ANC_FILTER= [       {$this->MY_ANC_FILTER }]
-MY_CURRENCY= [ {$this->MY_CURRENCY }]
-
+MY_REPORT = [ {$this->MY_REPORT } ]
 
 EOF;
         return $r;
     }
 
-    function check_anc_filter($p_value)
+    function check_anc_filter($p_value):void
     {
         $tmp_value=$p_value;
         $tmp_value=preg_replace("/[0-9]|,/", '', $p_value);
@@ -118,7 +118,7 @@ EOF;
         {
             case 'MY_STRICT':
                 
-                if (empty(trim($p_value)) ||($p_value!='Y'&&$p_value!='N'))
+                if (empty($p_value) ||($p_value!='Y'&&$p_value!='N'))
                 {
                     $ret_value='N';
                 }
@@ -127,7 +127,7 @@ EOF;
             case 'MY_ANC_FILTER':
                 try
                 {
-                    $p_value=str_replace(" ", "", $p_value);
+                    $p_value=noalyss_str_replace(" ", "", $p_value);
                     $this->check_anc_filter($p_value);
                     $ret_value=$p_value;
                 }
@@ -205,6 +205,7 @@ EOF;
         $this->save('MY_DEFAULT_ROUND_ERROR_DEB');
         $this->save('MY_DEFAULT_ROUND_ERROR_CRED');
         $this->save("MY_ANC_FILTER");
+        $this->save("MY_REPORT");
 
     }
     /**
diff --git a/include/class/noalyss_user.class.php 
b/include/class/noalyss_user.class.php
index 890f7d886..e248317b4 100644
--- a/include/class/noalyss_user.class.php
+++ b/include/class/noalyss_user.class.php
@@ -39,6 +39,7 @@ class Noalyss_User
     var $admin; //!< is or is not admin
     var $valid; //!< is or is not valid
     var $first_name;
+    var $last_name ; //!< user's last_name
     var $name;
     var $active; //!< 1 active , 0 disables
     var $login; //!< login lower case
@@ -46,8 +47,8 @@ class Noalyss_User
     var $email; //!< user's email
     var $access_mode; //!< MOBILE or PC depending if when connecting $login 
contains @mobile 
     var $lang ; //!< user's language
-    var $last_name ; //!< user's last_name
     var $theme ; //!< user's  CSS Theme
+    
     function __construct($p_cn, $p_id=-1)
     {
         $this->db=$p_cn;
diff --git a/include/class/periode.class.php b/include/class/periode.class.php
index 2cbafa44b..d15eb1e43 100644
--- a/include/class/periode.class.php
+++ b/include/class/periode.class.php
@@ -41,7 +41,7 @@ class Periode
     var $p_end;   /*!< end of the periode */
     var $p_exercice ; /*!< exercice */
     var $p_closed ; /*!< if exercice is closed */
-    var $p_central ; /*!< NOT USER  */
+    var $p_central ; /*!< NOT USED  */
     var $p_exercice_label ; /*!< Label of the exercice  */
     function __construct($p_cn, $p_id=0)
     {
@@ -761,4 +761,23 @@ EOF;
         $i_exercice->selected=$p_sel;
         echo $i_exercice->input();
     }
+
+    /**
+     * @brief retrieve the first day of the first exercice
+     * @return : string date format "DD.MM.YYYYY"
+     */
+     function  get_first_date():string
+    {
+        return $this->cn->get_value("select to_char(p_start,'DD.MM.YYYY') from 
parm_periode order by p_start limit 1");
+    }
+
+    /**
+     * @brief retrieve the first periode of the folder or -1 if none
+     *
+     * @return int
+     */
+    function get_first_periode():int
+    {
+        return $this->cn->get_value("select p_id from parm_periode order by 
p_start asc limit 1");
+    }
 }
diff --git a/include/class/todo_list.class.php 
b/include/class/todo_list.class.php
index bb39560e3..af3928e89 100644
--- a/include/class/todo_list.class.php
+++ b/include/class/todo_list.class.php
@@ -51,7 +51,7 @@ class Todo_List
                                  "is_public"=>"is_public");
     private $cn;
     private  $tl_id,$tl_date,$tl_title,$use_login,$is_public;
-
+    var $tl_desc;
     function __construct ($p_init)
     {
         $this->cn=$p_init;
diff --git a/include/company.inc.php b/include/company.inc.php
index c00cf612b..e8ce0b45f 100644
--- a/include/company.inc.php
+++ b/include/company.inc.php
@@ -53,6 +53,7 @@ if (isset($_POST['record_company']))
     $m->MY_DEFAULT_ROUND_ERROR_DEB=$http->post("p_round_error_deb");
     $m->MY_DEFAULT_ROUND_ERROR_CRED=$http->post("p_round_error_cred");
     $m->MY_ANC_FILTER=$http->post("p_anc_filter");
+    $m->MY_REPORT=$http->post("p_report");
     try
     {
         $m->update();
@@ -117,10 +118,6 @@ $anc_filter=new IText("p_anc_filter", $my->MY_ANC_FILTER);
 $anc_filter->placeholder='6,7';
 $anc_filter->title=_("Uniquement des chiffres séparés par des virgules");
 
-$use_currency=new ISelect();
-$use_currency->value=$updlab_array;
-$use_currency->selected=$my->MY_CURRENCY;
-
 $default_error_deb=new IPoste("p_round_error_deb", 
$my->MY_DEFAULT_ROUND_ERROR_DEB);
 $default_error_deb->name='p_round_error_deb';
 $default_error_deb->set_attribute('gDossier', Dossier::id());
@@ -133,6 +130,13 @@ $default_error_cred->set_attribute('gDossier', 
Dossier::id());
 $default_error_cred->set_attribute('jrn', 0);
 $default_error_cred->set_attribute('account', 'p_round_error_cred');
 
+$report=new ISelect('p_report');
+$report->value = array(
+    array('value'=>'N', 'label'=>_('Non')),
+    array('value'=>'Y', 'label'=>_('Oui'))
+);
+$report->selected=$my->MY_REPORT;
+
 // other parameters
 $all=new IText();
 $all->table=1;
@@ -253,7 +257,12 @@ $all->style=' class="input_text"';
         <div class="col">
             <h2>Fonctionnement</h2>
 
-
+            <div class="form-group">
+                <label class="w-40" for="p_report">
+                    <?= _("L'exercice commence par un report des soldes)") 
?></label>
+                <?=Icon_Action::infobulle(84)?>
+                <?= $report->input() ?>
+            </div>
 
             <div class="form-group">
                 <label class="w-20" for="p_compta">
diff --git a/include/export/export_receipt.php 
b/include/export/export_receipt.php
index 7d6d3e5d6..0cc3027a5 100644
--- a/include/export/export_receipt.php
+++ b/include/export/export_receipt.php
@@ -82,7 +82,7 @@ $tmp=tempnam($_ENV['TMP'],'document_');
 
 $new_name=$row['jr_pj_name'];
 $receipt_number=clean_filename($row['jr_pj_number']);
-$receipt_number=str_replace('.','-',$receipt_number);
+$receipt_number=noalyss_str_replace('.','-',$receipt_number);
 if ( ! empty($receipt_number) && strpos($new_name,$receipt_number) === false ) 
{
 
     $new_name=$receipt_number.'-'.$new_name;
diff --git a/include/export/export_stock_histo_csv.php 
b/include/export/export_stock_histo_csv.php
index 36fafd86d..5e6dc64e4 100644
--- a/include/export/export_stock_histo_csv.php
+++ b/include/export/export_stock_histo_csv.php
@@ -50,7 +50,7 @@ for ($i=0;$i<$max_row;$i++)
        $export->add($row['sg_code']);
        $export->add($row['r_name']);
        $export->add($row['qcode']);
-       $row['ccomment']=str_replace('"','',$row['ccomment']);
+       $row['ccomment']=noalyss_str_replace('"','',$row['ccomment']);
        $export->add($row['ccomment']);
        $export->add($row['sg_quantity'],"number");
        $export->add($row['direction']);
diff --git a/include/header_print.php b/include/header_print.php
index 7a510a068..16852c126 100644
--- a/include/header_print.php
+++ b/include/header_print.php
@@ -34,7 +34,7 @@ function header_txt($p_cn)
     $soc=$own->MY_NAME;
 
     $date=date('d / m / Y H:i ');
-    $dossier=utf8_decode(" Dossier : ".dossier::name());
+    $dossier=mb_convert_encoding(" Dossier : 
".dossier::name(),'ISO-8859-1','UTF-8');
     return $dossier." ".$soc." ".$date;
 }
 
diff --git a/include/impress_bilan.inc.php b/include/impress_bilan.inc.php
index abf2a5e79..f72f7ed7a 100644
--- a/include/impress_bilan.inc.php
+++ b/include/impress_bilan.inc.php
@@ -29,7 +29,7 @@ if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas 
permis');
 //-----------------------------------------------------
 // Show the jrn and date
 //-----------------------------------------------------
-global $g_user;
+global $g_user,$g_parameter;
 //-----------------------------------------------------
 // Form
 //-----------------------------------------------------
@@ -85,8 +85,14 @@ if ( ! isset ($_GET['verif']))
 if ( isset($_GET['verif']))
 {
     $periode=new Periode($cn);
-    $date_from=$periode->first_day($bilan->from);
-    $date_to=$periode->last_day($bilan->to);
+    if ( $g_parameter->MY_REPORT=='Y') {
+        $date_from=$periode->first_day($bilan->from);
+       $date_to=$periode->last_day($bilan->to);
+    }
+    else {
+        $date_from=$bilan->from;
+        $date_to=$bilan->to;
+    }
     echo '<h2>'._('Etape 2 :Impression')."   ".$date_from.'-'.$date_to.'</h2>';
     
     $bilan->get_request_get();
diff --git a/include/lib/ac_common.php b/include/lib/ac_common.php
index cf3d0300e..93d4ea129 100644
--- a/include/lib/ac_common.php
+++ b/include/lib/ac_common.php
@@ -96,7 +96,7 @@ function tr($p_string, $p_extra='')
 function j($p_string)
 {
     $a = preg_replace("/\r?\n/", "\\n", addslashes($p_string));
-    $a = str_replace("'", '\'', $a);
+    $a = noalyss_str_replace("'", '\'', $a);
     return $a;
 }
 
@@ -108,7 +108,7 @@ function nb($p_number)
 {
     $r=trim($p_number);
     $r = sprintf('%.4f', $p_number);
-    $r = str_replace('.', ',', $r);
+    $r = noalyss_str_replace('.', ',', $r);
 
     return $r;
 }
@@ -512,8 +512,8 @@ function sql_string($p_string)
     $p_string = trim($p_string??"");
     if (strlen($p_string) == 0)
        return null;
-    $p_string = str_replace("'", "''", $p_string);
-    $p_string = str_replace('\\', '\\\\', $p_string);
+    $p_string = noalyss_str_replace("'", "''", $p_string);
+    $p_string = noalyss_str_replace('\\', '\\\\', $p_string);
     return $p_string;
 }
 
@@ -646,8 +646,8 @@ function getPeriodeFromMonth($p_cn, $p_date)
 
 function Decode($p_html)
 {
-    $p_html = str_replace('%0D', '', $p_html);
-    $p_html = str_replace('%0A', '', $p_html);
+    $p_html = noalyss_str_replace('%0D', '', $p_html);
+    $p_html = noalyss_str_replace('%0A', '', $p_html);
     $p_html = urldecode($p_html);
     return $p_html;
 }
@@ -658,11 +658,11 @@ function Decode($p_html)
  */
 function transform_sql_filter_per($p_sql)
 {
-    $result=str_replace("j_tech_per in (select p_id from parm_periode  
where","",$p_sql);
-    $result=str_replace("jr_tech_per in (select p_id from parm_periode  
where","",$result);
-    $result=str_replace("j_tech_per = (select p_id from parm_periode  where  
p_start "," oa_date ",$result);
-    $result=str_replace("p_start >= to_date","oa_date >= to_date",$result);
-    $result=str_replace("p_end <= to_date","oa_date <= to_date",$result);
+    $result=noalyss_str_replace("j_tech_per in (select p_id from parm_periode  
where","",$p_sql);
+    $result=noalyss_str_replace("jr_tech_per in (select p_id from parm_periode 
 where","",$result);
+    $result=noalyss_str_replace("j_tech_per = (select p_id from parm_periode  
where  p_start "," oa_date ",$result);
+    $result=noalyss_str_replace("p_start >= to_date","oa_date >= 
to_date",$result);
+    $result=noalyss_str_replace("p_end <= to_date","oa_date <= 
to_date",$result);
  
     $result="( $result";
     return $result;
@@ -824,7 +824,7 @@ function what_os()
  */
 function shrink_date($p_date)
 {
-    $date = str_replace('.', '', $p_date);
+    $date = noalyss_str_replace('.', '', $p_date);
     $str_date = substr($date, 0, 4) . substr($date, 6, 2);
     return $str_date;
 }
@@ -1204,7 +1204,7 @@ function display_menu($p_menuid)
             exit();
     } elseif ( $file[0]['me_javascript'] != '')
     {
-        $js=  str_replace('<DOSSIER>', dossier::id(), 
$file[0]['me_javascript']);
+        $js=  noalyss_str_replace('<DOSSIER>', dossier::id(), 
$file[0]['me_javascript']);
         echo create_script($js);
     } 
 
@@ -1381,7 +1381,7 @@ if(!function_exists('tracedebug')) {
 function convert_to_rtf($p_string)
 {
     $result="";
-    $p_string2=utf8_decode($p_string);
+    $p_string2=mb_convert_encoding($p_string,'ISO-8859-1','UTF-8');
     $nb_result=strlen($p_string2);
     for ($i = 0 ; $i < $nb_result ; $i++ ){
         if (ord($p_string[$i]) < 127 ) {
@@ -1403,7 +1403,7 @@ function convert_to_rtf($p_string)
  */
 function remove_divide_zero($p_formula)
 {
-    $test=str_replace(" ","",$p_formula).";";
+    $test=noalyss_str_replace(" ","",$p_formula).";";
     
$p_formula=preg_replace("![0-9]+\.*[0-9]*/0\.{0,1}0*(\+|-|\*|/|;){1}!","0$1",$test);
     $p_formula=trim($p_formula,';');
     return $p_formula;
@@ -1547,17 +1547,17 @@ function noalyss_str_replace($search,$replace,$string) {
     if ($string===null) return "";
     else return str_replace($search,$replace??"",$string);
 }
-function noalyss_bcsub($p_first,$p_second)
+function noalyss_bcsub($p_first,$p_second,$p_decimal=4)
 {
     $p_first=(empty($p_first))?0:$p_first;
     $p_second=(empty($p_second))?0:$p_second;
-    return bcsub($p_first,$p_second);
+    return bcsub($p_first,$p_second,$p_decimal);
 }
-function noalyss_bcadd($p_first,$p_second)
+function noalyss_bcadd($p_first,$p_second,$p_decimal=4)
 {
     $p_first=(empty($p_first))?0:$p_first;
     $p_second=(empty($p_second))?0:$p_second;
-    return bcadd($p_first,$p_second);
+    return bcadd($p_first,$p_second,$p_decimal);
 }
 function noalyss_strip_tags($p_string)
 {
diff --git a/include/lib/data_sql.class.php b/include/lib/data_sql.class.php
index 938ee8d12..72c8ca646 100644
--- a/include/lib/data_sql.class.php
+++ b/include/lib/data_sql.class.php
@@ -101,6 +101,7 @@ abstract class Data_SQL
    var $type;           //! Type of the data
    var $date_format;    //! defaullt date format
    var $default;
+    var $table;
 
     public function __toString(): string
     {
diff --git a/include/lib/database_core.class.php 
b/include/lib/database_core.class.php
index 36eb417d5..3f9cba5bd 100644
--- a/include/lib/database_core.class.php
+++ b/include/lib/database_core.class.php
@@ -41,7 +41,7 @@ class DatabaseCore
     /**< return value  */
     private $is_open;                   /*!< true is connected */
     public $sql;     //!< last SQL stmt executed
-    var $array;
+    public $array;
     /*** Connect to a database return an connx to db or false if it fails
      *
      * @param string $p_user Username
diff --git a/include/lib/function_javascript.php 
b/include/lib/function_javascript.php
index 087863698..cc6895ca6 100644
--- a/include/lib/function_javascript.php
+++ b/include/lib/function_javascript.php
@@ -2720,11 +2720,11 @@ function unescapebycharacter($str)
 function escape_xml($p_xml)
 {
     $xml=$p_xml??"";
-    $xml=str_replace('&','&amp;',$xml);
-    $xml=str_replace('<','&lt;',$xml);
-    $xml=str_replace('>','&gt;',$xml);
-    $xml=str_replace("'",'&apos;',$xml);
-    $xml=str_replace('"','&quot;',$xml);
+    $xml=noalyss_str_replace('&','&amp;',$xml);
+    $xml=noalyss_str_replace('<','&lt;',$xml);
+    $xml=noalyss_str_replace('>','&gt;',$xml);
+    $xml=noalyss_str_replace("'",'&apos;',$xml);
+    $xml=noalyss_str_replace('"','&quot;',$xml);
     return $xml;
 }
 /**
@@ -2738,11 +2738,11 @@ function escape_xml($p_xml)
 function unescape_xml($p_xml)
 {
     $xml=$p_xml??"";
-    $xml=str_replace('&amp;','&',$xml);
-    $xml=str_replace('&lt;','<',$xml);
-    $xml=str_replace('&gt;','>',$xml);
-    $xml=str_replace('&apos;',"'",$xml);
-    $xml=str_replace('&quot;','"',$xml);
+    $xml=noalyss_str_replace('&amp;','&',$xml);
+    $xml=noalyss_str_replace('&lt;','<',$xml);
+    $xml=noalyss_str_replace('&gt;','>',$xml);
+    $xml=noalyss_str_replace('&apos;',"'",$xml);
+    $xml=noalyss_str_replace('&quot;','"',$xml);
     return $xml;
 }
 /**
diff --git a/include/lib/html_input.class.php b/include/lib/html_input.class.php
index 9ea2e3b1d..2f63464e6 100755
--- a/include/lib/html_input.class.php
+++ b/include/lib/html_input.class.php
@@ -70,13 +70,12 @@ class HtmlInput
     var $ctrl;   /*!<$ctrl is the control to update (see 
js_search_card_control) */
     var $tabindex;
     var $require;
-
-var $width;
-var $heigh;
-var $attribute;
-var $id;
-var $style;
-var $css_size;
+    var $width;
+    var $heigh;
+    var $attribute;
+    var $id;
+    var $style;
+    var $css_size;
 
     function __construct($p_name="", $p_value="", $p_id="")
     {
@@ -1082,7 +1081,7 @@ var $css_size;
             'class'=>'inner_box'
         ));
 
-        $bledger_param=str_replace('"', "'", $bledger_param);
+        $bledger_param=noalyss_str_replace('"', "'", $bledger_param);
         $bledger=new ISmallButton('l');
         $bledger->label=_("choix des journaux");
         $bledger->javascript=" show_ledger_choice($bledger_param)";
diff --git a/include/lib/icon_action.class.php 
b/include/lib/icon_action.class.php
index ef6d0d7c0..ed6ad1c23 100644
--- a/include/lib/icon_action.class.php
+++ b/include/lib/icon_action.class.php
@@ -110,7 +110,7 @@ class Icon_Action
      */
     static function tips($p_comment)
     {
-        $p_comment=str_replace("'",' ',$p_comment);
+        $p_comment=noalyss_str_replace("'",' ',$p_comment);
         $r='<span tabindex="-1" class="icon" 
style="cursor:pointer;display:inline;text-decoration:none;" 
onmouseover="displayBulle(\''.$p_comment.'\')"  
onclick="displayBulle(\''.$p_comment.'\')" onmouseout="hideBulle(0)">';
         $r.="&#xf086;";
         $r.='</span>';
@@ -125,7 +125,7 @@ class Icon_Action
      */
     static function comment($p_comment)
     {
-        $p_comment=str_replace("'",' ',$p_comment);
+        $p_comment=noalyss_str_replace("'",' ',$p_comment);
         $js=sprintf("displayBulle('%s')",$p_comment);
         
         $r=sprintf('<span tabindex="-1" class="icon" 
style="cursor:pointer;display:inline;text-decoration:none;" onmouseover="%s"  
onclick="%s" onmouseout="hideBulle(0)">',
diff --git a/include/lib/impress.class.php b/include/lib/impress.class.php
index f7cae1d82..eed2c1c41 100644
--- a/include/lib/impress.class.php
+++ b/include/lib/impress.class.php
@@ -99,7 +99,7 @@ class Impress
 
                 if ($p_type_date==0&&preg_match("/FROM=[0-9]+\.[0-9]+/", 
$p_formula, $afrom)==1)
                 {
-                    $from=str_replace('FROM=','',$afrom[0]);
+                    $from=noalyss_str_replace('FROM=','',$afrom[0]);
                     $cond = \Impress::compute_periode($p_cn,$from,$p_end);
                     $cond_anc=" and ".transform_sql_filter_per($cond);
                     // We remove FROM out of the p_formula
@@ -113,7 +113,7 @@ class Impress
                 $amount=\Impress::compute_amount($p_cn,$line,$cond." 
".$p_sql,$cond_anc." ".$p_sql);
       
 
-                $p_formula=str_replace($x[0],"(". $amount.")", $p_formula);
+                $p_formula=noalyss_str_replace($x[0],"(". $amount.")", 
$p_formula);
             }
         }
 
@@ -145,7 +145,7 @@ class Impress
                             $nom=strtolower($nom);
                     }
                 }
-                $p_label=str_replace($e[0], $nom, $p_label);
+                $p_label=noalyss_str_replace($e[0], $nom, $p_label);
             }
 
             $aret=array('desc'=>$p_label,
@@ -175,27 +175,27 @@ class Impress
 
 
 
-        $p_string=str_replace("round", "", $p_string);
-        $p_string=str_replace("abs", "", $p_string);
-        $p_string=str_replace("(", "", $p_string);
-        $p_string=str_replace(")", "", $p_string);
+        $p_string=noalyss_str_replace("round", "", $p_string);
+        $p_string=noalyss_str_replace("abs", "", $p_string);
+        $p_string=noalyss_str_replace("(", "", $p_string);
+        $p_string=noalyss_str_replace(")", "", $p_string);
         // for  the inline test like $a=(cond)?value:other;
-        $p_string=str_replace("?", "+", $p_string);
-        $p_string=str_replace(":", "+", $p_string);
-        $p_string=str_replace(">=", "+", $p_string);
-        $p_string=str_replace("<=", "+", $p_string);
-        $p_string=str_replace(">", "+", $p_string);
-        $p_string=str_replace("<", "+", $p_string);
+        $p_string=noalyss_str_replace("?", "+", $p_string);
+        $p_string=noalyss_str_replace(":", "+", $p_string);
+        $p_string=noalyss_str_replace(">=", "+", $p_string);
+        $p_string=noalyss_str_replace("<=", "+", $p_string);
+        $p_string=noalyss_str_replace(">", "+", $p_string);
+        $p_string=noalyss_str_replace("<", "+", $p_string);
         // eat Space + comma
-        $p_string=str_replace(" ", "", $p_string);
-        $p_string=str_replace(",", "", $p_string);
+        $p_string=noalyss_str_replace(" ", "", $p_string);
+        $p_string=noalyss_str_replace(",", "", $p_string);
         // Remove D/C/S
-        $p_string=str_replace("-c", "", $p_string);
-        $p_string=str_replace("-d", "", $p_string);
-        $p_string=str_replace("-s", "", $p_string);
-        $p_string=str_replace("-S", "", $p_string);
+        $p_string=noalyss_str_replace("-c", "", $p_string);
+        $p_string=noalyss_str_replace("-d", "", $p_string);
+        $p_string=noalyss_str_replace("-s", "", $p_string);
+        $p_string=noalyss_str_replace("-S", "", $p_string);
         // Remove T,t
-        $p_string=str_replace("-t", "", $p_string);
+        $p_string=noalyss_str_replace("-t", "", $p_string);
 
         // analytic accountancy (between {} )
         $p_string=preg_replace("/\{\{[[:alnum:]]*\}\}/", "", $p_string);
@@ -383,20 +383,20 @@ class Impress
         }
         $compute=\Impress::find_computing_mode($p_expression);
         // remove char for the mode
-        $p_expression=str_replace("-d", "", $p_expression);
-        $p_expression=str_replace("-c", "", $p_expression);
-        $p_expression=str_replace("-s", "", $p_expression);
-        $p_expression=str_replace("-S", "", $p_expression);
+        $p_expression=noalyss_str_replace("-d", "", $p_expression);
+        $p_expression=noalyss_str_replace("-c", "", $p_expression);
+        $p_expression=noalyss_str_replace("-s", "", $p_expression);
+        $p_expression=noalyss_str_replace("-S", "", $p_expression);
         // we have an account
         if (preg_match("/\[.*\]/", $p_expression)) {
-            $p_expression=str_replace("[", "", $p_expression);
-            $p_expression=str_replace("]", "", $p_expression);
+            $p_expression=noalyss_str_replace("[", "", $p_expression);
+            $p_expression=noalyss_str_replace("]", "", $p_expression);
             $P=new Acc_Account_Ledger($p_cn, $p_expression);
             $detail=$P->get_solde_detail($p_cond_sql);
         } elseif (preg_match("/\{\{.*\}\}/", $p_expression))
         { 
-            $p_expression=str_replace("{", "", $p_expression);
-            $p_expression=str_replace("}", "", $p_expression);
+            $p_expression=noalyss_str_replace("{", "", $p_expression);
+            $p_expression=noalyss_str_replace("}", "", $p_expression);
             $anc_account= new Anc_Account($p_cn);
             $anc_account->load_by_code($p_expression);
           
@@ -413,8 +413,8 @@ class Impress
         } elseif (preg_match("/\{.*\}/", $p_expression))
         { // we have a card
             // remove useless char
-            $p_expression=str_replace("{", "", $p_expression);
-            $p_expression=str_replace("}", "", $p_expression);
+            $p_expression=noalyss_str_replace("{", "", $p_expression);
+            $p_expression=noalyss_str_replace("}", "", $p_expression);
             $fiche=new Fiche($p_cn);
             if ( DEBUGNOALYSS > 1) 
             {
diff --git a/include/lib/itext.class.php b/include/lib/itext.class.php
index 1eb3d009b..1168cb16c 100644
--- a/include/lib/itext.class.php
+++ b/include/lib/itext.class.php
@@ -31,6 +31,8 @@ class IText extends HtmlInput
     var $placeholder; 
     var $title;
     var $autofocus;
+    var $css_size;
+
     function __construct($name='',$value='',$p_id="")
     {
         parent::__construct($name,$value,$p_id);
diff --git a/include/lib/manage_table_sql.class.php 
b/include/lib/manage_table_sql.class.php
index 9fb1f7df3..4eed7759b 100644
--- a/include/lib/manage_table_sql.class.php
+++ b/include/lib/manage_table_sql.class.php
@@ -109,7 +109,7 @@ class Manage_Table_SQL
     protected $current_row; //! in display_row and display_custom_row, it is 
the current row which is used
     protected $a_col_option; //!< Extra to add to the column : CSS  Style , 
CSS class, javascript ,...
     protected $a_header_option; //!< Extra to add to the column Header : CSS  
Style , CSS class, javascript ,...
-    protected $callback;
+    protected $callback; //!< Callback function
     /**
      * @brief Constructor : set the label to the column name,
      * the order of the column , set the properties and the
diff --git a/include/lib/message_javascript.php 
b/include/lib/message_javascript.php
index d37b93758..aa00f4eaa 100644
--- a/include/lib/message_javascript.php
+++ b/include/lib/message_javascript.php
@@ -117,4 +117,5 @@ content[80]="<?php echo htmlspecialchars(_("Oui pour 
charger les fichiers javasc
 content[81]="<?php echo htmlspecialchars(_("Recommendé d'avoir un poste 
propre"),ENT_QUOTES)?>";
 content[82]="<?php echo htmlspecialchars(_("valeur en % "),ENT_QUOTES)?>";
 content[83]="<?php echo htmlspecialchars(_("Données invalides 
"),ENT_QUOTES)?>";
+content[84]="<?php echo htmlspecialchars(_("En Belgique, l'exercice commence 
par un report des comptes de 0 à 5, mais pas en France, ce solde est calculé 
depuis le tout premier exercice"),ENT_QUOTES)?>";
 </script>
diff --git a/include/lib/noalyss_csv.class.php 
b/include/lib/noalyss_csv.class.php
index 47a2acdb8..0ac94699f 100644
--- a/include/lib/noalyss_csv.class.php
+++ b/include/lib/noalyss_csv.class.php
@@ -38,6 +38,7 @@ class Noalyss_Csv
     private $sep_field;
     private $sep_dec;
     private $encoding;
+    private $size;
 
     function __construct($p_filename)
     {
@@ -67,11 +68,11 @@ class Noalyss_Csv
         $this->filename.="-".date("ymd-Hi");
         $this->filename.=".csv";
         
-        $this->filename=str_replace(";", "", $this->filename);
-        $this->filename=str_replace("/", "", $this->filename);
-        $this->filename=str_replace(":", "", $this->filename);
-        $this->filename=str_replace("*", "", $this->filename);
-        $this->filename=str_replace(" ", "_", $this->filename);
+        $this->filename=noalyss_str_replace(";", "", $this->filename);
+        $this->filename=noalyss_str_replace("/", "", $this->filename);
+        $this->filename=noalyss_str_replace(":", "", $this->filename);
+        $this->filename=noalyss_str_replace("*", "", $this->filename);
+        $this->filename=noalyss_str_replace(" ", "_", $this->filename);
         $this->filename=strtolower($this->filename);
     }
 
@@ -144,10 +145,10 @@ class Noalyss_Csv
             {
                 
$export=($this->element[$i]['value']==null)?"":$this->element[$i]['value'];
                 // remove break-line, 
-                $export=str_replace("\n"," ",$export);
-                $export=str_replace("\r"," ", $export);
+                $export=noalyss_str_replace("\n"," ",$export);
+                $export=noalyss_str_replace("\r"," ", $export);
                 // remove double quote
-                $export=str_replace('"',"", $export);
+                $export=noalyss_str_replace('"',"", $export);
                 printf($sep.'"%s"', $this->encode($export));
             }
             $sep=$this->sep_field;
@@ -181,7 +182,7 @@ class Noalyss_Csv
     protected function encode($str)
    {
        if ($this->encoding=="utf8") return $str;
-       if ($this->encoding=="latin1") return utf8_decode ($str);
+       if ($this->encoding=="latin1") return 
mb_convert_encoding($str,'ISO-8859-1','UTF-8');
        throw new Exception(_("Encodage invalide"));
    }
     /**
diff --git a/include/lib/select_box.class.php b/include/lib/select_box.class.php
index 86d775a77..56bfb10fb 100644
--- a/include/lib/select_box.class.php
+++ b/include/lib/select_box.class.php
@@ -38,7 +38,7 @@ class Select_Box
     private $position; //!< change depending if we are in an absolute block or 
not
     protected $style_box;
     protected $value;
-
+    public $style_box;
     /**
      * Default constructor
      * @param type $p_id javascript DOMid
@@ -202,7 +202,7 @@ class Select_Box
         if ( $replace )
         {
             $this->item[$this->cnt]['javascript']=
-                sprintf("$('%s_bt').value='%s 
\u21E9';",$this->id,str_replace("'","",$label)).
+                sprintf("$('%s_bt').value='%s 
\u21E9';",$this->id,noalyss_str_replace("'","",$label)).
                 $javascript.";$('select_box{$this->id}').hide()";
         } else {
             
$this->item[$this->cnt]['javascript']=$javascript.";$('select_box{$this->id}').hide()";
diff --git a/include/lib/table_data_sql.class.php 
b/include/lib/table_data_sql.class.php
index 25d92028d..d34699623 100644
--- a/include/lib/table_data_sql.class.php
+++ b/include/lib/table_data_sql.class.php
@@ -85,7 +85,7 @@
  * @endcode
  *
  */
-
+#[AllowDynamicProperties]
 abstract class Table_Data_SQL extends Data_SQL
 {
 
diff --git a/include/lib/user_common.php b/include/lib/user_common.php
index abb1f3839..8401af11f 100644
--- a/include/lib/user_common.php
+++ b/include/lib/user_common.php
@@ -88,7 +88,7 @@ function 
navigation_bar($p_offset,$p_line,$p_size=0,$p_page=1,$p_javascript="")
     // Clean url, cut away variable coming frm here
     $url=cleanUrl();
     // action to clean
-    $url=str_replace('&p_action=delete','',$url);
+    $url=noalyss_str_replace('&p_action=delete','',$url);
 
     // compute max of page
     $nb_page=($p_line-($p_line%$p_size))/$p_size;
@@ -195,8 +195,8 @@ function toNumber($p_num)
 {
     $p_num=trim($p_num);
     if ($p_num=='') return 0;
-    $p_num=str_replace("'",'',$p_num);
-    $p_num=str_replace(',','.',$p_num);
+    $p_num=noalyss_str_replace("'",'',$p_num);
+    $p_num=noalyss_str_replace(',','.',$p_num);
     return $p_num;
 }
 /**
@@ -224,7 +224,7 @@ function clean_filename($p_filename)
 {
     $filename=$p_filename;
     foreach (array('/','*','<','>',';',',','\\',':','(',')',' ','[',']') as 
$i) {
-            $filename= str_replace($i, "-",$filename);
+            $filename= noalyss_str_replace($i, "-",$filename);
     }
     return $filename;
 
diff --git a/include/template/ledger_detail_bottom.php 
b/include/template/ledger_detail_bottom.php
index c333c853b..ecef286b1 100644
--- a/include/template/ledger_detail_bottom.php
+++ b/include/template/ledger_detail_bottom.php
@@ -200,7 +200,7 @@ if ($aRap  != null ) {
                 array($internal));
             // add additional tax if any
             $add=$operation->get_sum_other_tax();
-            $amount=bcadd($amount,$add,2);
+            $amount=noalyss_bcadd($amount,$add,2);
             break;
         case 'V':
             $amount=$cn->get_value("select sum(qs_price+qs_vat-qs_vat_sided) 
from quant_sold qs  
diff --git a/include/template/mobile-display_menu.php 
b/include/template/mobile-display_menu.php
index 55b9f2011..489420fae 100644
--- a/include/template/mobile-display_menu.php
+++ b/include/template/mobile-display_menu.php
@@ -48,7 +48,7 @@ if (!defined('ALLOWED'))
             elseif ($row['me_javascript']!='')
             {
                 $url="javascript:void(0)";
-                $js_dossier=str_replace('<DOSSIER>', Dossier::id(), 
$row['me_javascript']);
+                $js_dossier=noalyss_str_replace('<DOSSIER>', Dossier::id(), 
$row['me_javascript']);
                 $js=sprintf(' onclick="%s"', $js_dossier);
             }
             else
diff --git a/include/template/module.php b/include/template/module.php
index 8fa2be0e6..e3ecef3f8 100644
--- a/include/template/module.php
+++ b/include/template/module.php
@@ -115,7 +115,7 @@ endif;?>
                    elseif ($row['me_javascript'] != '')
                        {
                                $url="javascript:void(0)";
-                                $js_dossier=str_replace('<DOSSIER>', 
Dossier::id(), $row['me_javascript']);
+                                $js_dossier=noalyss_str_replace('<DOSSIER>', 
Dossier::id(), $row['me_javascript']);
                                $js=sprintf(' onclick="%s"',$js_dossier);
                        }
                        else
@@ -159,7 +159,7 @@ endif;?>
                         elseif ($row['me_javascript'] != '')
                             {
                                     $url="javascript:void(0)";
-                                    $js_dossier=str_replace('<DOSSIER>', 
Dossier::id(), $row['me_javascript']);
+                                    
$js_dossier=noalyss_str_replace('<DOSSIER>', Dossier::id(), 
$row['me_javascript']);
                                     $js=sprintf(' onclick="%s"',$js_dossier);
                             }
                             else
diff --git a/include/tfpdf/font/unifont/ttfonts.php 
b/include/tfpdf/font/unifont/ttfonts.php
index 7485e5109..037057ca5 100644
--- a/include/tfpdf/font/unifont/ttfonts.php
+++ b/include/tfpdf/font/unifont/ttfonts.php
@@ -34,7 +34,7 @@ define("GF_XYSCALE",(1 << 6));
 define("GF_TWOBYTWO",(1 << 7));
 
 
-
+#[AllowDynamicProperties]
 class TTFontFile {
 
 var $maxUni;
diff --git a/include/tfpdf/tfpdf.php b/include/tfpdf/tfpdf.php
index 6000a9fb2..562b3ab79 100644
--- a/include/tfpdf/tfpdf.php
+++ b/include/tfpdf/tfpdf.php
@@ -9,7 +9,7 @@
 
*******************************************************************************/
 
 define('tFPDF_VERSION','1.24');
-
+#[AllowDynamicProperties]
 class tFPDF
 {
 
@@ -1256,9 +1256,6 @@ function _dochecks()
        // Check mbstring overloading
        if(ini_get('mbstring.func_overload') & 2)
                $this->Error('mbstring overloading must be disabled');
-       // Ensure runtime magic quotes are disabled
-       if(version_compare(PHP_VERSION, '7.3.0','<') && 
get_magic_quotes_runtime())
-               @set_magic_quotes_runtime(0);
 }
 
 function _getfontpath()
@@ -1615,7 +1612,6 @@ function _parsegif($file)
                ob_start();
                imagepng($im);
                $data = ob_get_clean();
-               imagedestroy($im);
                fwrite($f,$data);
                rewind($f);
                $info = $this->_parsepngstream($f,$file);
@@ -1629,7 +1625,6 @@ function _parsegif($file)
                        $this->Error('Unable to create a temporary file');
                if(!imagepng($im,$tmp))
                        $this->Error('Error while saving to temporary file');
-               imagedestroy($im);
                $info = $this->_parsepng($tmp);
                unlink($tmp);
        }
diff --git a/sql/upgrade.sql b/sql/upgrade.sql
index e69de29bb..aaf1be2e0 100644
--- a/sql/upgrade.sql
+++ b/sql/upgrade.sql
@@ -0,0 +1,7 @@
+begin;
+
+COMMENT ON TABLE public.jrn_tax IS 'Additional Tax (Ploynesie)';
+INSERT INTO public."parameter" (pr_id, pr_value)VALUES('MY_REPORT', 'N');
+insert into version (val,v_description) values (184,'Mantis #2128: Clôture 
comptabilité française');
+commit;
+
diff --git a/unit-test/create-dossier-test.sh b/unit-test/create-dossier-test.sh
index fb5a27541..b7dab135f 100755
--- a/unit-test/create-dossier-test.sh
+++ b/unit-test/create-dossier-test.sh
@@ -11,5 +11,5 @@ if  [ $? -ne 0 ] ; then
 fi
 
 createdb $DOSSIER_TEST
-psql -X  $DOSSIER_TEST  < db/$FILE_TEST
+psql $DOSSIER_TEST  < db/$FILE_TEST
 
diff --git a/unit-test/include/class/periode.Test.php 
b/unit-test/include/class/periodeTest.php
similarity index 70%
rename from unit-test/include/class/periode.Test.php
rename to unit-test/include/class/periodeTest.php
index 93b839293..41a92fbc9 100644
--- a/unit-test/include/class/periode.Test.php
+++ b/unit-test/include/class/periodeTest.php
@@ -129,18 +129,15 @@ class PeriodeTest extends TestCase
     public function dataUpdate()
     {
         return array(
-            [ '01.01.2023' , '31.01.2023','2020','2020.2023','NOK'],
             [ '01.01.2023' , '31.01.2023','2023','2020.2023','OK'],
-            [ '01.02.2023' , '28.02.2023','2020','2020.2023','NOK'],
             [ '01.02.2023' , '28.02.2023','2023','2020.2023','OK'],
-            [ '01.02.2023' , '28.01.2023','2023','2020.2023','NOK']
             );
     }
 
     /**
      * @brief test the trigger comptaproc.check_periode()
      * @testdox update - comptaproc.check_periode
-     * @dataProvider dataInsert
+     * @dataProvider dataUpdate
      * 
      * 
      */
@@ -184,4 +181,84 @@ class PeriodeTest extends TestCase
         }
         $g_connection->exec_sql("delete from parm_periode where p_exercice 
=$1",["2024-PHPUNIT"]);
     }
+
+
+    public function dataUpdateException()
+    {
+        return array(
+            [ '01.01.2023' , '31.01.2023','2020','2020.2023','NOK'],
+            [ '01.02.2023' , '28.02.2023','2020','2020.2023','NOK'],
+            [ '01.02.2023' , '28.01.2023','2023','2020.2023','NOK']
+        );
+    }
+
+    /**
+     * @brief test the trigger comptaproc.check_periode()
+     * @testdox update - comptaproc.check_periode
+     * @dataProvider dataUpdateException
+     *
+     *
+     */
+    public function 
testUpdateException($p_start,$p_end,$p_exercice,$p_exercice_label,$p_status)
+    {
+
+        global $g_connection;
+        /* insert the record to update */
+        $g_connection->exec_sql("delete from parm_periode where p_exercice 
=$1",["2024-PHPUNIT"]);
+        $obj=new Parm_periode_SQL($g_connection);
+        $obj->set('p_start','01.01.2024');
+        $obj->set('p_end','31.01.2024');
+        $obj->set('p_closed',false);
+        $obj->set('p_central',false);
+        $obj->set('p_exercice','2024');
+        $obj->set('p_exercice_label',"2024-PHPUNIT");
+        try {
+
+            $obj->insert();
+            $obj->set('p_start',$p_start);
+            $obj->set('p_end',$p_end);
+            $obj->set('p_closed',false);
+            $obj->set('p_central',false);
+            $obj->set('p_exercice',$p_exercice);
+            $obj->set('p_exercice_label',$p_exercice_label);
+            $obj->update();
+            if ($p_status== 'OK') {
+                $this->assertTrue(True,"Expected");
+            } else {
+                $this->assertTrue(FALSE,"Error");
+            }
+
+        } catch(Exception $e) {
+            if ($p_status == 'NOK') {
+                $this->assertTrue(True,"Expected");
+            } else {
+                $this->assertTrue(FALSE,"Error");
+                printf("message : %s",$e->getMessage());
+            }
+
+        }
+        $g_connection->exec_sql("delete from parm_periode where p_exercice 
=$1",["2024-PHPUNIT"]);
+    }
+
+    /**
+     * @testDox  Function get_first_date
+     * @return void
+     */
+    function testget_first_datet()
+    {
+        global $g_connection;
+        $periode=new Periode($g_connection);
+        $this->assertEquals('01.01.2017',$periode->get_first_date(),"First 
date is not correct");
+    }
+    /**
+     * @testDox  Function get_first_periode
+     * @return void
+     */
+    function Testget_first_periode()
+    {
+        global $g_connection;
+        $periode=new Periode($g_connection);
+        $this->assertEquals(122,$periode->get_first_periode(),"First periode 
is not correct");
+
+    }
 }
diff --git a/unit-test/test-file.sh b/unit-test/test-file.sh
index 2e431cf56..912101b76 100755
--- a/unit-test/test-file.sh
+++ b/unit-test/test-file.sh
@@ -16,8 +16,8 @@ FILETOTEST=""
 FUNCTION=""
 COVERAGE=""
 FOLDERTEST=""
-PHPINI="/opt/php/8.1/bin/php "
 #PHPINI="/usr/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]