Try to avoid to make subquery when not necessary
This commit is contained in:
parent
c31318f29d
commit
a0bc6672d8
@ -563,17 +563,21 @@ class Adherent extends CommonObject
|
|||||||
$sql.= ", fk_user_mod = ".($user->id>0?$user->id:'null'); // Can be null because member can be create by a guest
|
$sql.= ", fk_user_mod = ".($user->id>0?$user->id:'null'); // Can be null because member can be create by a guest
|
||||||
$sql.= " WHERE rowid = ".$this->id;
|
$sql.= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
$sql2 = "SELECT libelle";
|
// If we change the type of membership, we set also label of new type
|
||||||
$sql2.= " FROM ".MAIN_DB_PREFIX."adherent_type";
|
if (! empty($this->oldcopy) && $this->typeid != $this->oldcopy->typeid)
|
||||||
$sql2.= " WHERE rowid = ".$this->typeid;
|
{
|
||||||
$resql2 = $this->db->query($sql2);
|
$sql2 = "SELECT libelle as label";
|
||||||
if($resql2)
|
$sql2.= " FROM ".MAIN_DB_PREFIX."adherent_type";
|
||||||
{
|
$sql2.= " WHERE rowid = ".$this->typeid;
|
||||||
while ($obj=$this->db->fetch_object($resql2))
|
$resql2 = $this->db->query($sql2);
|
||||||
{
|
if ($resql2)
|
||||||
$this->type=$obj->libelle;
|
{
|
||||||
}
|
while ($obj=$this->db->fetch_object($resql2))
|
||||||
}
|
{
|
||||||
|
$this->type=$obj->label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::update update member", LOG_DEBUG);
|
dol_syslog(get_class($this)."::update update member", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user