FIX: modulebuilder: handle 'price' fieldtype

This commit is contained in:
Marc de Lima Lucio
2018-04-11 12:18:54 +02:00
parent bbc12cf06b
commit fa8cf98249
2 changed files with 6 additions and 1 deletions

View File

@@ -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';