mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 17:48:25 +01:00
Fix phan errors (dolibarr_set_const can accept int)
This commit is contained in:
@@ -572,7 +572,7 @@ function run_sql($sqlfile, $silent = 1, $entity = 0, $usesavepoint = 1, $handler
|
|||||||
* Delete a constant
|
* Delete a constant
|
||||||
*
|
*
|
||||||
* @param DoliDB $db Database handler
|
* @param DoliDB $db Database handler
|
||||||
* @param string|int $name Name of constant or rowid of line
|
* @param string $name Name of constant or rowid of line
|
||||||
* @param int $entity Multi company id, -1 for all entities
|
* @param int $entity Multi company id, -1 for all entities
|
||||||
* @return int Return integer <0 if KO, >0 if OK
|
* @return int Return integer <0 if KO, >0 if OK
|
||||||
*
|
*
|
||||||
@@ -659,7 +659,7 @@ function dolibarr_get_const($db, $name, $entity = 1)
|
|||||||
*
|
*
|
||||||
* @param DoliDB $db Database handler
|
* @param DoliDB $db Database handler
|
||||||
* @param string $name Name of constant
|
* @param string $name Name of constant
|
||||||
* @param string $value Value of constant
|
* @param int|string $value Value of constant
|
||||||
* @param string $type Type of constant. Deprecated, only strings are allowed for $value. Caller must json encode/decode to store other type of data.
|
* @param string $type Type of constant. Deprecated, only strings are allowed for $value. Caller must json encode/decode to store other type of data.
|
||||||
* @param int $visible Is constant visible in Setup->Other page (0 by default)
|
* @param int $visible Is constant visible in Setup->Other page (0 by default)
|
||||||
* @param string $note Note on parameter
|
* @param string $note Note on parameter
|
||||||
@@ -685,6 +685,8 @@ function dolibarr_set_const($db, $name, $value, $type = 'chaine', $visible = 0,
|
|||||||
$hookmanager = new HookManager($db);
|
$hookmanager = new HookManager($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$value = (string) $value; // We force type string (may be int)
|
||||||
|
|
||||||
$parameters = array(
|
$parameters = array(
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'value' => $value,
|
'value' => $value,
|
||||||
@@ -741,7 +743,6 @@ function dolibarr_set_const($db, $name, $value, $type = 'chaine', $visible = 0,
|
|||||||
$conf->global->$name = $value;
|
$conf->global->$name = $value;
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
$error = $db->lasterror();
|
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user