mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-10 03:28:18 +01:00
FIX: modulebuilder: handle 'price' fieldtype
This commit is contained in:
@@ -53,6 +53,8 @@ if ($action == 'add' && ! empty($permissiontoadd))
|
||||
$value = dol_mktime(12, 0, 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
|
||||
} elseif ($object->fields[$key]['type']=='datetime') {
|
||||
$value = dol_mktime(GETPOST($key.'hour'), GETPOST($key.'min'), 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
|
||||
} elseif ($object->fields[$key]['type']=='price') {
|
||||
$value = price2num(GETPOST($key));
|
||||
} else {
|
||||
$value = GETPOST($key,'alpha');
|
||||
}
|
||||
@@ -106,6 +108,8 @@ if ($action == 'update' && ! empty($permissiontoadd))
|
||||
$value = dol_mktime(12, 0, 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
|
||||
} elseif ($object->fields[$key]['type']=='datetime') {
|
||||
$value = dol_mktime(GETPOST($key.'hour'), GETPOST($key.'min'), 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
|
||||
} elseif ($object->fields[$key]['type']=='price') {
|
||||
$value = price2num(GETPOST($key));
|
||||
} else {
|
||||
$value = GETPOST($key,'alpha');
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir='
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Label")), null, 'errors');
|
||||
return -2;
|
||||
}
|
||||
if (! preg_match('/^(integer|date|timestamp|varchar|double|html)/', $addfieldentry['type']))
|
||||
if (! preg_match('/^(integer|date|timestamp|varchar|double|html|price)/', $addfieldentry['type']))
|
||||
{
|
||||
setEventMessages($langs->trans('BadFormatForType', $objectname), null, 'errors');
|
||||
return -2;
|
||||
@@ -257,6 +257,7 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir='',
|
||||
$type = $val['type'];
|
||||
$type = preg_replace('/:.*$/', '', $type); // For case type = 'integer:Societe:societe/class/societe.class.php'
|
||||
if ($type == 'html') $type = 'text'; // html modulebuilder type is a text type in database
|
||||
if ($type == 'price') $type = 'double'; // html modulebuilder type is a text type in database
|
||||
$texttoinsert.= "\t".$key." ".$type;
|
||||
if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY';
|
||||
if ($key == 'entity') $texttoinsert.= ' DEFAULT 1';
|
||||
|
||||
Reference in New Issue
Block a user