From 504b0e3d162eb0b3193e395e852d5d3ab086bdd3 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 22 Aug 2018 18:34:50 +0200 Subject: [PATCH] Update and standardize code --- htdocs/compta/bank/class/account.class.php | 5 +++ .../bank/class/paymentvarious.class.php | 7 +++- .../deplacement/class/deplacement.class.php | 5 +++ .../class/deplacementstats.class.php | 5 ++- .../facture/class/facture-rec.class.php | 9 +++++ htdocs/compta/facture/class/facture.class.php | 11 ++++- .../facture/class/facturestats.class.php | 6 ++- .../compta/localtax/class/localtax.class.php | 7 +++- .../cheque/class/remisecheque.class.php | 5 +++ .../compta/paiement/class/cpaiement.class.php | 8 +--- .../compta/paiement/class/paiement.class.php | 7 +++- .../class/bonprelevement.class.php | 5 +++ .../salaries/class/paymentsalary.class.php | 7 +++- .../salaries/class/salariesstats.class.php | 3 ++ .../sociales/class/cchargesociales.class.php | 7 +--- .../sociales/class/chargesociales.class.php | 7 +++- .../class/paymentsocialcontribution.class.php | 7 +++- htdocs/compta/tva/class/tva.class.php | 7 +++- htdocs/contact/class/contact.class.php | 5 +++ htdocs/contrat/class/contrat.class.php | 13 +++++- htdocs/core/class/comment.class.php | 6 ++- htdocs/core/class/commonobject.class.php | 40 ++++++++++++++++++- htdocs/core/class/ctyperesource.class.php | 7 +--- .../core/class/emailsenderprofile.class.php | 3 ++ htdocs/core/class/events.class.php | 6 ++- htdocs/core/class/fiscalyear.class.php | 5 +++ htdocs/core/class/link.class.php | 6 ++- 27 files changed, 174 insertions(+), 35 deletions(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 26e9527c7f3..9895de511fe 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -37,7 +37,12 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php'; class Account extends CommonObject { public $element = 'bank_account'; + + /** + * @var string Name of table without prefix where object is stored + */ public $table_element = 'bank_account'; + public $picto = 'account'; /** diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index f08694e72b6..6215858dd6d 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -31,7 +31,12 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php'; class PaymentVarious extends CommonObject { public $element='variouspayment'; //!< Id that identify managed objects - public $table_element='payment_various'; //!< Name of table without prefix where object is stored + + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element='payment_various'; + public $picto = 'bill'; /** diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index 05664080ed3..6a51244529a 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -32,7 +32,12 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php'; class Deplacement extends CommonObject { public $element='deplacement'; + + /** + * @var string Name of table without prefix where object is stored + */ public $table_element='deplacement'; + public $table_element_line = ''; public $fk_element = ''; public $ismultientitymanaged = 0; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe diff --git a/htdocs/compta/deplacement/class/deplacementstats.class.php b/htdocs/compta/deplacement/class/deplacementstats.class.php index 75ac39a7cca..9d99063e726 100644 --- a/htdocs/compta/deplacement/class/deplacementstats.class.php +++ b/htdocs/compta/deplacement/class/deplacementstats.class.php @@ -30,7 +30,10 @@ include_once DOL_DOCUMENT_ROOT . '/compta/deplacement/class/deplacement.class.ph */ class DeplacementStats extends Stats { - public $table_element; + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element; var $socid; var $userid; diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 06f33f3f69a..385224e10d7 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -40,7 +40,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; class FactureRec extends CommonInvoice { public $element='facturerec'; + + /** + * @var string Name of table without prefix where object is stored + */ public $table_element='facture_rec'; + public $table_element_line='facturedet_rec'; public $fk_element='fk_facture'; public $picto='bill'; @@ -1640,6 +1645,10 @@ class FactureRec extends CommonInvoice class FactureLigneRec extends CommonInvoiceLine { public $element='facturedetrec'; + + /** + * @var string Name of table without prefix where object is stored + */ public $table_element='facturedet_rec'; var $date_start_fill; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index af3597de447..f05c7302ef0 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -54,7 +54,12 @@ if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accoun class Facture extends CommonInvoice { public $element='facture'; + + /** + * @var string Name of table without prefix where object is stored + */ public $table_element='facture'; + public $table_element_line = 'facturedet'; public $fk_element = 'fk_facture'; public $picto='bill'; @@ -4232,7 +4237,11 @@ class Facture extends CommonInvoice class FactureLigne extends CommonInvoiceLine { public $element='facturedet'; - public $table_element='facturedet'; + + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element='facturedet'; var $oldline; diff --git a/htdocs/compta/facture/class/facturestats.class.php b/htdocs/compta/facture/class/facturestats.class.php index a23d5bdc2c2..e8d8d30e1b5 100644 --- a/htdocs/compta/facture/class/facturestats.class.php +++ b/htdocs/compta/facture/class/facturestats.class.php @@ -35,7 +35,11 @@ class FactureStats extends Stats var $socid; var $userid; - public $table_element; + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element; + var $from; var $field; var $where; diff --git a/htdocs/compta/localtax/class/localtax.class.php b/htdocs/compta/localtax/class/localtax.class.php index 5d2045740bf..717e251f841 100644 --- a/htdocs/compta/localtax/class/localtax.class.php +++ b/htdocs/compta/localtax/class/localtax.class.php @@ -30,7 +30,12 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php'; class Localtax extends CommonObject { public $element='localtax'; //!< Id that identify managed objects - public $table_element='localtax'; //!< Name of table without prefix where object is stored + + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element='localtax'; + public $picto='payment'; var $ltt; diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 189afeda59f..8981a760864 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -34,7 +34,12 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; class RemiseCheque extends CommonObject { public $element='chequereceipt'; + + /** + * @var string Name of table without prefix where object is stored + */ public $table_element='bordereau_cheque'; + public $picto = 'payment'; var $num; diff --git a/htdocs/compta/paiement/class/cpaiement.class.php b/htdocs/compta/paiement/class/cpaiement.class.php index 59f13023b24..1919b5fa94c 100644 --- a/htdocs/compta/paiement/class/cpaiement.class.php +++ b/htdocs/compta/paiement/class/cpaiement.class.php @@ -34,15 +34,12 @@ class Cpaiement * @var string Id to identify managed objects */ public $element = 'cpaiement'; + /** * @var string Name of table without prefix where object is stored */ public $table_element = 'c_paiement'; - - /** - */ - public $code; public $libelle; public $type; @@ -50,9 +47,6 @@ class Cpaiement public $accountancy_code; public $module; - /** - */ - /** * Constructor diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 53a17830c09..e8057853952 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -37,7 +37,12 @@ require_once DOL_DOCUMENT_ROOT .'/multicurrency/class/multicurrency.class.php'; class Paiement extends CommonObject { public $element='payment'; - public $table_element='paiement'; + + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element='paiement'; + public $picto = 'payment'; var $facid; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 94d5a764a38..523117b8351 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -40,7 +40,12 @@ require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; class BonPrelevement extends CommonObject { public $element='widthdraw'; + + /** + * @var string Name of table without prefix where object is stored + */ public $table_element='prelevement_bons'; + public $picto = 'payment'; var $date_echeance; diff --git a/htdocs/compta/salaries/class/paymentsalary.class.php b/htdocs/compta/salaries/class/paymentsalary.class.php index 31c616ac00d..edb316674b3 100644 --- a/htdocs/compta/salaries/class/paymentsalary.class.php +++ b/htdocs/compta/salaries/class/paymentsalary.class.php @@ -32,7 +32,12 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php'; class PaymentSalary extends CommonObject { public $element='payment_salary'; //!< Id that identify managed objects - public $table_element='payment_salary'; //!< Name of table without prefix where object is stored + + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element='payment_salary'; + public $picto='payment'; public $tms; diff --git a/htdocs/compta/salaries/class/salariesstats.class.php b/htdocs/compta/salaries/class/salariesstats.class.php index 647dc27f4a5..82a8d094148 100644 --- a/htdocs/compta/salaries/class/salariesstats.class.php +++ b/htdocs/compta/salaries/class/salariesstats.class.php @@ -29,6 +29,9 @@ include_once DOL_DOCUMENT_ROOT . '/compta/salaries/class/paymentsalary.class.php */ class SalariesStats extends Stats { + /** + * @var string Name of table without prefix where object is stored + */ public $table_element; var $socid; diff --git a/htdocs/compta/sociales/class/cchargesociales.class.php b/htdocs/compta/sociales/class/cchargesociales.class.php index a44b820c8ea..de382423cc5 100644 --- a/htdocs/compta/sociales/class/cchargesociales.class.php +++ b/htdocs/compta/sociales/class/cchargesociales.class.php @@ -38,14 +38,12 @@ class Cchargesociales * @var string Id to identify managed objects */ public $element = 'cchargesociales'; + /** * @var string Name of table without prefix where object is stored */ public $table_element = 'c_chargesociales'; - /** - */ - public $libelle; public $deductible; public $active; @@ -53,9 +51,6 @@ class Cchargesociales public $fk_pays; public $module; public $accountancy_code; - - /** - */ /** diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 65e6085a650..023dd334583 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -34,7 +34,12 @@ class ChargeSociales extends CommonObject { public $element='chargesociales'; public $table='chargesociales'; - public $table_element='chargesociales'; + + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element='chargesociales'; + public $picto = 'bill'; /** diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 114a2e78cf1..26d8094acbd 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -32,7 +32,12 @@ require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php' class PaymentSocialContribution extends CommonObject { public $element='paiementcharge'; //!< Id that identify managed objects - public $table_element='paiementcharge'; //!< Name of table without prefix where object is stored + + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element='paiementcharge'; + public $picto = 'payment'; var $fk_charge; diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index 3ff8df88600..d3b7c42b86b 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -34,7 +34,12 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php'; class Tva extends CommonObject { public $element='tva'; //!< Id that identify managed objects - public $table_element='tva'; //!< Name of table without prefix where object is stored + + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element='tva'; + public $picto='payment'; var $tms; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 92ebbfaeedb..d7d95de2795 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -38,7 +38,12 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php'; class Contact extends CommonObject { public $element='contact'; + + /** + * @var string Name of table without prefix where object is stored + */ public $table_element='socpeople'; + public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe public $picto = 'contact'; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 9fe66648411..b857cad8e2e 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -42,15 +42,22 @@ require_once DOL_DOCUMENT_ROOT . '/margin/lib/margins.lib.php'; class Contrat extends CommonObject { public $element='contrat'; + + /** + * @var string Name of table without prefix where object is stored + */ public $table_element='contrat'; + public $table_element_line='contratdet'; public $fk_element='fk_contrat'; public $picto='contract'; + /** * 0=No test on entity, 1=Test with field entity, 2=Test with link by societe * @var int */ public $ismultientitymanaged = 1; + /** * 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user * @var integer @@ -2452,7 +2459,11 @@ class Contrat extends CommonObject class ContratLigne extends CommonObjectLine { public $element='contratdet'; - public $table_element='contratdet'; + + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element='contratdet'; /** * @var int ID diff --git a/htdocs/core/class/comment.class.php b/htdocs/core/class/comment.class.php index 9aeebd575bf..cad33316b68 100644 --- a/htdocs/core/class/comment.class.php +++ b/htdocs/core/class/comment.class.php @@ -5,7 +5,11 @@ class Comment extends CommonObject { public $element='comment'; //!< Id that identify managed objects - public $table_element='comment'; //!< Name of table without prefix where object is stored + + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element='comment'; public $fk_element; public $element_type; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 05de2d6d789..9d8462274cb 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -46,47 +46,58 @@ abstract class CommonObject * @var DoliDb Database handler (result of a new DoliDB) */ public $db; + /** * @var int The object identifier */ public $id; + /** * @var string Error string * @see errors */ public $error; + /** * @var string[] Array of error strings */ public $errors=array(); + /** * @var string */ public $element; + /** - * @var string + * @var string Name of table without prefix where object is stored */ - public $table_element; + public $table_element + /** * @var */ public $table_element_line; + /** * @var string Key value used to track if data is coming from import wizard */ public $import_key; + /** * @var mixed Contains data to manage extrafields */ public $array_options=array(); + /** * @var int[][] Array of linked objects ids. Loaded by ->fetchObjectLinked */ public $linkedObjectsIds; + /** * @var mixed Array of linked objects. Loaded by ->fetchObjectLinked */ public $linkedObjects; + /** * @var Object To store a cloned copy of object before to edit it and keep track of old properties */ @@ -116,11 +127,13 @@ abstract class CommonObject * @see fetch_projet() */ public $project; + /** * @var int The related project ID * @see setProject(), project */ public $fk_project; + /** * @deprecated * @see project @@ -132,6 +145,7 @@ abstract class CommonObject * @see fetch_contact() */ public $contact; + /** * @var int The related contact ID * @see fetch_contact() @@ -165,14 +179,17 @@ abstract class CommonObject * @var string The object's reference */ public $ref; + /** * @var string The object's previous reference */ public $ref_previous; + /** * @var string The object's next reference */ public $ref_next; + /** * @var string An external reference for the object */ @@ -189,36 +206,43 @@ abstract class CommonObject * @see getFullAddress() */ public $country; + /** * @var int * @see getFullAddress(), country */ public $country_id; + /** * @var string * @see getFullAddress(), isInEEC(), country */ public $country_code; + /** * @var string * @see getFullAddress() */ public $state; + /** * @var int * @see getFullAddress(), state */ public $state_id; + /** * @var string * @see getFullAddress(), state */ public $state_code; + /** * @var string * @see getFullAddress(), region */ public $region; + /** * @var string * @see getFullAddress(), region @@ -230,16 +254,19 @@ abstract class CommonObject * @see fetch_barcode() */ public $barcode_type; + /** * @var string * @see fetch_barcode(), barcode_type */ public $barcode_type_code; + /** * @var string * @see fetch_barcode(), barcode_type */ public $barcode_type_label; + /** * @var string * @see fetch_barcode(), barcode_type @@ -257,6 +284,7 @@ abstract class CommonObject * @see setPaymentTerms() */ public $cond_reglement_id; + /** * @var int Payment terms ID * @deprecated Kept for compatibility @@ -294,11 +322,13 @@ abstract class CommonObject * @see update_note() */ public $note_public; + /** * @var string Private note * @see update_note() */ public $note_private; + /** * @deprecated * @see note_public @@ -310,21 +340,25 @@ abstract class CommonObject * @see update_price() */ public $total_ht; + /** * @var float Total VAT amount * @see update_price() */ public $total_tva; + /** * @var float Total local tax 1 amount * @see update_price() */ public $total_localtax1; + /** * @var float Total local tax 2 amount * @see update_price() */ public $total_localtax2; + /** * @var float Total amount with taxes * @see update_price() @@ -347,11 +381,13 @@ abstract class CommonObject * @see setIncoterms() */ public $fk_incoterms; + /** * @var string * @see SetIncoterms() */ public $libelle_incoterms; + /** * @var string * @see display_incoterms() diff --git a/htdocs/core/class/ctyperesource.class.php b/htdocs/core/class/ctyperesource.class.php index a5a6ea879ce..9e0e5b90377 100644 --- a/htdocs/core/class/ctyperesource.class.php +++ b/htdocs/core/class/ctyperesource.class.php @@ -36,6 +36,7 @@ class Ctyperesource * @var string Id to identify managed objects */ public $element = 'ctyperesource'; + /** * @var string Name of table without prefix where object is stored */ @@ -46,16 +47,10 @@ class Ctyperesource */ public $lines = array(); - /** - */ - public $code; public $label; public $active; - /** - */ - /** * Constructor diff --git a/htdocs/core/class/emailsenderprofile.class.php b/htdocs/core/class/emailsenderprofile.class.php index 7f34165030b..e0ff56d6736 100644 --- a/htdocs/core/class/emailsenderprofile.class.php +++ b/htdocs/core/class/emailsenderprofile.class.php @@ -39,14 +39,17 @@ class EmailSenderProfile extends CommonObject * @var string ID to identify managed object */ public $element = 'emailsenderprofile'; + /** * @var string Name of table without prefix where object is stored */ public $table_element = 'c_email_senderprofile'; + /** * @var array Does emailsenderprofile support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe */ public $ismultientitymanaged = 1; + /** * @var string String with name of icon for emailsenderprofile */ diff --git a/htdocs/core/class/events.class.php b/htdocs/core/class/events.class.php index eb054792beb..7f77f99f183 100644 --- a/htdocs/core/class/events.class.php +++ b/htdocs/core/class/events.class.php @@ -35,7 +35,11 @@ class Events // extends CommonObject { public $element='events'; //!< Id that identify managed objects - public $table_element='events'; //!< Name of table without prefix where object is stored + + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element='events'; /** * @var int ID diff --git a/htdocs/core/class/fiscalyear.class.php b/htdocs/core/class/fiscalyear.class.php index 482b647a3df..640ad2ed5ac 100644 --- a/htdocs/core/class/fiscalyear.class.php +++ b/htdocs/core/class/fiscalyear.class.php @@ -29,7 +29,12 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php'; class Fiscalyear extends CommonObject { public $element='fiscalyear'; + + /** + * @var string Name of table without prefix where object is stored + */ public $table_element='accounting_fiscalyear'; + public $table_element_line = ''; public $fk_element = ''; public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe diff --git a/htdocs/core/class/link.class.php b/htdocs/core/class/link.class.php index 0441c04a86e..4896a1919d7 100644 --- a/htdocs/core/class/link.class.php +++ b/htdocs/core/class/link.class.php @@ -29,7 +29,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; class Link extends CommonObject { public $element = 'link'; - public $table_element = 'links'; + + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element = 'links'; public $entity; public $datea;