/** * Recupere une constante depuis la base de donnees. * * @param DoliDB $db Database handler * @param string $name Nom de la constante * @param int $entity Multi company id * @return string Valeur de la constante * * @see dolibarr_del_const, dolibarr_set_const, dol_set_user_param */ function dolibarr_get_const($db, $name, $entity = 1) { global $conf; $value = ''; $sql = "SELECT " . $db->decrypt('value') . " as value"; $sql .= " FROM " . MAIN_DB_PREFIX . "const"; $sql .= " WHERE name = " . $db->encrypt($name, 1); $sql .= " AND entity = " . $entity; dol_syslog("admin.lib::dolibarr_get_const", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { $obj = $db->fetch_object($resql); if ($obj) { $value = $obj->value; } } return $value; }