From 6c3154abbd67d1a32b93bfbee7a4bf2d741698dd Mon Sep 17 00:00:00 2001 From: sparkyx Date: Fri, 1 Aug 2025 17:44:22 +0200 Subject: [PATCH] Code improvement : change fiche function getAttribut becomes load_attribute, strAttribut becomes set_attribute getAttribut becomes get_attribute --- include/XMLDocument/FacturX.php | 4 +- include/XMLDocument/InvoiceUBL21.php | 4 +- include/XMLDocument/XMLInvoice.php | 16 +-- include/ajax/ajax_follow_up.php | 4 +- include/ajax/ajax_history.php | 4 +- include/class/acc_ledger.class.php | 16 +-- include/class/acc_ledger_fin.class.php | 32 +++--- .../acc_ledger_history_generic.class.php | 2 +- include/class/acc_ledger_purchase.class.php | 64 +++++------ include/class/acc_ledger_sale.class.php | 34 +++--- include/class/acc_payment.class.php | 2 +- include/class/balance_age.class.php | 4 +- include/class/card_pdf.class.php | 8 +- include/class/card_property.class.php | 6 +- include/class/document.class.php | 44 ++++---- include/class/fiche.class.php | 86 +++++++-------- include/class/fiche_def.class.php | 10 +- include/class/follow_up.class.php | 10 +- include/class/pre_op_ach.class.php | 12 +-- include/class/pre_op_advanced.class.php | 2 +- include/class/pre_op_ven.class.php | 12 +-- include/class/stock_goods.class.php | 2 +- include/compta_fin_saldo.inc.php | 4 +- include/export/export_fiche_balance_csv.php | 14 +-- include/export/export_fiche_balance_pdf.php | 8 +- include/export/export_fiche_csv.php | 4 +- include/export/export_fiche_detail_pdf.php | 2 +- include/export/export_ledger_csv.php | 2 +- include/fiche.inc.php | 16 +-- include/impress_poste.inc.php | 2 +- include/lib/itva_popup.class.php | 4 +- include/template/contact-summary.php | 2 +- include/template/ledger_detail_ach.php | 8 +- include/template/ledger_detail_bottom.php | 2 +- include/template/ledger_detail_fin.php | 4 +- include/template/ledger_detail_misc.php | 2 +- include/template/ledger_detail_ven.php | 8 +- unit-test/include/Ajax/ajax_miscTest.php | 6 +- unit-test/include/class/DocumentTest.php | 13 ++- unit-test/include/class/Fiche_DefTest.php | 4 +- .../include/class/acc_ledger_purchaseTest.php | 8 +- unit-test/include/class/acc_letterTest.php | 4 +- unit-test/include/class/card_propertyTest.php | 28 ++--- unit-test/include/class/contactTest.php | 4 +- unit-test/include/class/ficheTest.php | 100 +++++++++--------- 45 files changed, 316 insertions(+), 311 deletions(-) diff --git a/include/XMLDocument/FacturX.php b/include/XMLDocument/FacturX.php index 8b5e5b9ff..48e68fa52 100644 --- a/include/XMLDocument/FacturX.php +++ b/include/XMLDocument/FacturX.php @@ -51,8 +51,8 @@ class FacturX extends XMLInvoice $customer=new \Fiche($this->cn,$result['customer']['card_id']); - $result['customer']['siren']=$customer->strAttribut(ATTR_DEF_SIREN); - $result['customer']['siret']=$customer->strAttribut(ATTR_DEF_SIRET); + $result['customer']['siren']=$customer->get_attribute(ATTR_DEF_SIREN); + $result['customer']['siret']=$customer->get_attribute(ATTR_DEF_SIRET); return $result; } /** diff --git a/include/XMLDocument/InvoiceUBL21.php b/include/XMLDocument/InvoiceUBL21.php index 8d3f5668f..af8edaf62 100644 --- a/include/XMLDocument/InvoiceUBL21.php +++ b/include/XMLDocument/InvoiceUBL21.php @@ -96,7 +96,7 @@ class InvoiceUBL21 extends XMLInvoice { ]; foreach ($a_needed as $item=>$value) { - if (\noalyss_trim($card->strAttribut($item))=="") { + if (\noalyss_trim($card->get_attribute($item))=="") { printf (_("ATTENTION donnée manquante dans la fiche client [%s]"),$value); } } @@ -414,7 +414,7 @@ class InvoiceUBL21 extends XMLInvoice { ->setAttribute("currencyID","EUR"); $item=$this->createElement("cac:Item"); $card=new \Fiche($this->cn,$row['card_id']); - $item->appendChild($this->createElement("cbc:Name", $card->strAttribut(ATTR_DEF_NAME))); + $item->appendChild($this->createElement("cbc:Name", $card->get_attribute(ATTR_DEF_NAME))); $classifiedTaxCat=$this->createElement("cac:ClassifiedTaxCategory"); ///@todo cbc:ID S = standard rate et que se passe-t'il pour l'autoliquidation ??? /// Il faut ajouter dans TVA_RATE , un code pour la TVA, diff --git a/include/XMLDocument/XMLInvoice.php b/include/XMLDocument/XMLInvoice.php index 9c8097930..60eab9f9d 100644 --- a/include/XMLDocument/XMLInvoice.php +++ b/include/XMLDocument/XMLInvoice.php @@ -183,20 +183,20 @@ abstract class XMLInvoice extends \DOMDocument $customer=new \Fiche($this->cn,$operation->det->array[0]['qs_client']); $result['customer']=array(); $result['customer']['card_id']=$operation->det->array[0]['qs_client']; - $result['customer']['name']=$customer->strAttribut(ATTR_DEF_NAME); - $result['customer']['street']=$customer->strAttribut(ATTR_DEF_ADRESS); - $result['customer']['postalzone']=$customer->strAttribut(ATTR_DEF_POSTCODE); - $result['customer']['city']=$customer->strAttribut(ATTR_DEF_CITY); + $result['customer']['name']=$customer->get_attribute(ATTR_DEF_NAME); + $result['customer']['street']=$customer->get_attribute(ATTR_DEF_ADRESS); + $result['customer']['postalzone']=$customer->get_attribute(ATTR_DEF_POSTCODE); + $result['customer']['city']=$customer->get_attribute(ATTR_DEF_CITY); // find country_code of this card - $result['customer']['country']=$customer->strAttribut(ATTR_DEF_COUNTRY); + $result['customer']['country']=$customer->get_attribute(ATTR_DEF_COUNTRY); - $result['customer']['customer_id']=str_replace([" ",".","-","/"],"" ,$customer->strAttribut(ATTR_DEF_NUMTVA)); + $result['customer']['customer_id']=str_replace([" ",".","-","/"],"" ,$customer->get_attribute(ATTR_DEF_NUMTVA)); // official name of the company - $result['customer']['registration_name']=$customer->strAttribut(ATTR_DEF_NAME); + $result['customer']['registration_name']=$customer->get_attribute(ATTR_DEF_NAME); // official ID , like VAT - $result['customer']['customer_id']=$customer->strAttribut(ATTR_DEF_NUMTVA); + $result['customer']['customer_id']=$customer->get_attribute(ATTR_DEF_NUMTVA); // +++TODO+++ adapt for all currency // currency must be EURO ! $result['currency']=$operation->det->currency_id; diff --git a/include/ajax/ajax_follow_up.php b/include/ajax/ajax_follow_up.php index bdb035952..5a2d9df3b 100644 --- a/include/ajax/ajax_follow_up.php +++ b/include/ajax/ajax_follow_up.php @@ -148,9 +148,9 @@ if ($op =="view_followup_card") { $div=$http->get("div"); $card=new Fiche($cn,$http->get("f_id","number")); - echo HtmlInput::title_box("Suivi ".h($card->strAttribut(ATTR_DEF_NAME)),$div); + echo HtmlInput::title_box("Suivi ".h($card->get_attribute(ATTR_DEF_NAME)),$div); - $query="where true=true ".Follow_Up::create_query($cn,["qcode"=>$card->strAttribut(ATTR_DEF_QUICKCODE), + $query="where true=true ".Follow_Up::create_query($cn,["qcode"=>$card->get_attribute(ATTR_DEF_QUICKCODE), 'closed_action'=>true]); $followup=new Follow_Up($cn); echo $followup->view_list($query,' limit 25'); diff --git a/include/ajax/ajax_history.php b/include/ajax/ajax_history.php index 51e2cdfb8..33c1af00d 100644 --- a/include/ajax/ajax_history.php +++ b/include/ajax/ajax_history.php @@ -110,8 +110,8 @@ if ( isset($_GET['f_id'])) ob_start(); require_once NOALYSS_TEMPLATE.'/history_top.php'; - $detail_card=HtmlInput::card_detail($fiche->strAttribut(ATTR_DEF_QUICKCODE),$fiche->getName()." ".$fiche->strAttribut(ATTR_DEF_FIRST_NAME,0)); - echo h2( $fiche->getName().'['.$fiche->strAttribut(ATTR_DEF_QUICKCODE).']',' class="title" '); + $detail_card=HtmlInput::card_detail($fiche->get_attribute(ATTR_DEF_QUICKCODE),$fiche->getName()." ".$fiche->get_attribute(ATTR_DEF_FIRST_NAME,0)); + echo h2( $fiche->getName().'['.$fiche->get_attribute(ATTR_DEF_QUICKCODE).']',' class="title" '); echo '

'.$detail_card.'

'; if ( $result ==-1){ diff --git a/include/class/acc_ledger.class.php b/include/class/acc_ledger.class.php index ad21b3054..426c012c5 100644 --- a/include/class/acc_ledger.class.php +++ b/include/class/acc_ledger.class.php @@ -802,10 +802,10 @@ class Acc_Ledger extends jrn_def_sql { $oqc=new Fiche($this->db); $oqc->get_by_qcode(${'qc_'.$i}, false); - $strPoste=$oqc->strAttribut(ATTR_DEF_ACCOUNT); + $strPoste=$oqc->get_attribute(ATTR_DEF_ACCOUNT); $ret.="". ${'qc_'.$i}.' - '. - $oqc->strAttribut(ATTR_DEF_NAME).HtmlInput::hidden('qc_'.$i, + $oqc->get_attribute(ATTR_DEF_NAME).HtmlInput::hidden('qc_'.$i, ${'qc_'.$i}). ''; } @@ -1119,7 +1119,7 @@ class Acc_Ledger extends jrn_def_sql { $Fiche=new Fiche($this->db); $Fiche->get_by_qcode($quick_code->value); - $label=$Fiche->strAttribut(ATTR_DEF_NAME); + $label=$Fiche->get_attribute(ATTR_DEF_NAME); } @@ -1338,7 +1338,7 @@ class Acc_Ledger extends jrn_def_sql if (noalyss_strlentrim(${'qc_'.$i})!=0&&isNumber(${'amount'.$i})==0) throw new Exception(_('Montant invalide'), 3); - $strPoste=$f->strAttribut(ATTR_DEF_ACCOUNT); + $strPoste=$f->get_attribute(ATTR_DEF_ACCOUNT); if ($strPoste=='') throw new Exception(sprintf(_("La fiche %s n'a pas de poste comptable"), ${"qc_".$i})); @@ -1372,8 +1372,8 @@ class Acc_Ledger extends jrn_def_sql for ($x=0; $x<$max; $x++) { $card=new Fiche($this->db, $card_id[$x]['f_id']); - $str_msg.=HtmlInput::card_detail($card->strAttribut(ATTR_DEF_QUICKCODE), - $card->strAttribut(ATTR_DEF_NAME), + $str_msg.=HtmlInput::card_detail($card->get_attribute(ATTR_DEF_QUICKCODE), + $card->get_attribute(ATTR_DEF_NAME), 'style="color:red;display:inline;text-decoration:underline"'); $str_msg.=" "; } @@ -1484,7 +1484,7 @@ class Acc_Ledger extends jrn_def_sql { $qc=new Fiche($this->db); $qc->get_by_qcode(${'qc_'.$i}, false); - $sposte=$qc->strAttribut(ATTR_DEF_ACCOUNT); + $sposte=$qc->get_attribute(ATTR_DEF_ACCOUNT); /* if there are 2 accounts take following the deb or cred */ if (strpos($sposte, ',')!=0) { @@ -2019,7 +2019,7 @@ class Acc_Ledger extends jrn_def_sql 20); } /* get the account and explode if necessary */ - $sposte=$empl->strAttribut(ATTR_DEF_ACCOUNT); + $sposte=$empl->get_attribute(ATTR_DEF_ACCOUNT); // if 2 accounts, take only the debit one for customer if (strpos($sposte, ',')!=0) { diff --git a/include/class/acc_ledger_fin.class.php b/include/class/acc_ledger_fin.class.php index 88a5e3d2c..0f7ce0b88 100644 --- a/include/class/acc_ledger_fin.class.php +++ b/include/class/acc_ledger_fin.class.php @@ -73,7 +73,7 @@ class Acc_Ledger_Fin extends Acc_Ledger throw new Exception("Ce journal n'a pas de compte en banque, allez dans paramètre->journal pour régler cela"); /* check if the accounting of the bank is correct */ $fBank=new Fiche($this->db, $bank_id); - $bank_accounting=$fBank->strAttribut(ATTR_DEF_ACCOUNT); + $bank_accounting=$fBank->get_attribute(ATTR_DEF_ACCOUNT); if (trim($bank_accounting)=='') throw new Exception('Le poste comptable du compte en banque de ce journal est invalide'); @@ -149,7 +149,7 @@ class Acc_Ledger_Fin extends Acc_Ledger if ($fiche->empty_attribute(ATTR_DEF_ACCOUNT)==true) throw new Exception('La fiche '.${'e_other'.$i}.'n\'a pas de poste comptable', 8); - $sposte=$fiche->strAttribut(ATTR_DEF_ACCOUNT); + $sposte=$fiche->get_attribute(ATTR_DEF_ACCOUNT); // if 2 accounts, take only the debit one for customer if (strpos($sposte, ',')!=0) { @@ -520,7 +520,7 @@ class Acc_Ledger_Fin extends Acc_Ledger $filter_year=" j_tech_per in (select p_id from parm_periode where p_exercice='".$exercice."')"; - $acc_account=new Acc_Account_Ledger($this->db, $fBank->strAttribut(ATTR_DEF_ACCOUNT)); + $acc_account=new Acc_Account_Ledger($this->db, $fBank->get_attribute(ATTR_DEF_ACCOUNT)); $asolde=$acc_account->get_solde_detail($filter_year); $deb=$asolde['debit']; $cred=$asolde['credit']; @@ -596,7 +596,7 @@ class Acc_Ledger_Fin extends Acc_Ledger $fTiers=new Fiche($this->db); $fTiers->get_by_qcode($tiers); - $tiers_label=$fTiers->strAttribut(ATTR_DEF_NAME); + $tiers_label=$fTiers->get_attribute(ATTR_DEF_NAME); $r.=""; if ($chdate==2) @@ -604,7 +604,7 @@ class Acc_Ledger_Fin extends Acc_Ledger $r.="".${'e_other'.$i}.""; // label $r.=''; - $r.=$fTiers->strAttribut(ATTR_DEF_NAME); + $r.=$fTiers->get_attribute(ATTR_DEF_NAME); $r.=''; // Comment $r.=''.$tiers_comment.''; @@ -624,7 +624,7 @@ class Acc_Ledger_Fin extends Acc_Ledger } $r.=''; // encode the pa - if ($g_parameter->MY_ANALYTIC!='nu'&&$g_parameter->match_analytic($fTiers->strAttribut(ATTR_DEF_ACCOUNT))==1) // use of AA + if ($g_parameter->MY_ANALYTIC!='nu'&&$g_parameter->match_analytic($fTiers->get_attribute(ATTR_DEF_ACCOUNT))==1) // use of AA { // show form $anc_op=new Anc_Operation($this->db); @@ -759,10 +759,10 @@ class Acc_Ledger_Fin extends Acc_Ledger // Debit = banque $bank_id=$this->get_bank(); $fBank=new Fiche($this->db, $bank_id); - $e_bank_account=$fBank->strAttribut(ATTR_DEF_QUICKCODE); + $e_bank_account=$fBank->get_attribute(ATTR_DEF_QUICKCODE); // Get the saldo $pPeriode=new Periode($this->db); - $sposte=$fBank->strAttribut(ATTR_DEF_ACCOUNT); + $sposte=$fBank->get_attribute(ATTR_DEF_ACCOUNT); // if 2 accounts, take only the debit one for customer if (strpos($sposte, ',')!=0) { @@ -869,7 +869,7 @@ class Acc_Ledger_Fin extends Acc_Ledger $acc_operation=new Acc_Operation($this->db); $acc_operation->date=$e_date; - $sposte=$fPoste->strAttribut(ATTR_DEF_ACCOUNT); + $sposte=$fPoste->get_attribute(ATTR_DEF_ACCOUNT); // if 2 accounts if (strpos($sposte, ',')!=0) { @@ -912,7 +912,7 @@ class Acc_Ledger_Fin extends Acc_Ledger $acc_operation=new Acc_Operation($this->db); $acc_operation->date=$e_date; - $sposte=$fBank->strAttribut(ATTR_DEF_ACCOUNT); + $sposte=$fBank->get_attribute(ATTR_DEF_ACCOUNT); // if 2 accounts, use the first one if DEB otherwise the second one if (strpos($sposte, ',')!=0) @@ -948,8 +948,8 @@ class Acc_Ledger_Fin extends Acc_Ledger if (sql_string(${"e_other$i"."_comment"})==null) { // if comment is blank set a default one - $comment=sprintf(_(" compte : %s a %s "), $fBank->strAttribut(ATTR_DEF_NAME), - $fPoste->strAttribut(ATTR_DEF_NAME) + $comment=sprintf(_(" compte : %s a %s "), $fBank->get_attribute(ATTR_DEF_NAME), + $fPoste->get_attribute(ATTR_DEF_NAME) ); } else @@ -1067,7 +1067,7 @@ class Acc_Ledger_Fin extends Acc_Ledger $row=td($e_date) .td($js_detail) .td(${"e_other$i"}) - .td($fPoste->strAttribut(ATTR_DEF_NAME)) + .td($fPoste->get_attribute(ATTR_DEF_NAME)) .td(${"e_other".$i."_comment"}) .td(nbm(${"e_other$i"."_amount"}), 'class="num"'); $class=($i%2==0)?' class="even" ':' class="odd" '; @@ -1132,9 +1132,9 @@ class Acc_Ledger_Fin extends Acc_Ledger { $this->bank_id=$this->db->get_value('select jrn_def_bank from jrn_def where jrn_def_id=$1', array($this->id)); $fBank=new Fiche($this->db, $this->bank_id); - $e_bank_account=" : ".$fBank->strAttribut(ATTR_DEF_BQ_NO); - $e_bank_name=" : ".$fBank->strAttribut(ATTR_DEF_NAME); - $e_bank_qcode=": ".$fBank->strAttribut(ATTR_DEF_QUICKCODE); + $e_bank_account=" : ".$fBank->get_attribute(ATTR_DEF_BQ_NO); + $e_bank_name=" : ".$fBank->get_attribute(ATTR_DEF_NAME); + $e_bank_qcode=": ".$fBank->get_attribute(ATTR_DEF_QUICKCODE); return $e_bank_qcode.$e_bank_name.$e_bank_account; } diff --git a/include/class/acc_ledger_history_generic.class.php b/include/class/acc_ledger_history_generic.class.php index 53f5bcf2d..6dbe37ad0 100644 --- a/include/class/acc_ledger_history_generic.class.php +++ b/include/class/acc_ledger_history_generic.class.php @@ -562,7 +562,7 @@ class Acc_Ledger_History_Generic extends Acc_Ledger_History $fiche=new Fiche($this->db); if ($fiche->get_by_qcode($line['j_qcode'], false)==0) { - $line['description']=$fiche->strAttribut(ATTR_DEF_NAME); + $line['description']=$fiche->get_attribute(ATTR_DEF_NAME); } } if ($case!=$line['grp']) diff --git a/include/class/acc_ledger_purchase.class.php b/include/class/acc_ledger_purchase.class.php index 12584484c..8690df2e0 100644 --- a/include/class/acc_ledger_purchase.class.php +++ b/include/class/acc_ledger_purchase.class.php @@ -125,7 +125,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger /* get the account and explode if necessary */ - $sposte=$fiche->strAttribut(ATTR_DEF_ACCOUNT); + $sposte=$fiche->get_attribute(ATTR_DEF_ACCOUNT); // if 2 accounts, take only the credit one for supplier if ( strpos($sposte,',') != 0 ) { @@ -202,7 +202,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger throw new Exception(_('La fiche ').${'e_march'.$i}._('n\'a pas de poste comptable'),8); /* get the account and explode if necessary */ - $sposte=$fiche->strAttribut(ATTR_DEF_ACCOUNT); + $sposte=$fiche->get_attribute(ATTR_DEF_ACCOUNT); // if 2 accounts, take only the debit if ( strpos($sposte,',') != 0 ) { @@ -246,7 +246,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger } if ( ! $fiche->empty_attribute($key[0]) && ! $fiche->empty_attribute($key[2])) { - $nd_str=$fiche->strAttribut($key[2]); + $nd_str=$fiche->get_attribute($key[2]); if ( $nd_str != '') { $poste_nd=new Acc_Account_Ledger($this->db,$nd_str); @@ -305,23 +305,23 @@ class Acc_Ledger_Purchase extends Acc_Ledger { if (!$p_fiche->empty_attribute(ATTR_DEF_DEPENSE_NON_DEDUCTIBLE)) { - $p_nd_amount->amount_nd_rate = $p_fiche->strAttribut(ATTR_DEF_DEPENSE_NON_DEDUCTIBLE); + $p_nd_amount->amount_nd_rate = $p_fiche->get_attribute(ATTR_DEF_DEPENSE_NON_DEDUCTIBLE); $p_nd_amount->compute_nd(); } if (!$p_fiche->empty_attribute(ATTR_DEF_TVA_NON_DEDUCTIBLE) ) { - $p_nd_amount->nd_vat_rate = $p_fiche->strAttribut(ATTR_DEF_TVA_NON_DEDUCTIBLE); + $p_nd_amount->nd_vat_rate = $p_fiche->get_attribute(ATTR_DEF_TVA_NON_DEDUCTIBLE); $p_nd_amount->compute_nd_vat(); } if (!$p_fiche->empty_attribute(ATTR_DEF_TVA_NON_DEDUCTIBLE_RECUP) ) { - $p_nd_amount->nd_ded_vat_rate = $p_fiche->strAttribut(ATTR_DEF_TVA_NON_DEDUCTIBLE_RECUP); + $p_nd_amount->nd_ded_vat_rate = $p_fiche->get_attribute(ATTR_DEF_TVA_NON_DEDUCTIBLE_RECUP); $p_nd_amount->compute_ndded_vat(); } if (!$p_fiche->empty_attribute(ATTR_DEF_DEP_PRIV)) { - $p_nd_amount->amount_perso_rate = $p_fiche->strAttribut(ATTR_DEF_DEP_PRIV); + $p_nd_amount->amount_perso_rate = $p_fiche->get_attribute(ATTR_DEF_DEP_PRIV); $p_nd_amount->compute_perso(); } @@ -357,7 +357,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger /* save op. */ if (!$p_fiche->empty_attribute(ATTR_DEF_ACCOUNT_ND)) { - $dna = $p_fiche->strAttribut(ATTR_DEF_ACCOUNT_ND); + $dna = $p_fiche->get_attribute(ATTR_DEF_ACCOUNT_ND); } else { $dna = $dna_default->p_value; @@ -368,7 +368,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger $p_acc_operation->amount = $p_nd_amount->amount_nd; $p_acc_operation->poste = $dna; $p_acc_operation->qcode = ''; - $p_acc_operation->desc=$this->find_label($dna)." ND ".$p_fiche->strAttribut(ATTR_DEF_QUICKCODE); + $p_acc_operation->desc=$this->find_label($dna)." ND ".$p_fiche->get_attribute(ATTR_DEF_QUICKCODE); if ($p_nd_amount->amount_nd > 0) $p_tot_debit = bcadd($p_tot_debit, $p_nd_amount->amount_nd ); $j_id = $p_acc_operation->insert_jrnx(); @@ -384,7 +384,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger $p_acc_operation->type = 'd'; if (!$p_fiche->empty_attribute(ATTR_DEF_ACCOUNT_ND_PERSO)) { - $dna = $p_fiche->strAttribut(ATTR_DEF_ACCOUNT_ND_PERSO); + $dna = $p_fiche->get_attribute(ATTR_DEF_ACCOUNT_ND_PERSO); } else { $dna = $dna_default->p_value; @@ -394,7 +394,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger $p_acc_operation->amount = $p_nd_amount->amount_perso ; $p_acc_operation->poste = $dna; $p_acc_operation->qcode = ''; - $p_acc_operation->desc=$this->find_label($dna)." ND_PRIV ".$p_fiche->strAttribut(ATTR_DEF_QUICKCODE); + $p_acc_operation->desc=$this->find_label($dna)." ND_PRIV ".$p_fiche->get_attribute(ATTR_DEF_QUICKCODE); if ($p_nd_amount->amount_perso> 0) $p_tot_debit = bcadd($p_tot_debit, $p_nd_amount->amount_perso); $j_id = $p_acc_operation->insert_jrnx(); @@ -408,7 +408,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger $p_acc_operation->qcode = ''; if (!$p_fiche->empty_attribute(ATTR_DEF_ACCOUNT_ND_TVA_ND) ) { - $dna = $p_fiche->strAttribut(ATTR_DEF_ACCOUNT_ND_TVA_ND); + $dna = $p_fiche->get_attribute(ATTR_DEF_ACCOUNT_ND_TVA_ND); } else { $dna = $dna_default->p_value; @@ -417,10 +417,10 @@ class Acc_Ledger_Purchase extends Acc_Ledger $p_acc_operation->amount = $p_nd_amount->nd_vat; $p_acc_operation->poste = $dna; - $p_acc_operation->desc=$this->find_label($dna)." ND_TVA ".$p_fiche->strAttribut(ATTR_DEF_QUICKCODE); + $p_acc_operation->desc=$this->find_label($dna)." ND_TVA ".$p_fiche->get_attribute(ATTR_DEF_QUICKCODE); $j_id = $p_acc_operation->insert_jrnx(); if ( $g_parameter->MY_ANALYTIC != "nu" - && $g_parameter->match_analytic($p_fiche->strAttribut(ATTR_DEF_ACCOUNT)) + && $g_parameter->match_analytic($p_fiche->get_attribute(ATTR_DEF_ACCOUNT)) ) { $op=new Anc_Operation($this->db); @@ -443,7 +443,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger /* save op. */ if (!$p_fiche->empty_attribute(ATTR_DEF_ACCOUNT_ND_TVA) ) { - $dna = $p_fiche->strAttribut(ATTR_DEF_ACCOUNT_ND_TVA); + $dna = $p_fiche->get_attribute(ATTR_DEF_ACCOUNT_ND_TVA); } else { $dna = $dna_default->p_value; @@ -456,12 +456,12 @@ class Acc_Ledger_Purchase extends Acc_Ledger $p_acc_operation->qcode = ''; $p_acc_operation->amount = $p_nd_amount->nd_ded_vat; $p_acc_operation->poste = $dna; - $p_acc_operation->desc=$this->find_label($dna)." DED_TVA ".$p_fiche->strAttribut(ATTR_DEF_QUICKCODE); + $p_acc_operation->desc=$this->find_label($dna)." DED_TVA ".$p_fiche->get_attribute(ATTR_DEF_QUICKCODE); if ($p_nd_amount->nd_ded_vat > 0) $p_tot_debit = bcadd($p_tot_debit, $p_nd_amount->nd_ded_vat); $j_id = $p_acc_operation->insert_jrnx(); if ( $g_parameter->MY_ANALYTIC != "nu" - && $g_parameter->match_analytic($p_fiche->strAttribut(ATTR_DEF_ACCOUNT)) + && $g_parameter->match_analytic($p_fiche->get_attribute(ATTR_DEF_ACCOUNT)) ) { $op=new Anc_Operation($this->db); @@ -530,7 +530,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger $cust=new Fiche($this->db); $cust->get_by_qcode($e_client); - $sposte=$cust->strAttribut(ATTR_DEF_ACCOUNT); + $sposte=$cust->get_attribute(ATTR_DEF_ACCOUNT); // if 2 accounts, take only the credit Supplier if ( strpos($sposte,',') != 0 ) { @@ -665,7 +665,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger $tot_amount=round(bcadd($tot_amount,$acc_amount->amount_perso),2); /* get the account and explode if necessary */ - $sposte=$fiche->strAttribut(ATTR_DEF_ACCOUNT); + $sposte=$fiche->get_attribute(ATTR_DEF_ACCOUNT); // if 2 accounts, take only the debit one for customer if ( strpos($sposte,',') != 0 ) { @@ -1008,7 +1008,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger if ( $acjrn->get_type()=='FIN') { $acjrn=new Acc_Ledger_Fin($this->db, $mp->get_parameter('ledger_target')); $acfiche=new Fiche($this->db,$acjrn->get_bank()); - $fqcode=$acfiche->strAttribut(ATTR_DEF_QUICKCODE); + $fqcode=$acfiche->get_attribute(ATTR_DEF_QUICKCODE); } else { $fqcode = ${'e_mp_qcode_' . $e_mp}; $acfiche = new Fiche($this->db); @@ -1019,7 +1019,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger $acc_pay->date=$e_date; /* get the account and explode if necessary */ - $sposte=$acfiche->strAttribut(ATTR_DEF_ACCOUNT); + $sposte=$acfiche->get_attribute(ATTR_DEF_ACCOUNT); // if 2 accounts, take only the debit one for customer if ( strpos($sposte,',') != 0 ) { @@ -1333,10 +1333,10 @@ class Acc_Ledger_Purchase extends Acc_Ledger { $fClient=new Fiche($this->db); $fClient->get_by_qcode($e_client); - $e_client_label=$fClient->strAttribut(ATTR_DEF_NAME).' '. - ' Adresse : '.$fClient->strAttribut(ATTR_DEF_ADRESS).' '. - $fClient->strAttribut(ATTR_DEF_POSTCODE).' '. - $fClient->strAttribut(ATTR_DEF_CITY).' '; + $e_client_label=$fClient->get_attribute(ATTR_DEF_NAME).' '. + ' Adresse : '.$fClient->get_attribute(ATTR_DEF_ADRESS).' '. + $fClient->get_attribute(ATTR_DEF_POSTCODE).' '. + $fClient->get_attribute(ATTR_DEF_CITY).' '; } @@ -1402,10 +1402,10 @@ class Acc_Ledger_Purchase extends Acc_Ledger { $fMarch=new Fiche($this->db); $fMarch->get_by_qcode($march); - $march_label=$fMarch->strAttribut(ATTR_DEF_NAME); + $march_label=$fMarch->get_attribute(ATTR_DEF_NAME); /* vat use */ if ( ! isset($march_tva_id) && $g_parameter->MY_TVA_USE=='Y' ) - $march_tva_id=$fMarch->strAttribut(ATTR_DEF_TVA); + $march_tva_id=$fMarch->get_attribute(ATTR_DEF_TVA); } // Show input //-- @@ -1589,9 +1589,9 @@ class Acc_Ledger_Purchase extends Acc_Ledger $client->get_by_qcode($e_client,true); $client_name=h($client->getName(). - ' '.$client->strAttribut(ATTR_DEF_ADRESS).' '. - $client->strAttribut(ATTR_DEF_POSTCODE).' '. - $client->strAttribut(ATTR_DEF_CITY)); + ' '.$client->get_attribute(ATTR_DEF_ADRESS).' '. + $client->get_attribute(ATTR_DEF_POSTCODE).' '. + $client->get_attribute(ATTR_DEF_CITY)); $lPeriode=new Periode($this->db); if ($this->check_periode() == true) { @@ -1713,7 +1713,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger if ( $g_parameter->MY_UPDLAB=='Y') $fiche_name=h(${"e_march".$i."_label"}); else - $fiche_name=$fiche->strAttribut (ATTR_DEF_NAME); + $fiche_name=$fiche->get_attribute (ATTR_DEF_NAME); $amount=bcmul(${"e_march".$i."_price"},${'e_quant'.$i}); if ( $g_parameter->MY_TVA_USE=='Y') { @@ -1794,7 +1794,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger $r.=''; // encode the pa if ( $g_parameter->MY_ANALYTIC!='nu' - && $g_parameter->match_analytic($fiche->strAttribut(ATTR_DEF_ACCOUNT))==TRUE + && $g_parameter->match_analytic($fiche->get_attribute(ATTR_DEF_ACCOUNT))==TRUE ) // use of AA { // show form diff --git a/include/class/acc_ledger_sale.class.php b/include/class/acc_ledger_sale.class.php index e013f960f..2f832ef26 100644 --- a/include/class/acc_ledger_sale.class.php +++ b/include/class/acc_ledger_sale.class.php @@ -118,7 +118,7 @@ class Acc_Ledger_Sale extends Acc_Ledger { /* get the account and explode if necessary */ - $sposte = $fiche->strAttribut(ATTR_DEF_ACCOUNT); + $sposte = $fiche->get_attribute(ATTR_DEF_ACCOUNT); // if 2 accounts, take only the debit one for customer if (strpos($sposte, ',') != 0) { $array = explode(',', $sposte); @@ -184,7 +184,7 @@ class Acc_Ledger_Sale extends Acc_Ledger { } // if 2 accounts, take only the credit one /* The account exists */ - $sposte = $fiche->strAttribut(ATTR_DEF_ACCOUNT); + $sposte = $fiche->get_attribute(ATTR_DEF_ACCOUNT); if (strpos($sposte, ',') != 0) { $array = explode(',', $sposte); @@ -287,7 +287,7 @@ class Acc_Ledger_Sale extends Acc_Ledger { $cust = new Fiche($this->db); $cust->get_by_qcode($e_client); - $sposte = $cust->strAttribut(ATTR_DEF_ACCOUNT); + $sposte = $cust->get_attribute(ATTR_DEF_ACCOUNT); // if 2 accounts, take only the debit one for the customer // @@ -337,7 +337,7 @@ class Acc_Ledger_Sale extends Acc_Ledger { $tot_amount = round($tot_amount, 2); $acc_operation = new Acc_Operation($this->db); $acc_operation->date = $e_date; - $sposte = $fiche->strAttribut(ATTR_DEF_ACCOUNT); + $sposte = $fiche->get_attribute(ATTR_DEF_ACCOUNT); // if 2 accounts, take only the credit one if (strpos($sposte, ',') != 0) { @@ -734,7 +734,7 @@ class Acc_Ledger_Sale extends Acc_Ledger { if ( $acjrn->get_type()=='FIN') { $acjrn=new Acc_Ledger_Fin($this->db, $mp->get_parameter('ledger_target')); $acfiche=new Fiche($this->db,$acjrn->get_bank()); - $fqcode=$acfiche->strAttribut(ATTR_DEF_QUICKCODE); + $fqcode=$acfiche->get_attribute(ATTR_DEF_QUICKCODE); } else { $fqcode = ${'e_mp_qcode_' . $e_mp}; $acfiche = new Fiche($this->db); @@ -745,7 +745,7 @@ class Acc_Ledger_Sale extends Acc_Ledger { $acc_pay = new Acc_Operation($this->db); $acc_pay->date = $pay_date; /* get the account and explode if necessary */ - $sposte = $acfiche->strAttribut(ATTR_DEF_ACCOUNT); + $sposte = $acfiche->get_attribute(ATTR_DEF_ACCOUNT); // if 2 accounts, take only the debit one for customer if (strpos($sposte, ',') != 0) { $array = explode(',', $sposte); @@ -892,9 +892,9 @@ class Acc_Ledger_Sale extends Acc_Ledger { $client->get_by_qcode($e_client, true); $client_name = $client->getName() . - ' ' . $client->strAttribut(ATTR_DEF_ADRESS) . ' ' . - $client->strAttribut(ATTR_DEF_POSTCODE) . ' ' . - $client->strAttribut(ATTR_DEF_CITY); + ' ' . $client->get_attribute(ATTR_DEF_ADRESS) . ' ' . + $client->get_attribute(ATTR_DEF_POSTCODE) . ' ' . + $client->get_attribute(ATTR_DEF_CITY); $lPeriode = new Periode($this->db); if ($this->check_periode() == true) { $lPeriode->p_id = $period; @@ -1004,7 +1004,7 @@ class Acc_Ledger_Sale extends Acc_Ledger { if ($g_parameter->MY_UPDLAB == 'Y') $fiche_name = h(${"e_march" . $i . "_label"}); else - $fiche_name = $fiche->strAttribut(ATTR_DEF_NAME); + $fiche_name = $fiche->get_attribute(ATTR_DEF_NAME); if ($g_parameter->MY_TVA_USE == 'Y') { $idx_tva = ${"e_march" . $i . "_tva_id"}; $oTva = Acc_Tva::build($this->db,$idx_tva); @@ -1069,7 +1069,7 @@ class Acc_Ledger_Sale extends Acc_Ledger { } // encode the pa if ($g_parameter->MY_ANALYTIC != 'nu' - && $g_parameter->match_analytic($fiche->strAttribut(ATTR_DEF_ACCOUNT))==TRUE) { // use of AA + && $g_parameter->match_analytic($fiche->get_attribute(ATTR_DEF_ACCOUNT))==TRUE) { // use of AA // show form $anc_op = new Anc_Operation($this->db); $null = ($g_parameter->MY_ANALYTIC == 'op') ? 1 : 0; @@ -1478,10 +1478,10 @@ EOF; if (noalyss_strlentrim($e_client) != 0) { $fClient = new Fiche($this->db); $fClient->get_by_qcode($e_client); - $e_client_label = $fClient->strAttribut(ATTR_DEF_NAME) . ' ' . - ' Adresse : ' . $fClient->strAttribut(ATTR_DEF_ADRESS) . ' ' . - $fClient->strAttribut(ATTR_DEF_POSTCODE) . ' ' . - $fClient->strAttribut(ATTR_DEF_CITY) . ' '; + $e_client_label = $fClient->get_attribute(ATTR_DEF_NAME) . ' ' . + ' Adresse : ' . $fClient->get_attribute(ATTR_DEF_ADRESS) . ' ' . + $fClient->get_attribute(ATTR_DEF_POSTCODE) . ' ' . + $fClient->get_attribute(ATTR_DEF_CITY) . ' '; } $W1 = new ICard(); @@ -1536,10 +1536,10 @@ EOF; if (noalyss_strlentrim($march) != 0 && noalyss_strlentrim($march_label) == 0) { $fMarch = new Fiche($this->db); $fMarch->get_by_qcode($march); - $march_label = $fMarch->strAttribut(ATTR_DEF_NAME); + $march_label = $fMarch->get_attribute(ATTR_DEF_NAME); if ($flag_tva == 'Y') { if (!(isset(${"e_march$i" . "_tva_id"}))) - $march_tva_id = $fMarch->strAttribut(ATTR_DEF_TVA); + $march_tva_id = $fMarch->get_attribute(ATTR_DEF_TVA); } } // Show input diff --git a/include/class/acc_payment.class.php b/include/class/acc_payment.class.php index 8b3fa5420..1ad573c38 100644 --- a/include/class/acc_payment.class.php +++ b/include/class/acc_payment.class.php @@ -275,7 +275,7 @@ class Acc_Payment $fiche->get_by_qcode($row->mp_qcode); $f=HtmlInput::hidden('e_mp_qcode_'.$row->mp_id,$row->mp_qcode); - // $f.=$fiche->strAttribut(ATTR_DEF_NAME); + // $f.=$fiche->get_attribute(ATTR_DEF_NAME); } $check=( $p_select == $row->mp_id)?" checked " : "unchecked"; $r.='
  • '; diff --git a/include/class/balance_age.class.php b/include/class/balance_age.class.php index 53cd641ce..ca5dc6060 100644 --- a/include/class/balance_age.class.php +++ b/include/class/balance_age.class.php @@ -63,8 +63,8 @@ class Balance_Age $fiche=new Fiche($this->cn, $p_extra); $this->afiche[0]['f_id']=$fiche->id; $this->afiche[0]['quick_code']=$fiche->get_quick_code(); - $this->afiche[0]['name']=$fiche->strAttribut(ATTR_DEF_NAME, 0); - $this->afiche[0]['first_name']=$fiche->strAttribut(ATTR_DEF_FIRST_NAME, 0); + $this->afiche[0]['name']=$fiche->get_attribute(ATTR_DEF_NAME, 0); + $this->afiche[0]['first_name']=$fiche->get_attribute(ATTR_DEF_FIRST_NAME, 0); break; case 'F': $this->afiche=$this->cn->get_array(" diff --git a/include/class/card_pdf.class.php b/include/class/card_pdf.class.php index 366a51c30..5ff04daac 100644 --- a/include/class/card_pdf.class.php +++ b/include/class/card_pdf.class.php @@ -17,7 +17,7 @@ class Card_PDF extends \PDF $this->card=new \Fiche ($cn,$p_card_id); $this->card->load(); parent::__construct($cn, "P"); - $this->setDossierInfo($this->card->strAttribut(ATTR_DEF_QUICKCODE)); + $this->setDossierInfo($this->card->get_attribute(ATTR_DEF_QUICKCODE)); } /** @@ -46,8 +46,8 @@ class Card_PDF extends \PDF if ($nb_attribut == 0) { throw new \Exception(_("card_pdf.044 , card_inexistante")); } - $this->setTitle($this->card->get_quick_code()." ".strtoupper($this->card->strAttribut(1)) - ." ".$this->card->strAttribut(32,0), true); + $this->setTitle($this->card->get_quick_code()." ".strtoupper($this->card->get_attribute(1)) + ." ".$this->card->get_attribute(32,0), true); $this->SetAuthor('NOALYSS'); $this->AliasNbPages(); $this->AddPage(); @@ -63,7 +63,7 @@ class Card_PDF extends \PDF } - $filename=$this->card->strAttribut(1)."-".$this->card->strAttribut(23).".pdf"; + $filename=$this->card->get_attribute(1)."-".$this->card->get_attribute(23).".pdf"; $filename=sanitize_filename($filename); $this->Output($filename,"D"); } diff --git a/include/class/card_property.class.php b/include/class/card_property.class.php index 91ceb5958..0472d9758 100644 --- a/include/class/card_property.class.php +++ b/include/class/card_property.class.php @@ -304,7 +304,7 @@ class Card_Property if ($fiche->id==0 && $fiche->fiche_def !=0 ) { $fiche_def=new Fiche_Def($fiche->cn,$fiche->fiche_def); - $aProperty=$fiche_def->getAttribut(); + $aProperty=$fiche_def->load_attribute(); $fiche->attribut=$aProperty; return; } elseif ($fiche->id==0 && $fiche->fiche_def ==0 ) @@ -339,7 +339,7 @@ class Card_Property $fiche->attribut[$i]=$t; } $e=new Fiche_Def($fiche->cn, $fiche->fiche_def); - $e->GetAttribut(); + $e->load_attribute(); if (sizeof($fiche->attribut)!=sizeof($e->attribut)) { @@ -475,7 +475,7 @@ class Card_Property $p_fiche->cn->exec_sql("update fiche set f_enable=$1 where f_id=$2", array($p_fiche->get_f_enable(), $p_fiche->id)); - $name = $p_fiche->strAttribut(ATTR_DEF_NAME); + $name = $p_fiche->get_attribute(ATTR_DEF_NAME); // parse the attribute foreach ($p_fiche->attribut as $value) diff --git a/include/class/document.class.php b/include/class/document.class.php index 7c195ba73..87cb4d4f8 100644 --- a/include/class/document.class.php +++ b/include/class/document.class.php @@ -800,7 +800,7 @@ class Document $tiers=new Fiche($this->db); $qcode=isset($p_array['qcode_dest'])?$p_array['qcode_dest']:$p_array['e_client']; $tiers->get_by_qcode($qcode, false); - $p=$tiers->strAttribut(ATTR_DEF_ACCOUNT,0); + $p=$tiers->get_attribute(ATTR_DEF_ACCOUNT,0); // if exercice is open with a report, 1 day is 1st exercice's day if ( $g_parameter->MY_REPORT == 'Y') { // var $user_exercice (int) current user exercice (from his preference) @@ -826,13 +826,13 @@ class Document $tiers=new Fiche($this->db); $qcode=isset($p_array['qcode_dest'])?$p_array['qcode_dest']:$p_array['e_client']; $tiers->get_by_qcode($qcode, false); - $r=$tiers->strAttribut(ATTR_DEF_NAME,0); + $r=$tiers->get_attribute(ATTR_DEF_NAME,0); break; case 'CUST_ADDR_1': $tiers=new Fiche($this->db); $qcode=isset($p_array['qcode_dest'])?$p_array['qcode_dest']:$p_array['e_client']; $tiers->get_by_qcode($qcode, false); - $r=$tiers->strAttribut(ATTR_DEF_ADRESS,0); + $r=$tiers->get_attribute(ATTR_DEF_ADRESS,0); break; case 'CUST_CP': @@ -840,7 +840,7 @@ class Document $qcode=isset($p_array['qcode_dest'])?$p_array['qcode_dest']:$p_array['e_client']; $tiers->get_by_qcode($qcode, false); - $r=$tiers->strAttribut(ATTR_DEF_POSTCODE,0); + $r=$tiers->get_attribute(ATTR_DEF_POSTCODE,0); break; case 'CUST_CITY': @@ -848,7 +848,7 @@ class Document $qcode=isset($p_array['qcode_dest'])?$p_array['qcode_dest']:$p_array['e_client']; $tiers->get_by_qcode($qcode, false); - $r=$tiers->strAttribut(ATTR_DEF_CITY,0); + $r=$tiers->get_attribute(ATTR_DEF_CITY,0); break; @@ -857,7 +857,7 @@ class Document $qcode=isset($p_array['qcode_dest'])?$p_array['qcode_dest']:$p_array['e_client']; $tiers->get_by_qcode($qcode, false); - $r=$tiers->strAttribut(ATTR_DEF_COUNTRY,0); + $r=$tiers->get_attribute(ATTR_DEF_COUNTRY,0); break; // Marchandise in $p_array['e_march*'] @@ -867,25 +867,25 @@ class Document $qcode=isset($p_array['qcode_dest'])?$p_array['qcode_dest']:$p_array['e_client']; $tiers->get_by_qcode($qcode, false); - $r=$tiers->strAttribut(ATTR_DEF_NUMTVA,0); + $r=$tiers->get_attribute(ATTR_DEF_NUMTVA,0); break; case 'CUST_NUM': $tiers=new Fiche($this->db); $qcode=isset($p_array['qcode_dest'])?$p_array['qcode_dest']:$p_array['e_client']; $tiers->get_by_qcode($qcode, false); - $r=$tiers->strAttribut(ATTR_DEF_NUMBER_CUSTOMER,0); + $r=$tiers->get_attribute(ATTR_DEF_NUMBER_CUSTOMER,0); break; case 'CUST_BANQUE_NO': $tiers=new Fiche($this->db); $qcode=isset($p_array['qcode_dest'])?$p_array['qcode_dest']:$p_array['e_client']; $tiers->get_by_qcode($qcode, false); - $r=$tiers->strAttribut(ATTR_DEF_BQ_NO,0); + $r=$tiers->get_attribute(ATTR_DEF_BQ_NO,0); break; case 'CUST_BANQUE_NAME': $tiers=new Fiche($this->db); $qcode=isset($p_array['qcode_dest'])?$p_array['qcode_dest']:$p_array['e_client']; $tiers->get_by_qcode($qcode, false); - $r=$tiers->strAttribut(ATTR_DEF_BQ_NAME,0); + $r=$tiers->get_attribute(ATTR_DEF_BQ_NAME,0); break; /* -------------------------------------------------------------------------------- */ /* BENEFIT (fee notes */ @@ -898,7 +898,7 @@ class Document break; } $tiers->get_by_qcode($qcode, false); - $r=$tiers->strAttribut(ATTR_DEF_NAME,0); + $r=$tiers->get_attribute(ATTR_DEF_NAME,0); break; case 'BENEF_ADDR_1': $tiers=new Fiche($this->db); @@ -909,7 +909,7 @@ class Document break; } $tiers->get_by_qcode($qcode, false); - $r=$tiers->strAttribut(ATTR_DEF_ADRESS,0); + $r=$tiers->get_attribute(ATTR_DEF_ADRESS,0); break; case 'BENEF_CP': @@ -922,7 +922,7 @@ class Document break; } $tiers->get_by_qcode($qcode, false); - $r=$tiers->strAttribut(ATTR_DEF_POSTCODE,0); + $r=$tiers->get_attribute(ATTR_DEF_POSTCODE,0); break; case 'BENEF_CITY': @@ -935,7 +935,7 @@ class Document break; } $tiers->get_by_qcode($qcode, false); - $r=$tiers->strAttribut(ATTR_DEF_CITY,0); + $r=$tiers->get_attribute(ATTR_DEF_CITY,0); break; @@ -949,7 +949,7 @@ class Document break; } $tiers->get_by_qcode($qcode, false); - $r=$tiers->strAttribut(ATTR_DEF_COUNTRY,0); + $r=$tiers->get_attribute(ATTR_DEF_COUNTRY,0); break; // Marchandise in $p_array['e_march*'] @@ -964,7 +964,7 @@ class Document break; } $tiers->get_by_qcode($qcode, false); - $r=$tiers->strAttribut(ATTR_DEF_NUMTVA,0); + $r=$tiers->get_attribute(ATTR_DEF_NUMTVA,0); break; case 'BENEF_NUM': $tiers=new Fiche($this->db); @@ -975,7 +975,7 @@ class Document break; } $tiers->get_by_qcode($qcode, false); - $r=$tiers->strAttribut(ATTR_DEF_NUMBER_CUSTOMER,0); + $r=$tiers->get_attribute(ATTR_DEF_NUMBER_CUSTOMER,0); break; case 'BENEF_BANQUE_NO': $tiers=new Fiche($this->db); @@ -986,7 +986,7 @@ class Document break; } $tiers->get_by_qcode($qcode, false); - $r=$tiers->strAttribut(ATTR_DEF_BQ_NO,0); + $r=$tiers->get_attribute(ATTR_DEF_BQ_NO,0); break; case 'BENEF_BANQUE_NAME': $tiers=new Fiche($this->db); @@ -997,7 +997,7 @@ class Document break; } $tiers->get_by_qcode($qcode, false); - $r=$tiers->strAttribut(ATTR_DEF_BQ_NAME,0); + $r=$tiers->get_attribute(ATTR_DEF_BQ_NAME,0); break; // Marchandise in $p_array['e_march*'] @@ -1070,7 +1070,7 @@ class Document { $f=new Fiche($this->db); $f->get_by_qcode($p_array["e_march".$this->counter], false); - $r=$f->strAttribut(ATTR_DEF_NAME,0); + $r=$f->get_attribute(ATTR_DEF_NAME,0); } else $r=""; @@ -1092,7 +1092,7 @@ class Document { $f=new Fiche($this->db); $f->get_by_qcode($p_array[$id], false); - $r=$f->strAttribut(ATTR_DEF_NAME,0); + $r=$f->get_attribute(ATTR_DEF_NAME,0); } else $r=""; @@ -1113,7 +1113,7 @@ class Document { $f=new Fiche($this->db); $f->get_by_qcode($p_array[$id], false); - $r=$f->strAttribut(ATTR_DEF_STOCK,0); + $r=$f->get_attribute(ATTR_DEF_STOCK,0); $r=($r==NOTFOUND)?'':$r; } } diff --git a/include/class/fiche.class.php b/include/class/fiche.class.php index b57325d90..92c9dba03 100644 --- a/include/class/fiche.class.php +++ b/include/class/fiche.class.php @@ -136,7 +136,7 @@ class Fiche */ static function cmp_name(Fiche $o1,Fiche $o2) { - return strcmp($o1->strAttribut(ATTR_DEF_NAME),$o2->strAttribut(ATTR_DEF_NAME)); + return strcmp($o1->get_attribute(ATTR_DEF_NAME),$o2->get_attribute(ATTR_DEF_NAME)); } /** @@ -159,7 +159,7 @@ class Fiche $t=new Fiche($this->cn,$avail[$i]['jrn_def_bank']); $t->ledger_name=$avail[$i]['jrn_def_name']; $t->ledger_description=$avail[$i]['jrn_def_description']; - $t->getAttribut(); + $t->load_attribute(); $all[$i]=$t; } @@ -192,20 +192,20 @@ class Fiche if ( $p_all ) - $this->getAttribut(); + $this->load_attribute(); return 0; } /** *@brief set an attribute by a value, if the attribut array is empty - * a call to getAttribut is performed + * a call to load_attribute is performed *@param int AD_ID attr_def.ad_id *@param int value value of this attribute *@see constant.php table: attr_def */ - function setAttribut($p_ad_id,$p_value) + function set_attribute($p_ad_id,$p_value) { if ( $this->fiche_def == 0) throw new Exception ("FICHE.179 Invalid category",EXC_INVALID); - if ( sizeof($this->attribut)==0 ) $this->getAttribut(); + if ( sizeof($this->attribut)==0 ) $this->load_attribute(); for ($e=0;$e attribut);$e++) { @@ -220,7 +220,7 @@ class Fiche *\brief get all the attribute of a card, add missing ones * and sort the array ($this-\>attribut) by ad_id */ - function getAttribut() + function load_attribute() { Card_Property::load($this); } @@ -307,13 +307,13 @@ class Fiche * @return string * @note reread data from database and so it reset previous unsaved change */ - function strAttribut($p_ad_id,$p_return=1) + function get_attribute($p_ad_id,$p_return=1) { $return=($p_return==1)?NOTFOUND:""; if ( empty ($this->attribut) ) { - $this->getAttribut(); + $this->load_attribute(); } foreach ($this->attribut as $e) @@ -332,7 +332,7 @@ class Fiche { $a_return=[]; if ( empty ($this->attribut)) { - $this->getAttribut(); + $this->load_attribute(); } foreach ($this->attribut as $attr) { @@ -354,7 +354,7 @@ class Fiche // array = array of attribute object sorted on ad_id $fiche_def=new Fiche_Def($this->cn,$p_fiche_def); $fiche_def->get(); - $array=$fiche_def->getAttribut(); + $array=$fiche_def->load_attribute(); $r=""; $r.=''; foreach ($array as $attr) @@ -396,7 +396,7 @@ class Fiche */ function Display($p_readonly,$p_in="") { - $this->GetAttribut(); + $this->load_attribute(); $attr=$this->attribut; $ret=""; $ret.=''. @@ -505,7 +505,7 @@ class Fiche // get the card properties for this card category $fiche_def=new Fiche_Def($this->cn, $p_fiche_def); - $this->attribut=$fiche_def->getAttribut(); + $this->attribut=$fiche_def->load_attribute(); if (empty($this->attribut)) { @@ -517,14 +517,14 @@ class Fiche $key='av_text'.$property->ad_id; if (isset($p_array[$key])) { - $this->setAttribut($property->ad_id, $p_array[$key]); + $this->set_attribute($property->ad_id, $p_array[$key]); } } // For accounting Card_Property::update($this); // reread from database - $this->getAttribut(); + $this->load_attribute(); } catch (Exception $e) { @@ -565,7 +565,7 @@ class Fiche // get the card properties for this card category - $this->getAttribut(); + $this->load_attribute(); if ( empty ($this->attribut) ) { throw new Exception("FICHE.UPDATE02"._("Aucun attribut ")."($this->fiche_def)",EXC_INVALID); @@ -574,7 +574,7 @@ class Fiche foreach($this->attribut as $property) { $key='av_text'.$property->ad_id; if ( isset($p_array[$key])) { - $this->setAttribut($property->ad_id, $p_array[$key]); + $this->set_attribute($property->ad_id, $p_array[$key]); } } if ( isset($p_array['f_enable'])) { @@ -584,7 +584,7 @@ class Fiche } // save all Card_Property::update($this); - $this->quick_code=$this->strAttribut(ATTR_DEF_QUICKCODE); + $this->quick_code=$this->get_attribute(ATTR_DEF_QUICKCODE); } /*!\brief remove a card, check if not used first, must be synchro with is_used @@ -634,17 +634,17 @@ class Fiche return $r[0]['ad_value']; } - /*!\brief Synonum of fiche::getAttribut + /*!\brief Synonum of fiche::load_attribute */ function Get() { - $this->getAttribut(); + $this->load_attribute(); } - /*!\brief Synonum of fiche::getAttribut + /*!\brief Synonum of fiche::load_attribute */ function load() :void { - $this->getAttribut(); + $this->load_attribute(); } /*! * \brief get all the card thanks the fiche_def_ref @@ -692,7 +692,7 @@ class Fiche { $row=Database::fetch_array($Ret,$i); $t=new Fiche($this->cn,$row['f_id']); - $t->getAttribut(); + $t->load_attribute(); $all[$i]=clone $t; } @@ -772,7 +772,7 @@ class Fiche break; } - $qcode=$this->strAttribut(ATTR_DEF_QUICKCODE); + $qcode=$this->get_attribute(ATTR_DEF_QUICKCODE); $this->row=$this->cn->get_array(" with sqlletter as (select j_id,jl_id from letter_cred union all select j_id , jl_id from letter_deb ) @@ -851,7 +851,7 @@ class Fiche echo_error("class_fiche",__LINE__,"id is 0"); return; } - $qcode=$this->strAttribut(ATTR_DEF_QUICKCODE); + $qcode=$this->get_attribute(ATTR_DEF_QUICKCODE); $periode=sql_filter_per($this->cn,$p_from,$p_to,'p_id','jr_tech_per'); $this->row=$this->cn->get_array("select j_date, @@ -909,7 +909,7 @@ class Fiche if ( count($this->row ) == 0 ) return; - $qcode=$this->strAttribut(ATTR_DEF_QUICKCODE); + $qcode=$this->get_attribute(ATTR_DEF_QUICKCODE); $rep=""; $already_seen=array(); @@ -1204,7 +1204,7 @@ class Fiche function get_solde_detail($p_cond="") { if ( $this->id == 0 ) return array('credit'=>0,'debit'=>0,'solde'=>0); - $qcode=$this->strAttribut(ATTR_DEF_QUICKCODE); + $qcode=$this->get_attribute(ATTR_DEF_QUICKCODE); if ( $p_cond != "") $p_cond=" and ".$p_cond; $Res=$this->cn->exec_sql("select coalesce(sum(deb),0) as sum_deb, @@ -1256,7 +1256,7 @@ class Fiche function get_bk_balance($p_cond="") { if ( $this->id == 0 ) throw new Exception('fiche->id est nul'); - $qcode=$this->strAttribut(ATTR_DEF_QUICKCODE); + $qcode=$this->get_attribute(ATTR_DEF_QUICKCODE); if ( $p_cond != "") $p_cond=" and ".$p_cond; $sql="select sum(deb) as sum_deb, sum(cred) as sum_cred from @@ -1388,7 +1388,7 @@ class Fiche $odd=""; $odd = ($i % 2 == 0 ) ? ' odd ': ' even '; - $accounting=$tiers->strAttribut(ATTR_DEF_ACCOUNT,0); + $accounting=$tiers->get_attribute(ATTR_DEF_ACCOUNT,0); if ( ! empty($accounting) && $p_action == 'bank' && $amount['debit'] < $amount['credit'] && @@ -1410,14 +1410,14 @@ class Fiche $e=sprintf(' ', $url_detail); - $r.=""; + $r.=""; $r.=""; - $r.=""; - $r.=""; + $r.=""; - $r.=''; + $r.=''; $str_deb=(($amount['debit']==0)?0:nbm($amount['debit'])); $str_cred=(($amount['credit']==0)?0:nbm($amount['credit'])); $str_solde=nbm($amount['solde']); @@ -1604,7 +1604,7 @@ class Fiche function is_used() { /* retrieve first the quickcode */ - $qcode=$this->strAttribut(ATTR_DEF_QUICKCODE); + $qcode=$this->get_attribute(ATTR_DEF_QUICKCODE); $sql='select count(*) as c from jrnx where j_qcode=$1'; $count=$this->cn->get_value($sql,array($qcode)); if ( $count > 0 ) return TRUE; @@ -1804,15 +1804,15 @@ class Fiche $fiche->set_fiche_def($fiche_def->id); - $fiche->setAttribut(ATTR_DEF_NAME,$name); - $fiche->setAttribut(ATTR_DEF_ACCOUNT,$fiche_def->class_base.$name); + $fiche->set_attribute(ATTR_DEF_NAME,$name); + $fiche->set_attribute(ATTR_DEF_ACCOUNT,$fiche_def->class_base.$name); echo p(print_r($fiche->to_array(),false)); $fiche->insert(1,$fiche->to_array()); - assert($name == $fiche->strAttribut(ATTR_DEF_NAME)); + assert($name == $fiche->get_attribute(ATTR_DEF_NAME)); - echo p("fiche ATTR_DEF_ACCOUNT after insert ",$fiche->strAttribut(ATTR_DEF_ACCOUNT)); - $accounting=$fiche->strAttribut(ATTR_DEF_ACCOUNT); + echo p("fiche ATTR_DEF_ACCOUNT after insert ",$fiche->get_attribute(ATTR_DEF_ACCOUNT)); + $accounting=$fiche->get_attribute(ATTR_DEF_ACCOUNT); $acc_accounting=new Acc_Account($cn,$accounting); echo p("accounting id",$acc_accounting->get_parameter("id")); @@ -1822,7 +1822,7 @@ class Fiche function get_gestion_title() { - $r = "

    " . h($this->getName()) . " " . h($this->strAttribut(ATTR_DEF_FIRST_NAME,0)) . '[' . $this->get_quick_code() . ']

    '; + $r = "

    " . h($this->getName()) . " " . h($this->get_attribute(ATTR_DEF_FIRST_NAME,0)) . '[' . $this->get_quick_code() . ']

    '; return $r; } function get_all_account() @@ -1908,7 +1908,7 @@ class Fiche */ function display_row() { - $this->getAttribut(); + $this->load_attribute(); foreach($this->attribut as $attr) { $sort=""; diff --git a/include/class/fiche_def.class.php b/include/class/fiche_def.class.php index 1e5b3da89..b87957a65 100644 --- a/include/class/fiche_def.class.php +++ b/include/class/fiche_def.class.php @@ -65,7 +65,7 @@ class Fiche_Def * * \return array of Card_Property */ - function getAttribut() + function load_attribute() { $sql="select * from jnt_fic_attr ". " natural join attr_def where fd_id= $1". @@ -389,7 +389,7 @@ $order { $row=Database::fetch_array($Ret,$i); $t=new Fiche($this->cn,$row['f_id']); - $t->getAttribut(); + $t->load_attribute(); $all[$i]=$t; } @@ -621,7 +621,7 @@ $order { if ( $this->id == 0 ) return; /* ORDER */ - $this->GetAttribut(); + $this->load_attribute(); $order=$p_order; if ( $p_order == -1 ) { $order = $this->cn->get_value("select ad_default_order from attr_def where ad_id=$1",[$p_ad_id]); @@ -667,7 +667,7 @@ $order function save_order($p_array) { extract($p_array, EXTR_SKIP); - $this->GetAttribut(); + $this->load_attribute(); foreach ($this->attribut as $row) { if ( $row->ad_id == 1 ) continue; @@ -778,7 +778,7 @@ $order // Save the label $this->get(); - $this->GetAttribut(); + $this->load_attribute(); $r.= '

    ' . $this->id . " " . h($this->label) . '

    '; $r.='
    '._('Données générales').''; diff --git a/include/class/follow_up.class.php b/include/class/follow_up.class.php index 6f0748dd5..e1767e12f 100644 --- a/include/class/follow_up.class.php +++ b/include/class/follow_up.class.php @@ -339,8 +339,8 @@ class Follow_Up { $tiers=new Fiche($this->db); $tiers->get_by_qcode($this->qcode_dest); - $qcode_dest_label=strtoupper($tiers->strAttribut(1)); - $qcode_dest_label.=" ".$tiers->strAttribut(ATTR_DEF_FIRST_NAME,0); + $qcode_dest_label=strtoupper($tiers->get_attribute(1)); + $qcode_dest_label.=" ".$tiers->get_attribute(ATTR_DEF_FIRST_NAME,0); $this->f_id_dest=$tiers->id; } else @@ -411,8 +411,8 @@ class Follow_Up if ($fiche_contact->id!=0) { - $spcontact->value=strtoupper($fiche_contact->strAttribut(ATTR_DEF_NAME)??""); - $spcontact->value.=" ".$fiche_contact->strAttribut(ATTR_DEF_FIRST_NAME,0); + $spcontact->value=strtoupper($fiche_contact->get_attribute(ATTR_DEF_NAME)??""); + $spcontact->value.=" ".$fiche_contact->get_attribute(ATTR_DEF_FIRST_NAME,0); } @@ -535,7 +535,7 @@ class Follow_Up } $this->dt_id=$this->ag_type; $aexp=new Fiche($this->db, $this->f_id_dest); - $this->qcode_dest=$aexp->strAttribut(ATTR_DEF_QUICKCODE); + $this->qcode_dest=$aexp->get_attribute(ATTR_DEF_QUICKCODE); } /** diff --git a/include/class/pre_op_ach.class.php b/include/class/pre_op_ach.class.php index 6e2091ff9..3f942e16a 100644 --- a/include/class/pre_op_ach.class.php +++ b/include/class/pre_op_ach.class.php @@ -228,10 +228,10 @@ class Pre_op_ach extends Pre_operation_detail { $fClient=new Fiche($ledger->db); $fClient->get_by_qcode($e_client); - $e_client_label=$fClient->strAttribut(ATTR_DEF_NAME).' '. - ' Adresse : '.$fClient->strAttribut(ATTR_DEF_ADRESS).' '. - $fClient->strAttribut(ATTR_DEF_POSTCODE).' '. - $fClient->strAttribut(ATTR_DEF_CITY).' '; + $e_client_label=$fClient->get_attribute(ATTR_DEF_NAME).' '. + ' Adresse : '.$fClient->get_attribute(ATTR_DEF_ADRESS).' '. + $fClient->get_attribute(ATTR_DEF_POSTCODE).' '. + $fClient->get_attribute(ATTR_DEF_CITY).' '; } @@ -296,11 +296,11 @@ class Pre_op_ach extends Pre_operation_detail { $fMarch=new Fiche($ledger->db); $fMarch->get_by_qcode($march); - $march_label=$fMarch->strAttribut(ATTR_DEF_NAME); + $march_label=$fMarch->get_attribute(ATTR_DEF_NAME); if ( $flag_tva=='Y') { if ( ! (isset($p_array["e_march$i"."_tva_id"]))) - $march_tva_id=$fMarch->strAttribut(ATTR_DEF_TVA); + $march_tva_id=$fMarch->get_attribute(ATTR_DEF_TVA); } } // Show input diff --git a/include/class/pre_op_advanced.class.php b/include/class/pre_op_advanced.class.php index 4f6bb4d3d..bcae40899 100644 --- a/include/class/pre_op_advanced.class.php +++ b/include/class/pre_op_advanced.class.php @@ -228,7 +228,7 @@ class Pre_Op_Advanced extends Pre_operation_detail { $Fiche = new Fiche($legder->db); $Fiche->get_by_qcode($quick_code->value); - $label = $Fiche->strAttribut(ATTR_DEF_NAME); + $label = $Fiche->get_attribute(ATTR_DEF_NAME); } diff --git a/include/class/pre_op_ven.class.php b/include/class/pre_op_ven.class.php index c579b574f..f6c1cd5a2 100644 --- a/include/class/pre_op_ven.class.php +++ b/include/class/pre_op_ven.class.php @@ -215,10 +215,10 @@ class Pre_op_ven extends Pre_operation_detail { $fClient=new Fiche($ledger->db); $fClient->get_by_qcode($e_client); - $e_client_label=$fClient->strAttribut(ATTR_DEF_NAME).' '. - ' Adresse : '.$fClient->strAttribut(ATTR_DEF_ADRESS).' '. - $fClient->strAttribut(ATTR_DEF_POSTCODE).' '. - $fClient->strAttribut(ATTR_DEF_CITY).' '; + $e_client_label=$fClient->get_attribute(ATTR_DEF_NAME).' '. + ' Adresse : '.$fClient->get_attribute(ATTR_DEF_ADRESS).' '. + $fClient->get_attribute(ATTR_DEF_POSTCODE).' '. + $fClient->get_attribute(ATTR_DEF_CITY).' '; } @@ -283,11 +283,11 @@ class Pre_op_ven extends Pre_operation_detail { $fMarch=new Fiche($ledger->db); $fMarch->get_by_qcode($march); - $march_label=$fMarch->strAttribut(ATTR_DEF_NAME); + $march_label=$fMarch->get_attribute(ATTR_DEF_NAME); if ( $flag_tva=='Y') { if ( ! (isset($p_array["e_march$i"."_tva_id"]))) - $march_tva_id=$fMarch->strAttribut(ATTR_DEF_TVA); + $march_tva_id=$fMarch->get_attribute(ATTR_DEF_TVA); } } // Show input diff --git a/include/class/stock_goods.class.php b/include/class/stock_goods.class.php index 6c3385eac..996d36b59 100644 --- a/include/class/stock_goods.class.php +++ b/include/class/stock_goods.class.php @@ -193,7 +193,7 @@ class Stock_Goods extends Stock_Goods_Sql // Retrieve the good account for stock $code = new Fiche($p_cn); $code->get_by_qcode($goods); - $code_marchandise = $code->strAttribut(ATTR_DEF_STOCK); + $code_marchandise = $code->get_attribute(ATTR_DEF_STOCK); if ($code_marchandise == NOTFOUND || $code_marchandise=='') return false; diff --git a/include/compta_fin_saldo.inc.php b/include/compta_fin_saldo.inc.php index 1f5745ee7..5d748bad4 100644 --- a/include/compta_fin_saldo.inc.php +++ b/include/compta_fin_saldo.inc.php @@ -117,7 +117,7 @@ for ($i=0; $i<$nb_array; $i++) echo "
    "; echo ""; $saldo_rec=noalyss_bcsub($saldo_reconcilied['debit'], @@ -125,7 +125,7 @@ for ($i=0; $i<$nb_array; $i++) $diff=noalyss_bcsub($saldo_not_reconcilied['debit'], $saldo_not_reconcilied['credit']); echo "". td(h($array[$i]->ledger_name)). td(h($array[$i]->ledger_description)). diff --git a/include/export/export_fiche_balance_csv.php b/include/export/export_fiche_balance_csv.php index 01d9466fd..036f2a3f3 100644 --- a/include/export/export_fiche_balance_csv.php +++ b/include/export/export_fiche_balance_csv.php @@ -82,9 +82,9 @@ if ( $_GET['histo'] == 4 || $_GET['histo'] == 5) if (bcsub($solde['credit'], $solde['debit']) > 0) $side = 'Cred.'; - $export->add($oCard->strAttribut(ATTR_DEF_QUICKCODE)); - $export->add($oCard->strAttribut(ATTR_DEF_NAME)); - $export->add($oCard->strAttribut(ATTR_DEF_ACCOUNT)); + $export->add($oCard->get_attribute(ATTR_DEF_QUICKCODE)); + $export->add($oCard->get_attribute(ATTR_DEF_NAME)); + $export->add($oCard->get_attribute(ATTR_DEF_ACCOUNT)); $export->add($solde['debit'],"number"); $export->add($solde['credit'],"number"); $export->add(abs($solde['solde']),"number"); @@ -114,7 +114,7 @@ else { $row = new Fiche($cn, $card['f_id']); $letter = new Lettering_Card($cn); - $letter->set_parameter('quick_code', $row->strAttribut(ATTR_DEF_QUICKCODE)); + $letter->set_parameter('quick_code', $row->get_attribute(ATTR_DEF_QUICKCODE)); $letter->set_parameter('start', $_GET['start']); $letter->set_parameter('end', $_GET['end']); // all @@ -140,9 +140,9 @@ else /* skip if nothing to display */ if (count($letter->content) == 0) continue; - $export->add($row->strAttribut(ATTR_DEF_QUICKCODE)); - $export->add( $row->strAttribut(ATTR_DEF_NAME)); - $export->add($row->strAttribut(ATTR_DEF_ACCOUNT)); + $export->add($row->get_attribute(ATTR_DEF_QUICKCODE)); + $export->add( $row->get_attribute(ATTR_DEF_NAME)); + $export->add($row->get_attribute(ATTR_DEF_ACCOUNT)); $export->write(); diff --git a/include/export/export_fiche_balance_pdf.php b/include/export/export_fiche_balance_pdf.php index 393d92fd7..4f2f3d4de 100644 --- a/include/export/export_fiche_balance_pdf.php +++ b/include/export/export_fiche_balance_pdf.php @@ -120,8 +120,8 @@ if ($histo == 4 || $histo==5) $sum_deb=bcadd($sum_deb,$solde['debit']); $sum_solde=bcsub($sum_deb,$sum_cred); - $pdf->write_cell(30,7,$oCard->strAttribut(ATTR_DEF_QUICKCODE),0,0,'L',$fill); - $pdf->LongLine(80,7,$oCard->strAttribut(ATTR_DEF_NAME)." (".$oCard->strAttribut(ATTR_DEF_ACCOUNT).")",0,'L',$fill); + $pdf->write_cell(30,7,$oCard->get_attribute(ATTR_DEF_QUICKCODE),0,0,'L',$fill); + $pdf->LongLine(80,7,$oCard->get_attribute(ATTR_DEF_NAME)." (".$oCard->get_attribute(ATTR_DEF_ACCOUNT).")",0,'L',$fill); $pdf->write_cell(20,7,nbm($solde['debit']),0,0,'R',$fill); $pdf->write_cell(20,7,nbm($solde['credit']),0,0,'R',$fill); $pdf->write_cell(20,7,nbm(abs($solde['solde'])),0,0,'R',$fill); @@ -181,7 +181,7 @@ else { $fic = new Fiche($cn, $row_fiche['f_id']); $letter = new Lettering_Card($cn); - $letter->set_parameter('quick_code', $fic->strAttribut(ATTR_DEF_QUICKCODE)); + $letter->set_parameter('quick_code', $fic->get_attribute(ATTR_DEF_QUICKCODE)); $letter->set_parameter('start',$http->request('start')); $letter->set_parameter('end',$http->request('end')); // all @@ -209,7 +209,7 @@ else continue; $pdf->SetFont('DejaVuCond', '', 10); $fiche = new Fiche($cn, $row_fiche['f_id']); - $pdf->write_cell(0, 7, $fiche->strAttribut(ATTR_DEF_NAME)." [".$fiche->strAttribut(ATTR_DEF_QUICKCODE).":".$fiche->strAttribut(ATTR_DEF_ACCOUNT)."]", 1, 'C'); + $pdf->write_cell(0, 7, $fiche->get_attribute(ATTR_DEF_NAME)." [".$fiche->get_attribute(ATTR_DEF_QUICKCODE).":".$fiche->get_attribute(ATTR_DEF_ACCOUNT)."]", 1, 'C'); $pdf->SetFont('DejaVuCond', '', 7); $pdf->line_new(); diff --git a/include/export/export_fiche_csv.php b/include/export/export_fiche_csv.php index ecfbc0b9b..4817ead15 100644 --- a/include/export/export_fiche_csv.php +++ b/include/export/export_fiche_csv.php @@ -42,7 +42,7 @@ if ( isset ($_GET['fd_id'])) $e=$fiche_def->get_by_type(inactive: $http->request('inactive')); $o=0; // Heading - $fiche_def->GetAttribut(); + $fiche_def->load_attribute(); $title=array(); foreach ($fiche_def->attribut as $attribut) { @@ -56,7 +56,7 @@ if ( isset ($_GET['fd_id'])) { $detail=new Fiche($cn,$fiche['f_id']); - $detail->getAttribut(); + $detail->load_attribute(); foreach ( $detail->attribut as $dattribut ) { diff --git a/include/export/export_fiche_detail_pdf.php b/include/export/export_fiche_detail_pdf.php index aa6936dd4..27609bfba 100644 --- a/include/export/export_fiche_detail_pdf.php +++ b/include/export/export_fiche_detail_pdf.php @@ -59,7 +59,7 @@ if ( count($array) == 0 ) $size=array(13,25,20,60,12,20,20,20); $align=array('L','C','C','L','R','R','R','R'); -$Libelle=sprintf("(%s) %s %s [ %s ]",$Fiche->id,$Fiche->getName(),$Fiche->strAttribut(ATTR_DEF_FIRST_NAME,0),$Fiche->get_quick_code()); +$Libelle=sprintf("(%s) %s %s [ %s ]",$Fiche->id,$Fiche->getName(),$Fiche->get_attribute(ATTR_DEF_FIRST_NAME,0),$Fiche->get_quick_code()); $pdf->SetFont('DejaVu','',10); $pdf->write_cell(0,8,$Libelle,1,0,'C'); $pdf->line_new(); diff --git a/include/export/export_ledger_csv.php b/include/export/export_ledger_csv.php index 893406059..a09b15618 100644 --- a/include/export/export_ledger_csv.php +++ b/include/export/export_ledger_csv.php @@ -229,7 +229,7 @@ if ($get_option=="L" && ($jrn_type=='ODS'||$jrn_type=='FIN'||$jrn_type=='GL') ) { $tiers_id=$Jrn->get_tiers_id($line['jrn_def_type'], $line['jr_id']); $fiche_tiers=new Fiche($cn, $tiers_id); - $tiers=$fiche_tiers->strAttribut(ATTR_DEF_NAME, 0)." ".$fiche_tiers->strAttribut(ATTR_DEF_FIRST_NAME, + $tiers=$fiche_tiers->get_attribute(ATTR_DEF_NAME, 0)." ".$fiche_tiers->get_attribute(ATTR_DEF_FIRST_NAME, 0); $export->add($line['num']); diff --git a/include/fiche.inc.php b/include/fiche.inc.php index 9a673050b..111d37c6f 100644 --- a/include/fiche.inc.php +++ b/include/fiche.inc.php @@ -194,7 +194,7 @@ if ($histo->selected == -1) $fiche = new Fiche($cn, $ack[$i]); if ( $fiche->remove(true) == 1 ) { - $msg.="\n ".$fiche->strAttribut(ATTR_DEF_QUICKCODE); + $msg.="\n ".$fiche->get_attribute(ATTR_DEF_QUICKCODE); } } if ($msg != "") @@ -268,7 +268,7 @@ if ($histo->selected == 3) $cat_card = new Fiche_Def($cn); $cat_card->id =$http->get('cat','number'); - $aHeading = $cat_card->getAttribut(); + $aHeading = $cat_card->load_attribute(); $str_add_card=""; if ( $allcard == 0 ) { $h_add_card_b = new IButton('add_card'); @@ -476,9 +476,9 @@ if ($histo->selected == 4 || $histo->selected == 5) $sum_deb=bcadd($sum_deb,$solde['debit']); $sum_solde=bcsub($sum_deb,$sum_cred); echo tr( - td(HtmlInput::history_card($oCard->id, $oCard->strAttribut(ATTR_DEF_QUICKCODE))) . - td($oCard->strAttribut(ATTR_DEF_NAME)) . - td(HtmlInput::history_account($oCard->strAttribut(ATTR_DEF_ACCOUNT),$oCard->strAttribut(ATTR_DEF_ACCOUNT))). + td(HtmlInput::history_card($oCard->id, $oCard->get_attribute(ATTR_DEF_QUICKCODE))) . + td($oCard->get_attribute(ATTR_DEF_NAME)) . + td(HtmlInput::history_account($oCard->get_attribute(ATTR_DEF_ACCOUNT),$oCard->get_attribute(ATTR_DEF_ACCOUNT))). td(nbm($solde['debit']), 'class="sorttable_numeric" sorttable_customkey="'.$solde['debit'].'" style="text-align:right"') . td(nbm($solde['credit']), 'class="sorttable_numeric" sorttable_customkey="'.$solde['debit'].'" style="text-align:right"') . td(nbm(abs($solde['solde'])), 'class="sorttable_numeric" sorttable_customkey="'.$solde['solde'].'" style="text-align:right"') . @@ -541,7 +541,7 @@ for ($e = 0; $e < count($afiche); $e++) { $row = new Fiche($cn, $card['f_id']); $letter = new Lettering_Card($cn); - $letter->set_parameter('quick_code', $row->strAttribut(ATTR_DEF_QUICKCODE)); + $letter->set_parameter('quick_code', $row->get_attribute(ATTR_DEF_QUICKCODE)); $letter->set_parameter('start', $periode_start->value ); $letter->set_parameter('end', $periode_end->value ); // all @@ -567,11 +567,11 @@ for ($e = 0; $e < count($afiche); $e++) /* skip if nothing to display */ if (count($letter->content) == 0) continue; - $detail_card = HtmlInput::card_detail($row->strAttribut(ATTR_DEF_QUICKCODE), $row->strAttribut(ATTR_DEF_NAME)); + $detail_card = HtmlInput::card_detail($row->get_attribute(ATTR_DEF_QUICKCODE), $row->get_attribute(ATTR_DEF_NAME)); echo '

    ' . $detail_card ; echo "poste " - . ":".HtmlInput::history_account($row->strAttribut(ATTR_DEF_ACCOUNT),$row->strAttribut(ATTR_DEF_ACCOUNT),'display:inline').Icon_Action::infobulle(27).'

    '; + . ":".HtmlInput::history_account($row->get_attribute(ATTR_DEF_ACCOUNT),$row->get_attribute(ATTR_DEF_ACCOUNT),'display:inline').Icon_Action::infobulle(27).''; echo '
    $e".$tiers->strAttribut(ATTR_DEF_QUICKCODE)." $e".$tiers->get_attribute(ATTR_DEF_QUICKCODE)." $e".$accounting."".h($tiers->strAttribut(ATTR_DEF_NAME))."".h($tiers->strAttribut(ATTR_DEF_ADRESS,0). - " ".$tiers->strAttribut(ATTR_DEF_POSTCODE,0). - " ".$tiers->strAttribut(ATTR_DEF_COUNTRY,0)). + $r.="".h($tiers->get_attribute(ATTR_DEF_NAME))."".h($tiers->get_attribute(ATTR_DEF_ADRESS,0). + " ".$tiers->get_attribute(ATTR_DEF_POSTCODE,0). + " ".$tiers->get_attribute(ATTR_DEF_COUNTRY,0)). "'.linkTo($tiers->strAttribut(ATTR_DEF_WEBSITE,0)).''.linkTo($tiers->get_attribute(ATTR_DEF_WEBSITE,0)).'
    ". IButton::history_card($array[$i]->id, - $array[$i]->strAttribut(ATTR_DEF_QUICKCODE)). + $array[$i]->get_attribute(ATTR_DEF_QUICKCODE)). "". - $array[$i]->strAttribut(ATTR_DEF_NAME). + $array[$i]->get_attribute(ATTR_DEF_NAME). "
    '; echo ''; diff --git a/include/impress_poste.inc.php b/include/impress_poste.inc.php index dd3ee2590..fe9f1946e 100644 --- a/include/impress_poste.inc.php +++ b/include/impress_poste.inc.php @@ -144,7 +144,7 @@ if ( isset( $_REQUEST['bt_html'] ) ) // thanks the qcode we found the poste account $fiche=new Fiche($cn); $qcode=$fiche->get_by_qcode($http->get('f_id')); - $p=$fiche->strAttribut(ATTR_DEF_ACCOUNT); + $p=$fiche->get_attribute(ATTR_DEF_ACCOUNT); if ( $p != NOTFOUND) { $go=2; diff --git a/include/lib/itva_popup.class.php b/include/lib/itva_popup.class.php index 4a0e20c25..0ef12fd72 100644 --- a/include/lib/itva_popup.class.php +++ b/include/lib/itva_popup.class.php @@ -140,7 +140,7 @@ class ITva_Popup extends HtmlInput $code = $this->code->input(); } - $strAttribut = $this->get_node_attribute(); + $get_attribute = $this->get_node_attribute(); // show tva code if ( self::$vat_code == 1) { if ( isNumber($this->value ) == 1) { @@ -151,7 +151,7 @@ class ITva_Popup extends HtmlInput $str = ''; - $r = sprintf($str, $this->name, $this->value, $this->id, _("C.TVA"),$this->js, $strAttribut,$this->id); + $r = sprintf($str, $this->name, $this->value, $this->id, _("C.TVA"),$this->js, $get_attribute,$this->id); $r.=$code; if ($this->in_table) diff --git a/include/template/contact-summary.php b/include/template/contact-summary.php index 317e7d1ec..ede28a8fa 100644 --- a/include/template/contact-summary.php +++ b/include/template/contact-summary.php @@ -56,7 +56,7 @@ $from=$http->request("ac","string",""); if ( !empty ($contact['contact_company']) ) { $l_company=new Fiche($cn); $l_company->get_by_qcode(trim($contact['contact_company']),false); - $l_company_name=$l_company->strAttribut(ATTR_DEF_NAME,0); + $l_company_name=$l_company->get_attribute(ATTR_DEF_NAME,0); // add popup for detail if the company does exist if ( $l_company_name !="") diff --git a/include/template/ledger_detail_ach.php b/include/template/ledger_detail_ach.php index b03d4abca..3633f348e 100644 --- a/include/template/ledger_detail_ach.php +++ b/include/template/ledger_detail_ach.php @@ -201,7 +201,7 @@ global $div,$g_parameter,$cn,$access,$jr_id,$obj; $row = ''; $q = $obj->det->array[$e]; $fiche = new Fiche($cn, $q['qp_fiche']); - $qcode=$fiche->strAttribut(ATTR_DEF_QUICKCODE); + $qcode=$fiche->get_attribute(ATTR_DEF_QUICKCODE); $view_card_detail = HtmlInput::card_detail($qcode, "", ' class="line" '); $row = td($view_card_detail); $sym_tva = ''; @@ -217,7 +217,7 @@ global $div,$g_parameter,$cn,$access,$jr_id,$obj; } if ($owner->MY_UPDLAB == 'Y') { - $l_lib = ($q['j_text'] == '') ? $fiche->strAttribut(ATTR_DEF_NAME) : $q['j_text']; + $l_lib = ($q['j_text'] == '') ? $fiche->get_attribute(ATTR_DEF_NAME) : $q['j_text']; $hidden = HtmlInput::hidden("j_id[]", $q['j_id']); $input = new IText("e_march" . $q['j_id'] . "_label", $l_lib); $input->css_size = "100%"; @@ -225,7 +225,7 @@ global $div,$g_parameter,$cn,$access,$jr_id,$obj; { $input = new ISpan("e_march" . $q['j_id'] . "_label"); $hidden = HtmlInput::hidden("j_id[]", $q['j_id']); - $input->value = $fiche->strAttribut(ATTR_DEF_NAME); + $input->value = $fiche->get_attribute(ATTR_DEF_NAME); } $row.=td($input->input() . $hidden); $pu = $q['qp_unit']; @@ -261,7 +261,7 @@ global $div,$g_parameter,$cn,$access,$jr_id,$obj; /* Analytic accountancy */ if ($owner->MY_ANALYTIC != "nu" /*&& $div == 'popup'*/ ) { - $poste = $fiche->strAttribut(ATTR_DEF_ACCOUNT); + $poste = $fiche->get_attribute(ATTR_DEF_ACCOUNT); if ( $g_parameter->match_analytic($poste)) { $anc_op = new Anc_Operation($cn); diff --git a/include/template/ledger_detail_bottom.php b/include/template/ledger_detail_bottom.php index 08f3873e0..3cd985c44 100644 --- a/include/template/ledger_detail_bottom.php +++ b/include/template/ledger_detail_bottom.php @@ -120,7 +120,7 @@ endif; // nom de la fiche $ff = new Fiche($cn); $ff->get_by_qcode($q[$e]['j_qcode']); - $row.=td($ff->strAttribut(h(ATTR_DEF_NAME))); + $row.=td($ff->get_attribute(h(ATTR_DEF_NAME))); } else { // libellé du compte diff --git a/include/template/ledger_detail_fin.php b/include/template/ledger_detail_fin.php index b6e944784..640afc4eb 100644 --- a/include/template/ledger_detail_fin.php +++ b/include/template/ledger_detail_fin.php @@ -152,10 +152,10 @@ if ($obj->det->currency_id!=0) /* Analytic accountancy */ if ( $owner->MY_ANALYTIC != "nu" /*&& $div == 'popup'*/) { - $poste=$fiche->strAttribut(ATTR_DEF_ACCOUNT); + $poste=$fiche->get_attribute(ATTR_DEF_ACCOUNT); if ( $g_parameter->match_analytic($q[$e]['j_poste'])) { - $qcode=$fiche->strAttribut(ATTR_DEF_QUICKCODE); + $qcode=$fiche->get_attribute(ATTR_DEF_QUICKCODE); $anc_op=new Anc_Operation($cn); $anc_op->j_id=$q[$e]['j_id']; $anc_op->in_div=$div; diff --git a/include/template/ledger_detail_misc.php b/include/template/ledger_detail_misc.php index 91b868809..fd8d97598 100644 --- a/include/template/ledger_detail_misc.php +++ b/include/template/ledger_detail_misc.php @@ -161,7 +161,7 @@ $amount_idx=0; $sum_prod_currency=0; // nom de la fiche $ff=new Fiche($cn); $ff->get_by_qcode( $q[$e]['j_qcode']); - $l_lib=$ff->strAttribut(ATTR_DEF_NAME); + $l_lib=$ff->get_attribute(ATTR_DEF_NAME); } else { // libellé du compte $name=$cn->get_value('select pcm_lib from tmp_pcmn where pcm_val=$1',array($q[$e]['j_poste'])); diff --git a/include/template/ledger_detail_ven.php b/include/template/ledger_detail_ven.php index 9b0fea531..c0dcbc5ae 100644 --- a/include/template/ledger_detail_ven.php +++ b/include/template/ledger_detail_ven.php @@ -201,18 +201,18 @@ $str_anc = ""; $row = ''; $q = $obj->det->array[$e]; $fiche = new Fiche($cn, $q['qs_fiche']); - $qcode = $fiche->strAttribut(ATTR_DEF_QUICKCODE); + $qcode = $fiche->get_attribute(ATTR_DEF_QUICKCODE); $view_card_detail = HtmlInput::card_detail($qcode, "", ' class="line" '); $row .= td($view_card_detail); if ($owner->MY_UPDLAB == 'Y') { - $l_lib = ($q['j_text'] == '') ? $fiche->strAttribut(ATTR_DEF_NAME) : $q['j_text']; + $l_lib = ($q['j_text'] == '') ? $fiche->get_attribute(ATTR_DEF_NAME) : $q['j_text']; $hidden = HtmlInput::hidden("j_id[]", $q['j_id']); $input = new IText("e_march" . $q['j_id'] . "_label", $l_lib); $input->css_size = "100%"; } else { $input = new ISpan("e_march" . $q['j_id'] . "_label"); $hidden = HtmlInput::hidden("j_id[]", $q['j_id']); - $input->value = $fiche->strAttribut(ATTR_DEF_NAME); + $input->value = $fiche->get_attribute(ATTR_DEF_NAME); } $row .= td($input->input() . $hidden); @@ -250,7 +250,7 @@ $str_anc = ""; $total_htva = bcadd($total_htva, $htva); /* Analytic accountancy */ if ($owner->MY_ANALYTIC != "nu" /*&& $div == 'popup' */) { - $poste = $fiche->strAttribut(ATTR_DEF_ACCOUNT); + $poste = $fiche->get_attribute(ATTR_DEF_ACCOUNT); if ($g_parameter->match_analytic($poste)) { $anc_op = new Anc_Operation($cn); $anc_op->in_div = $div; diff --git a/unit-test/include/Ajax/ajax_miscTest.php b/unit-test/include/Ajax/ajax_miscTest.php index dc8204a80..f5e94c81e 100644 --- a/unit-test/include/Ajax/ajax_miscTest.php +++ b/unit-test/include/Ajax/ajax_miscTest.php @@ -110,9 +110,9 @@ class Ajax_MiscTest extends TestCase // card for Merchandise $fiche->set_fiche_def(1); Card_Property::load($fiche); - $fiche->setAttribut(1, "Inserted by PHPUNIT-" . __CLASS__ . ":" . __FUNCTION__); - $fiche->setAttribut(ATTR_DEF_TVA, '210A'); - $fiche->setAttribut(ATTR_DEF_QUICKCODE, 'MA1'); + $fiche->set_attribute(1, "Inserted by PHPUNIT-" . __CLASS__ . ":" . __FUNCTION__); + $fiche->set_attribute(ATTR_DEF_TVA, '210A'); + $fiche->set_attribute(ATTR_DEF_QUICKCODE, 'MA1'); $fiche->insert(1, $fiche->to_array()); return $fiche; } diff --git a/unit-test/include/class/DocumentTest.php b/unit-test/include/class/DocumentTest.php index ea7248510..eed2e873d 100644 --- a/unit-test/include/class/DocumentTest.php +++ b/unit-test/include/class/DocumentTest.php @@ -27,6 +27,9 @@ use PHPUnit\Framework\TestCase; */ require DIRTEST . '/global.php'; +/** + * @backupGlobals disabled + */ class DocumentTest extends TestCase { /** @@ -198,6 +201,7 @@ class DocumentTest extends TestCase { /** * @testdox Generate Document::generate(), Document::parseDocument(),Document::replace(); require unoconv -l in another session * @covers Document::generate(), Document::parseDocument(),Document::replace(); + * @backupGlobals disabled */ function testGenerate() { require_once 'global.php'; @@ -308,13 +312,13 @@ class DocumentTest extends TestCase { } /** * @testdox test balance - * @backupGlobals enabled + * @dataProvider dataBalance */ function testBalance($quickcode,$balance_report,$balance_noreport) { - require "global.php"; require "global.php"; + global $g_parameter; static $request = null; static $parameter = null; $document = $this->build_document(); @@ -324,18 +328,19 @@ class DocumentTest extends TestCase { if ( $parameter == null ){ $parameter=new \Noalyss_Parameter_Folder($document->db); } - global $g_parameter; $g_parameter=$parameter; $g_parameter->MY_REPORT='Y'; - + $g_parameter->save('MY_REPORT'); $request['qcode_dest']=$quickcode; $this->assertEquals($document->replace('SOLDE',$request),$balance_report,"{$quickcode} balance_report fails"); $g_parameter->MY_REPORT='N'; + $g_parameter->save('MY_REPORT'); $this->assertEquals($document->replace('SOLDE',$request),$balance_noreport,"{$quickcode} balance_noreport fails"); $g_parameter->MY_REPORT='Y'; + $g_parameter->save('MY_REPORT'); } } diff --git a/unit-test/include/class/Fiche_DefTest.php b/unit-test/include/class/Fiche_DefTest.php index 9dbaefcb5..f4bdc0e31 100644 --- a/unit-test/include/class/Fiche_DefTest.php +++ b/unit-test/include/class/Fiche_DefTest.php @@ -160,7 +160,7 @@ class Fiche_DefTest extends Testcase } /** - * @testdox getAttribut + * @testdox load_attribute */ function testGetAttribut() { @@ -168,7 +168,7 @@ class Fiche_DefTest extends Testcase $fiche_def=$this->getFicheDef(); $aProperty=$g_connection->get_array("select ad_id from jnt_fic_attr where fd_id=$1", [$fiche_def->id]); - $this->assertEquals(count($fiche_def->getAttribut()),count($aProperty)," number of property different in db and function getAttribut"); + $this->assertEquals(count($fiche_def->load_attribute()),count($aProperty)," number of property different in db and function load_attribute"); } /** * @testdox if we insert a attribut ; all the cards from this category will have these attributes diff --git a/unit-test/include/class/acc_ledger_purchaseTest.php b/unit-test/include/class/acc_ledger_purchaseTest.php index d3a7ab25c..19289225a 100644 --- a/unit-test/include/class/acc_ledger_purchaseTest.php +++ b/unit-test/include/class/acc_ledger_purchaseTest.php @@ -461,8 +461,8 @@ class Acc_Ledger_PurchaseTest extends TestCase //-- modify card 29 : ELECTR $fiche=new Fiche($g_connection,29); $fiche->set_f_enable("1"); - $fiche->setAttribut($p_attribut,$p_value); - $fiche->setAttribut($p_counterpart,$p_accounting); + $fiche->set_attribute($p_attribut,$p_value); + $fiche->set_attribute($p_counterpart,$p_accounting); $a_attribut=$fiche->to_array(); $this->assertEquals($a_attribut['av_text'.$p_attribut],$p_value,"Attribut $p_attribut not set to $p_value%"); @@ -516,8 +516,8 @@ class Acc_Ledger_PurchaseTest extends TestCase //-- modify card 29 : ELECTR $fiche=new Fiche($g_connection,29); $fiche->set_f_enable("1"); - $fiche->setAttribut($p_attribut,$p_value); - $fiche->setAttribut($p_counterpart,$p_accounting); + $fiche->set_attribute($p_attribut,$p_value); + $fiche->set_attribute($p_counterpart,$p_accounting); $a_attribut=$fiche->to_array(); $this->assertEquals($a_attribut['av_text'.$p_attribut],$p_value,"Attribut $p_attribut not set to $p_value%"); diff --git a/unit-test/include/class/acc_letterTest.php b/unit-test/include/class/acc_letterTest.php index f6be39006..55aedca12 100644 --- a/unit-test/include/class/acc_letterTest.php +++ b/unit-test/include/class/acc_letterTest.php @@ -110,7 +110,7 @@ class Acc_LetterTest extends TestCase global $g_connection; $letter = new Lettering_Account($g_connection); $fiche=new Fiche($g_connection,$p_fiche_id); - $letter->set_parameter('account', $fiche->strAttribut(ATTR_DEF_ACCOUNT)); + $letter->set_parameter('account', $fiche->get_attribute(ATTR_DEF_ACCOUNT)); $letter->set_parameter('start', '01.01.2010' ); $letter->set_parameter('end', '31.12.2019'); @@ -161,7 +161,7 @@ class Acc_LetterTest extends TestCase global $g_connection; $letter = new Lettering_Card($g_connection); $fiche=new Fiche($g_connection,$p_fiche_id); - $letter->set_parameter('quick_code', $fiche->strAttribut(ATTR_DEF_QUICKCODE)); + $letter->set_parameter('quick_code', $fiche->get_attribute(ATTR_DEF_QUICKCODE)); $letter->set_parameter('start', '01.01.2010' ); $letter->set_parameter('end', '31.12.2019'); diff --git a/unit-test/include/class/card_propertyTest.php b/unit-test/include/class/card_propertyTest.php index 5bdf47bb3..400629c7f 100644 --- a/unit-test/include/class/card_propertyTest.php +++ b/unit-test/include/class/card_propertyTest.php @@ -74,15 +74,15 @@ class Card_PropertyTest extends TestCase } $fiche=new Fiche($g_connection); $fiche->set_fiche_def($fiche_def->id); - $fiche->attribut=$fiche_def->getAttribut(); + $fiche->attribut=$fiche_def->load_attribute(); foreach ($fiche->attribut as $row) { - $fiche->setAttribut($row->ad_id, "av_text = {$row->ad_id}"); + $fiche->set_attribute($row->ad_id, "av_text = {$row->ad_id}"); } - $fiche->setAttribut(ATTR_DEF_QUICKCODE, self::FICHE_QCODE); - $fiche->setAttribut(ATTR_DEF_ACCOUNT, '600'); - $fiche->setAttribut(ATTR_DEF_TVA, ''); + $fiche->set_attribute(ATTR_DEF_QUICKCODE, self::FICHE_QCODE); + $fiche->set_attribute(ATTR_DEF_ACCOUNT, '600'); + $fiche->set_attribute(ATTR_DEF_TVA, ''); $fiche->insert($fiche_def->id, $fiche->to_array()); $fiche->load(); } @@ -147,15 +147,15 @@ class Card_PropertyTest extends TestCase $fiche=$this->getFiche(); $fiche->load(); $name="test ".microtime(); - $this->assertFalse($fiche->getAttribut(1)==$name, 'name not different'); - $fiche->setAttribut(1, $name); + $this->assertFalse($fiche->load_attribute(1)==$name, 'name not different'); + $fiche->set_attribute(1, $name); $aProperty=$fiche->to_array(); $this->assertEquals($name, $aProperty['av_text1'], 'name not identical in array'); Card_Property::update($fiche); Card_Property::load($fiche); - $this->assertEquals(trim($name), trim($fiche->strAttribut(1)), 'name identical in DB'); + $this->assertEquals(trim($name), trim($fiche->get_attribute(1)), 'name identical in DB'); $this->assertEquals(trim($name), trim($fiche->getName()), 'name identical in DB'); } @@ -174,13 +174,13 @@ class Card_PropertyTest extends TestCase echo "fiche_def->id",$fiche_def->id; $fiche->set_fiche_def($fiche_def->id); - $fiche->setAttribut(ATTR_DEF_NAME,$name); - $fiche->setAttribut(ATTR_DEF_ACCOUNT,$fiche_def->class_base.$name); + $fiche->set_attribute(ATTR_DEF_NAME,$name); + $fiche->set_attribute(ATTR_DEF_ACCOUNT,$fiche_def->class_base.$name); $fiche->insert($fiche_def->id,$fiche->to_array()); - $this->assertEquals($name,$fiche->strAttribut(ATTR_DEF_NAME)); + $this->assertEquals($name,$fiche->get_attribute(ATTR_DEF_NAME)); - $accounting=$fiche->strAttribut(ATTR_DEF_ACCOUNT); + $accounting=$fiche->get_attribute(ATTR_DEF_ACCOUNT); $acc_accounting=new Acc_Account($g_connection,$accounting); $this->assertEquals($acc_accounting->get_lib("pcm_lib"),$name,"Cannot create a new accouting with @@ -279,14 +279,14 @@ class Card_PropertyTest extends TestCase $g_connection->exec_sql("update fiche_def set fd_create_account=true where fd_id=25"); $fiche=$this->getFiche(); - $fiche->setAttribut(ATTR_DEF_ACCOUNT, null); + $fiche->set_attribute(ATTR_DEF_ACCOUNT, null); $aProperty=$fiche->to_array(); Card_Property::update($fiche); $g_connection->commit(); $fiche->load(); - $this->assertTrue(!empty($fiche->strAttribut(ATTR_DEF_ACCOUNT)),' accounting not computed'); + $this->assertTrue(!empty($fiche->get_attribute(ATTR_DEF_ACCOUNT)),' accounting not computed'); } } diff --git a/unit-test/include/class/contactTest.php b/unit-test/include/class/contactTest.php index 353f6f5e1..2fa41a301 100644 --- a/unit-test/include/class/contactTest.php +++ b/unit-test/include/class/contactTest.php @@ -145,8 +145,8 @@ class ContactTest extends TestCase $fiche=new Fiche($this->connection); $fiche->fiche_def=$this->object->fiche_def->id; $fiche->load(); - $fiche->setAttribut(ATTR_DEF_NAME, $param['name']); - $fiche->setAttribut(ATTR_DEF_COMPANY, $param['company']); + $fiche->set_attribute(ATTR_DEF_NAME, $param['name']); + $fiche->set_attribute(ATTR_DEF_COMPANY, $param['company']); $fiche->insert($fiche->fiche_def,$fiche->to_array()); $this->object->card_to_clean[]=$fiche->id; printf("Card to clean %s ",$fiche->id); diff --git a/unit-test/include/class/ficheTest.php b/unit-test/include/class/ficheTest.php index 2e696665d..96afd657e 100644 --- a/unit-test/include/class/ficheTest.php +++ b/unit-test/include/class/ficheTest.php @@ -215,7 +215,7 @@ class FicheTest extends TestCase //-- modify card 29 : ELECTR $fiche = new Fiche($this->g_connection, 29); $fiche->set_f_enable("1"); - $fiche->setAttribut(20, "33.33"); + $fiche->set_attribute(20, "33.33"); $a_attribut = $fiche->to_array(); $this->assertEquals($a_attribut['av_text20'], 33.33, "Attribut 20 set to 33%"); @@ -225,8 +225,8 @@ class FicheTest extends TestCase $this->g_connection->get_value("select ad_value from fiche_detail where f_id=$1 and ad_id=$2", [29, 20]), "Attribut ad_id 20 inserted"); - $this->assertEquals("33.33", $fiche->strAttribut(20), "retrieve attribute 20"); - $fiche->setAttribut(20, "0.05"); + $this->assertEquals("33.33", $fiche->get_attribute(20), "retrieve attribute 20"); + $fiche->set_attribute(20, "0.05"); Card_Property::update($fiche); $this->assertEquals("0.05", $this->g_connection->get_value("select ad_value from fiche_detail where f_id=$1 and ad_id=$2", [29, 20]), @@ -256,12 +256,12 @@ class FicheTest extends TestCase $fiche_goods = new Fiche($this->g_connection); $fiche_goods->get_by_qcode("MARCHA"); $this->assertEquals($fiche_goods->id, 23, "retrieve card by qcode"); - $this->assertEquals($fiche_goods->strAttribut(ATTR_DEF_NAME), "Marchandise1", "Retrieve name"); + $this->assertEquals($fiche_goods->get_attribute(ATTR_DEF_NAME), "Marchandise1", "Retrieve name"); $this->assertEquals($fiche_goods->getName(), "Marchandise1", "Retrieve name from db"); $fiche_2 = new Fiche($this->g_connection); $fiche_2->get_by_qcode("marcha "); $this->assertEquals($fiche_2->id, 23, "retrieve card by qcode"); - $this->assertEquals($fiche_2->strAttribut(ATTR_DEF_NAME), "Marchandise1", "Retrieve name"); + $this->assertEquals($fiche_2->get_attribute(ATTR_DEF_NAME), "Marchandise1", "Retrieve name"); $this->assertEquals($fiche_2->getName(), "Marchandise1", "Retrieve name from db"); } @@ -334,7 +334,7 @@ class FicheTest extends TestCase $fiche = new Fiche($this->g_connection); $fiche->insert(2, ['av_text13' => $quick_code, "av_text1" => $name]); $fiche->load(); - $this->assertTrue($fiche->id > 0 && !empty(trim($fiche->strAttribut(23))), 'error : card created with empty quickcode'); + $this->assertTrue($fiche->id > 0 && !empty(trim($fiche->get_attribute(23))), 'error : card created with empty quickcode'); $fiche->remove(); } @@ -364,7 +364,7 @@ class FicheTest extends TestCase //insert $fiche = new Fiche($this->g_connection); $fiche->insert(2, ['av_text23' => 'QC', "av_text1" => $name]); - $this->assertTrue($fiche->id > 0 && !empty($fiche->strAttribut(23)), 'error : card created with empty quickcode'); + $this->assertTrue($fiche->id > 0 && !empty($fiche->get_attribute(23)), 'error : card created with empty quickcode'); $aCardId[]=$fiche->get_id(); // add attributes of type card , and for another card, set it to this quickcode @@ -401,19 +401,19 @@ where // ---- $fiche_related1->load(); $fiche_related2->load(); - $this->assertTrue($fiche_related1->id > 0 && !empty($fiche_related1->strAttribut(23)),'error related card + $this->assertTrue($fiche_related1->id > 0 && !empty($fiche_related1->get_attribute(23)),'error related card not created properly'); - $this->assertTrue($fiche_related2->id > 0 && !empty($fiche_related2->strAttribut(23)),'error related card + $this->assertTrue($fiche_related2->id > 0 && !empty($fiche_related2->get_attribute(23)),'error related card not created properly'); // ---- // check card attribute // ---- foreach ($aAttribute as $nAttribute) { - $this->assertEquals('QC',$fiche_related1->strAttribut($nAttribute['ad_id']),'Attribute QC is not set'); - $this->assertEquals('QC',$fiche_related2->strAttribut($nAttribute['ad_id']),'Attribute QC is not set'); + $this->assertEquals('QC',$fiche_related1->get_attribute($nAttribute['ad_id']),'Attribute QC is not set'); + $this->assertEquals('QC',$fiche_related2->get_attribute($nAttribute['ad_id']),'Attribute QC is not set'); } - $fiche->setAttribut(23, $name); + $fiche->set_attribute(23, $name); $fiche->update($fiche->to_array()); @@ -422,8 +422,8 @@ where // check that the other attributes of type card have been updated foreach ($aAttribute as $nAttribute) { - $this->assertEquals($fiche->get_quick_code(),$fiche_related1->strAttribut($nAttribute['ad_id']),'Attribute QC is not set'); - $this->assertEquals($fiche->get_quick_code(),$fiche_related2->strAttribut($nAttribute['ad_id']),'Attribute QC is not set'); + $this->assertEquals($fiche->get_quick_code(),$fiche_related1->get_attribute($nAttribute['ad_id']),'Attribute QC is not set'); + $this->assertEquals($fiche->get_quick_code(),$fiche_related2->get_attribute($nAttribute['ad_id']),'Attribute QC is not set'); } if ($fiche->is_used()) { @@ -482,7 +482,7 @@ where $fiche = new Fiche($this->g_connection); $fiche->insert(2, ['av_text23' => 'QC', "av_text1" => $p_name]); $fiche->load(); - $this->assertEquals($p_result,$fiche->strAttribut(ATTR_DEF_NAME),'incorrect name'); + $this->assertEquals($p_result,$fiche->get_attribute(ATTR_DEF_NAME),'incorrect name'); $fiche->remove(); } @@ -497,7 +497,7 @@ where $fiche = new Fiche($this->g_connection); $fiche->insert(2, ['av_text23' => 'QC', "av_text1" => $p_name]); $fiche->load(); - $this->assertEquals($p_result,$fiche->strAttribut(ATTR_DEF_NAME),'incorrect name'); + $this->assertEquals($p_result,$fiche->get_attribute(ATTR_DEF_NAME),'incorrect name'); $fiche->remove(); } /** @@ -507,14 +507,14 @@ where { $fiche=new Fiche($this->g_connection); $fiche->insert(2,array("av_text1"=>'Card for PHPUNIT','av_text23'=>'DUP')); - $this->assertTrue($fiche->id > 0 && 'DUP'==$fiche->strAttribut(23), - 'error : card created with wrong quickcode'.$fiche->strAttribut(23)); + $this->assertTrue($fiche->id > 0 && 'DUP'==$fiche->get_attribute(23), + 'error : card created with wrong quickcode'.$fiche->get_attribute(23)); for ($i=0;$i<100;$i++) { $fiche_duplicate = new Fiche($this->g_connection); $fiche_duplicate->insert(2, array("av_text1" => 'Base Card' . $i, 'av_text23' => 'DUP')); - $this->assertTrue($fiche_duplicate->id > $fiche->id && 'DUP' . $i == $fiche_duplicate->strAttribut(23), - " error : card created with quickcode {$fiche_duplicate->strAttribut(23)} expected DUP{$i}"); + $this->assertTrue($fiche_duplicate->id > $fiche->id && 'DUP' . $i == $fiche_duplicate->get_attribute(23), + " error : card created with quickcode {$fiche_duplicate->get_attribute(23)} expected DUP{$i}"); } $a_fiche_clean=$this->g_connection->get_array("select f_id from fiche where f_id >= $1", @@ -542,8 +542,8 @@ where $fiche->remove(); } $fiche->insert($p_category,array("av_text1"=>'Card for PHPUNIT','av_text23'=>$p_qcode)); - $this->assertTrue($fiche->id > 0 && $p_qcode==$fiche->strAttribut(23), - 'error : card created with wrong quickcode'.$fiche->strAttribut(23)); + $this->assertTrue($fiche->id > 0 && $p_qcode==$fiche->get_attribute(23), + 'error : card created with wrong quickcode'.$fiche->get_attribute(23)); return $fiche; } /** @@ -558,13 +558,13 @@ where $fiche_def->save_class_base('600'); $fiche=$this->build_fiche(2,'TESTACCOUNT'); // $start=$fiche->id; - $this->assertEquals('6000001',$fiche->strAttribut(ATTR_DEF_ACCOUNT),'Account not properly created'); + $this->assertEquals('6000001',$fiche->get_attribute(ATTR_DEF_ACCOUNT),'Account not properly created'); for ( $i=6000002; $i < 6000999;$i++) { - $fiche->setAttribut(ATTR_DEF_ACCOUNT, ""); + $fiche->set_attribute(ATTR_DEF_ACCOUNT, ""); Card_Property::update($fiche); $fiche->load(); - $this->assertEquals($i,$fiche->strAttribut(ATTR_DEF_ACCOUNT),'Account not properly created'); + $this->assertEquals($i,$fiche->get_attribute(ATTR_DEF_ACCOUNT),'Account not properly created'); } @@ -581,13 +581,13 @@ where $fiche_def->save_class_base('620'); $fiche=$this->build_fiche(2,'TESTACCOUNT'); // $start=$fiche->id; - $this->assertEquals('6200001',$fiche->strAttribut(ATTR_DEF_ACCOUNT),'Account not properly created'); + $this->assertEquals('6200001',$fiche->get_attribute(ATTR_DEF_ACCOUNT),'Account not properly created'); for ( $i=6200002; $i < 6200999;$i++) { - $fiche->setAttribut(ATTR_DEF_ACCOUNT, ""); + $fiche->set_attribute(ATTR_DEF_ACCOUNT, ""); Card_Property::update($fiche); $fiche->load(); - $this->assertEquals($i,$fiche->strAttribut(ATTR_DEF_ACCOUNT),'Account not properly created'); + $this->assertEquals($i,$fiche->get_attribute(ATTR_DEF_ACCOUNT),'Account not properly created'); } @@ -610,7 +610,7 @@ where $first=false; } $fiche->load(); - $this->assertEquals($i,$fiche->strAttribut(ATTR_DEF_ACCOUNT),'Account not properly created'); + $this->assertEquals($i,$fiche->get_attribute(ATTR_DEF_ACCOUNT),'Account not properly created'); } } public function dataAccount() @@ -629,9 +629,9 @@ where public function testAccountInsert($p_value,$p_expected) { $fiche=$this->build_fiche(2, 'PHPUNIT.ACCOUNT.INSERT'); - $fiche->setAttribut(ATTR_DEF_ACCOUNT, $p_value); + $fiche->set_attribute(ATTR_DEF_ACCOUNT, $p_value); Card_Property::update($fiche); - $this->assertEquals($p_expected,$fiche->strAttribut(ATTR_DEF_ACCOUNT)," cannot SET accounting"); + $this->assertEquals($p_expected,$fiche->get_attribute(ATTR_DEF_ACCOUNT)," cannot SET accounting"); $this->assertTrue($this->g_connection->get_value("select count(*) from tmp_pcmn where pcm_val = $1",[$p_expected])==1 ," accounting not created in TMP_PCMN"); $this->g_connection->exec_sql("delete from tmp_pcmn where pcm_val=$1",[$p_expected]); @@ -650,19 +650,19 @@ where $fiche_def->set_autocreate(true); $fiche_def->save_class_base('600'); $fiche=$this->build_fiche(2,'TESTACCOUNT'); - $fiche->setAttribut(ATTR_DEF_ACCOUNT, ""); + $fiche->set_attribute(ATTR_DEF_ACCOUNT, ""); Card_Property::update($fiche); $fiche->load(); - $this->assertEquals('600CARDF1',$fiche->strAttribut(ATTR_DEF_ACCOUNT),'Account not properly created'); + $this->assertEquals('600CARDF1',$fiche->get_attribute(ATTR_DEF_ACCOUNT),'Account not properly created'); for ( $i=600002; $i < 600099;$i++) { - $fiche->setAttribut(ATTR_DEF_NAME,'Card for testing '.$i); - $fiche->setAttribut(ATTR_DEF_ACCOUNT, ""); + $fiche->set_attribute(ATTR_DEF_NAME,'Card for testing '.$i); + $fiche->set_attribute(ATTR_DEF_ACCOUNT, ""); Card_Property::update($fiche); $fiche->load(); $idx=$i-600000; - $this->assertEquals("600CARDF".$idx,$fiche->strAttribut(ATTR_DEF_ACCOUNT),'Account not properly created'); + $this->assertEquals("600CARDF".$idx,$fiche->get_attribute(ATTR_DEF_ACCOUNT),'Account not properly created'); } @@ -687,7 +687,7 @@ where $fiche->load(); $expected="600".substr($i."PHPU",0,5); - $this->assertEquals($expected,$fiche->strAttribut(ATTR_DEF_ACCOUNT),'Account not properly created'); + $this->assertEquals($expected,$fiche->get_attribute(ATTR_DEF_ACCOUNT),'Account not properly created'); } @@ -702,9 +702,9 @@ where $this->g_connection->exec_sql("update public.parameter set pr_value = $1 where pr_id=$2", array('N','MY_ALPHANUM')); $fiche=$this->build_fiche(2, 'PHPUNIT.ACCOUNT.UPDATE'); - $fiche->setAttribut(ATTR_DEF_ACCOUNT, $p_value); + $fiche->set_attribute(ATTR_DEF_ACCOUNT, $p_value); $fiche->update($fiche->to_array()); - $this->assertEquals($p_expected,$fiche->strAttribut(ATTR_DEF_ACCOUNT)," cannot SET accounting"); + $this->assertEquals($p_expected,$fiche->get_attribute(ATTR_DEF_ACCOUNT)," cannot SET accounting"); $this->assertTrue($this->g_connection->get_value("select count(*) from tmp_pcmn where pcm_val = $1",[$p_expected])==1 ," accounting not created in TMP_PCMN"); $this->g_connection->exec_sql("delete from tmp_pcmn where pcm_val=$1",[$p_expected]); @@ -722,12 +722,12 @@ where $fiche_def->set_autocreate(false); $fiche_def->save_class_base('600'); $fiche=$this->build_fiche(2,'TESTACCOUNT'); - $this->assertEquals('600',$fiche->strAttribut(ATTR_DEF_ACCOUNT),'Account not properly created'); + $this->assertEquals('600',$fiche->get_attribute(ATTR_DEF_ACCOUNT),'Account not properly created'); for ( $i=600003; $i < 600025;$i++) { - $fiche->setAttribut(ATTR_DEF_ACCOUNT, ""); + $fiche->set_attribute(ATTR_DEF_ACCOUNT, ""); Card_Property::update($fiche); $fiche->load(); - $this->assertEquals(600,$fiche->strAttribut(ATTR_DEF_ACCOUNT),'Account not properly created'); + $this->assertEquals(600,$fiche->get_attribute(ATTR_DEF_ACCOUNT),'Account not properly created'); } $fiche->remove(); @@ -746,7 +746,7 @@ where $fiche=new Fiche($this->g_connection); $fiche->insert(2,['av_text1'=>'PHPUNIT test Same accounting','av_text5'=>""]); $fiche->load(); - $this->assertEquals(600,$fiche->strAttribut(ATTR_DEF_ACCOUNT),'Account not properly created'); + $this->assertEquals(600,$fiche->get_attribute(ATTR_DEF_ACCOUNT),'Account not properly created'); $fiche->remove(); } @@ -780,19 +780,19 @@ where $fiche=new Fiche($this->g_connection); $fiche->set_fiche_def(5); Card_Property::load($fiche); - $fiche->setAttribut(1, "Inserted by PHPUNIT"); - $fiche->setAttribut(23, " a a a a"); + $fiche->set_attribute(1, "Inserted by PHPUNIT"); + $fiche->set_attribute(23, " a a a a"); $fiche->insert("5", $fiche->to_array()); $this->assertGreaterThan (0,$fiche->id, "Card no created"); $fiche_target=new Fiche($this->g_connection,$fiche->id); - $this->assertTrue("AAAA"==$fiche_target->strAttribut(23),"Insert Quick code format not correct"); - $fiche_target->setAttribut(ATTR_DEF_QUICKCODE, " a a a a a a "); + $this->assertTrue("AAAA"==$fiche_target->get_attribute(23),"Insert Quick code format not correct"); + $fiche_target->set_attribute(ATTR_DEF_QUICKCODE, " a a a a a a "); $fiche_target->update($fiche_target->to_array()); // reload the card !! $fiche_target->load(); - $this->assertTrue("AAAAAA"==$fiche_target->strAttribut(23),"Update Quick code format not correct"); + $this->assertTrue("AAAAAA"==$fiche_target->get_attribute(23),"Update Quick code format not correct"); $fiche->delete(); } @@ -820,13 +820,13 @@ where $fiche=$this->build_fiche(2,'TESTACCOUNT'); // Try to generate an account - $fiche->setAttribut(ATTR_DEF_ACCOUNT, null); + $fiche->set_attribute(ATTR_DEF_ACCOUNT, null); $fiche->load(); Card_Property::update($fiche); $fiche_updated=new Fiche($this->g_connection,$fiche->id); $fiche_updated->load(); - $this->assertEquals('6000001',$fiche_updated->strAttribut(ATTR_DEF_ACCOUNT),'account not computed properly'); + $this->assertEquals('6000001',$fiche_updated->get_attribute(ATTR_DEF_ACCOUNT),'account not computed properly'); $this->g_connection->exec_sql('delete from tmp_pcmn where pcm_val=$1',['600TESTALPHA']); }