Assigments in conditions is often considered bad practice

So let's put a comment, just in case
This commit is contained in:
Raphaël Doursenaud 2013-11-07 20:51:30 +01:00
parent 638764f86d
commit 8907c9944d
3 changed files with 7 additions and 1 deletions

View File

@ -611,6 +611,7 @@ class ActionComm extends CommonObject
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
// This assignment in condition is not a bug. It allows walking the results.
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
{ {
$this->nbtodo++; $this->nbtodo++;
@ -933,6 +934,7 @@ class ActionComm extends CommonObject
if ($resql) if ($resql)
{ {
// Note: Output of sql request is encoded in $conf->file->character_set_client // Note: Output of sql request is encoded in $conf->file->character_set_client
// This assignment in condition is not a bug. It allows walking the results.
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
{ {
$qualified=true; $qualified=true;

View File

@ -2368,6 +2368,7 @@ class Propal extends CommonObject
if ($mode == 'opened') $delay_warning=$conf->propal->cloture->warning_delay; if ($mode == 'opened') $delay_warning=$conf->propal->cloture->warning_delay;
if ($mode == 'signed') $delay_warning=$conf->propal->facturation->warning_delay; if ($mode == 'signed') $delay_warning=$conf->propal->facturation->warning_delay;
// This assignment in condition is not a bug. It allows walking the results.
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
{ {
$this->nbtodo++; $this->nbtodo++;
@ -2506,6 +2507,7 @@ class Propal extends CommonObject
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
// This assignment in condition is not a bug. It allows walking the results.
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
{ {
$this->nb["proposals"]=$obj->nb; $this->nb["proposals"]=$obj->nb;

View File

@ -490,6 +490,7 @@ class EcmDirectory // extends CommonObject
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
// This assignment in condition is not a bug. It allows walking the results.
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
{ {
$this->motherof[$obj->id_son]=$obj->id_parent; $this->motherof[$obj->id_son]=$obj->id_parent;
@ -555,6 +556,7 @@ class EcmDirectory // extends CommonObject
{ {
$this->cats = array(); $this->cats = array();
$i=0; $i=0;
// This assignment in condition is not a bug. It allows walking the results.
while ($obj = $this->db->fetch_object($resql)) while ($obj = $this->db->fetch_object($resql))
{ {
$this->cats[$obj->rowid]['id'] = $obj->rowid; $this->cats[$obj->rowid]['id'] = $obj->rowid;