Clean code

This commit is contained in:
Laurent Destailleur 2021-09-01 16:26:59 +02:00
parent 2bad48bdcc
commit b66bd781a4

View File

@ -71,7 +71,7 @@ abstract class CommonObjectLine extends CommonObject
{ {
global $langs; global $langs;
if (!$this->fk_unit) { if (empty($this->fk_unit)) {
return ''; return '';
} }
@ -86,7 +86,7 @@ abstract class CommonObjectLine extends CommonObject
$label_type = 'code'; $label_type = 'code';
} }
$sql = 'select '.$label_type.', code from '.MAIN_DB_PREFIX.'c_units where rowid='.$this->fk_unit; $sql = 'select '.$label_type.', code from '.MAIN_DB_PREFIX.'c_units where rowid = '.((int) $this->fk_unit);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql && $this->db->num_rows($resql) > 0) { if ($resql && $this->db->num_rows($resql) > 0) {
$res = $this->db->fetch_array($resql); $res = $this->db->fetch_array($resql);