Qual: Move code from company to form class
This commit is contained in:
parent
05426c956c
commit
322a547c87
@ -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
|
* \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
|
* \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é
|
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 = "SELECT rowid, code, libelle";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."cond_reglement";
|
$sql.= " FROM ".MAIN_DB_PREFIX."cond_reglement";
|
||||||
$sql.= " WHERE active=1";
|
$sql.= " WHERE active=1";
|
||||||
$sql.= " ORDER BY sortorder";
|
$sql.= " ORDER BY sortorder";
|
||||||
|
dolibarr_syslog('Form::load_cache_conditions_paiements sql='.$sql,LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -1379,11 +1484,11 @@ class Form
|
|||||||
|
|
||||||
if (sizeof($this->cache_types_paiements)) return 0; // Cache déja chargé
|
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 = "SELECT id, code, libelle, type";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_paiement";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_paiement";
|
||||||
$sql.= " WHERE active > 0";
|
$sql.= " WHERE active > 0";
|
||||||
$sql.= " ORDER BY id";
|
$sql.= " ORDER BY id";
|
||||||
|
dolibarr_syslog('Form::load_cache_types_paiements sql='.$sql,LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -86,14 +86,14 @@ if ($_GET["action"] == 'edit')
|
|||||||
|
|
||||||
print '<tr><td>Forme juridique</td><td colspan="3">';
|
print '<tr><td>Forme juridique</td><td colspan="3">';
|
||||||
$html = new Form($db);
|
$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 '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Type").'</td><td>';
|
print '<tr><td>'.$langs->trans("Type").'</td><td>';
|
||||||
$form->select_array("typent_id",$soc->typent_array(), $soc->typent_id);
|
$form->select_array("typent_id",$form->typent_array(), $soc->typent_id);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>'.$langs->trans("Staff").'</td><td>';
|
print '<td>'.$langs->trans("Staff").'</td><td>';
|
||||||
$form->select_array("effectif_id",$soc->effectif_array(), $soc->effectif_id);
|
$form->select_array("effectif_id",$form->effectif_array(), $soc->effectif_id);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<input type="hidden" name="tva_intra_code" value="'.$soc->tva_intra_code.'">';
|
print '<input type="hidden" name="tva_intra_code" value="'.$soc->tva_intra_code.'">';
|
||||||
|
|||||||
@ -557,11 +557,11 @@ if ($_POST["getcustomercode"] || $_POST["getsuppliercode"] ||
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Type").'</td><td>'."\n";
|
print '<tr><td>'.$langs->trans("Type").'</td><td>'."\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);
|
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>'.$langs->trans("Staff").'</td><td>';
|
print '<td>'.$langs->trans("Staff").'</td><td>';
|
||||||
$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);
|
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@ -918,11 +918,11 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Type").'</td><td>';
|
print '<tr><td>'.$langs->trans("Type").'</td><td>';
|
||||||
$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);
|
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>'.$langs->trans("Staff").'</td><td>';
|
print '<td>'.$langs->trans("Staff").'</td><td>';
|
||||||
$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);
|
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@ -1136,7 +1136,7 @@ else
|
|||||||
print '<tr><td>'.$langs->trans('JuridicalStatus').'</td><td colspan="3">'.$soc->forme_juridique.'</td></tr>';
|
print '<tr><td>'.$langs->trans('JuridicalStatus').'</td><td colspan="3">'.$soc->forme_juridique.'</td></tr>';
|
||||||
|
|
||||||
// Type + Staff
|
// Type + Staff
|
||||||
$arr = $soc->typent_array(1);
|
$arr = $form->typent_array(1);
|
||||||
$soc->typent= $arr[$soc->typent_code];
|
$soc->typent= $arr[$soc->typent_code];
|
||||||
print '<tr><td>'.$langs->trans("Type").'</td><td>'.$soc->typent.'</td><td>'.$langs->trans("Staff").'</td><td>'.$soc->effectif.'</td></tr>';
|
print '<tr><td>'.$langs->trans("Type").'</td><td>'.$soc->typent.'</td><td>'.$langs->trans("Staff").'</td><td>'.$soc->effectif.'</td></tr>';
|
||||||
|
|
||||||
|
|||||||
@ -1294,105 +1294,6 @@ class Societe extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Renvoie la liste des libell<EFBFBD>s traduits des types actifs de soci<EFBFBD>t<EFBFBD>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
|
* \brief Affiche le rib
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user