Better practice in boolean comparison

This commit is contained in:
Laurent Destailleur 2016-05-17 23:19:57 +02:00
parent 753c5c7fc4
commit c8a8474b69
4 changed files with 7 additions and 7 deletions

View File

@ -123,7 +123,7 @@ if ($resql)
foreach ($listofstatus as $status)
{
$dataseries[]=array('label'=>$commandestatic->LibStatut($status,$bool,1),'data'=>(isset($vals[$status.$bool])?(int) $vals[$status.$bool]:0));
if ($status==3 && $bool==false) $bool=true;
if ($status==3 && ! $bool) $bool=true;
else $bool=false;
}
if ($conf->use_javascript_ajax)
@ -147,7 +147,7 @@ if ($resql)
print '</a>';
print '</td>';
print "</tr>\n";
if ($status==3 && $bool==false) $bool=true;
if ($status==3 && ! $bool) $bool=true;
else $bool=false;
}
}

View File

@ -190,7 +190,7 @@ foreach($listofstatus as $status)
print '<td align="right"><a href="services.php?mode='.$status.($bool?'&filter=expired':'').'">'.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status,3,($bool?1:0)).'</a></td>';
print "</tr>\n";
}
if ($status==4 && $bool==false) $bool=true;
if ($status==4 && ! $bool) $bool=true;
else $bool=false;
}
if (! empty($conf->use_javascript_ajax))
@ -210,7 +210,7 @@ foreach($listofstatus as $status)
print '<tr '.$bc[$var].'>';
print '<td>'.$staticcontratligne->LibStatut($status,0,($bool?1:0)).'</td>';
print '<td align="right"><a href="services.php?mode='.$status.($bool?'&filter=expired':'').'">'.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status,3,($bool?1:0)).'</a></td>';
if ($status==4 && $bool==false) $bool=true;
if ($status==4 && ! $bool) $bool=true;
else $bool=false;
print "</tr>\n";
}

View File

@ -360,7 +360,7 @@ class DoliDBMssql extends DoliDB
$query_comp[]=$fld->COLUMN_NAME." IS NOT NULL";
}
}
if ($query_comp)
if (! empty($query_comp))
$query.=" WHERE ".implode(" AND ",$query_comp);
}
}

View File

@ -120,7 +120,7 @@ if ($resql)
foreach ($listofstatus as $status)
{
$dataseries[]=array('label'=>$fichinterstatic->LibStatut($status,$bool,1),'data'=>(isset($vals[$status.$bool])?(int) $vals[$status.$bool]:0));
if ($status==3 && $bool==false) $bool=true;
if ($status==3 && ! $bool) $bool=true;
else $bool=false;
}
if ($conf->use_javascript_ajax)
@ -144,7 +144,7 @@ if ($resql)
print '</a>';
print '</td>';
print "</tr>\n";
if ($status==3 && $bool==false) $bool=true;
if ($status==3 && ! $bool) $bool=true;
else $bool=false;
}
}