From f3756403504462e0987a325d01c54c5e616a8a6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Nov 2020 23:24:09 +0100 Subject: [PATCH] Update cactioncomm.class.php --- .../comm/action/class/cactioncomm.class.php | 35 ++++++++++++++++--- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index 01afdb8a49c..3b932b2f59c 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -43,16 +43,36 @@ class CActionComm */ public $id; + /** + * @var string code + */ public $code; + + /** + * @var string type + */ public $type; - public $libelle; // deprecated + + /** + * @var string label + * @deprecated + * @see $label + */ + public $libelle; /** * @var string Type of agenda event label */ public $label; + /** + * @var int active + */ public $active; + + /** + * @var string color hex + */ public $color; /** @@ -60,6 +80,9 @@ class CActionComm */ public $picto; + /** + * @var array array of type_actions + */ public $type_actions = array(); @@ -76,14 +99,14 @@ class CActionComm /** * Load action type from database * - * @param int $id id or code of action type to read - * @return int 1=ok, 0=not found, -1=error + * @param int|string $id id or code of action type to read + * @return int 1=ok, 0=not found, -1=error */ public function fetch($id) { $sql = "SELECT id, code, type, libelle as label, color, active, picto"; $sql .= " FROM ".MAIN_DB_PREFIX."c_actioncomm"; - if (is_numeric($id)) $sql .= " WHERE id=".$id; + if (is_numeric($id)) $sql .= " WHERE id=".(int) $id; else $sql .= " WHERE code='".$this->db->escape($id)."'"; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); @@ -138,7 +161,9 @@ class CActionComm $sql = "SELECT id, code, libelle as label, module, type, color, picto"; $sql .= " FROM ".MAIN_DB_PREFIX."c_actioncomm"; $sql .= " WHERE 1=1"; - if ($active != '') $sql .= " AND active=".$active; + if ($active != '') { + $sql .= " AND active=".(int) $active; + } if (!empty($excludetype)) $sql .= " AND type <> '".$this->db->escape($excludetype)."'"; if ($morefilter) $sql .= " AND ".$morefilter; $sql .= " ORDER BY module, position, type";