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 '

'; 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 '

'.$nb." ".$scenario[$nb]['file']."

"; echo '

description = '.$scenario[$nb]["desc"].'

'; @@ -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 '

'.$script."

"; echo '

description = '.$description.'

'; 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 '
'; 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.= ''; + if ( $g_parameter->MY_REPORT == 'Y') { - $r.=''; -// filter on the current year - $w=new ISelect(); - $w->table=1; + $r.= '
'; - $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"); + $r.=''; + // filter on the current year + $w=new ISelect(); + $w->table=1; - $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"); + $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"); - $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.= ""; - $r.=""; - $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.=""; - $r.= '
'; - return $r; + $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.= ""; + $r.=""; + $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.=""; + $r.= ''; + 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.='

'; + $r.=_("Depuis")." ".$from_periode->input()." "._("jusque")." ".$to_periode->input(); + $r.='

'; + $mod=new ISelect(); + $mod->value=$this->db->make_array("select b_id, b_name from bilan order by b_name"); + $r.='

'; + $r.=_("Choix du bilan"); + $r.=$mod->input('b_id'); + $r.='

'; + 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 '

'._("Comptes normaux").'

'; $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 ''; - /* 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="/<<\\$[A-Z]*[0-9]*>>/"; $lt="<"; $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("<","",$f2_str); - $f2_value=str_replace(">","",$f2_value); - $f2_value=str_replace("$","",$f2_value); + $f2_value=noalyss_str_replace("<","",$f2_str); + $f2_value=noalyss_str_replace(">","",$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('<','<',$a); - $a=str_replace('>','>',$a); + $a=noalyss_str_replace('<','<',$a); + $a=noalyss_str_replace('>','>',$a); } } } @@ -457,15 +511,15 @@ class Acc_Bilan /* -- for libreOffice < 5 or openoffice -- */ $searched='office:value-type="string">'.$f2_str; $replaced='office:value-type="float" office:value="'.$a.'">'.$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">'.$f2_str; $replaced='office:value-type="float" office:value="'.$a.'" calcext:value-type="float">'.$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
"; // 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 ''; } } + + /** + * @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 tag and '; char $desc=$op['description']; - $desc=str_replace("", "", $desc); - $desc=str_replace("", "", $desc); - $desc=str_replace("", "", $desc); - $desc=str_replace("", "", $desc); + $desc=noalyss_str_replace("", "", $desc); + $desc=noalyss_str_replace("", "", $desc); + $desc=noalyss_str_replace("", "", $desc); + $desc=noalyss_str_replace("", "", $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; /* ', '='], "", $check); + $check=noalyss_str_replace(['<', '>', '<', '>', '='], "", $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::id(), $aModule['me_javascript']); + $js=noalyss_str_replace('', 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"';

Fonctionnement

- +
+ + + input() ?> +