mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
1784 - Fix Toolkit error on decimals
This commit is contained in:
@@ -900,6 +900,20 @@ class CMDBSource
|
||||
return ($aFieldData["Type"]);
|
||||
}
|
||||
|
||||
private static function IsNumericType($aFieldData)
|
||||
{
|
||||
$aNumericTypes = array('tinyint(', 'decimal(', 'int(' );
|
||||
$sType = strtolower($aFieldData["Type"]);
|
||||
foreach ($aNumericTypes as $sNumericType)
|
||||
{
|
||||
if (strpos($sType, $sNumericType) === 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sTable
|
||||
* @param string $sField
|
||||
@@ -938,8 +952,15 @@ class CMDBSource
|
||||
}
|
||||
else
|
||||
{
|
||||
$default = $aFieldData["Default"] + 0; // Coerce to a numeric variable
|
||||
$sRet .= ' DEFAULT '.self::Quote($default);
|
||||
if (self::IsNumericType($aFieldData))
|
||||
{
|
||||
$sRet .= ' DEFAULT '.$aFieldData["Default"];
|
||||
}
|
||||
else
|
||||
{
|
||||
$default = $aFieldData["Default"] + 0; // Coerce to a numeric variable
|
||||
$sRet .= ' DEFAULT '.self::Quote($default);
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (is_string($aFieldData["Default"]) == 'string')
|
||||
|
||||
Reference in New Issue
Block a user