Qual: Clean deprecated code.
This commit is contained in:
parent
ec69fe1210
commit
4cb671f4db
@ -103,11 +103,11 @@ class Categorie extends CommonObject
|
|||||||
$this->visible = $res['visible'];
|
$this->visible = $res['visible'];
|
||||||
$this->type = $res['type'];
|
$this->type = $res['type'];
|
||||||
$this->entity = $res['entity'];
|
$this->entity = $res['entity'];
|
||||||
|
|
||||||
$this->fetch_optionals($this->id,$extralabels);
|
$this->fetch_optionals($this->id,$extralabels);
|
||||||
|
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
|
|
||||||
// multilangs
|
// multilangs
|
||||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->getMultiLangs();
|
if (! empty($conf->global->MAIN_MULTILANGS)) $this->getMultiLangs();
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ class Categorie extends CommonObject
|
|||||||
if ($id > 0)
|
if ($id > 0)
|
||||||
{
|
{
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
|
|
||||||
// Actions on extra fields (by external module or standard code)
|
// Actions on extra fields (by external module or standard code)
|
||||||
// FIXME le hook fait double emploi avec le trigger !!
|
// FIXME le hook fait double emploi avec le trigger !!
|
||||||
$hookmanager->initHooks(array('HookModuleNamedao'));
|
$hookmanager->initHooks(array('HookModuleNamedao'));
|
||||||
@ -281,7 +281,7 @@ class Categorie extends CommonObject
|
|||||||
dol_syslog(get_class($this)."::update sql=".$sql);
|
dol_syslog(get_class($this)."::update sql=".$sql);
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
{
|
{
|
||||||
|
|
||||||
// Actions on extra fields (by external module or standard code)
|
// Actions on extra fields (by external module or standard code)
|
||||||
// FIXME le hook fait double emploi avec le trigger !!
|
// FIXME le hook fait double emploi avec le trigger !!
|
||||||
$hookmanager->initHooks(array('HookCategorydao'));
|
$hookmanager->initHooks(array('HookCategorydao'));
|
||||||
@ -299,10 +299,10 @@ class Categorie extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($reshook < 0) $error++;
|
else if ($reshook < 0) $error++;
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
|
||||||
|
|
||||||
// Appel des triggers
|
// Appel des triggers
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||||
$interface=new Interfaces($this->db);
|
$interface=new Interfaces($this->db);
|
||||||
@ -340,7 +340,7 @@ class Categorie extends CommonObject
|
|||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."categorie";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."categorie";
|
||||||
$sql.= " SET fk_parent = ".$this->fk_parent;
|
$sql.= " SET fk_parent = ".$this->fk_parent;
|
||||||
$sql.= " WHERE fk_parent = ".$this->id;
|
$sql.= " WHERE fk_parent = ".$this->id;
|
||||||
|
|
||||||
if (!$this->db->query($sql))
|
if (!$this->db->query($sql))
|
||||||
@ -771,7 +771,7 @@ class Categorie extends CommonObject
|
|||||||
function get_full_arbo($type,$markafterid=0)
|
function get_full_arbo($type,$markafterid=0)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$this->cats = array();
|
$this->cats = array();
|
||||||
|
|
||||||
// Init this->motherof that is array(id_son=>id_parent, ...)
|
// Init this->motherof that is array(id_son=>id_parent, ...)
|
||||||
@ -780,7 +780,7 @@ class Categorie extends CommonObject
|
|||||||
|
|
||||||
// Init $this->cats array
|
// Init $this->cats array
|
||||||
$sql = "SELECT DISTINCT c.rowid, c.label, c.description, c.fk_parent"; // Distinct reduce pb with old tables with duplicates
|
$sql = "SELECT DISTINCT c.rowid, c.label, c.description, c.fk_parent"; // Distinct reduce pb with old tables with duplicates
|
||||||
if (! empty($conf->global->MAIN_MULTILANGS))
|
if (! empty($conf->global->MAIN_MULTILANGS))
|
||||||
$sql.= ", t.label as label_trans, t.description as description_trans";
|
$sql.= ", t.label as label_trans, t.description as description_trans";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."categorie as c";
|
$sql.= " FROM ".MAIN_DB_PREFIX."categorie as c";
|
||||||
if (! empty($conf->global->MAIN_MULTILANGS))
|
if (! empty($conf->global->MAIN_MULTILANGS))
|
||||||
@ -1055,63 +1055,6 @@ class Categorie extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Affiche le chemin le plus court pour se rendre a un produit
|
|
||||||
*
|
|
||||||
* @param int $id Id of category
|
|
||||||
* @param string $type Type of category
|
|
||||||
* @return void
|
|
||||||
* @deprecated function not used ?
|
|
||||||
*/
|
|
||||||
function get_primary_way($id, $type="")
|
|
||||||
{
|
|
||||||
$primary_way = array("taille" => -1, "chemin" => array());
|
|
||||||
$meres = $this->containing($id,$type);
|
|
||||||
foreach ($meres as $mere)
|
|
||||||
{
|
|
||||||
foreach ($mere->get_all_ways() as $way)
|
|
||||||
{
|
|
||||||
if(count($way) < $primary_way["taille"] || $primary_way["taille"] < 0)
|
|
||||||
{
|
|
||||||
$primary_way["taille"] = count($way);
|
|
||||||
$primary_way["chemin"] = $way;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $primary_way["chemin"];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Affiche le chemin le plus court pour se rendre a un produit
|
|
||||||
*
|
|
||||||
* @param int $id Id of category
|
|
||||||
* @param string $sep Separator
|
|
||||||
* @param string $url Url
|
|
||||||
* @param string $type Type
|
|
||||||
* @return void
|
|
||||||
* @deprecated function not used ?
|
|
||||||
*/
|
|
||||||
function print_primary_way($id, $sep= " >> ", $url="", $type="")
|
|
||||||
{
|
|
||||||
$primary_way = array();
|
|
||||||
$way = $this->get_primary_way($id,$type);
|
|
||||||
$w = array();
|
|
||||||
foreach ($way as $cat)
|
|
||||||
{
|
|
||||||
if ($url == '')
|
|
||||||
{
|
|
||||||
$w[] = "<a href='".DOL_URL_ROOT."/categories/viewcat.php?id=".$cat->id."'>".$cat->label."</a>";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$w[] = "<a href='".DOL_URL_ROOT."/".$url."?catid=".$cat->id."'>".$cat->label."</a>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return implode($sep, $w);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retourne un tableau contenant la liste des categories meres
|
* Retourne un tableau contenant la liste des categories meres
|
||||||
*
|
*
|
||||||
@ -1476,19 +1419,19 @@ class Categorie extends CommonObject
|
|||||||
function setMultiLangs()
|
function setMultiLangs()
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$langs_available = $langs->get_available_languages();
|
$langs_available = $langs->get_available_languages();
|
||||||
$current_lang = $langs->getDefaultLang();
|
$current_lang = $langs->getDefaultLang();
|
||||||
|
|
||||||
foreach ($langs_available as $key => $value)
|
foreach ($langs_available as $key => $value)
|
||||||
{
|
{
|
||||||
$sql = "SELECT rowid";
|
$sql = "SELECT rowid";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."categorie_lang";
|
$sql.= " FROM ".MAIN_DB_PREFIX."categorie_lang";
|
||||||
$sql.= " WHERE fk_category=".$this->id;
|
$sql.= " WHERE fk_category=".$this->id;
|
||||||
$sql.= " AND lang='".$key."'";
|
$sql.= " AND lang='".$key."'";
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
if ($key == $current_lang)
|
if ($key == $current_lang)
|
||||||
{
|
{
|
||||||
if ($this->db->num_rows($result)) // si aucune ligne dans la base
|
if ($this->db->num_rows($result)) // si aucune ligne dans la base
|
||||||
@ -1527,7 +1470,7 @@ class Categorie extends CommonObject
|
|||||||
$sql2.= " VALUES(".$this->id.",'".$key."','". $this->db->escape($this->multilangs["$key"]["label"]);
|
$sql2.= " VALUES(".$this->id.",'".$key."','". $this->db->escape($this->multilangs["$key"]["label"]);
|
||||||
$sql2.= "','".$this->db->escape($this->multilangs["$key"]["description"])."')";
|
$sql2.= "','".$this->db->escape($this->multilangs["$key"]["description"])."')";
|
||||||
}
|
}
|
||||||
|
|
||||||
// on ne sauvegarde pas des champs vides
|
// on ne sauvegarde pas des champs vides
|
||||||
if ( $this->multilangs["$key"]["label"] || $this->multilangs["$key"]["description"] || $this->multilangs["$key"]["note"] )
|
if ( $this->multilangs["$key"]["label"] || $this->multilangs["$key"]["description"] || $this->multilangs["$key"]["note"] )
|
||||||
dol_syslog(get_class($this).'::setMultiLangs sql='.$sql2);
|
dol_syslog(get_class($this).'::setMultiLangs sql='.$sql2);
|
||||||
@ -1541,7 +1484,7 @@ class Categorie extends CommonObject
|
|||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load array this->multilangs
|
* Load array this->multilangs
|
||||||
*
|
*
|
||||||
@ -1550,13 +1493,13 @@ class Categorie extends CommonObject
|
|||||||
function getMultiLangs()
|
function getMultiLangs()
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$current_lang = $langs->getDefaultLang();
|
$current_lang = $langs->getDefaultLang();
|
||||||
|
|
||||||
$sql = "SELECT lang, label, description";
|
$sql = "SELECT lang, label, description";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."categorie_lang";
|
$sql.= " FROM ".MAIN_DB_PREFIX."categorie_lang";
|
||||||
$sql.= " WHERE fk_category=".$this->id;
|
$sql.= " WHERE fk_category=".$this->id;
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
@ -1567,7 +1510,7 @@ class Categorie extends CommonObject
|
|||||||
{
|
{
|
||||||
$this->label = $obj->label;
|
$this->label = $obj->label;
|
||||||
$this->description = $obj->description;
|
$this->description = $obj->description;
|
||||||
|
|
||||||
}
|
}
|
||||||
$this->multilangs["$obj->lang"]["label"] = $obj->label;
|
$this->multilangs["$obj->lang"]["label"] = $obj->label;
|
||||||
$this->multilangs["$obj->lang"]["description"] = $obj->description;
|
$this->multilangs["$obj->lang"]["description"] = $obj->description;
|
||||||
|
|||||||
@ -1803,10 +1803,13 @@ if ($action == 'create') {
|
|||||||
if ($action != 'editline') {
|
if ($action != 'editline') {
|
||||||
$var = true;
|
$var = true;
|
||||||
|
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1) {
|
if ($conf->global->MAIN_FEATURES_LEVEL > 1)
|
||||||
|
{
|
||||||
// Add free or predefined products/services
|
// Add free or predefined products/services
|
||||||
$object->formAddObjectLine(1, $mysoc, $soc);
|
$object->formAddObjectLine(1, $mysoc, $soc);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Add free products/services
|
// Add free products/services
|
||||||
$object->formAddFreeProduct(1, $mysoc, $soc);
|
$object->formAddFreeProduct(1, $mysoc, $soc);
|
||||||
|
|
||||||
|
|||||||
@ -2102,10 +2102,13 @@ if ($action == 'create' && $user->rights->commande->creer) {
|
|||||||
if ($action != 'editline') {
|
if ($action != 'editline') {
|
||||||
$var = true;
|
$var = true;
|
||||||
|
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1) {
|
if ($conf->global->MAIN_FEATURES_LEVEL > 1)
|
||||||
|
{
|
||||||
// Add free or predefined products/services
|
// Add free or predefined products/services
|
||||||
$object->formAddObjectLine(1, $mysoc, $soc);
|
$object->formAddObjectLine(1, $mysoc, $soc);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Add free products/services
|
// Add free products/services
|
||||||
$object->formAddFreeProduct(1, $mysoc, $soc);
|
$object->formAddFreeProduct(1, $mysoc, $soc);
|
||||||
|
|
||||||
|
|||||||
@ -3307,10 +3307,13 @@ if ($action == 'create')
|
|||||||
if ($object->statut == 0 && $user->rights->facture->creer && $action != 'valid' && $action != 'editline') {
|
if ($object->statut == 0 && $user->rights->facture->creer && $action != 'valid' && $action != 'editline') {
|
||||||
$var = true;
|
$var = true;
|
||||||
|
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1) {
|
if ($conf->global->MAIN_FEATURES_LEVEL > 1)
|
||||||
|
{
|
||||||
// Add free or predefined products/services
|
// Add free or predefined products/services
|
||||||
$object->formAddObjectLine(1, $mysoc, $soc);
|
$object->formAddObjectLine(1, $mysoc, $soc);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Add free products/services
|
// Add free products/services
|
||||||
$object->formAddFreeProduct(1, $mysoc, $soc);
|
$object->formAddFreeProduct(1, $mysoc, $soc);
|
||||||
|
|
||||||
|
|||||||
@ -2693,13 +2693,12 @@ abstract class CommonObject
|
|||||||
/**
|
/**
|
||||||
* Show add free products/services form
|
* Show add free products/services form
|
||||||
* TODO Edit templates to use global variables and include them directly in controller call
|
* TODO Edit templates to use global variables and include them directly in controller call
|
||||||
* But for the moment we don't know if it'st possible as we keep a method available on overloaded objects.
|
* But for the moment we don't know if it's possible as we keep a method available on overloaded objects.
|
||||||
*
|
*
|
||||||
* @param int $dateSelector 1=Show also date range input fields
|
* @param int $dateSelector 1=Show also date range input fields (start and end date)
|
||||||
* @param Societe $seller Object thirdparty who sell
|
* @param Societe $seller Object thirdparty who sell
|
||||||
* @param Societe $buyer Object thirdparty who buy
|
* @param Societe $buyer Object thirdparty who buy
|
||||||
* @return void
|
* @return void
|
||||||
* @deprecated
|
|
||||||
*/
|
*/
|
||||||
function formAddFreeProduct($dateSelector,$seller,$buyer)
|
function formAddFreeProduct($dateSelector,$seller,$buyer)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user