From 963df8f59d54b36adb267d851b6d81b71f2ca13c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Dec 2011 23:23:31 +0100 Subject: [PATCH] Qual: Uniformize code --- htdocs/admin/company.php | 2 +- htdocs/core/class/html.formcompany.class.php | 187 +++++++++++-------- htdocs/master.inc.php | 2 +- 3 files changed, 107 insertions(+), 84 deletions(-) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 182b46f085d..8c5fe0c7dbf 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -232,7 +232,7 @@ $formcompany=new FormCompany($db); $countrynotdefined=''.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; -// We define country_id, country_code and pays_label +// We define country_id, country_code and country if (! empty($conf->global->MAIN_INFO_SOCIETE_PAYS)) { $tmp=explode(':',$conf->global->MAIN_INFO_SOCIETE_PAYS); diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 7d2d4cc98a5..7f22b659c1f 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -35,12 +35,13 @@ class FormCompany /** - * \brief Constructeur - * \param DB handler d'acces base de donnee + * Constructor + * + * @param DoliDB $db Database handler */ - function FormCompany($DB) + function FormCompany($db) { - $this->db = $DB; + $this->db = $db; return 1; } @@ -48,9 +49,10 @@ class FormCompany /** * Return list of labels (translated) of third parties type - * @param mode 0=Return id+label, 1=Return code+label - * @param filter Add a SQL filter to select - * @return array Array of types + * + * @param int $mode 0=Return id+label, 1=Return code+label + * @param string $filter Add a SQL filter to select + * @return array Array of types */ function typent_array($mode=0, $filter='') { @@ -63,7 +65,7 @@ class FormCompany $sql.= " WHERE active = 1"; if ($filter) $sql.=" ".$filter; $sql.= " ORDER by id"; - dol_syslog('Form::typent_array sql='.$sql,LOG_DEBUG); + dol_syslog(get_class($this).'::typent_array sql='.$sql,LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -87,9 +89,10 @@ class FormCompany } /** - * \brief Renvoie la liste des types d'effectifs possibles (pas de traduction car nombre) - * \param mode 0=renvoi id+libelle, 1=renvoi code+libelle - * \return array tableau des types d'effectifs + * Renvoie la liste des types d'effectifs possibles (pas de traduction car nombre) + * + * @param int $mode 0=renvoi id+libelle, 1=renvoi code+libelle + * @return array Array of types d'effectifs */ function effectif_array($mode=0) { @@ -99,7 +102,7 @@ class FormCompany $sql .= " FROM ".MAIN_DB_PREFIX."c_effectif"; $sql.= " WHERE active = 1"; $sql .= " ORDER BY id ASC"; - dol_syslog('Form::effectif_array sql='.$sql,LOG_DEBUG); + dol_syslog(get_class($this).'::effectif_array sql='.$sql,LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -122,11 +125,13 @@ class FormCompany /** - * \brief Affiche formulaire de selection des modes de reglement - * \param page Page - * \param selected Id or code preselected - * \param htmlname Nom du formulaire select - * \param empty Add empty value in list + * Affiche formulaire de selection des modes de reglement + * + * @param int $page Page + * @param int $selected Id or code preselected + * @param string $htmlname Nom du formulaire select + * @param int $empty Add empty value in list + * @return void */ function form_prospect_level($page, $selected='', $htmlname='prospect_level_id', $empty=0) { @@ -141,7 +146,7 @@ class FormCompany print ''; - if ($pays_code) $out.= ''; + if ($country_codeid) $out.= ''; $num = $this->db->num_rows($result); $i = 0; if ($num) @@ -448,11 +463,11 @@ class FormCompany $out.= ''; } else { - if (! $pays || $pays != $obj->libelle_pays) { + if (! $pays || $pays != $obj->country) { // Affiche la rupture si on est en mode liste multipays - if (! $pays_code && $obj->code_pays) { - $out.= '\n"; - $pays=$obj->libelle_pays; + if (! $country_codeid && $obj->country_code) { + $out.= '\n"; + $pays=$obj->country; } } @@ -486,12 +501,14 @@ class FormCompany /** - * \brief Return list of third parties - * \param object Object we try to find contacts - * \param var_id Name of id field - * \param selected Pre-selected third party - * \param htmlname Name of HTML form - * \param limitto Disable answers that are not id in this array list + * Return list of third parties + * + * @param Object $object Object we try to find contacts + * @param string $var_id Name of id field + * @param string $selected Pre-selected third party + * @param string $htmlname Name of HTML form + * @param string $limitto Disable answers that are not id in this array list + * @return void */ function selectCompaniesForNewContact($object, $var_id, $selected='', $htmlname='newcompany', $limitto='') { @@ -594,14 +611,16 @@ class FormCompany /** * Return a select list with types of contacts - * @param object Object to use to find type of contact - * @param $selected Default selected value - * @param htmlname - * @param source - * @param order - * @param showempty 1=Add en empty line + * + * @param Object $object Object to use to find type of contact + * @param string $selected Default selected value + * @param string $htmlname HTML select name + * @param string $source Source ('internal' or 'external') + * @param string $order Sort criteria + * @param int $showempty 1=Add en empty line + * @return void */ - function selectTypeContact($object, $selected, $htmlname = 'type', $source, $order='code', $showempty=0) + function selectTypeContact($object, $selected, $htmlname = 'type', $source='internal', $order='code', $showempty=0) { $lesTypes = $object->liste_type_contact($source, $order); print '