From b4186b3ca057580bbee9f87706a0978553e353f9 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Tue, 11 May 2010 21:30:03 +0000 Subject: [PATCH] ereg is deprecated and must be replaced by preg_match the function which mimic ereg is myereg --- html/get_pj.php | 2 +- html/modify_op.php | 4 +- include/ac_common.php | 24 ++++++++- include/cbc_be.inc.php | 2 +- include/class_acc_bilan.php | 12 ++--- include/class_acc_ledger.php | 4 +- include/class_acc_ledger_purchase.php | 72 ++++++++++++++------------- include/class_acc_ledger_sold.php | 70 +++++++++++++------------- include/class_database.php | 2 +- include/class_document.php | 4 +- include/dexia.inc.php | 4 +- include/dexia_be.inc.php | 4 +- include/fortis_be.inc.php | 4 +- include/impress_inc.php | 10 ++-- include/ing_be.inc.php | 6 +-- include/jrn.php | 6 +-- 16 files changed, 128 insertions(+), 102 deletions(-) diff --git a/html/get_pj.php b/html/get_pj.php index 0d041e7ee..9d284b4d0 100644 --- a/html/get_pj.php +++ b/html/get_pj.php @@ -42,7 +42,7 @@ extract ($_GET); foreach (array('l','gDossier') as $a) { if ( ! isset (${$a}) ) { echo "error $a is not set "; exit();} } -if ( ereg('^[0-9]+$',$l) == false ) {exit();} +if ( myereg('^[0-9]+$',$l) == false ) {exit();} $cn=new Database(dossier::id()); $User=new User($cn); $User->Check(); diff --git a/html/modify_op.php b/html/modify_op.php index 27939aae0..be7748ae2 100644 --- a/html/modify_op.php +++ b/html/modify_op.php @@ -308,7 +308,7 @@ if ( isset($_POST['update_record']) ) { foreach( $array_jid as $row_ca) { echo_debug(__FILE__.':'.__LINE__,"array is ",$row_ca); - if ( ereg("^[6,7]+",$row_ca['j_poste'])) { + if ( myereg("^[6,7]+",$row_ca['j_poste'])) { echo_debug(__FILE__.':'.__LINE__,"count is ",$count); $op=new Anc_Operation($cn); $op->delete_by_jid($row_ca['j_id']); @@ -319,7 +319,7 @@ if ( isset($_POST['update_record']) ) { $op->oa_description=$_POST['comment']; $op->save_form_plan($_POST,$count); $count++; - } //if ereg + } //if myereg }//foreach }// if ( $own->MY_ANALYTIC != "nu" ) } catch (Exception $e) { diff --git a/include/ac_common.php b/include/ac_common.php index 7b486360c..b8f2f09f7 100644 --- a/include/ac_common.php +++ b/include/ac_common.php @@ -121,7 +121,7 @@ function isNumber(&$p_int) { function isDate ( $p_date) { if ( strlen (trim($p_date)) == 0 ) return null; - if (! ereg ("^[0-9]{1,2}\.[0-9]{1,2}\.20[0-9]{2}",$p_date) ) { + if (! myereg ("^[0-9]{1,2}\.[0-9]{1,2}\.20[0-9]{2}",$p_date) ) { return null; } else { @@ -527,4 +527,26 @@ function shrink_date ($p_date) { $str_date=substr($date,0,4).substr($date,6,2); return $str_date; } +/** + *@brief ereg is not supported from the version 5.3 and is marked as + *obsolete, this function will call preg_match and returns + * false is nothing is found or the length of the string found + *@param + *@param + *@return + *@see + */ +function myereg($p_pattern,$p_string,&$p_array=null) { + $version=phpversion(); + if ( substr($version,0,3) == '5.2' ) { + /* mimic old ereg */ + return ereg($p_pattern,$p_string,$p_array); + } else { + /* use the new preg_match */ + $p_pattern="/$p_pattern/"; + $a=preg_match($p_pattern,$p_string,$p_array); + if ( $a == 0 ) return false; + return true; + } +} ?> \ No newline at end of file diff --git a/include/cbc_be.inc.php b/include/cbc_be.inc.php index 1fa1d052e..727884629 100644 --- a/include/cbc_be.inc.php +++ b/include/cbc_be.inc.php @@ -54,7 +54,7 @@ while (($data = fgetcsv($handle, 2000,'@')) !== FALSE) { $devise=$row[1]; $compte_ordre=$row[0]; $detail=trim($row[7]).' '.trim($row[8]).' '.trim($row[9]).' '.trim($row[10]); - if ( ereg('[0-9]{3}-[0-9]{7}-[0-9]{2}',$row[7],$r) ) + if ( myereg('[0-9]{3}-[0-9]{7}-[0-9]{2}',$row[7],$r) ) { $compte_ordre=$r[0]; } diff --git a/include/class_acc_bilan.php b/include/class_acc_bilan.php index 41b294428..5565488a4 100644 --- a/include/class_acc_bilan.php +++ b/include/class_acc_bilan.php @@ -294,7 +294,7 @@ class Acc_Bilan { continue; // buffer contains a formula A$=.... // We need to eval it - //ereg("\\$[a-zA-Z]+[0-9]*=",$buffer,$e); + //myereg("\\$[a-zA-Z]+[0-9]*=",$buffer,$e); // echo $e[0]; //echo "
".$form; $a=ParseFormula($this->db,"$buffer",$buffer,$this->from,$this->to,false); @@ -354,7 +354,7 @@ class Acc_Bilan { // echo_debug(__FILE__.':'.__LINE__.'-','$line_rtf',$line_rtf); /* replace the header tag */ - while( ereg('<<header>>',$line_rtf,$head) == true ) { + while( myereg('<<header>>',$line_rtf,$head) == true ) { foreach ($head as $h) { // Create the header $line_rtf=str_replace($h,header_txt($this->db),$line_rtf); @@ -364,7 +364,7 @@ class Acc_Bilan { // echo_debug(__FILE__.':'.__LINE__.'- ','$r',$r); // the line contains the magic << $tmp=""; - while (ereg($regex,$line_rtf,$f2) == true) { + while (myereg($regex,$line_rtf,$f2) == true) { echo_debug(__FILE__.':'.__LINE__.'- ','Pattern found',$f2); // the f2 array contains all the magic << in the line @@ -407,7 +407,7 @@ class Acc_Bilan { $line_rtf=str_replace($f2_str,$a,$line_rtf); }// foreach end - } // while ereg + } // while myereg $r.=$line_rtf; }// odt file is read @@ -430,7 +430,7 @@ class Acc_Bilan { while ( !feof($p_file) ) { $line_rtf=fgets($p_file); echo_debug(__FILE__.':'.__LINE__.'-','$line_rtf',$line_rtf); - if ( ereg($lt.$lt.'header'.$gt.$gt,$line_rtf) ) { + if ( myereg($lt.$lt.'header'.$gt.$gt,$line_rtf) ) { // Create the header $line_rtf=str_replace($lt.$lt.'header'.$gt.$gt,header_txt($this->db),$line_rtf); $r.=$line_rtf; @@ -438,7 +438,7 @@ class Acc_Bilan { } echo_debug(__FILE__.':'.__LINE__.'- ','$r',$r); // the line contains the magic << - if (ereg($lt.$lt."\\$[a-zA-Z]*[0-9]*".$gt.$gt,$line_rtf,$f2) == true) { + if (myereg($lt.$lt."\\$[a-zA-Z]*[0-9]*".$gt.$gt,$line_rtf,$f2) == true) { // DEBUG // echo $r.'
'; echo_debug(__FILE__.':'.__LINE__.'- ','Pattern found',$f2); diff --git a/include/class_acc_ledger.php b/include/class_acc_ledger.php index 1e24e284e..9ed6dc59a 100644 --- a/include/class_acc_ledger.php +++ b/include/class_acc_ledger.php @@ -1199,7 +1199,7 @@ jr_comment||' ('||c_internal||')'||case when jr_pj_number is not null and jr_pj_ if ( $own->MY_ANALYTIC!='nu') // use of AA { - if ( ereg("^[6,7]+",$strPoste)) { + if ( myereg("^[6,7]+",$strPoste)) { // show form $op=new Anc_Operation($this->db); $null=($own->MY_ANALYTIC=='op')?1:0; @@ -1614,7 +1614,7 @@ jr_comment||' ('||c_internal||')'||case when jr_pj_number is not null and jr_pj_ $tot_cred+=($acc_op->type=='c')?$acc_op->amount:0; if ( $own->MY_ANALYTIC != "nu" ) { - if ( ereg("^[6,7]+",$poste)) { + if ( myereg("^[6,7]+",$poste)) { // for each item, insert into operation_analytique */ $op=new Anc_Operation($this->db); diff --git a/include/class_acc_ledger_purchase.php b/include/class_acc_ledger_purchase.php index e1f7d5b28..f842d85c5 100644 --- a/include/class_acc_ledger_purchase.php +++ b/include/class_acc_ledger_purchase.php @@ -158,19 +158,21 @@ class Acc_Ledger_Purchase extends Acc_Ledger { if ( isNumber(${'e_quant'.$i}) == 0 ) throw new Exception(_('La fiche ').${'e_march'.$i}._('a une quantité invalide').' ['.${'e_quant'.$i}.']',7); + $owner=new Own($this->db); // Check if the given tva id is valid - if ( isNumber(${'e_march'.$i.'_tva_id'}) == 0 ) + if ( $owner->MY_TVA=='Y') { + if (${'e_march'.$i.'_tva_id'} == 0 ) throw new Exception(_('La fiche ').${'e_march'.$i}._('a un code tva invalide').' ['.${'e_march'.$i.'_tva_id'}.']',13); $tva_rate=new Acc_Tva($this->db); $tva_rate->set_parameter('id',${'e_march'.$i.'_tva_id'}); if ( $tva_rate->load() != 0 ) throw new Exception(_('La fiche ').${'e_march'.$i}._('a un code tva invalide').' ['.${'e_march'.$i.'_tva_id'}.']',13); - - /* check if all card has a ATTR_DEF_ACCOUNT*/ - $fiche=new fiche($this->db); - $fiche->get_by_qcode(${'e_march'.$i}); - if ( $fiche->empty_attribute(ATTR_DEF_ACCOUNT) == true) + } + /* check if all card has a ATTR_DEF_ACCOUNT*/ + $fiche=new fiche($this->db); + $fiche->get_by_qcode(${'e_march'.$i}); + if ( $fiche->empty_attribute(ATTR_DEF_ACCOUNT) == true) throw new Exception(_('La fiche ').${'e_march'.$i}._('n\'a pas de poste comptable'),8); /* get the account and explode if necessary */ @@ -243,7 +245,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger { extract ($p_array); $this->verify($p_array) ; - $own=new own($this->db); + $owner=new own($this->db); $group=$this->db->get_next_seq("s_oa_group"); /* for analytic */ $seq=$this->db->get_next_seq('s_grpt'); $this->id=$p_jrn; @@ -292,7 +294,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger { $fiche->get_by_qcode(${"e_march".$i}); /* tva */ - if ($own->MY_TVA_USE=='Y') { + if ($owner->MY_TVA_USE=='Y') { $idx_tva=${'e_march'.$i.'_tva_id'}; $oTva=new Acc_Tva($this->db); $oTva->set_parameter('id',$idx_tva); @@ -304,7 +306,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger { $acc_amount=new Acc_Compute(); $acc_amount->check=false; $acc_amount->set_parameter('amount',$amount); - if ( $own->MY_TVA_USE=='Y') { + if ( $owner->MY_TVA_USE=='Y') { $acc_amount->set_parameter('amount_vat_rate',$oTva->get_parameter('rate')); if ( strlen(trim(${'e_march'.$i.'_tva_amount'})) ==0) { $acc_amount->compute_vat(); @@ -377,7 +379,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger { /* Compute sum vat */ - if ( $own->MY_TVA_USE=='Y') { + if ( $owner->MY_TVA_USE=='Y') { $tva_item=$acc_amount->amount_vat; if (isset($tva[$idx_tva] ) ) @@ -397,7 +399,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger { InsertStockGoods($this->db,$j_id,${'e_march'.$i},$nNeg*${'e_quant'.$i},'d') ; - if ( $own->MY_ANALYTIC != "nu" ) + if ( $owner->MY_ANALYTIC != "nu" ) { // for each item, insert into operation_analytique */ $op=new Anc_Operation($this->db); @@ -411,7 +413,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger { } // insert into quant_purchase //----- - if ( $own->MY_TVA_USE=='Y') { + if ( $owner->MY_TVA_USE=='Y') { $r=$this->db->exec_sql("select insert_quant_purchase ". "('".$internal."'". /* 1 */ ",".$j_id. /* 2 */ @@ -508,7 +510,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger { } - if ( $own->MY_TVA_USE=='Y') { + if ( $owner->MY_TVA_USE=='Y') { /* save all vat * $i contains the tva_id and value contains the vat amount */ @@ -680,8 +682,8 @@ class Acc_Ledger_Purchase extends Acc_Ledger { if ( $p_array != null ) extract($p_array); $user = new User($this->db); - $own=new Own($this->db); - $flag_tva=$own->MY_TVA_USE; + $owner=new Own($this->db); + $flag_tva=$owner->MY_TVA_USE; /* Add button */ $f_add_button=new IButton('add_card'); $f_add_button->label=_('Créer une nouvelle fiche'); @@ -757,7 +759,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger { //-- /* if we suggest the next pj, then we need a javascript */ $add_js=""; - if ( $own->MY_PJ_SUGGEST=='Y') { + if ( $owner->MY_PJ_SUGGEST=='Y') { $add_js="update_pj();"; } $wLedger=$this->select_ledger('ACH',2); @@ -781,7 +783,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger { //-- /* suggest PJ ? */ $default_pj=''; - if ( $own->MY_PJ_SUGGEST=='Y') { + if ( $owner->MY_PJ_SUGGEST=='Y') { $default_pj=$this->guess_pj(); } $pj=new IText(); @@ -859,7 +861,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger { $march=(isset(${"e_march$i"}))?${"e_march$i"}:""; $march_price=(isset(${"e_march".$i."_price"}))?${"e_march".$i."_price"}:""; /* use vat */ - if ( $own->MY_TVA_USE=='Y') { + if ( $owner->MY_TVA_USE=='Y') { $march_tva_id=(isset(${"e_march$i"."_tva_id"}))?${"e_march$i"."_tva_id"}:""; $march_tva_amount=(isset(${"e_march$i"."_tva_amount"}))?${"e_march$i"."_tva_amount"}:""; } @@ -874,7 +876,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger { $fMarch->get_by_qcode($march); $march_label=$fMarch->strAttribut(ATTR_DEF_NAME); /* vat use */ - if ( ! isset($march_tva_id) && $own->MY_TVA_USE=='Y' ) + if ( ! isset($march_tva_id) && $owner->MY_TVA_USE=='Y' ) $march_tva_id=$fMarch->strAttribut(ATTR_DEF_TVA); } // Show input @@ -906,11 +908,11 @@ class Acc_Ledger_Purchase extends Acc_Ledger { $array[$i]['hidden']=''; // For computing we need some hidden field for holding the value - if ( $own->MY_TVA_USE=='Y') { + if ( $owner->MY_TVA_USE=='Y') { $array[$i]['hidden'].=HtmlInput::hidden('tva_march'.$i,0); } - if ( $own->MY_TVA_USE=='Y') + if ( $owner->MY_TVA_USE=='Y') $tvac=new INum('tvac_march'.$i); else $tvac=new IHidden('tvac_march'.$i); @@ -936,7 +938,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger { $Price->size=9; $Price->javascript="onBlur='format_number(this);clean_tva($i);compute_ledger($i)'"; $array[$i]['pu']=$Price->input("e_march".$i."_price",$march_price); - if ( $own->MY_TVA_USE=='Y') { + if ( $owner->MY_TVA_USE=='Y') { // vat label //-- @@ -980,7 +982,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger { /* if we suggest the pj n# the run the script */ - if ( $own->MY_PJ_SUGGEST=='Y') { + if ( $owner->MY_PJ_SUGGEST=='Y') { $r.=''; } return $r; @@ -1008,7 +1010,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger { // to show a select list for the analytic // if analytic is op (optionnel) there is a blank line - $own = new Own($this->db); + $owner = new Own($this->db); bcscale(4); $client=new fiche($this->db); @@ -1051,7 +1053,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger { $r.=""._('Dénomination').""; $r.=""._('prix').""; /* vat use */ - if ( $own->MY_TVA_USE=='Y') { + if ( $owner->MY_TVA_USE=='Y') { $r.="tva"; $r.=""._('quantité').""; $r.=' '._('Montant TVA').''; @@ -1060,7 +1062,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger { $r.=""._('quantité').""; $r.=' '._('Total').""; } - $r.=($own->MY_ANALYTIC!='nu')?''._('Compt. Analytique').'':''; + $r.=($owner->MY_ANALYTIC!='nu')?''._('Compt. Analytique').'':''; $r.=''; $tot_amount=0.0; $tot_tva=0.0; @@ -1075,7 +1077,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger { $fiche->get_by_qcode(${"e_march".$i}); $fiche_name=h($fiche->getName()); - if ( $own->MY_TVA_USE=='Y') { + if ( $owner->MY_TVA_USE=='Y') { $idx_tva=${"e_march".$i."_tva_id"}; $oTva=new Acc_Tva($this->db); $oTva->set_parameter('id',$idx_tva); @@ -1083,7 +1085,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger { } $amount=bcmul(${"e_march".$i."_price"},${'e_quant'.$i}); - if ( $own->MY_TVA_USE=='Y') { + if ( $owner->MY_TVA_USE=='Y') { //----- if tva_amount is not given we compute the vat ---- if ( strlen (trim (${'e_march'.$i.'_tva_amount'})) == 0) { $op=new Acc_Compute(); @@ -1116,7 +1118,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger { $r.=''; $r.=${"e_quant".$i}; $r.=''; - if ($own->MY_TVA_USE == 'Y') { + if ($owner->MY_TVA_USE == 'Y') { $r.=''; $r.=$oTva->get_parameter('label'); $r.=''; @@ -1129,11 +1131,11 @@ class Acc_Ledger_Purchase extends Acc_Ledger { $r.=''; // encode the pa - if ( $own->MY_ANALYTIC!='nu') // use of AA + if ( $owner->MY_ANALYTIC!='nu') // use of AA { // show form $anc_op=new Anc_Operation($this->db); - $null=($own->MY_ANALYTIC=='op')?1:0; + $null=($owner->MY_ANALYTIC=='op')?1:0; $r.=''; $p_mode=1; $r.=$anc_op->display_form_plan($p_array,$null,$p_mode,$i,$amount); @@ -1147,7 +1149,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger { $r.=''; - if ( $own->MY_ANALYTIC!='nu') // use of AA + if ( $owner->MY_ANALYTIC!='nu') // use of AA $r.=''; $r.=''; @@ -1156,7 +1158,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger { $tot=round(bcadd($tot_amount,$tot_tva),2); $r.='
'; $r.='
'._('Total HTVA'); - if ($own->MY_TVA_USE=='Y') { + if ($owner->MY_TVA_USE=='Y') { foreach ($tva as $i=>$value) { $oTva->set_parameter('id',$i); $oTva->load(); @@ -1173,7 +1175,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger { $r.='
'; $r.='
'.$tot_amount.''; - if ( $own->MY_TVA_USE=='Y') { + if ( $owner->MY_TVA_USE=='Y') { foreach ($tva as $i=>$value) { $r.='
'.$tva[$i]; } @@ -1216,7 +1218,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger { for ($i=0;$i < $nb_item;$i++) { $r.=HtmlInput::hidden("e_march".$i,${"e_march".$i}); $r.=HtmlInput::hidden("e_march".$i."_price",${"e_march".$i."_price"}); - if ( $own->MY_TVA_USE=='Y' ) { + if ( $owner->MY_TVA_USE=='Y' ) { $r.=HtmlInput::hidden("e_march".$i."_tva_id",${"e_march".$i."_tva_id"}); $r.=HtmlInput::hidden('e_march'.$i.'_tva_amount', ${'e_march'.$i.'_tva_amount'}); } diff --git a/include/class_acc_ledger_sold.php b/include/class_acc_ledger_sold.php index ee21b659b..537ab6664 100644 --- a/include/class_acc_ledger_sold.php +++ b/include/class_acc_ledger_sold.php @@ -151,16 +151,18 @@ class Acc_Ledger_Sold extends Acc_Ledger { $fiche->get_by_qcode(${'e_march'.$i}); if ( $fiche->empty_attribute(ATTR_DEF_ACCOUNT) == true) throw new Exception(_('La fiche ').${'e_march'.$i}._('n\'a pas de poste comptable'),8); - + // Check if the given tva id is valid - if ( isNumber(${'e_march'.$i.'_tva_id'}) == 0 ) - throw new Exception(_('La fiche ').${'e_march'.$i}._('a un code tva invalide').' ['.${'e_march'.$i.'_tva_id'}.']',13); - $tva_rate=new Acc_Tva($this->db); - $tva_rate->set_parameter('id',${'e_march'.$i.'_tva_id'}); - - if ( $tva_rate->load() != 0 ) - throw new Exception(_('La fiche ').${'e_march'.$i}._('a un code tva invalide').' ['.${'e_march'.$i.'_tva_id'}.']',13); - + $owner=new Own($this->db); + if ( $owner->MY_TVA=='Y') { + if ( isNumber(${'e_march'.$i.'_tva_id'}) == 0 ) + throw new Exception(_('La fiche ').${'e_march'.$i}._('a un code tva invalide').' ['.${'e_march'.$i.'_tva_id'}.']',13); + $tva_rate=new Acc_Tva($this->db); + $tva_rate->set_parameter('id',${'e_march'.$i.'_tva_id'}); + + if ( $tva_rate->load() != 0 ) + throw new Exception(_('La fiche ').${'e_march'.$i}._('a un code tva invalide').' ['.${'e_march'.$i.'_tva_id'}.']',13); + } // if 2 accounts, take only the credit one /* The account exists */ $sposte=$fiche->strAttribut(ATTR_DEF_ACCOUNT); @@ -208,7 +210,7 @@ class Acc_Ledger_Sold extends Acc_Ledger { extract ($p_array); $this->verify($p_array) ; - $own=new own($this->db); + $owner=new own($this->db); $group=$this->db->get_next_seq("s_oa_group"); /* for analytic */ $seq=$this->db->get_next_seq('s_grpt'); $this->id=$p_jrn; @@ -276,7 +278,7 @@ class Acc_Ledger_Sold extends Acc_Ledger { $j_id=$acc_operation->insert_jrnx(); - if ($own->MY_TVA_USE == 'Y' ) { + if ($owner->MY_TVA_USE == 'Y' ) { /* Compute sum vat */ $oTva=new Acc_Tva($this->db); $idx_tva=${'e_march'.$i.'_tva_id'}; @@ -299,7 +301,7 @@ class Acc_Ledger_Sold extends Acc_Ledger { // what card need a stock management InsertStockGoods($this->db,$j_id,${'e_march'.$i},$nNeg*${'e_quant'.$i},'c') ; - if ( $own->MY_ANALYTIC != "nu" ) + if ( $owner->MY_ANALYTIC != "nu" ) { // for each item, insert into operation_analytique */ $op=new Anc_Operation($this->db); @@ -311,7 +313,7 @@ class Acc_Ledger_Sold extends Acc_Ledger { $op->oa_description=FormatString($e_comm); $op->save_form_plan($_POST,$i); } - if ( $own->MY_TVA_USE=='Y') { + if ( $owner->MY_TVA_USE=='Y') { /* save into quant_sold */ $r=$this->db->exec_sql("select insert_quant_sold ($1,$2,$3,$4,$5,$6,$7,$8)", array($internal, /* 1 */ @@ -334,7 +336,7 @@ class Acc_Ledger_Sold extends Acc_Ledger { null, $e_client)); - } // if ( $own->MY_TVA_USE=='Y') { + } // if ( $owner->MY_TVA_USE=='Y') { }// end loop : save all items /* save total customer */ @@ -354,9 +356,9 @@ class Acc_Ledger_Sold extends Acc_Ledger { /** save all vat * $i contains the tva_id and value contains the vat amount - * if if ($own->MY_TVA_USE == 'Y' ) + * if if ($owner->MY_TVA_USE == 'Y' ) */ - if ($own->MY_TVA_USE == 'Y' ) { + if ($owner->MY_TVA_USE == 'Y' ) { foreach ($tva as $i => $value) { $oTva=new Acc_Tva($this->db); $oTva->set_parameter('id',$i); @@ -378,7 +380,7 @@ class Acc_Ledger_Sold extends Acc_Ledger { } - } // if ($own->MY_TVA_USE=='Y') + } // if ($owner->MY_TVA_USE=='Y') /* insert into jrn */ $acc_operation=new Acc_Operation($this->db); $acc_operation->date=$e_date; @@ -528,7 +530,7 @@ class Acc_Ledger_Sold extends Acc_Ledger { // to show a select list for the analytic & VAT USE // if analytic is op (optionnel) there is a blank line - $own = new Own($this->db); + $owner = new Own($this->db); bcscale(4); $client=new fiche($this->db); @@ -574,11 +576,11 @@ class Acc_Ledger_Sold extends Acc_Ledger { $r.=""._('tva').""; - if ( $own->MY_TVA_USE=='Y') { + if ( $owner->MY_TVA_USE=='Y') { $r.=' '._('Montant TVA').''; $r.=''._('Montant HTVA').''; } - $r.=($own->MY_ANALYTIC!='nu')?''._('Compt. Analytique').'':''; + $r.=($owner->MY_ANALYTIC!='nu')?''._('Compt. Analytique').'':''; $r.=''; $tot_amount=0.0; $tot_tva=0.0; @@ -589,7 +591,7 @@ class Acc_Ledger_Sold extends Acc_Ledger { $fiche=new fiche($this->db); $fiche->get_by_qcode(${"e_march".$i}); $fiche_name=h($fiche->getName()); - if ( $own->MY_TVA_USE=='Y') { + if ( $owner->MY_TVA_USE=='Y') { $oTva=new Acc_Tva($this->db); $idx_tva=${"e_march".$i."_tva_id"}; @@ -599,7 +601,7 @@ class Acc_Ledger_Sold extends Acc_Ledger { $op=new Acc_Compute(); $amount=bcmul(${"e_march".$i."_price"},${'e_quant'.$i}); $op->set_parameter("amount",$amount); - if ( $own->MY_TVA_USE=='Y') { + if ( $owner->MY_TVA_USE=='Y') { $op->set_parameter('amount_vat_rate',$oTva->get_parameter('rate')); $op->compute_vat(); $tva_computed=$op->get_parameter('amount_vat'); @@ -625,7 +627,7 @@ class Acc_Ledger_Sold extends Acc_Ledger { $r.=''; $r.=${"e_quant".$i}; $r.=''; - if ( $own->MY_TVA_USE=='Y') { + if ( $owner->MY_TVA_USE=='Y') { $r.=''; $r.=$oTva->get_parameter('label'); $r.=''; @@ -641,11 +643,11 @@ class Acc_Ledger_Sold extends Acc_Ledger { $r.=''; // encode the pa - if ( $own->MY_ANALYTIC!='nu') // use of AA + if ( $owner->MY_ANALYTIC!='nu') // use of AA { // show form $anc_op=new Anc_Operation($this->db); - $null=($own->MY_ANALYTIC=='op')?1:0; + $null=($owner->MY_ANALYTIC=='op')?1:0; $r.=''; $p_mode=1; $r.=$anc_op->display_form_plan($p_array,$null,$p_mode,$i,$amount); @@ -659,7 +661,7 @@ class Acc_Ledger_Sold extends Acc_Ledger { $r.=''; - if ( $own->MY_ANALYTIC!='nu') // use of AA + if ( $owner->MY_ANALYTIC!='nu') // use of AA $r.=''; $r.=''; $r.=$this->extra_info(); @@ -670,7 +672,7 @@ class Acc_Ledger_Sold extends Acc_Ledger { $tot=round(bcadd($tot_amount,$tot_tva),2); $r.='
'; /* use VAT */ - if ($own->MY_TVA_USE == 'Y' ) { + if ($owner->MY_TVA_USE == 'Y' ) { $r.='
Total HTVA'; foreach ($tva as $i=>$value) { $oTva->set_parameter('id',$i); @@ -688,7 +690,7 @@ class Acc_Ledger_Sold extends Acc_Ledger { $r.='
'; $r.='
'.$tot_amount.''; - if ($own->MY_TVA_USE == 'Y' ) { + if ($owner->MY_TVA_USE == 'Y' ) { foreach ($tva as $i=>$value) { $r.='
'.$tva[$i]; } @@ -736,7 +738,7 @@ class Acc_Ledger_Sold extends Acc_Ledger { for ($i=0;$i < $nb_item;$i++) { $r.=HtmlInput::hidden("e_march".$i,${"e_march".$i}); $r.=HtmlInput::hidden("e_march".$i."_price",${"e_march".$i."_price"}); - if ( $own->MY_TVA_USE=='Y') { + if ( $owner->MY_TVA_USE=='Y') { $r.=HtmlInput::hidden("e_march".$i."_tva_id",${"e_march".$i."_tva_id"}); $r.=HtmlInput::hidden("e_march".$i."_tva_amount",${"e_march".$i."_tva_amount"}); } @@ -829,8 +831,8 @@ class Acc_Ledger_Sold extends Acc_Ledger { function input($p_array=null) { if ( $p_array != null ) extract($p_array); $user = new User($this->db); - $own=new Own($this->db); - $flag_tva=$own->MY_TVA_USE; + $owner=new Own($this->db); + $flag_tva=$owner->MY_TVA_USE; /* Add button */ $f_add_button=new IButton('add_card'); $f_add_button->label=_('Créer une nouvelle fiche'); @@ -898,7 +900,7 @@ class Acc_Ledger_Sold extends Acc_Ledger { } /* if we suggest the next pj, then we need a javascript */ $add_js=""; - if ( $own->MY_PJ_SUGGEST=='Y') { + if ( $owner->MY_PJ_SUGGEST=='Y') { $add_js="update_pj();"; } @@ -924,7 +926,7 @@ class Acc_Ledger_Sold extends Acc_Ledger { //-- /* suggest PJ ? */ $default_pj=''; - if ( $own->MY_PJ_SUGGEST=='Y') { + if ( $owner->MY_PJ_SUGGEST=='Y') { $default_pj=$this->guess_pj(); } @@ -1053,7 +1055,7 @@ class Acc_Ledger_Sold extends Acc_Ledger { $htva->value=0; $array[$i]['htva']=$htva->input(); - if ( $own->MY_TVA_USE=='Y') + if ( $owner->MY_TVA_USE=='Y') $tvac=new INum('tvac_march'.$i); else $tvac=new IHidden('tvac_march'.$i); diff --git a/include/class_database.php b/include/class_database.php index e16f23d06..90ff05869 100644 --- a/include/class_database.php +++ b/include/class_database.php @@ -80,7 +80,7 @@ de données"); } $this->db=$a; - if ($p_type == 'dos'||$p_type=='mod') + if ( $this->exist_schema('comptaproc') ) pg_exec($this->db,'set search_path to public,comptaproc;'); ob_end_clean(); } diff --git a/include/class_document.php b/include/class_document.php index a67315230..b72cae801 100644 --- a/include/class_document.php +++ b/include/class_document.php @@ -216,8 +216,8 @@ class Document // replace the tag $buffer=fgets($h); // search in the buffer the magic << and >> - // while ereg finds something to replace - while ( eregi ($regex,$buffer,$f) ) + // while myereg finds something to replace + while ( myeregi ($regex,$buffer,$f) ) { echo_debug(__FILE__,__LINE__,'Search for a regex'); echo_debug('class_document',__LINE__,'var_export '.var_export( $f,true)); diff --git a/include/dexia.inc.php b/include/dexia.inc.php index 457820d37..6c263090c 100644 --- a/include/dexia.inc.php +++ b/include/dexia.inc.php @@ -52,7 +52,7 @@ while (($data = fgetcsv($handle, 2000,'@')) !== FALSE) // Skipping all the lines whith a blank operation reference ('numéro extrait') if ( $row[2] == '' || - !(ereg('[0-9]{3}-[0-9]{7}-[0-9]{2}',$row[0],$r))) + !(myereg('[0-9]{3}-[0-9]{7}-[0-9]{2}',$row[0],$r))) { $LinesSkipped++; continue; @@ -61,7 +61,7 @@ while (($data = fgetcsv($handle, 2000,'@')) !== FALSE) // !! Disable check of doubles as all the unreferenced operations have hte smae //NULL' reference // Just use the following test : if ( - //!(ereg('[0-9]{3}-[0-9]{7}-[0-9]{2}',$row[0],$r))) + //!(myereg('[0-9]{3}-[0-9]{7}-[0-9]{2}',$row[0],$r))) // Parsing the remaining lines $num_compte=$row[3]; // Third party bank account diff --git a/include/dexia_be.inc.php b/include/dexia_be.inc.php index b0caea766..df56cd2e4 100644 --- a/include/dexia_be.inc.php +++ b/include/dexia_be.inc.php @@ -50,14 +50,14 @@ while (($data = fgetcsv($handle, 2000,'@')) !== FALSE) { // Skipping all the lines whith a blank operation reference ('numéro extrait') - if ( $row[2] == '' || !(ereg('[0-9]{3}-[0-9]{7}-[0-9]{2}',$row[0],$r))) + if ( $row[2] == '' || !(myereg('[0-9]{3}-[0-9]{7}-[0-9]{2}',$row[0],$r))) { $LinesSkipped++; continue; } // Alternative filter : import all the operations even without a reference // !! Disable check of doubles as all the unreferenced operations have hte smae 'NULL' reference - // Just use the following test : if ( !(ereg('[0-9]{3}-[0-9]{7}-[0-9]{2}',$row[0],$r))) + // Just use the following test : if ( !(myereg('[0-9]{3}-[0-9]{7}-[0-9]{2}',$row[0],$r))) // Parsing the remaining lines $num_compte=$row[3]; // Third party bank account diff --git a/include/fortis_be.inc.php b/include/fortis_be.inc.php index 494404178..ba698fa46 100644 --- a/include/fortis_be.inc.php +++ b/include/fortis_be.inc.php @@ -48,12 +48,12 @@ while (($data = fgetcsv($handle, 2000,'@')) !== FALSE) { $date_exec = str_replace(chr(34),"", $date_exec); // Si LTXXXXX ou LT XXXXX dans le détail - if ((ereg ("LT+([0-9]{5})", $detail, $regs)) || (ereg ("LT+[ ]+([0-9]{5})", $detail, $regs))) { + if ((myereg ("LT+([0-9]{5})", $detail, $regs)) || (myereg ("LT+[ ]+([0-9]{5})", $detail, $regs))) { $iduser = $regs[1]; } // Si 00000XXXXXXX - if (ereg ("[0-9]{12}", $detail, $regs)){ + if (myereg ("[0-9]{12}", $detail, $regs)){ if($regs[0] != "000000000000") { $id = substr($regs[0], 5, 5); $check = substr($regs[0], 10, 2); diff --git a/include/impress_inc.php b/include/impress_inc.php index 27019a9c1..75c39bbe1 100644 --- a/include/impress_inc.php +++ b/include/impress_inc.php @@ -230,7 +230,7 @@ function ParseFormula($p_cn,$p_label,$p_formula,$p_start,$p_end,$p_eval=true,$p_ $cond="( j_date >= to_date('$p_start','DD.MM.YYYY') and j_date <= to_date('$p_end','DD.MM.YYYY'))"; echo_debug(__FILE__,__LINE__,"receiving $p_formula"); include_once("class_acc_account_ledger.php"); - while (ereg("(\[[0-9]*%*D*C*S*\])",$p_formula,$e) == true) { + while (myereg("(\[[0-9]*%*D*C*S*\])",$p_formula,$e) == true) { // remove the [ ] $x=$e; @@ -252,7 +252,7 @@ echo_debug(__FILE__,__LINE__,"receiving $p_formula"); // If there is a FROM clause we must recompute // the time cond - if ($p_type_date == 0 && ereg ("FROM=[0-9]+\.[0-9]+", $p_formula,$afrom) == true ){ + if ($p_type_date == 0 && myereg ("FROM=[0-9]+\.[0-9]+", $p_formula,$afrom) == true ){ // There is a FROM clause // then we must modify the cond for the periode $from=str_replace("FROM=","",$afrom[0]); @@ -326,7 +326,7 @@ echo_debug(__FILE__,__LINE__,"p_formula = $p_formula "); eval("$p_formula"); - while (ereg("\[([0-9]+)([Tt]*)\]",trim($p_label),$e) == true) { + while (myereg("\[([0-9]+)([Tt]*)\]",trim($p_label),$e) == true) { $nom = "!!".$e[1]."!!"; if (CheckFormula($e[0])) { $nom = $p_cn->get_value ( "SELECT pcm_lib AS acct_name FROM tmp_pcmn WHERE pcm_val::text LIKE $1||'%' ORDER BY pcm_val ASC LIMIT 1",array($e[1])); @@ -354,7 +354,7 @@ echo_debug(__FILE__,__LINE__,"p_formula = $p_formula "); * \return true if the formula is good otherwise false */ function CheckFormula($p_string) { - // the ereg gets too complex if we want to add a test + // the myereg gets too complex if we want to add a test // for parenthesis, math function... // So I prefer remove them before testing $p_string=str_replace("round","",$p_string); @@ -378,7 +378,7 @@ function CheckFormula($p_string) { $p_string=str_replace("T","",$p_string); $p_string=str_replace("t","",$p_string); - if ( ereg ("^(\\$[a-zA-Z]*[0-9]*=){0,1}((\[{0,1}[0-9]+\.*[0-9]*%{0,1}\]{0,1})+ *([+-\*/])* *(\[{0,1}[0-9]+\.*[0-9]*%{0,1}\]{0,1})*)*(([+-\*/])*\\$([a-zA-Z])+[0-9]*([+-\*/])*)* *( *FROM=[0-9][0-0].20[0-9][0-9]){0,1}$",$p_string) == false) + if ( myereg ("^(\\$[a-zA-Z]*[0-9]*=){0,1}((\[{0,1}[0-9]+\.*[0-9]*%{0,1}\]{0,1})+ *([+-\*/])* *(\[{0,1}[0-9]+\.*[0-9]*%{0,1}\]{0,1})*)*(([+-\*/])*\\$([a-zA-Z])+[0-9]*([+-\*/])*)* *( *FROM=[0-9][0-0].20[0-9][0-9]){0,1}$",$p_string) == false) { return false; } else { diff --git a/include/ing_be.inc.php b/include/ing_be.inc.php index 536b0db66..bda1e39e0 100644 --- a/include/ing_be.inc.php +++ b/include/ing_be.inc.php @@ -48,17 +48,17 @@ while (($data = fgetcsv($handle, 2000,'@')) !== FALSE) { $date_exec = str_replace("\"", "", $date_exec); $date_valeur = str_replace("\"", "", $date_valeur); $montant = str_replace("\"", "", $montant); - if ((ereg ("([0-9]{3})-([0-9]{7})-([0-9]{2})", $num_compte, $regs))){ + if ((myereg ("([0-9]{3})-([0-9]{7})-([0-9]{2})", $num_compte, $regs))){ $num_compte = $regs[0]; } // Si LTXXXXX ou LT XXXXX dans le détail - if ((ereg ("LT+([0-9]{5})", $detail, $regs)) || (ereg ("LT+[ ]+([0-9]{5})", $detail, $regs))) { + if ((myereg ("LT+([0-9]{5})", $detail, $regs)) || (myereg ("LT+[ ]+([0-9]{5})", $detail, $regs))) { $iduser = $regs[1]; } // Si XXXXXXXXXXXX - if (ereg ("[0-9]{12}", $detail, $regs)){ + if (myereg ("[0-9]{12}", $detail, $regs)){ if($regs[0] != "000000000000") { $id = substr($regs[0], 2, 5); $longchiffre = substr($regs[0], 0, 10); diff --git a/include/jrn.php b/include/jrn.php index 09f166635..65c7b62c1 100644 --- a/include/jrn.php +++ b/include/jrn.php @@ -147,7 +147,7 @@ function ShowOperationExpert($p_cn,$p_jr_id,$p_mode=1) if ( $content['j_debit'] == 't' ) $r.=$col_vide; //-- add ca // - if ( $own->MY_ANALYTIC != "nu" && ereg("^[6,7]+",$content['j_poste'])) + if ( $own->MY_ANALYTIC != "nu" && myereg("^[6,7]+",$content['j_poste'])) { $r.=display_table_ca($p_cn,$count,$content['j_id'],$own,$p_mode,$content['j_montant']); @@ -405,7 +405,7 @@ function ShowOperationUser($p_cn,$p_jr_id,$p_mode=1) $content['j_poste']=$fiche->strAttribut(ATTR_DEF_ACCOUNT); // echo "j_poste= ".$content['j_poste']; - if ( $own->MY_ANALYTIC != "nu" && ereg("^[6,7]+",$content['j_poste'])) + if ( $own->MY_ANALYTIC != "nu" && myereg("^[6,7]+",$content['j_poste'])) { $r.=display_table_ca($p_cn,$i_march,$row->j_id,$own,$p_mode,round($tot_amount,2)); $i_march++; @@ -510,7 +510,7 @@ function ShowOperationUser($p_cn,$p_jr_id,$p_mode=1) echo_debug(__FILE__.':'.__LINE__,'$content["j_poste"]',$content['j_poste']); // echo "j_poste= ".$content['j_poste']; - if ( $own->MY_ANALYTIC != "nu" && ereg("^[6,7]+",$content['j_poste'])) + if ( $own->MY_ANALYTIC != "nu" && myereg("^[6,7]+",$content['j_poste'])) { echo_debug(__FILE__.':'.__LINE__,'showUser VEN $content',$content); echo_debug(__FILE__.':'.__LINE__,'showUser VEN $row ',$row);