Fix: column name should not be an numeric
This commit is contained in:
parent
6a570222cc
commit
c69565fd69
@ -28,7 +28,7 @@ $extrasize=GETPOST('size');
|
|||||||
if (GETPOST('type')=='double' && strpos($extrasize,',')===false) $extrasize='24,8';
|
if (GETPOST('type')=='double' && strpos($extrasize,',')===false) $extrasize='24,8';
|
||||||
if (GETPOST('type')=='date') $extrasize='';
|
if (GETPOST('type')=='date') $extrasize='';
|
||||||
if (GETPOST('type')=='datetime') $extrasize='';
|
if (GETPOST('type')=='datetime') $extrasize='';
|
||||||
if (GETPOST('type')=='select') $extrasize='';
|
if (GETPOST('type')=='select') $extrasize='';
|
||||||
|
|
||||||
|
|
||||||
// Add attribute
|
// Add attribute
|
||||||
|
|||||||
@ -2120,11 +2120,11 @@ abstract class CommonObject
|
|||||||
|
|
||||||
foreach ($tab as $key => $value)
|
foreach ($tab as $key => $value)
|
||||||
{
|
{
|
||||||
// Test fetch_array ! is_int($key) because fetch_array seult is a mix table with Key as alpha and Key as int (depend db engine)
|
// Test fetch_array ! is_int($key) because fetch_array result is a mix table with some key as alpha and some key as int (depend db engine)
|
||||||
if ($key != 'rowid' && $key != 'tms' && $key != 'fk_member' && ! is_int($key))
|
if ($key != 'rowid' && $key != 'tms' && ! is_int($key))
|
||||||
{
|
{
|
||||||
// we can add this attribute to adherent object
|
// we can add this attribute to object properties
|
||||||
$this->array_options["options_$key"]=$value;
|
$this->array_options["options_".$key]=$value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -154,7 +154,7 @@ class ExtraFields
|
|||||||
{
|
{
|
||||||
$table=$elementtype.'_extrafields';
|
$table=$elementtype.'_extrafields';
|
||||||
|
|
||||||
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname))
|
if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname) && ! is_numeric($attrname))
|
||||||
{
|
{
|
||||||
if ($type=='boolean') {
|
if ($type=='boolean') {
|
||||||
$typedb='int';
|
$typedb='int';
|
||||||
@ -226,8 +226,7 @@ class ExtraFields
|
|||||||
// Clean parameters
|
// Clean parameters
|
||||||
if (empty($pos)) $pos=0;
|
if (empty($pos)) $pos=0;
|
||||||
|
|
||||||
|
if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname) && ! is_numeric($attrname))
|
||||||
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname))
|
|
||||||
{
|
{
|
||||||
if(is_array($param) and count($param) > 0)
|
if(is_array($param) and count($param) > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user