diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php
index 5b6970f86de..f04fc7d44bb 100644
--- a/htdocs/html.form.class.php
+++ b/htdocs/html.form.class.php
@@ -1331,6 +1331,111 @@ class Form
}
}
+
+ /**
+ * \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
+ */
+ function effectif_array($mode=0)
+ {
+ $effs = array();
+
+ $sql = "SELECT id, code, libelle";
+ $sql .= " FROM ".MAIN_DB_PREFIX."c_effectif";
+ $sql.= " WHERE active = 1";
+ $sql .= " ORDER BY id ASC";
+ dolibarr_syslog('Form::effectif_array sql='.$sql,LOG_DEBUG);
+ $resql=$this->db->query($sql);
+ if ($resql)
+ {
+ $num = $this->db->num_rows($resql);
+ $i = 0;
+
+ while ($i < $num)
+ {
+ $objp = $this->db->fetch_object($resql);
+ if (! $mode) $key=$objp->id;
+ else $key=$objp->code;
+
+ $effs[$key] = $objp->libelle!='-'?$objp->libelle:'';
+ $i++;
+ }
+ $this->db->free($resql);
+ }
+ return $effs;
+ }
+
+ /**
+ * \brief Renvoie la liste des formes juridiques existantes (pas de traduction car unique au pays)
+ * \return array tableau des formes juridiques
+ */
+ function forme_juridique_array()
+ {
+ $fj = array();
+
+ $sql = "SELECT code, libelle";
+ $sql.= " FROM ".MAIN_DB_PREFIX."c_forme_juridique";
+ $sql.= " WHERE active = 1";
+ $sql.= " ORDER BY code ASC";
+ dolibarr_syslog('Form::forme_juridique_array sql='.$sql,LOG_DEBUG);
+ $resql=$this->db->query($sql);
+ if ($resql)
+ {
+ $num = $this->db->num_rows($resql);
+ $i = 0;
+
+ while ($i < $num)
+ {
+ $objp = $this->db->fetch_object($resql);
+ $fj[$objp->code] = $objp->libelle!='-'?$objp->libelle:'';
+ $i++;
+ }
+ $this->db->free($resql);
+ }
+ return $fj;
+ }
+
+ /**
+ * \brief Renvoie la liste des libelles traduits des types actifs de societes
+ * \param mode 0=renvoi id+libelle, 1=renvoi code+libelle
+ * \return array tableau des types
+ */
+ function typent_array($mode=0)
+ {
+ global $langs;
+
+ $effs = array();
+
+ $sql = "SELECT id, code, libelle";
+ $sql.= " FROM ".MAIN_DB_PREFIX."c_typent";
+ $sql.= " WHERE active = 1";
+ $sql.= " ORDER by id";
+ dolibarr_syslog('Form::typent_array sql='.$sql,LOG_DEBUG);
+ $resql=$this->db->query($sql);
+ if ($resql)
+ {
+ $num = $this->db->num_rows($resql);
+ $i = 0;
+
+ while ($i < $num)
+ {
+ $objp = $this->db->fetch_object($resql);
+ if (! $mode) $key=$objp->id;
+ else $key=$objp->code;
+
+ if ($langs->trans($objp->code) != $objp->code)
+ $effs[$key] = $langs->trans($objp->code);
+ else
+ $effs[$key] = $objp->libelle!='-'?$objp->libelle:'';
+ $i++;
+ }
+ $this->db->free($resql);
+ }
+
+ return $effs;
+ }
+
/**
* \brief Charge dans cache la liste des conditions de paiements possibles
* \return int Nb lignes chargées, 0 si déjà chargées, <0 si ko
@@ -1341,11 +1446,11 @@ class Form
if (sizeof($this->cache_conditions_paiements)) return 0; // Cache déja chargé
- dolibarr_syslog('Form::load_cache_conditions_paiements',LOG_DEBUG);
$sql = "SELECT rowid, code, libelle";
$sql.= " FROM ".MAIN_DB_PREFIX."cond_reglement";
$sql.= " WHERE active=1";
$sql.= " ORDER BY sortorder";
+ dolibarr_syslog('Form::load_cache_conditions_paiements sql='.$sql,LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
@@ -1379,11 +1484,11 @@ class Form
if (sizeof($this->cache_types_paiements)) return 0; // Cache déja chargé
- dolibarr_syslog('Form::load_cache_types_paiements',LOG_DEBUG);
$sql = "SELECT id, code, libelle, type";
$sql.= " FROM ".MAIN_DB_PREFIX."c_paiement";
$sql.= " WHERE active > 0";
$sql.= " ORDER BY id";
+ dolibarr_syslog('Form::load_cache_types_paiements sql='.$sql,LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
diff --git a/htdocs/lolix/societe/fiche.php b/htdocs/lolix/societe/fiche.php
index 3ce4ebb948e..e6b032ce83e 100644
--- a/htdocs/lolix/societe/fiche.php
+++ b/htdocs/lolix/societe/fiche.php
@@ -86,14 +86,14 @@ if ($_GET["action"] == 'edit')
print '
| Forme juridique | ';
$html = new Form($db);
- print $html->select_array("forme_juridique_id",$soc->forme_juridique_array(), $soc->forme_juridique_id,0,1);
+ print $html->select_array("forme_juridique_id",$form->forme_juridique_array(), $soc->forme_juridique_id,0,1);
print ' |
';
print '| '.$langs->trans("Type").' | ';
- $form->select_array("typent_id",$soc->typent_array(), $soc->typent_id);
+ $form->select_array("typent_id",$form->typent_array(), $soc->typent_id);
print ' | ';
print ''.$langs->trans("Staff").' | ';
- $form->select_array("effectif_id",$soc->effectif_array(), $soc->effectif_id);
+ $form->select_array("effectif_id",$form->effectif_array(), $soc->effectif_id);
print ' |
';
print '';
diff --git a/htdocs/soc.php b/htdocs/soc.php
index 81bea4e7d6a..02a9328597c 100644
--- a/htdocs/soc.php
+++ b/htdocs/soc.php
@@ -557,11 +557,11 @@ if ($_POST["getcustomercode"] || $_POST["getsuppliercode"] ||
print '';
print '| '.$langs->trans("Type").' | '."\n";
- $form->select_array("typent_id",$soc->typent_array(0), $soc->typent_id);
+ $form->select_array("typent_id",$form->typent_array(0), $soc->typent_id);
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
print ' | ';
print ''.$langs->trans("Staff").' | ';
- $form->select_array("effectif_id",$soc->effectif_array(0), $soc->effectif_id);
+ $form->select_array("effectif_id",$form->effectif_array(0), $soc->effectif_id);
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
print ' |
';
@@ -918,11 +918,11 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
print '';
print '| '.$langs->trans("Type").' | ';
- $form->select_array("typent_id",$soc->typent_array(0), $soc->typent_id);
+ $form->select_array("typent_id",$form->typent_array(0), $soc->typent_id);
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
print ' | ';
print ''.$langs->trans("Staff").' | ';
- $form->select_array("effectif_id",$soc->effectif_array(0), $soc->effectif_id);
+ $form->select_array("effectif_id",$form->effectif_array(0), $soc->effectif_id);
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
print ' |
';
@@ -1136,7 +1136,7 @@ else
print '| '.$langs->trans('JuridicalStatus').' | '.$soc->forme_juridique.' |
';
// Type + Staff
- $arr = $soc->typent_array(1);
+ $arr = $form->typent_array(1);
$soc->typent= $arr[$soc->typent_code];
print '| '.$langs->trans("Type").' | '.$soc->typent.' | '.$langs->trans("Staff").' | '.$soc->effectif.' |
';
diff --git a/htdocs/societe.class.php b/htdocs/societe.class.php
index 723d6219fc1..d2779dd3fe6 100644
--- a/htdocs/societe.class.php
+++ b/htdocs/societe.class.php
@@ -1294,105 +1294,6 @@ class Societe extends CommonObject
}
- /**
- * \brief Renvoie la liste des libell�s traduits des types actifs de soci�t�s
- * \param mode 0=renvoi id+libelle, 1=renvoi code+libelle
- * \return array tableau des typesl
- */
- function typent_array($mode=0)
- {
- global $langs;
-
- $effs = array();
-
- $sql = "SELECT id, code, libelle";
- $sql .= " FROM ".MAIN_DB_PREFIX."c_typent";
- $sql .= " WHERE active = 1";
- $sql .= " ORDER by id";
- $result=$this->db->query($sql);
- if ($result)
- {
- $num = $this->db->num_rows($result);
- $i = 0;
-
- while ($i < $num)
- {
- $objp = $this->db->fetch_object($result);
- if (! $mode) $key=$objp->id;
- else $key=$objp->code;
-
- if ($langs->trans($objp->code) != $objp->code)
- $effs[$key] = $langs->trans($objp->code);
- else
- $effs[$key] = $objp->libelle!='-'?$objp->libelle:'';
- $i++;
- }
- $this->db->free($result);
- }
-
- return $effs;
- }
-
-
- /**
- * \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
- */
- function effectif_array($mode=0)
- {
- $effs = array();
-
- $sql = "SELECT id, code, libelle";
- $sql .= " FROM ".MAIN_DB_PREFIX."c_effectif";
- $sql .= " ORDER BY id ASC";
- if ($this->db->query($sql))
- {
- $num = $this->db->num_rows();
- $i = 0;
-
- while ($i < $num)
- {
- $objp = $this->db->fetch_object();
- if (! $mode) $key=$objp->id;
- else $key=$objp->code;
-
- $effs[$key] = $objp->libelle!='-'?$objp->libelle:'';
- $i++;
- }
- $this->db->free();
- }
- return $effs;
- }
-
- /**
- * \brief Renvoie la liste des formes juridiques existantes (pas de traduction car unique au pays)
- * \return array tableau des formes juridiques
- */
- function forme_juridique_array()
- {
- $fj = array();
-
- $sql = "SELECT code, libelle";
- $sql .= " FROM ".MAIN_DB_PREFIX."c_forme_juridique";
- $sql .= " ORDER BY code ASC";
- if ($this->db->query($sql))
- {
- $num = $this->db->num_rows();
- $i = 0;
-
- while ($i < $num)
- {
- $objp = $this->db->fetch_object();
- $fj[$objp->code] = $objp->libelle!='-'?$objp->libelle:'';
- $i++;
- }
- $this->db->free();
- }
- return $fj;
- }
-
-
/**
* \brief Affiche le rib
*/